diff --git a/Makefile b/Makefile index 1af5da21..51d1e4fe 100644 --- a/Makefile +++ b/Makefile @@ -38,7 +38,10 @@ addcopy: ## Add copyright to all files @scripts/add-copy.sh .PHONY: generate-v1beta1-client -generate-v1beta1-client: install-openapi-generator ## Generate v1beta1 client +generate-v1beta1-client: generate-v1beta1-serverless-client generate-v1beta1-iam-client generate-v1beta1-dedicated-client ## Generate v1beta1 client + +.PHONY: generate-v1beta1-serverless-client +generate-v1beta1-serverless-client: install-openapi-generator ## Generate serverless client @echo "==> Generating serverless branch client" rm -rf pkg/tidbcloud/v1beta1/serverless/branch cd tools/openapi-generator && npx openapi-generator-cli generate --inline-schema-options RESOLVE_INLINE_ENUMS=true --additional-properties=withGoMod=false,enumClassPrefix=true,disallowAdditionalPropertiesIfNotPresent=false --global-property=apiTests=false,apiDocs=false,modelDocs=false,modelTests=false -i ../../pkg/tidbcloud/v1beta1/serverless/branch.swagger.json -g go -o ../../pkg/tidbcloud/v1beta1/serverless/branch --package-name branch @@ -48,16 +51,27 @@ generate-v1beta1-client: install-openapi-generator ## Generate v1beta1 client @echo "==> Generating serverless export client" rm -rf pkg/tidbcloud/v1beta1/serverless/export cd tools/openapi-generator && npx openapi-generator-cli generate --inline-schema-options RESOLVE_INLINE_ENUMS=true --additional-properties=withGoMod=false,enumClassPrefix=true,disallowAdditionalPropertiesIfNotPresent=false --global-property=apiTests=false,apiDocs=false,modelDocs=false,modelTests=false -i ../../pkg/tidbcloud/v1beta1/serverless/export.swagger.json -g go -o ../../pkg/tidbcloud/v1beta1/serverless/export --package-name export - @echo "==> Generating iam client" - rm -rf pkg/tidbcloud/v1beta1/iam - cd tools/openapi-generator && npx openapi-generator-cli generate --inline-schema-options RESOLVE_INLINE_ENUMS=true --additional-properties=withGoMod=false,enumClassPrefix=true,disallowAdditionalPropertiesIfNotPresent=false --global-property=apiTests=false,apiDocs=false,modelDocs=false,modelTests=false -i ../../pkg/tidbcloud/v1beta1/iam.swagger.json -g go -o ../../pkg/tidbcloud/v1beta1/iam --package-name iam @echo "==> Generating serverless br client" rm -rf pkg/tidbcloud/v1beta1/serverless/br cd tools/openapi-generator && npx openapi-generator-cli generate --inline-schema-options RESOLVE_INLINE_ENUMS=true --additional-properties=withGoMod=false,enumClassPrefix=true,disallowAdditionalPropertiesIfNotPresent=false --global-property=apiTests=false,apiDocs=false,modelDocs=false,modelTests=false -i ../../pkg/tidbcloud/v1beta1/serverless/br.swagger.json -g go -o ../../pkg/tidbcloud/v1beta1/serverless/br --package-name br @echo "==> Generating serverless import client" rm -rf pkg/tidbcloud/v1beta1/serverless/imp cd tools/openapi-generator && npx openapi-generator-cli generate --inline-schema-options RESOLVE_INLINE_ENUMS=true --additional-properties=withGoMod=false,enumClassPrefix=true,disallowAdditionalPropertiesIfNotPresent=false --global-property=apiTests=false,apiDocs=false,modelDocs=false,modelTests=false -i ../../pkg/tidbcloud/v1beta1/serverless/import.swagger.json -g go -o ../../pkg/tidbcloud/v1beta1/serverless/imp --package-name imp - cd pkg && go fmt ./tidbcloud/v1beta1/... + cd pkg && go fmt ./tidbcloud/v1beta1/serverless/... + +.PHONY: generate-v1beta1-dedicated-client +generate-v1beta1-dedicated-client: install-openapi-generator ## Generate dedicated client + @echo "==> Generating dedicated client" + rm -rf pkg/tidbcloud/v1beta1/dedicated + cd tools/openapi-generator && npx openapi-generator-cli generate --inline-schema-options RESOLVE_INLINE_ENUMS=true --additional-properties=withGoMod=false,enumClassPrefix=true,disallowAdditionalPropertiesIfNotPresent=false --global-property=apiTests=false,apiDocs=false,modelDocs=false,modelTests=false --skip-validate-spec -i ../../pkg/tidbcloud/v1beta1/dedicated.swagger.json -g go -o ../../pkg/tidbcloud/v1beta1/dedicated --package-name dedicated + cd pkg && go fmt ./tidbcloud/v1beta1/dedicated/... + +.PHONY: generate-v1beta1-iam-client +generate-v1beta1-iam-client: install-openapi-generator ## Generate iam client + @echo "==> Generating iam client" + rm -rf pkg/tidbcloud/v1beta1/iam + cd tools/openapi-generator && npx openapi-generator-cli generate --inline-schema-options RESOLVE_INLINE_ENUMS=true --additional-properties=withGoMod=false,enumClassPrefix=true,disallowAdditionalPropertiesIfNotPresent=false --global-property=apiTests=false,apiDocs=false,modelDocs=false,modelTests=false -i ../../pkg/tidbcloud/v1beta1/iam.swagger.json -g go -o ../../pkg/tidbcloud/v1beta1/iam --package-name iam + cd pkg && go fmt ./tidbcloud/v1beta1/iam/... .PHONY: install-openapi-generator install-openapi-generator: diff --git a/pkg/tidbcloud/v1beta1/dedicated.swagger.json b/pkg/tidbcloud/v1beta1/dedicated.swagger.json new file mode 100644 index 00000000..a8181cc7 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated.swagger.json @@ -0,0 +1,5726 @@ +{ + "swagger": "2.0", + "info": { + "title": "TiDB Cloud Dedicated Open API", + "description": "TiDB Cloud Dedicated Open API.", + "version": "v1beta1" + }, + "tags": [ + { + "name": "ClusterService" + }, + { + "name": "RegionService" + }, + { + "name": "TidbNodeGroupService" + }, + { + "name": "PrivateEndpointConnectionService" + }, + { + "name": "NetworkContainerService" + }, + { + "name": "MaintenanceService" + }, + { + "name": "DatabaseAuditLogService" + } + ], + "host": "dedicated.tidbapi.com", + "basePath": "/v1beta1", + "schemes": [ + "https" + ], + "consumes": [ + "application/json" + ], + "produces": [ + "application/json" + ], + "paths": { + "/clusters": { + "get": { + "summary": "List clusters", + "operationId": "ClusterService_ListClusters", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/tidb_cloud_open_apidedicatedv1beta1ListClustersResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "projectId", + "description": "If unspecified, the project ID of default project is used.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "clusterIds", + "description": "If specified, only clusters in the specified cluster_ids will be returned.", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + }, + { + "name": "regionIds", + "description": "If specified, only clusters in the specified regions will be returned.", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string" + }, + "collectionFormat": "multi" + }, + { + "name": "clusterStates", + "description": "If specified, only clusters in the specified states will be returned.\n\n - CREATING: Cluster is being created.\n - DELETING: Cluster is being deleted.\n - ACTIVE: Cluster is active for use.\n - RESTORING: Cluster data is being restored.\n - MAINTENANCE: Cluster is under maintenance.\n - DELETED: Cluster has been deleted.\n - INACTIVE: Cluster is not active, but not being deleted.\n - UPGRADING: Cluster is being updated.\nOnly for Dedicated Cluster.\n - IMPORTING: Cluster is being imported.\nOnly for Dedicated Cluster.\n - MODIFYING: Cluster is being modified.\nOnly for Dedicated Cluster.\n - PAUSING: Cluster is being paused.\nOnly for Dedicated Cluster.\n - PAUSED: Cluster is paused.\nOnly for Dedicated Cluster.\n - RESUMING: Cluster is resuming.\nOnly for Dedicated Cluster.", + "in": "query", + "required": false, + "type": "array", + "items": { + "type": "string", + "enum": [ + "CREATING", + "DELETING", + "ACTIVE", + "RESTORING", + "MAINTENANCE", + "DELETED", + "INACTIVE", + "UPGRADING", + "IMPORTING", + "MODIFYING", + "PAUSING", + "PAUSED", + "RESUMING" + ] + }, + "collectionFormat": "multi" + }, + { + "name": "pageSize", + "description": "The maximum number of clusters to return. The service may return fewer than this value.\nIf unspecified, at most X clusters will be returned.\nThe maximum value is X; values above X will be coerced to X.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "pageToken", + "description": "A page token, received from a previous `ListClusters` call.\nProvide this to retrieve the subsequent page.\n\nWhen paginating, all other parameters provided to `ListClusters` must match\nthe call that provided the page token.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "skip", + "description": "The number of individual resources to skip before starting to return results.\nIf the skip value causes the cursor to move past the end of the collection,\nthe response will be 200 OK with an empty result set and no next_page_token.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + } + ], + "tags": [ + "ClusterService" + ] + }, + "post": { + "summary": "Create a cluster", + "operationId": "ClusterService_CreateCluster", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/tidb_cloud_open_apidedicatedv1beta1Cluster" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "cluster", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/tidb_cloud_open_apidedicatedv1beta1Cluster", + "required": [ + "cluster" + ] + } + }, + { + "name": "validateOnly", + "description": "if validate_only is true, the request will be validated but not executed.", + "in": "query", + "required": false, + "type": "boolean" + } + ], + "tags": [ + "ClusterService" + ] + } + }, + "/clusters/{clusterId}": { + "get": { + "summary": "Get a cluster", + "operationId": "ClusterService_GetCluster", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/tidb_cloud_open_apidedicatedv1beta1Cluster" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "ClusterService" + ] + }, + "delete": { + "summary": "Delete a cluster", + "operationId": "ClusterService_DeleteCluster", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/tidb_cloud_open_apidedicatedv1beta1Cluster" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "validateOnly", + "description": "if validate_only is true, the request will be validated but not executed.", + "in": "query", + "required": false, + "type": "boolean" + } + ], + "tags": [ + "ClusterService" + ] + } + }, + "/clusters/{cluster.clusterId}": { + "patch": { + "summary": "Update a cluster", + "operationId": "ClusterService_UpdateCluster", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/tidb_cloud_open_apidedicatedv1beta1Cluster" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "cluster.clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "cluster", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "tidbNodeSetting": { + "$ref": "#/definitions/v1beta1UpdateClusterRequestTidbNodeSetting" + }, + "tikvNodeSetting": { + "$ref": "#/definitions/v1beta1UpdateClusterRequestStorageNodeSetting" + }, + "tiflashNodeSetting": { + "$ref": "#/definitions/v1beta1UpdateClusterRequestStorageNodeSetting" + }, + "displayName": { + "type": "string" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The project_id key cannot be updated. If the project_id key is specified, it will be ignored." + } + } + } + }, + { + "name": "validateOnly", + "description": "if validate_only is true, the request will be validated but not executed.", + "in": "query", + "required": false, + "type": "boolean" + } + ], + "tags": [ + "ClusterService" + ] + } + }, + "/clusters/{clusterId}:pauseCluster": { + "post": { + "summary": "Pause a cluster", + "operationId": "ClusterService_PauseCluster", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/dedicatedv1beta1PauseClusterResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "ClusterService" + ] + } + }, + "/clusters/{clusterId}:resumeCluster": { + "post": { + "summary": "Resume a cluster", + "operationId": "ClusterService_ResumeCluster", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/dedicatedv1beta1ResumeClusterResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "ClusterService" + ] + } + }, + "/clusters/{clusterId}:resetRootPassword": { + "post": { + "summary": "Reset the root password of a cluster", + "operationId": "ClusterService_ResetRootPassword", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1ResetRootPasswordResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "body", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/ClusterServiceResetRootPasswordBody" + } + } + ], + "tags": [ + "ClusterService" + ] + } + }, + "/clusters/{clusterId}/nodeInstances": { + "get": { + "summary": "List node instances", + "operationId": "ClusterService_ListNodeInstances", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1ListNodeInstancesResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "componentType", + "description": "If specified, only node instances of the specified component type will be returned.", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "TIKV", + "TIDB", + "TIFLASH", + "PD", + "TIPROXY" + ] + }, + { + "name": "pageSize", + "description": "The maximum number of node instances to return. The service may return fewer than this value.\nIf unspecified, at most X node instances will be returned.\nThe maximum value is X; values above X will be coerced to X.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "pageToken", + "description": "A page token, received from a previous `ListNodeInstances` call.\nProvide this to retrieve the subsequent page.\n\nWhen paginating, all other parameters provided to `ListNodeInstances` must match\nthe call that provided the page token.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "skip", + "description": "The number of individual resources to skip before starting to return results.\nIf the skip value causes the cursor to move past the end of the collection,\nthe response will be 200 OK with an empty result set and no next_page_token.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + } + ], + "tags": [ + "ClusterService" + ] + } + }, + "/clusters/{clusterId}/nodeInstances/{instanceId}": { + "get": { + "summary": "Get a node instance", + "operationId": "ClusterService_GetNodeInstance", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1NodeInstance" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "instanceId", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "ClusterService" + ] + } + }, + "/clusters:showNodeQuota": { + "get": { + "summary": "Show node quota across the caller's organization", + "operationId": "ClusterService_ShowNodeQuota", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1ShowNodeQuotaResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "tags": [ + "ClusterService" + ] + } + }, + "/regions": { + "get": { + "summary": "List regions for creating a cluster", + "operationId": "RegionService_ListRegions", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/tidb_cloud_open_apidedicatedv1beta1ListRegionsResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "cloudProvider", + "description": "If specified, only regions of the specified cloud provider will be returned.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "projectId", + "description": "If unspecified, the project ID of default project is used.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "pageSize", + "description": "The maximum number of regions to return. The service may return fewer than this value.\nIf unspecified, at most X regions will be returned.\nThe maximum value is X; values above X will be coerced to X.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "pageToken", + "description": "A page token, received from a previous `ListRegions` call.\nProvide this to retrieve the subsequent page.\n\nWhen paginating, all other parameters provided to `ListRegions` must match\nthe call that provided the page token.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "skip", + "description": "The number of individual resources to skip before starting to return results.\nIf the skip value causes the cursor to move past the end of the collection,\nthe response will be 200 OK with an empty result set and no next_page_token.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + } + ], + "tags": [ + "RegionService" + ] + } + }, + "/regions/{regionId}": { + "get": { + "summary": "Get a region", + "operationId": "RegionService_GetRegion", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/commonv1beta1Region" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "regionId", + "description": "Format: {cloud_provider}-{region_code}", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "projectId", + "description": "If unspecified, the project ID of default project is used.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "RegionService" + ] + } + }, + "/regions:showCloudProviders": { + "get": { + "summary": "Show cloud providers for creating a cluster", + "operationId": "RegionService_ShowCloudProviders", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1ShowCloudProvidersResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "projectId", + "description": "If unspecified, the project ID of default project is used.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "RegionService" + ] + } + }, + "/regions/{regionId}/nodeSpecs": { + "get": { + "summary": "List node specs for creating or scaling a cluster", + "operationId": "RegionService_ListNodeSpecs", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1ListNodeSpecsResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "regionId", + "description": "Format: {cloud_provider}-{region_code}", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "componentType", + "description": "If specified, only node specs of the specified component type will be returned.", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "TIKV", + "TIDB", + "TIFLASH", + "PD", + "TIPROXY" + ] + }, + { + "name": "projectId", + "description": "If unspecified, the project ID of default project is used.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "pageSize", + "description": "The maximum number of node specs to return. The service may return fewer than this value.\nIf unspecified, at most X node specs will be returned.\nThe maximum value is X; values above X will be coerced to X.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "pageToken", + "description": "A page token, received from a previous `ListNodeSpecs` call.\nProvide this to retrieve the subsequent page.\n\nWhen paginating, all other parameters provided to `ListNodeSpecs` must match\nthe call that provided the page token.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "skip", + "description": "The number of individual resources to skip before starting to return results.\nIf the skip value causes the cursor to move past the end of the collection,\nthe response will be 200 OK with an empty result set and no next_page_token.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + } + ], + "tags": [ + "RegionService" + ] + } + }, + "/regions/{regionId}/componentTypes/{componentType}/nodeSpecs/{nodeSpecKey}": { + "get": { + "summary": "Get a node spec", + "operationId": "RegionService_GetNodeSpec", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/dedicatedv1beta1NodeSpec" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "regionId", + "description": "Format: {cloud_provider}-{region_code}", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "componentType", + "in": "path", + "required": true, + "type": "string", + "enum": [ + "TIKV", + "TIDB", + "TIFLASH", + "PD", + "TIPROXY" + ] + }, + { + "name": "nodeSpecKey", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "projectId", + "description": "If unspecified, the project ID of default project is used.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "RegionService" + ] + } + }, + "/clusters/{tidbNodeGroup.clusterId}/tidbNodeGroups": { + "post": { + "summary": "Create a TiDB Node Group", + "operationId": "TidbNodeGroupService_CreateTidbNodeGroup", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/dedicatedv1beta1TidbNodeGroup" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "tidbNodeGroup.clusterId", + "description": "The cluster ID of the TiDB group.\nOptional when creating cluster with the default TiDB group.\nRequired when creating non-default TiDB group.", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "tidbNodeGroup", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Format: tidbNodeGroups/{tidb_node_group_id}", + "readOnly": true + }, + "tidbNodeGroupId": { + "type": "string", + "description": "The unique ID of the TiDB group.", + "readOnly": true + }, + "displayName": { + "type": "string", + "description": "The display name of the TiDB group." + }, + "nodeCount": { + "type": "integer", + "format": "int32", + "description": "The number of TiDB nodes in the TiDB group." + }, + "endpoints": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/dedicatedv1beta1TidbNodeGroupEndpoint" + }, + "readOnly": true + }, + "nodeSpecKey": { + "type": "string", + "readOnly": true + }, + "nodeSpecDisplayName": { + "type": "string", + "readOnly": true + }, + "isDefaultGroup": { + "type": "boolean", + "readOnly": true + }, + "state": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/dedicatedv1beta1TidbNodeGroupState" + } + ] + }, + "nodeChangingProgress": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/ClusterNodeChangingProgress" + } + ] + } + }, + "required": [ + "nodeCount" + ] + } + }, + { + "name": "validateOnly", + "description": "if validate_only is true, the request will be validated but not executed.", + "in": "query", + "required": false, + "type": "boolean" + } + ], + "tags": [ + "TidbNodeGroupService" + ] + } + }, + "/clusters/{clusterId}/tidbNodeGroups": { + "get": { + "summary": "List TiDB Node Groups", + "operationId": "TidbNodeGroupService_ListTidbNodeGroups", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/dedicatedv1beta1ListTidbNodeGroupsResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "pageSize", + "description": "The maximum number of TiDB groups to return. The service may return fewer than this value.\nIf unspecified, at most X TiDB groups will be returned.\nThe maximum value is X; values above X will be coerced to X.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "pageToken", + "description": "A page token, received from a previous `ListTidbNodeGroups` call.\nProvide this to retrieve the subsequent page.\n\nWhen paginating, all other parameters provided to `ListTidbNodeGroups` must match\nthe call that provided the page token.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "skip", + "description": "The number of individual resources to skip before starting to return results.\nIf the skip value causes the cursor to move past the end of the collection,\nthe response will be 200 OK with an empty result set and no next_page_token.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + } + ], + "tags": [ + "TidbNodeGroupService" + ] + } + }, + "/clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}": { + "get": { + "summary": "Get a TiDB Node Group", + "operationId": "TidbNodeGroupService_GetTidbNodeGroup", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/dedicatedv1beta1TidbNodeGroup" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "tidbNodeGroupId", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "TidbNodeGroupService" + ] + }, + "delete": { + "summary": "Delete a TiDB Node Group", + "operationId": "TidbNodeGroupService_DeleteTidbNodeGroup", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "object", + "properties": {} + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "tidbNodeGroupId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "validateOnly", + "description": "if validate_only is true, the request will be validated but not executed.", + "in": "query", + "required": false, + "type": "boolean" + } + ], + "tags": [ + "TidbNodeGroupService" + ] + } + }, + "/clusters/{tidbNodeGroup.clusterId}/tidbNodeGroups/{tidbNodeGroup.tidbNodeGroupId}": { + "patch": { + "summary": "Update a TiDB Node Group", + "operationId": "TidbNodeGroupService_UpdateTidbNodeGroup", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/dedicatedv1beta1TidbNodeGroup" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "tidbNodeGroup.clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "tidbNodeGroup.tidbNodeGroupId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "tidbNodeGroup", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "displayName": { + "type": "string" + }, + "nodeCount": { + "type": "integer", + "format": "int32", + "x-nullable": true + } + } + } + }, + { + "name": "validateOnly", + "description": "if validate_only is true, the request will be validated but not executed.", + "in": "query", + "required": false, + "type": "boolean" + } + ], + "tags": [ + "TidbNodeGroupService" + ] + } + }, + "/clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}/publicEndpointSetting": { + "get": { + "summary": "Get the public endpoint setting of a TiDB Node Group", + "operationId": "TidbNodeGroupService_GetPublicEndpointSetting", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1PublicEndpointSetting" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "tidbNodeGroupId", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "TidbNodeGroupService" + ] + } + }, + "/clusters/{clusterId}/tidbNodeGroups/{publicEndpointSetting.tidbNodeGroupId}/publicEndpointSetting": { + "patch": { + "summary": "Update the public endpoint setting of a TiDB Node Group", + "operationId": "TidbNodeGroupService_UpdatePublicEndpointSetting", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1PublicEndpointSetting" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "publicEndpointSetting.tidbNodeGroupId", + "description": "If set to \"-\", the default TiDB group will be used.", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "publicEndpointSetting", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Format: tidbNodeGroups/{tidb_node_group_id}/publicEndpointSetting", + "readOnly": true + }, + "enabled": { + "type": "boolean", + "x-nullable": true + }, + "ipAccessList": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/PublicEndpointSettingIpAccessList" + } + } + } + } + }, + { + "name": "validateOnly", + "description": "if validate_only is true, the request will be validated but not executed.", + "in": "query", + "required": false, + "type": "boolean" + } + ], + "tags": [ + "TidbNodeGroupService" + ] + } + }, + "/clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}/privateLinkService": { + "get": { + "summary": "Get the private link service of a TiDB Node Group", + "operationId": "PrivateEndpointConnectionService_GetPrivateLinkService", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/dedicatedv1beta1PrivateLinkService" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "tidbNodeGroupId", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "PrivateEndpointConnectionService" + ] + } + }, + "/clusters/{clusterId}/tidbNodeGroups/{privateEndpointConnection.tidbNodeGroupId}/privateEndpointConnections": { + "post": { + "summary": "Create a private endpoint connection", + "operationId": "PrivateEndpointConnectionService_CreatePrivateEndpointConnection", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1PrivateEndpointConnection" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "privateEndpointConnection.tidbNodeGroupId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "privateEndpointConnection", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Format: tidbNodeGroups/{tidb_node_group_id}/privateEndpointConnections/{private_endpoint_connection_id}", + "readOnly": true + }, + "privateEndpointConnectionId": { + "type": "string", + "readOnly": true + }, + "clusterId": { + "type": "string", + "readOnly": true + }, + "clusterDisplayName": { + "type": "string", + "readOnly": true + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The labels of private link connection. It always contains the `project_id` label.", + "readOnly": true + }, + "endpointId": { + "type": "string", + "description": "The endpoint ID of the private link connection.\nFor AWS, it's VPC endpoint ID.\nFor GCP, it's private service connect endpoint ID.\nFor Azure, it's private endpoint resource ID." + }, + "privateIpAddress": { + "type": "string", + "x-nullable": true, + "description": "The private IP address of the private endpoint in the user's vNet.\nTiDB Cloud will setup a public DNS record for this private IP address. So the user can use DNS address to connect to the cluster.\nOnly available for Azure clusters." + }, + "endpointState": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/PrivateEndpointConnectionEndpointState" + } + ] + }, + "massage": { + "type": "string", + "readOnly": true + }, + "regionId": { + "type": "string", + "title": "Format: {cloud_provider}-{region_code}", + "readOnly": true + }, + "regionDisplayName": { + "type": "string", + "readOnly": true + }, + "cloudProvider": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/v1beta1RegionCloudProvider" + } + ] + }, + "privateLinkServiceName": { + "type": "string", + "readOnly": true + }, + "privateLinkServiceState": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/v1beta1PrivateLinkServiceState" + } + ] + }, + "tidbNodeGroupDisplayName": { + "type": "string", + "readOnly": true + }, + "accountId": { + "type": "string", + "x-nullable": true, + "description": "Only for GCP private service connections. It's GCP project name.", + "readOnly": true + }, + "host": { + "type": "string", + "readOnly": true + }, + "port": { + "type": "integer", + "format": "int32", + "readOnly": true + } + }, + "required": [ + "endpointId" + ] + } + }, + { + "name": "validateOnly", + "description": "Default is false. If true, the request will not be applied and only validation will be performed.\nAt present, this field is only available for Azure provider.", + "in": "query", + "required": false, + "type": "boolean" + } + ], + "tags": [ + "PrivateEndpointConnectionService" + ] + } + }, + "/clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}/privateEndpointConnections": { + "get": { + "summary": "List private endpoint connections", + "operationId": "PrivateEndpointConnectionService_ListPrivateEndpointConnections", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1ListPrivateEndpointConnectionsResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "description": "To list private link connections across different clusters and TiDB groups, set cluster_id to \"-\".", + "in": "path", + "required": true, + "type": "string", + "pattern": "[^/]+" + }, + { + "name": "tidbNodeGroupId", + "description": "To list private link connections across different clusters and TiDB groups, set tidb_node_group_id to \"-\".", + "in": "path", + "required": true, + "type": "string", + "pattern": "[^/]+" + }, + { + "name": "projectId", + "description": "Pass this project_id only when listing under a project across different clusters and TiDB groups.\nBoth cluster_id and tidb_node_group_id should be set to \"-\" in this case.\nIf unspecified, the project ID of the cluster is used.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "cloudProvider", + "description": "If specified, only private link connections of the specified cloud provider will be returned.\n\n - aws: Amazon Web Services.\nbuf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE\n - gcp: Google Cloud Platform.\nbuf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE\n - azure: Microsoft Azure.\nbuf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "aws", + "gcp", + "azure" + ] + }, + { + "name": "pageSize", + "description": "The maximum number of private link connections to return. The service may return fewer than this value.\nIf unspecified, at most X private link connections will be returned.\nThe maximum value is X; values above X will be coerced to X.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "pageToken", + "description": "A page token, received from a previous `ListPrivateLinkConnections` call.\nProvide this to retrieve the subsequent page.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "skip", + "description": "The number of individual resources to skip before starting to return results.\nIf the skip value causes the cursor to move past the end of the collection,\nthe response will be 200 OK with an empty result set and no next_page_token.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + } + ], + "tags": [ + "PrivateEndpointConnectionService" + ] + } + }, + "/clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}/privateEndpointConnections/{privateEndpointConnectionId}": { + "get": { + "summary": "Get a private endpoint connection", + "operationId": "PrivateEndpointConnectionService_GetPrivateEndpointConnection", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1PrivateEndpointConnection" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "tidbNodeGroupId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "privateEndpointConnectionId", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "PrivateEndpointConnectionService" + ] + }, + "delete": { + "summary": "Delete a private endpoint connection", + "operationId": "PrivateEndpointConnectionService_DeletePrivateEndpointConnection", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "object", + "properties": {} + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "tidbNodeGroupId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "privateEndpointConnectionId", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "PrivateEndpointConnectionService" + ] + } + }, + "/networkContainers": { + "get": { + "summary": "List network containers", + "operationId": "NetworkContainerService_ListNetworkContainers", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1ListNetworkContainersResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "projectId", + "description": "If unspecified, the project ID of default project is used.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "cloudProvider", + "description": " - aws: Amazon Web Services.\nbuf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE\n - gcp: Google Cloud Platform.\nbuf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE\n - azure: Microsoft Azure.\nbuf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "aws", + "gcp", + "azure" + ] + }, + { + "name": "pageSize", + "description": "The maximum number of network containers to return. The service may return fewer than this value.\nIf unspecified, at most X network containers will be returned.\nThe maximum value is X; values above X will be coerced to X.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "pageToken", + "description": "A page token, received from a previous `ListNetworkContainers` call.\nProvide this to retrieve the subsequent page.\n\nWhen paginating, all other parameters provided to `ListNetworkContainers` must match\nthe call that provided the page token.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "skip", + "description": "The number of individual resources to skip before starting to return results.\nIf the skip value causes the cursor to move past the end of the collection,\nthe response will be 200 OK with an empty result set and no next_page_token.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + } + ], + "tags": [ + "NetworkContainerService" + ] + }, + "post": { + "summary": "Create a network container", + "operationId": "NetworkContainerService_CreateNetworkContainer", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1NetworkContainer" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "networkContainer", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/v1beta1NetworkContainer", + "required": [ + "networkContainer" + ] + } + }, + { + "name": "validateOnly", + "in": "query", + "required": false, + "type": "boolean" + } + ], + "tags": [ + "NetworkContainerService" + ] + } + }, + "/networkContainers/{networkContainerId}": { + "get": { + "summary": "Get a network container", + "operationId": "NetworkContainerService_GetNetworkContainer", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1NetworkContainer" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "networkContainerId", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "NetworkContainerService" + ] + }, + "delete": { + "summary": "Delete a network container", + "operationId": "NetworkContainerService_DeleteNetworkContainer", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "object", + "properties": {} + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "networkContainerId", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "NetworkContainerService" + ] + } + }, + "/vpcPeerings": { + "get": { + "summary": "List VPC peerings", + "operationId": "NetworkContainerService_ListVpcPeerings", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/dedicatedv1beta1ListVpcPeeringsResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "projectId", + "description": "If unspecified, the project ID of default project is used.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "cloudProvider", + "description": "If specified, only VPC peerings of the specified cloud provider will be returned.\n\n - aws: Amazon Web Services.\nbuf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE\n - gcp: Google Cloud Platform.\nbuf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE\n - azure: Microsoft Azure.\nbuf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE", + "in": "query", + "required": false, + "type": "string", + "enum": [ + "aws", + "gcp", + "azure" + ] + }, + { + "name": "pageSize", + "description": "The maximum number of VPC peerings to return. The service may return fewer than this value.\nIf unspecified, at most X VPC peerings will be returned.\nThe maximum value is X; values above X will be coerced to X.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "pageToken", + "description": "A page token, received from a previous `ListVpcPeerings` call.\nProvide this to retrieve the subsequent page.\n\nWhen paginating, all other parameters provided to `ListVpcPeerings` must match\nthe call that provided the page token.", + "in": "query", + "required": false, + "type": "string" + } + ], + "tags": [ + "NetworkContainerService" + ] + }, + "post": { + "summary": "Create a VPC peering", + "operationId": "NetworkContainerService_CreateVpcPeering", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/dedicatedv1beta1VpcPeering" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "vpcPeering", + "in": "body", + "required": true, + "schema": { + "$ref": "#/definitions/dedicatedv1beta1VpcPeering", + "required": [ + "vpcPeering" + ] + } + } + ], + "tags": [ + "NetworkContainerService" + ] + } + }, + "/vpcPeerings/{vpcPeeringId}": { + "get": { + "summary": "Get a VPC peering", + "operationId": "NetworkContainerService_GetVpcPeering", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/dedicatedv1beta1VpcPeering" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "vpcPeeringId", + "description": "Format {cloud_provider}-{random_suffix}", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "NetworkContainerService" + ] + }, + "delete": { + "summary": "Delete a VPC peering", + "operationId": "NetworkContainerService_DeleteVpcPeering", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "object", + "properties": {} + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "vpcPeeringId", + "description": "Format {cloud_provider}-{random_suffix}", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "NetworkContainerService" + ] + } + }, + "/maintenanceWindows/{maintenanceWindowId}": { + "get": { + "summary": "Get a maintenance window", + "operationId": "MaintenanceService_GetMaintenanceWindow", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/dedicatedv1beta1MaintenanceWindow" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "maintenanceWindowId", + "description": "Format: project-{project_id}", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "MaintenanceService" + ] + } + }, + "/maintenanceWindows": { + "get": { + "summary": "List maintenance windows", + "operationId": "MaintenanceService_ListMaintenanceWindows", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1ListMaintenanceWindowsResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "projectId", + "description": "If unspecified, the project ID of default project is used.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "pageSize", + "description": "The maximum number of maintenance windows to return. The service may return fewer than this value.\nIf unspecified, at most X maintenance windows will be returned.\nThe maximum value is X; values above X will be coerced to X.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "pageToken", + "description": "A page token, received from a previous `ListMaintenanceWindows` call.\nProvide this to retrieve the subsequent page.\n\nWhen paginating, all other parameters provided to `ListMaintenanceWindows` must match\nthe call that provided the page token.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "skip", + "description": "The number of individual resources to skip before starting to return results.\nIf the skip value causes the cursor to move past the end of the collection,\nthe response will be 200 OK with an empty result set and no next_page_token.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + } + ], + "tags": [ + "MaintenanceService" + ] + } + }, + "/maintenanceWindows/{maintenanceWindow.maintenanceWindowId}": { + "patch": { + "summary": "Update a maintenance window", + "operationId": "MaintenanceService_UpdateMaintenanceWindow", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/dedicatedv1beta1MaintenanceWindow" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "maintenanceWindow.maintenanceWindowId", + "description": "Format: project-{project_id}", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "maintenanceWindow", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "weekDay": { + "type": "integer", + "format": "int32" + }, + "dayHour": { + "type": "integer", + "format": "int32" + }, + "hourMinute": { + "type": "integer", + "format": "int32" + } + } + } + } + ], + "tags": [ + "MaintenanceService" + ] + } + }, + "/maintenanceTasks": { + "get": { + "summary": "List maintenance tasks", + "operationId": "MaintenanceService_ListMaintenanceTasks", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1ListMaintenanceTasksResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "projectId", + "description": "If unspecified, the project ID of default project is used.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "pageSize", + "description": "The maximum number of maintenance tasks to return. The service may return fewer than this value.\nIf unspecified, at most X maintenance tasks will be returned.\nThe maximum value is X; values above X will be coerced to X.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "pageToken", + "description": "A page token, received from a previous `ListMaintenanceTasks` call.\nProvide this to retrieve the subsequent page.\n\nWhen paginating, all other parameters provided to `ListMaintenanceTasks` must match\nthe call that provided the page token.", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "skip", + "description": "The number of individual resources to skip before starting to return results.\nIf the skip value causes the cursor to move past the end of the collection,\nthe response will be 200 OK with an empty result set and no next_page_token.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + } + ], + "tags": [ + "MaintenanceService" + ] + } + }, + "/maintenanceTasks/{maintenanceTaskId}": { + "get": { + "summary": "Get a maintenance task", + "operationId": "MaintenanceService_GetMaintenanceTask", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1MaintenanceTask" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "maintenanceTaskId", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "MaintenanceService" + ] + } + }, + "/maintenanceTasks/{maintenanceTaskId}:deferMaintenanceTask": { + "post": { + "summary": "Defer a maintenance task", + "operationId": "MaintenanceService_DeferMaintenanceTask", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1DeferMaintenanceTaskResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "maintenanceTaskId", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "MaintenanceService" + ] + } + }, + "/clusters/{auditLogConfig.clusterId}/auditLogConfig": { + "post": { + "summary": "Create the audit log config for a cluster", + "operationId": "DatabaseAuditLogService_CreateAuditLogConfig", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/dedicatedv1beta1AuditLogConfig" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "auditLogConfig.clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "auditLogConfig", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Format: clusters/{cluster_id}/auditLogConfig", + "readOnly": true + }, + "enabled": { + "type": "boolean", + "description": "Default is false." + }, + "bucketUri": { + "type": "string" + }, + "bucketRegionId": { + "type": "string", + "title": "Format: {cloud_provider}-{region_code}" + }, + "awsRoleArn": { + "type": "string" + }, + "azureSasToken": { + "type": "string" + }, + "bucketWriteCheck": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/AuditLogConfigBucketWriteCheck" + } + ] + } + }, + "required": [ + "bucketUri" + ] + } + }, + { + "name": "validateOnly", + "in": "query", + "required": false, + "type": "boolean" + } + ], + "tags": [ + "DatabaseAuditLogService" + ] + }, + "patch": { + "summary": "Update the audit log config of a cluster", + "operationId": "DatabaseAuditLogService_UpdateAuditLogConfig", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/dedicatedv1beta1AuditLogConfig" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "auditLogConfig.clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "auditLogConfig", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "enabled": { + "type": "boolean", + "x-nullable": true + }, + "bucketUri": { + "type": "string" + }, + "bucketRegionId": { + "type": "string", + "title": "Format: {cloud_provider}-{region_code}" + }, + "awsRoleArn": { + "type": "string" + }, + "azureSasToken": { + "type": "string" + } + } + } + }, + { + "name": "validateOnly", + "in": "query", + "required": false, + "type": "boolean" + } + ], + "tags": [ + "DatabaseAuditLogService" + ] + } + }, + "/clusters/{clusterId}/auditLogConfig": { + "get": { + "summary": "Get the audit log config of a cluster", + "operationId": "DatabaseAuditLogService_GetAuditLogConfig", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/dedicatedv1beta1AuditLogConfig" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "DatabaseAuditLogService" + ] + } + }, + "/clusters/{auditLogFilterRule.clusterId}/auditLogFilterRules": { + "post": { + "summary": "Create an audit log filter rule", + "operationId": "DatabaseAuditLogService_CreateAuditLogFilterRule", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1AuditLogFilterRule" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "auditLogFilterRule.clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "auditLogFilterRule", + "in": "body", + "required": true, + "schema": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Format: auditLogFilterRules/{audit_log_filter_rule_id}", + "readOnly": true + }, + "auditLogFilterRuleId": { + "type": "string", + "readOnly": true + }, + "userExpr": { + "type": "string" + }, + "dbExpr": { + "type": "string" + }, + "tableExpr": { + "type": "string" + }, + "accessTypeList": { + "type": "array", + "items": { + "type": "string" + } + } + } + } + } + ], + "tags": [ + "DatabaseAuditLogService" + ] + } + }, + "/clusters/{clusterId}/auditLogFilterRules/{auditLogFilterRuleId}": { + "get": { + "summary": "Get an audit log filter rule", + "operationId": "DatabaseAuditLogService_GetAuditLogFilterRule", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1AuditLogFilterRule" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "auditLogFilterRuleId", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "DatabaseAuditLogService" + ] + }, + "delete": { + "summary": "Delete an audit log filter rule", + "operationId": "DatabaseAuditLogService_DeleteAuditLogFilterRule", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "type": "object", + "properties": {} + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "auditLogFilterRuleId", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "DatabaseAuditLogService" + ] + } + }, + "/clusters/{clusterId}/auditLogFilterRules": { + "get": { + "summary": "List audit log filter rules", + "operationId": "DatabaseAuditLogService_ListAuditLogFilterRules", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1ListAuditLogFilterRulesResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + }, + { + "name": "pageSize", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + }, + { + "name": "pageToken", + "in": "query", + "required": false, + "type": "string" + }, + { + "name": "skip", + "description": "The number of individual resources to skip before starting to return results.\nIf the skip value causes the cursor to move past the end of the collection,\nthe response will be 200 OK with an empty result set and no next_page_token.", + "in": "query", + "required": false, + "type": "integer", + "format": "int32" + } + ], + "tags": [ + "DatabaseAuditLogService" + ] + } + }, + "/clusters/{clusterId}/auditLogConfig:showObjectStorageAccessIamPrincipal": { + "get": { + "summary": "Show IAM principal of TiDB Cloud for accessing customer's object storage", + "operationId": "DatabaseAuditLogService_ShowObjectStorageAccessIamPrincipal", + "responses": { + "200": { + "description": "A successful response.", + "schema": { + "$ref": "#/definitions/v1beta1ShowObjectStorageAccessIamPrincipalResponse" + } + }, + "400": { + "description": "Bad Request", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "401": { + "description": "Unauthorized", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "403": { + "description": "Forbidden", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "429": { + "description": "Too Many Requests", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "500": { + "description": "Internal Server Error", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + }, + "default": { + "description": "An unexpected error response.", + "schema": { + "$ref": "#/definitions/googlerpcStatus" + } + } + }, + "parameters": [ + { + "name": "clusterId", + "in": "path", + "required": true, + "type": "string" + } + ], + "tags": [ + "DatabaseAuditLogService" + ] + } + } + }, + "definitions": { + "AuditLogConfigBucketWriteCheck": { + "type": "object", + "properties": { + "writable": { + "type": "boolean", + "readOnly": true + }, + "errorReason": { + "type": "string", + "description": "The reason why the bucket is not writable. Output only when `writable` is false.", + "readOnly": true + } + } + }, + "ClusterNodeChangingProgress": { + "type": "object", + "properties": { + "matchingNodeSpecNodeCount": { + "type": "integer", + "format": "int32", + "readOnly": true + }, + "remainingDeletionNodeCount": { + "type": "integer", + "format": "int32", + "description": "available if some nodes are deleting.", + "readOnly": true + } + } + }, + "ClusterServiceResetRootPasswordBody": { + "type": "object", + "properties": { + "rootPassword": { + "type": "string" + } + }, + "required": [ + "rootPassword" + ] + }, + "ClusterStorageNodeSettingStorageType": { + "type": "string", + "enum": [ + "BASIC", + "BASICV2", + "OPTIMIZED", + "PLUS" + ], + "title": "- BASIC: default\n - BASICV2: separate raft-log and data storage, only for tikv\n - OPTIMIZED: separate raft-log and data storage, and use high performance storage volume for raft-log, only for tikv\n - PLUS: use high performance storage volume" + }, + "EndpointConnectionType": { + "type": "string", + "enum": [ + "PUBLIC", + "VPC_PEERING", + "PRIVATE_ENDPOINT" + ], + "description": " - PUBLIC: The endpoint is a public endpoint.\n - VPC_PEERING: The endpoint is a VPC peering endpoint.\n - PRIVATE_ENDPOINT: The endpoint is a private link endpoint." + }, + "PrivateEndpointConnectionEndpointState": { + "type": "string", + "enum": [ + "PENDING", + "ACTIVE", + "DELETING", + "FAILED", + "DISCOVERED" + ], + "description": " - PENDING: Customer has posted to TiDB cloud API,\nbut endpoint connection has not been accepted **asynchronously** by TiDB Cloud.\n - DISCOVERED: Customer has created the endpoint in their vpc, but has not posted to TiDB Cloud API." + }, + "PublicEndpointSettingIpAccessList": { + "type": "object", + "properties": { + "cidrNotation": { + "type": "string" + }, + "description": { + "type": "string" + } + }, + "required": [ + "cidrNotation" + ] + }, + "ShowNodeQuotaResponseComponentQuota": { + "type": "object", + "properties": { + "componentType": { + "$ref": "#/definitions/dedicatedv1beta1ComponentType" + }, + "quota": { + "type": "integer", + "format": "int32" + } + } + }, + "UpdateClusterRequestTidbNodeSettingTidbNodeGroup": { + "type": "object", + "properties": { + "tidbNodeGroupId": { + "type": "string", + "title": "if tidb_node_group_id is empty, it means scale default tidb group" + }, + "nodeCount": { + "type": "integer", + "format": "int32", + "x-nullable": true + } + } + }, + "commonv1beta1ClusterState": { + "type": "string", + "enum": [ + "CREATING", + "DELETING", + "ACTIVE", + "RESTORING", + "MAINTENANCE", + "DELETED", + "INACTIVE", + "UPGRADING", + "IMPORTING", + "MODIFYING", + "PAUSING", + "PAUSED", + "RESUMING" + ], + "description": "Enum of possible states of a cluster.\n\n - CREATING: Cluster is being created.\n - DELETING: Cluster is being deleted.\n - ACTIVE: Cluster is active for use.\n - RESTORING: Cluster data is being restored.\n - MAINTENANCE: Cluster is under maintenance.\n - DELETED: Cluster has been deleted.\n - INACTIVE: Cluster is not active, but not being deleted.\n - UPGRADING: Cluster is being updated.\nOnly for Dedicated Cluster.\n - IMPORTING: Cluster is being imported.\nOnly for Dedicated Cluster.\n - MODIFYING: Cluster is being modified.\nOnly for Dedicated Cluster.\n - PAUSING: Cluster is being paused.\nOnly for Dedicated Cluster.\n - PAUSED: Cluster is paused.\nOnly for Dedicated Cluster.\n - RESUMING: Cluster is resuming.\nOnly for Dedicated Cluster." + }, + "commonv1beta1Region": { + "type": "object", + "properties": { + "name": { + "type": "string", + "example": "regions/aws-us-west-2", + "title": "The unique name of the region.\nFormat: regions/{region_id}", + "pattern": "^regions/(aws|gcp|azure)-(.+)$" + }, + "regionId": { + "type": "string", + "description": "Format: {cloud_provider}-{region_code}\nRegion code: us-west-2, asia-east1.", + "readOnly": true + }, + "cloudProvider": { + "description": "The cloud provider for the region.", + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/v1beta1RegionCloudProvider" + } + ] + }, + "displayName": { + "type": "string", + "description": "User-friendly display name of the region.", + "readOnly": true + }, + "provider": { + "type": "string", + "x-nullable": true, + "description": "Optional provider name for the region.\nOnly used for serverless cluster.\nDeprecated.", + "readOnly": true + } + }, + "description": "A representation of a region for deploying TiDB clusters." + }, + "dedicatedv1beta1AuditLogConfig": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Format: clusters/{cluster_id}/auditLogConfig", + "readOnly": true + }, + "clusterId": { + "type": "string" + }, + "enabled": { + "type": "boolean", + "description": "Default is false." + }, + "bucketUri": { + "type": "string" + }, + "bucketRegionId": { + "type": "string", + "title": "Format: {cloud_provider}-{region_code}" + }, + "awsRoleArn": { + "type": "string" + }, + "azureSasToken": { + "type": "string" + }, + "bucketWriteCheck": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/AuditLogConfigBucketWriteCheck" + } + ] + } + }, + "required": [ + "clusterId", + "bucketUri" + ] + }, + "dedicatedv1beta1ClusterPausePlan": { + "type": "object", + "properties": { + "pauseType": { + "$ref": "#/definitions/dedicatedv1beta1ClusterPausePlanType" + }, + "scheduledResumeTime": { + "type": "string", + "format": "date-time", + "readOnly": true + } + }, + "required": [ + "pauseType" + ] + }, + "dedicatedv1beta1ClusterPausePlanType": { + "type": "string", + "enum": [ + "NORMAL", + "DEPRECATE" + ], + "title": "- NORMAL: default pause plan\n - DEPRECATE: old pause plan, will be removed" + }, + "dedicatedv1beta1ComponentType": { + "type": "string", + "enum": [ + "TIKV", + "TIDB", + "TIFLASH", + "PD", + "TIPROXY" + ] + }, + "dedicatedv1beta1ListTidbNodeGroupsResponse": { + "type": "object", + "properties": { + "tidbNodeGroups": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/dedicatedv1beta1TidbNodeGroup" + } + }, + "totalSize": { + "type": "integer", + "format": "int32", + "description": "The total number of TiDB groups that matched the query." + }, + "nextPageToken": { + "type": "string", + "description": "A token, which can be sent as `page_token` to retrieve the next page.\nIf this field is omitted, there are no subsequent pages." + } + } + }, + "dedicatedv1beta1ListVpcPeeringsResponse": { + "type": "object", + "properties": { + "vpcPeerings": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/dedicatedv1beta1VpcPeering" + } + }, + "totalSize": { + "type": "integer", + "format": "int32", + "description": "The total number of VPC peerings that matched the query." + }, + "nextPageToken": { + "type": "string", + "description": "A token, which can be sent as `page_token` to retrieve the next page.\nIf this field is omitted, there are no subsequent pages." + } + } + }, + "dedicatedv1beta1MaintenanceWindow": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Format: maintenanceWindows/{maintenance_window_id}", + "readOnly": true + }, + "maintenanceWindowId": { + "type": "string", + "title": "Format: project-{project_id}", + "readOnly": true + }, + "projectId": { + "type": "string" + }, + "weekDay": { + "type": "integer", + "format": "int32", + "description": "0-6, 0 is Sunday." + }, + "dayHour": { + "type": "integer", + "format": "int32", + "description": "0-23 in UTC." + }, + "hourMinute": { + "type": "integer", + "format": "int32", + "description": "0-59 in UTC." + }, + "nextMaintenanceDate": { + "type": "string", + "format": "date-time", + "readOnly": true + }, + "unchangedMaintenanceTasks": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1beta1MaintenanceTask" + }, + "readOnly": true + } + }, + "description": "MaintenanceWindow is a singleton resource that represents the maintenance window under a project.", + "required": [ + "projectId", + "weekDay", + "dayHour", + "hourMinute" + ] + }, + "dedicatedv1beta1NodeSpec": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Format: regions/{region_id}/componentTypes/{component_type}/nodeSpecs/{node_spec_key}", + "readOnly": true + }, + "regionId": { + "type": "string", + "title": "Format: {cloud_provider}-{region_code}", + "readOnly": true + }, + "componentType": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/dedicatedv1beta1ComponentType" + } + ] + }, + "nodeSpecKey": { + "type": "string", + "readOnly": true + }, + "displayName": { + "type": "string", + "readOnly": true + }, + "vCpu": { + "type": "integer", + "format": "int32", + "readOnly": true + }, + "memorySizeGi": { + "type": "integer", + "format": "int32", + "readOnly": true + }, + "defaultStorageSizeGi": { + "type": "integer", + "format": "int32", + "readOnly": true + }, + "maxStorageSizeGi": { + "type": "integer", + "format": "int32", + "readOnly": true + }, + "minStorageSizeGi": { + "type": "integer", + "format": "int32", + "readOnly": true + }, + "defaultNodeCount": { + "type": "integer", + "format": "int32", + "readOnly": true + }, + "storageTypes": { + "type": "array", + "items": { + "$ref": "#/definitions/ClusterStorageNodeSettingStorageType" + }, + "readOnly": true + } + } + }, + "dedicatedv1beta1PauseClusterResponse": { + "type": "object", + "properties": { + "cluster": { + "$ref": "#/definitions/tidb_cloud_open_apidedicatedv1beta1Cluster" + } + }, + "required": [ + "cluster" + ] + }, + "dedicatedv1beta1PrivateLinkService": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Format: tidbNodeGroups/{tidb_node_group_id}/privateLinkService", + "readOnly": true + }, + "tidbNodeGroupId": { + "type": "string", + "readOnly": true + }, + "serviceName": { + "type": "string", + "description": "For AWS, it's the service name of the Private Link Service.\nFor GCP, it's the resource name of the service attachment.\nFor Azure, it's service resource ID of the Private Link Service.", + "readOnly": true + }, + "serviceDnsName": { + "type": "string", + "description": "For AWS, it's the fully qualified domain name (FQDN) shared for all private endpoints, despite which VPC the endpoint located in.\nFor GCP, it's the zone name (suffix of FQDN) shared for all private endpoints located in a single VPC network. The format of FQDN is `\u003cendpoint_name\u003e.\u003cservice_dns_name\u003e`.\nFor Azure, it's the zone name shared across public internet. The format of FQDN is `\u003cendpoint_name\u003e-\u003crandom_hash\u003e.\u003cservice_dns_name\u003e`.", + "readOnly": true + }, + "availableZones": { + "type": "array", + "items": { + "type": "string" + }, + "description": "Only available for AWS.\nSame as the `AvailabilityZones` field in response body of\n`github.com/aws/aws-sdk-go-v2/service/ec2.DescribeVpcEndpointServices` method.", + "readOnly": true + }, + "state": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/v1beta1PrivateLinkServiceState" + } + ] + }, + "regionId": { + "type": "string", + "title": "Format: {cloud_provider}-{region_code}", + "readOnly": true + }, + "regionDisplayName": { + "type": "string", + "readOnly": true + }, + "cloudProvider": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/v1beta1RegionCloudProvider" + } + ] + } + } + }, + "dedicatedv1beta1ResumeClusterResponse": { + "type": "object", + "properties": { + "cluster": { + "$ref": "#/definitions/tidb_cloud_open_apidedicatedv1beta1Cluster" + } + }, + "required": [ + "cluster" + ] + }, + "dedicatedv1beta1TidbNodeGroup": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Format: tidbNodeGroups/{tidb_node_group_id}", + "readOnly": true + }, + "tidbNodeGroupId": { + "type": "string", + "description": "The unique ID of the TiDB group.", + "readOnly": true + }, + "clusterId": { + "type": "string", + "description": "The cluster ID of the TiDB group.\nOptional when creating cluster with the default TiDB group.\nRequired when creating non-default TiDB group." + }, + "displayName": { + "type": "string", + "description": "The display name of the TiDB group." + }, + "nodeCount": { + "type": "integer", + "format": "int32", + "description": "The number of TiDB nodes in the TiDB group." + }, + "endpoints": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/dedicatedv1beta1TidbNodeGroupEndpoint" + }, + "readOnly": true + }, + "nodeSpecKey": { + "type": "string", + "readOnly": true + }, + "nodeSpecDisplayName": { + "type": "string", + "readOnly": true + }, + "isDefaultGroup": { + "type": "boolean", + "readOnly": true + }, + "state": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/dedicatedv1beta1TidbNodeGroupState" + } + ] + }, + "nodeChangingProgress": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/ClusterNodeChangingProgress" + } + ] + } + }, + "required": [ + "nodeCount" + ] + }, + "dedicatedv1beta1TidbNodeGroupEndpoint": { + "type": "object", + "properties": { + "host": { + "type": "string", + "description": "When endpoint's type is `PRIVATE_ENDPOINT`, the `host` field behave differently across cloud providers:\nFor AWS clusters, the `host` field is available right after the private link service is ready.\nFor GCP and Azure clusters, the `host` field is available after the user creates a `PrivateEndpointConnection`.", + "readOnly": true + }, + "port": { + "type": "integer", + "format": "int32", + "readOnly": true + }, + "connectionType": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/EndpointConnectionType" + } + ] + } + } + }, + "dedicatedv1beta1TidbNodeGroupState": { + "type": "string", + "enum": [ + "ACTIVE", + "MODIFYING", + "PAUSED" + ], + "description": " - ACTIVE: All nodes are ready.\n - MODIFYING: When TiDB group is modifying.\n - PAUSED: When cluster is paused." + }, + "dedicatedv1beta1VpcPeering": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Format: vpcPeerings/{vpc_peering_id}", + "readOnly": true + }, + "vpcPeeringId": { + "type": "string", + "title": "Format {cloud_provider}-{random_suffix}", + "readOnly": true + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The labels of the vpc peering. It always contains the `project_id` label.", + "readOnly": true + }, + "tidbCloudRegionId": { + "type": "string", + "title": "Format: {cloud_provider}-{region_code}" + }, + "customerRegionId": { + "type": "string", + "description": "Format: {cloud_provider}-{region_code}\nFor AWS, it's required.\nFor GCP, it's optional. Since GCP does not require region_id when creating VPC peering." + }, + "customerAccountId": { + "type": "string", + "description": "In AWS, it is the account ID.\nIn GCP, it is the project name." + }, + "customerVpcId": { + "type": "string", + "description": "In AWS, it is the VPC ID.\nIn GCP, it is the network name." + }, + "customerVpcCidr": { + "type": "string" + }, + "tidbCloudCloudProvider": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/v1beta1RegionCloudProvider" + } + ] + }, + "tidbCloudAccountId": { + "type": "string", + "description": "In AWS, it is the account ID.\nIn GCP, it is the project name.", + "readOnly": true + }, + "tidbCloudVpcId": { + "type": "string", + "description": "In AWS, it is the VPC ID.\nIn GCP, it is the network name.", + "readOnly": true + }, + "tidbCloudVpcCidr": { + "type": "string", + "readOnly": true + }, + "state": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/dedicatedv1beta1VpcPeeringState" + } + ] + }, + "awsVpcPeeringConnectionId": { + "type": "string", + "x-nullable": true, + "description": "Only for AWS vpc peerings.", + "readOnly": true + } + }, + "required": [ + "tidbCloudRegionId", + "customerAccountId", + "customerVpcId", + "customerVpcCidr" + ] + }, + "dedicatedv1beta1VpcPeeringState": { + "type": "string", + "enum": [ + "PENDING", + "FAILED", + "ACTIVE" + ] + }, + "googlerpcStatus": { + "type": "object", + "properties": { + "code": { + "type": "integer", + "format": "int32", + "description": "The status code, which should be an enum value of\n[google.rpc.Code][google.rpc.Code]." + }, + "message": { + "type": "string", + "description": "A developer-facing error message, which should be in English. Any\nuser-facing error message should be localized and sent in the\n[google.rpc.Status.details][google.rpc.Status.details] field, or localized\nby the client." + }, + "details": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/protobufAny" + }, + "description": "A list of messages that carry the error details. There is a common set of\nmessage types for APIs to use." + } + }, + "description": "The `Status` type defines a logical error model that is suitable for\ndifferent programming environments, including REST APIs and RPC APIs. It is\nused by [gRPC](https://github.com/grpc). Each `Status` message contains\nthree pieces of data: error code, error message, and error details.\n\nYou can find out more about this error model and how to work with it in the\n[API Design Guide](https://cloud.google.com/apis/design/errors)." + }, + "protobufAny": { + "type": "object", + "properties": { + "@type": { + "type": "string", + "description": "A URL/resource name that uniquely identifies the type of the serialized\nprotocol buffer message. This string must contain at least\none \"/\" character. The last segment of the URL's path must represent\nthe fully qualified name of the type (as in\n`path/google.protobuf.Duration`). The name should be in a canonical form\n(e.g., leading \".\" is not accepted).\n\nIn practice, teams usually precompile into the binary all types that they\nexpect it to use in the context of Any. However, for URLs which use the\nscheme `http`, `https`, or no scheme, one can optionally set up a type\nserver that maps type URLs to message definitions as follows:\n\n* If no scheme is provided, `https` is assumed.\n* An HTTP GET on the URL must yield a [google.protobuf.Type][]\n value in binary format, or produce an error.\n* Applications are allowed to cache lookup results based on the\n URL, or have them precompiled into a binary to avoid any\n lookup. Therefore, binary compatibility needs to be preserved\n on changes to types. (Use versioned type names to manage\n breaking changes.)\n\nNote: this functionality is not currently available in the official\nprotobuf release, and it is not used for type URLs beginning with\ntype.googleapis.com. As of May 2023, there are no widely used type server\nimplementations and no plans to implement one.\n\nSchemes other than `http`, `https` (or the empty scheme) might be\nused with implementation specific semantics." + } + }, + "additionalProperties": {}, + "description": "`Any` contains an arbitrary serialized protocol buffer message along with a\nURL that describes the type of the serialized message.\n\nProtobuf library provides support to pack/unpack Any values in the form\nof utility functions or additional generated methods of the Any type.\n\nExample 1: Pack and unpack a message in C++.\n\n Foo foo = ...;\n Any any;\n any.PackFrom(foo);\n ...\n if (any.UnpackTo(\u0026foo)) {\n ...\n }\n\nExample 2: Pack and unpack a message in Java.\n\n Foo foo = ...;\n Any any = Any.pack(foo);\n ...\n if (any.is(Foo.class)) {\n foo = any.unpack(Foo.class);\n }\n // or ...\n if (any.isSameTypeAs(Foo.getDefaultInstance())) {\n foo = any.unpack(Foo.getDefaultInstance());\n }\n\n Example 3: Pack and unpack a message in Python.\n\n foo = Foo(...)\n any = Any()\n any.Pack(foo)\n ...\n if any.Is(Foo.DESCRIPTOR):\n any.Unpack(foo)\n ...\n\n Example 4: Pack and unpack a message in Go\n\n foo := \u0026pb.Foo{...}\n any, err := anypb.New(foo)\n if err != nil {\n ...\n }\n ...\n foo := \u0026pb.Foo{}\n if err := any.UnmarshalTo(foo); err != nil {\n ...\n }\n\nThe pack methods provided by protobuf library will by default use\n'type.googleapis.com/full.type.name' as the type URL and the unpack\nmethods only use the fully qualified type name after the last '/'\nin the type URL, for example \"foo.bar.com/x/y.z\" will yield type\nname \"y.z\".\n\nJSON\n====\nThe JSON representation of an `Any` value uses the regular\nrepresentation of the deserialized, embedded message, with an\nadditional field `@type` which contains the type URL. Example:\n\n package google.profile;\n message Person {\n string first_name = 1;\n string last_name = 2;\n }\n\n {\n \"@type\": \"type.googleapis.com/google.profile.Person\",\n \"firstName\": \u003cstring\u003e,\n \"lastName\": \u003cstring\u003e\n }\n\nIf the embedded message type is well-known and has a custom JSON\nrepresentation, that representation will be embedded adding a field\n`value` which holds the custom JSON in addition to the `@type`\nfield. Example (for message [google.protobuf.Duration][]):\n\n {\n \"@type\": \"type.googleapis.com/google.protobuf.Duration\",\n \"value\": \"1.212s\"\n }" + }, + "tidb_cloud_open_apidedicatedv1beta1Cluster": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "The name of TiDB cluster resource.\nFormat: clusters/{cluster_id}", + "readOnly": true + }, + "clusterId": { + "type": "string", + "description": "The unique ID of the cluster.", + "readOnly": true + }, + "displayName": { + "type": "string", + "example": "foo-bar", + "description": "The display name of the cluster.", + "maxLength": 64, + "minLength": 4, + "pattern": "^[A-Za-z0-9][-A-Za-z0-9]{2,62}[A-Za-z0-9]$" + }, + "regionId": { + "type": "string", + "title": "Required. Region where the cluster will be created.\nFormat: {cloud_provider}-{region_code}" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The labels of the cluster.\nIf there is no \"project_id\" in labels, resource should be in the default project of the creator's organization." + }, + "tidbNodeSetting": { + "$ref": "#/definitions/v1beta1ClusterTidbNodeSetting" + }, + "tikvNodeSetting": { + "$ref": "#/definitions/v1beta1ClusterStorageNodeSetting" + }, + "tiflashNodeSetting": { + "$ref": "#/definitions/v1beta1ClusterStorageNodeSetting" + }, + "port": { + "type": "integer", + "format": "int32", + "description": "The port of the cluster. This port applies to all network endpoints of the cluster." + }, + "rootPassword": { + "type": "string", + "example": "my-shining-password", + "maxLength": 64, + "minLength": 8, + "pattern": "^.{8,64}$" + }, + "state": { + "description": "The current state of the cluster.", + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/commonv1beta1ClusterState" + } + ] + }, + "version": { + "type": "string", + "description": "The TiDB version of the cluster.", + "readOnly": true + }, + "createdBy": { + "type": "string", + "description": "The email address or public api key of the creator of the cluster.", + "readOnly": true + }, + "createTime": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the cluster was created.", + "readOnly": true + }, + "updateTime": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the cluster was last updated.", + "readOnly": true + }, + "pausePlan": { + "description": "Pause plan of the cluster.", + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/dedicatedv1beta1ClusterPausePlan" + } + ] + }, + "regionDisplayName": { + "type": "string", + "readOnly": true + }, + "cloudProvider": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/v1beta1RegionCloudProvider" + } + ] + }, + "annotations": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "OUTPUT_ONLY. The annotations for the cluster.\ntidb.cloud/has-set-password. The annotation for whether the cluster has set password.\ntidb.cloud/available-features. The annotation for the available features of the cluster.", + "readOnly": true + } + }, + "description": "Cluster represents a dedicated TiDB cluster.", + "required": [ + "displayName", + "regionId", + "tidbNodeSetting", + "tikvNodeSetting", + "port" + ] + }, + "tidb_cloud_open_apidedicatedv1beta1ListClustersResponse": { + "type": "object", + "properties": { + "clusters": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/tidb_cloud_open_apidedicatedv1beta1Cluster" + } + }, + "totalSize": { + "type": "integer", + "format": "int32", + "description": "The total number of clusters that matched the query." + }, + "nextPageToken": { + "type": "string", + "description": "A token, which can be sent as `page_token` to retrieve the next page.\nIf this field is omitted, there are no subsequent pages." + } + } + }, + "tidb_cloud_open_apidedicatedv1beta1ListRegionsResponse": { + "type": "object", + "properties": { + "regions": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/commonv1beta1Region" + } + }, + "totalSize": { + "type": "integer", + "format": "int32", + "description": "The total number of regions that matched the query." + }, + "nextPageToken": { + "type": "string", + "description": "A token, which can be sent as `page_token` to retrieve the next page.\nIf this field is omitted, there are no subsequent pages." + } + } + }, + "v1beta1AuditLogFilterRule": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Format: auditLogFilterRules/{audit_log_filter_rule_id}", + "readOnly": true + }, + "auditLogFilterRuleId": { + "type": "string", + "readOnly": true + }, + "clusterId": { + "type": "string" + }, + "userExpr": { + "type": "string" + }, + "dbExpr": { + "type": "string" + }, + "tableExpr": { + "type": "string" + }, + "accessTypeList": { + "type": "array", + "items": { + "type": "string" + } + } + }, + "required": [ + "clusterId" + ] + }, + "v1beta1ClusterStorageNodeSetting": { + "type": "object", + "properties": { + "nodeCount": { + "type": "integer", + "format": "int32" + }, + "nodeSpecKey": { + "type": "string" + }, + "storageSizeGi": { + "type": "integer", + "format": "int32" + }, + "storageType": { + "$ref": "#/definitions/ClusterStorageNodeSettingStorageType" + }, + "nodeSpecDisplayName": { + "type": "string", + "title": "output only", + "readOnly": true + }, + "nodeChangingProgress": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/ClusterNodeChangingProgress" + } + ] + } + }, + "required": [ + "nodeCount", + "nodeSpecKey", + "storageSizeGi", + "storageType" + ] + }, + "v1beta1ClusterTidbNodeSetting": { + "type": "object", + "properties": { + "nodeSpecKey": { + "type": "string" + }, + "tidbNodeGroups": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/dedicatedv1beta1TidbNodeGroup" + }, + "description": "When creating a cluster, the length of the `tidb_node_groups` should be 1\nand the `node_count` field of `TidbNodeGroup` should be set." + }, + "nodeSpecDisplayName": { + "type": "string", + "readOnly": true + } + }, + "required": [ + "nodeSpecKey", + "tidbNodeGroups" + ] + }, + "v1beta1DeferMaintenanceTaskResponse": { + "type": "object" + }, + "v1beta1ListAuditLogFilterRulesResponse": { + "type": "object", + "properties": { + "auditLogFilterRules": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1beta1AuditLogFilterRule" + } + }, + "totalSize": { + "type": "integer", + "format": "int32" + }, + "nextPageToken": { + "type": "string" + } + } + }, + "v1beta1ListMaintenanceTasksResponse": { + "type": "object", + "properties": { + "maintenanceTasks": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1beta1MaintenanceTask" + } + }, + "totalSize": { + "type": "integer", + "format": "int32", + "description": "The total number of maintenance tasks that matched the query." + }, + "nextPageToken": { + "type": "string", + "description": "A token, which can be sent as `page_token` to retrieve the next page.\nIf this field is omitted, there are no subsequent pages." + } + } + }, + "v1beta1ListMaintenanceWindowsResponse": { + "type": "object", + "properties": { + "maintenanceWindows": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/dedicatedv1beta1MaintenanceWindow" + } + }, + "totalSize": { + "type": "integer", + "format": "int32", + "description": "The total number of maintenance windows that matched the query." + }, + "nextPageToken": { + "type": "string", + "description": "A token, which can be sent as `page_token` to retrieve the next page.\nIf this field is omitted, there are no subsequent pages." + } + } + }, + "v1beta1ListNetworkContainersResponse": { + "type": "object", + "properties": { + "networkContainers": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1beta1NetworkContainer" + } + }, + "totalSize": { + "type": "integer", + "format": "int32", + "description": "The total number of network containers that matched the query." + }, + "nextPageToken": { + "type": "string", + "description": "A token, which can be sent as `page_token` to retrieve the next page.\nIf this field is omitted, there are no subsequent pages." + } + } + }, + "v1beta1ListNodeInstancesResponse": { + "type": "object", + "properties": { + "nodeInstances": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1beta1NodeInstance" + } + }, + "totalSize": { + "type": "integer", + "format": "int32", + "description": "The total number of node instances that matched the query." + }, + "nextPageToken": { + "type": "string", + "description": "A token, which can be sent as `page_token` to retrieve the next page.\nIf this field is omitted, there are no subsequent pages." + } + } + }, + "v1beta1ListNodeSpecsResponse": { + "type": "object", + "properties": { + "nodeSpecs": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/dedicatedv1beta1NodeSpec" + } + }, + "totalSize": { + "type": "integer", + "format": "int32", + "description": "The total number of node specs that matched the query." + }, + "nextPageToken": { + "type": "string", + "description": "A token, which can be sent as `page_token` to retrieve the next page.\nIf this field is omitted, there are no subsequent pages." + } + } + }, + "v1beta1ListPrivateEndpointConnectionsResponse": { + "type": "object", + "properties": { + "privateEndpointConnections": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/v1beta1PrivateEndpointConnection" + } + }, + "totalSize": { + "type": "integer", + "format": "int32", + "description": "The total number of private link connections that matched the query." + }, + "nextPageToken": { + "type": "string", + "description": "A token, which can be sent as `page_token` to retrieve the next page.\nIf this field is omitted, there are no subsequent pages." + } + } + }, + "v1beta1MaintenanceTask": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Format: maintenanceTasks/{maintenance_task_id}", + "readOnly": true + }, + "maintenanceTaskId": { + "type": "string", + "readOnly": true + }, + "projectId": { + "type": "string", + "readOnly": true + }, + "description": { + "type": "string", + "readOnly": true + }, + "state": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/v1beta1MaintenanceTaskState" + } + ] + }, + "createTime": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the task was created.", + "readOnly": true + }, + "scheduledApplyTime": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the task run.", + "readOnly": true + }, + "deadline": { + "type": "string", + "format": "date-time", + "description": "Timestamp when the task will be expired.", + "readOnly": true + } + } + }, + "v1beta1MaintenanceTaskState": { + "type": "string", + "enum": [ + "PENDING", + "RUNNING", + "DONE" + ] + }, + "v1beta1NetworkContainer": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Format: networkContainers/{network_container_id}", + "readOnly": true + }, + "networkContainerId": { + "type": "string", + "readOnly": true + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The labels of the cluster.\nIf there is no \"project_id\" in labels, resource should be in the default project of the creator's organization." + }, + "regionId": { + "type": "string", + "title": "Format: {cloud_provider}-{region_code}" + }, + "cidrNotion": { + "type": "string", + "description": "If not set, the default cidr of the region will be used." + }, + "cloudProvider": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/v1beta1RegionCloudProvider" + } + ] + }, + "state": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/v1beta1NetworkContainerState" + } + ] + }, + "regionDisplayName": { + "type": "string", + "readOnly": true + }, + "vpcId": { + "type": "string", + "description": "For AWS, it is the vpc id.\nFor GCP, it is the network name.\nFor Azure, it is the vnet name.", + "readOnly": true + } + }, + "required": [ + "regionId" + ] + }, + "v1beta1NetworkContainerState": { + "type": "string", + "enum": [ + "ACTIVE", + "INACTIVE" + ] + }, + "v1beta1NodeInstance": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Format: clusters/{cluster_id}/nodeInstances/{instance_id}", + "readOnly": true + }, + "clusterId": { + "type": "string", + "readOnly": true + }, + "instanceId": { + "type": "string", + "title": "Format for TiDB instances in the default TiDB group: tidb-{index}\nFormat for TiDB instances in non-default TiDB groups: {tidb_group_name}-tidb-{index}\nFormat for other instances: {component_type}-{index}", + "readOnly": true + }, + "componentType": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/dedicatedv1beta1ComponentType" + } + ] + }, + "state": { + "description": "the state of the instance, e.g. \"Available\".", + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/v1beta1NodeInstanceState" + } + ] + }, + "vCpu": { + "type": "integer", + "format": "int32", + "description": "the cpu size of the instance, e.g. 2.", + "readOnly": true + }, + "memorySizeGi": { + "type": "integer", + "format": "int32", + "description": "the memory size of the instance, e.g. 8.", + "readOnly": true + }, + "availabilityZone": { + "type": "string", + "description": "the availability zone of the instance, e.g. \"us-west1-a\".", + "readOnly": true + }, + "storageSizeGi": { + "type": "integer", + "format": "int32", + "description": "the storage size of the instance, e.g. 100.", + "readOnly": true + }, + "tidbNodeGroupId": { + "type": "string", + "x-nullable": true, + "readOnly": true + }, + "tidbNodeGroupDisplayName": { + "type": "string", + "x-nullable": true, + "readOnly": true + }, + "isDefaultTidbNodeGroup": { + "type": "boolean", + "x-nullable": true, + "readOnly": true + } + } + }, + "v1beta1NodeInstanceState": { + "type": "string", + "enum": [ + "CREATING", + "AVAILABLE", + "DELETING", + "UNAVAILABLE" + ] + }, + "v1beta1PrivateEndpointConnection": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Format: tidbNodeGroups/{tidb_node_group_id}/privateEndpointConnections/{private_endpoint_connection_id}", + "readOnly": true + }, + "tidbNodeGroupId": { + "type": "string" + }, + "privateEndpointConnectionId": { + "type": "string", + "readOnly": true + }, + "clusterId": { + "type": "string", + "readOnly": true + }, + "clusterDisplayName": { + "type": "string", + "readOnly": true + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The labels of private link connection. It always contains the `project_id` label.", + "readOnly": true + }, + "endpointId": { + "type": "string", + "description": "The endpoint ID of the private link connection.\nFor AWS, it's VPC endpoint ID.\nFor GCP, it's private service connect endpoint ID.\nFor Azure, it's private endpoint resource ID." + }, + "privateIpAddress": { + "type": "string", + "x-nullable": true, + "description": "The private IP address of the private endpoint in the user's vNet.\nTiDB Cloud will setup a public DNS record for this private IP address. So the user can use DNS address to connect to the cluster.\nOnly available for Azure clusters." + }, + "endpointState": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/PrivateEndpointConnectionEndpointState" + } + ] + }, + "massage": { + "type": "string", + "readOnly": true + }, + "regionId": { + "type": "string", + "title": "Format: {cloud_provider}-{region_code}", + "readOnly": true + }, + "regionDisplayName": { + "type": "string", + "readOnly": true + }, + "cloudProvider": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/v1beta1RegionCloudProvider" + } + ] + }, + "privateLinkServiceName": { + "type": "string", + "readOnly": true + }, + "privateLinkServiceState": { + "readOnly": true, + "allOf": [ + { + "$ref": "#/definitions/v1beta1PrivateLinkServiceState" + } + ] + }, + "tidbNodeGroupDisplayName": { + "type": "string", + "readOnly": true + }, + "accountId": { + "type": "string", + "x-nullable": true, + "description": "Only for GCP private service connections. It's GCP project name.", + "readOnly": true + }, + "host": { + "type": "string", + "readOnly": true + }, + "port": { + "type": "integer", + "format": "int32", + "readOnly": true + } + }, + "required": [ + "tidbNodeGroupId", + "endpointId" + ] + }, + "v1beta1PrivateLinkServiceState": { + "type": "string", + "enum": [ + "CREATING", + "ACTIVE", + "DELETING" + ] + }, + "v1beta1PublicEndpointSetting": { + "type": "object", + "properties": { + "name": { + "type": "string", + "title": "Format: tidbNodeGroups/{tidb_node_group_id}/publicEndpointSetting", + "readOnly": true + }, + "tidbNodeGroupId": { + "type": "string", + "description": "If set to \"-\", the default TiDB group will be used." + }, + "enabled": { + "type": "boolean", + "x-nullable": true + }, + "ipAccessList": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/PublicEndpointSettingIpAccessList" + } + } + }, + "required": [ + "tidbNodeGroupId" + ] + }, + "v1beta1RegionCloudProvider": { + "type": "string", + "enum": [ + "aws", + "gcp", + "azure" + ], + "description": "Enum of cloud provider names.\n\n - aws: Amazon Web Services.\nbuf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE\n - gcp: Google Cloud Platform.\nbuf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE\n - azure: Microsoft Azure.\nbuf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE" + }, + "v1beta1ResetRootPasswordResponse": { + "type": "object" + }, + "v1beta1ShowCloudProvidersResponse": { + "type": "object", + "properties": { + "cloudProviders": { + "type": "array", + "items": { + "$ref": "#/definitions/v1beta1RegionCloudProvider" + } + } + } + }, + "v1beta1ShowNodeQuotaResponse": { + "type": "object", + "properties": { + "componentQuotas": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/ShowNodeQuotaResponseComponentQuota" + } + } + } + }, + "v1beta1ShowObjectStorageAccessIamPrincipalResponse": { + "type": "object", + "properties": { + "iamPrincipal": { + "type": "string" + } + } + }, + "v1beta1UpdateAuditLogConfigRequestAuditLogConfig": { + "type": "object", + "properties": { + "clusterId": { + "type": "string" + }, + "enabled": { + "type": "boolean", + "x-nullable": true + }, + "bucketUri": { + "type": "string" + }, + "bucketRegionId": { + "type": "string", + "title": "Format: {cloud_provider}-{region_code}" + }, + "awsRoleArn": { + "type": "string" + }, + "azureSasToken": { + "type": "string" + } + }, + "required": [ + "clusterId" + ] + }, + "v1beta1UpdateClusterRequestCluster": { + "type": "object", + "properties": { + "clusterId": { + "type": "string" + }, + "tidbNodeSetting": { + "$ref": "#/definitions/v1beta1UpdateClusterRequestTidbNodeSetting" + }, + "tikvNodeSetting": { + "$ref": "#/definitions/v1beta1UpdateClusterRequestStorageNodeSetting" + }, + "tiflashNodeSetting": { + "$ref": "#/definitions/v1beta1UpdateClusterRequestStorageNodeSetting" + }, + "displayName": { + "type": "string" + }, + "labels": { + "type": "object", + "additionalProperties": { + "type": "string" + }, + "description": "The project_id key cannot be updated. If the project_id key is specified, it will be ignored." + } + }, + "required": [ + "clusterId" + ] + }, + "v1beta1UpdateClusterRequestStorageNodeSetting": { + "type": "object", + "properties": { + "nodeSpecKey": { + "type": "string" + }, + "nodeCount": { + "type": "integer", + "format": "int32", + "x-nullable": true, + "description": "When update TiFlash node setting:\n - If the node count is set to 0, the TiFlash node will be removed.\n - If the node count is null, the TiFlash node count won't change.\nFor other components, if the node count is set to 0, server will ignore the node count." + }, + "storageSizeGi": { + "type": "integer", + "format": "int32" + } + } + }, + "v1beta1UpdateClusterRequestTidbNodeSetting": { + "type": "object", + "properties": { + "nodeSpecKey": { + "type": "string" + }, + "tidbNodeGroups": { + "type": "array", + "items": { + "type": "object", + "$ref": "#/definitions/UpdateClusterRequestTidbNodeSettingTidbNodeGroup" + } + } + } + }, + "v1beta1UpdateMaintenanceWindowRequestMaintenanceWindow": { + "type": "object", + "properties": { + "maintenanceWindowId": { + "type": "string", + "title": "Format: project-{project_id}" + }, + "weekDay": { + "type": "integer", + "format": "int32" + }, + "dayHour": { + "type": "integer", + "format": "int32" + }, + "hourMinute": { + "type": "integer", + "format": "int32" + } + }, + "required": [ + "maintenanceWindowId" + ] + }, + "v1beta1UpdateTidbNodeGroupRequestTidbNodeGroup": { + "type": "object", + "properties": { + "clusterId": { + "type": "string" + }, + "tidbNodeGroupId": { + "type": "string" + }, + "displayName": { + "type": "string" + }, + "nodeCount": { + "type": "integer", + "format": "int32", + "x-nullable": true + } + }, + "required": [ + "clusterId", + "tidbNodeGroupId" + ] + } + }, + "securityDefinitions": { + "Bearer": { + "type": "apiKey", + "description": "Enter the token with the `Bearer: ` prefix, e.g. \"Bearer abcde12345\".", + "name": "Authorization", + "in": "header" + } + }, + "security": [ + { + "Bearer": [] + } + ], + "externalDocs": { + "description": "More about TiDB Cloud API", + "url": "https://docs.pingcap.com/tidbcloud/api-overview" + } +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/.gitignore b/pkg/tidbcloud/v1beta1/dedicated/.gitignore new file mode 100644 index 00000000..daf913b1 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe +*.test +*.prof diff --git a/pkg/tidbcloud/v1beta1/dedicated/.openapi-generator-ignore b/pkg/tidbcloud/v1beta1/dedicated/.openapi-generator-ignore new file mode 100644 index 00000000..7484ee59 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/.openapi-generator-ignore @@ -0,0 +1,23 @@ +# OpenAPI Generator Ignore +# Generated by openapi-generator https://github.com/openapitools/openapi-generator + +# Use this file to prevent files from being overwritten by the generator. +# The patterns follow closely to .gitignore or .dockerignore. + +# As an example, the C# client generator defines ApiClient.cs. +# You can make changes and tell OpenAPI Generator to ignore just this file by uncommenting the following line: +#ApiClient.cs + +# You can match any string of characters against a directory, file or extension with a single asterisk (*): +#foo/*/qux +# The above matches foo/bar/qux and foo/baz/qux, but not foo/bar/baz/qux + +# You can recursively match patterns against a directory, file or extension with a double asterisk (**): +#foo/**/qux +# This matches foo/bar/qux, foo/baz/qux, and foo/bar/baz/qux + +# You can also negate patterns with an exclamation (!). +# For example, you can ignore all files in a docs folder with the file extension .md: +#docs/*.md +# Then explicitly reverse the ignore rule for a single file: +#!docs/README.md diff --git a/pkg/tidbcloud/v1beta1/dedicated/.openapi-generator/FILES b/pkg/tidbcloud/v1beta1/dedicated/.openapi-generator/FILES new file mode 100644 index 00000000..333a731f --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/.openapi-generator/FILES @@ -0,0 +1,90 @@ +.gitignore +.openapi-generator-ignore +.travis.yml +README.md +api/openapi.yaml +api_cluster_service.go +api_database_audit_log_service.go +api_maintenance_service.go +api_network_container_service.go +api_private_endpoint_connection_service.go +api_region_service.go +api_tidb_node_group_service.go +client.go +configuration.go +git_push.sh +model_audit_log_config_bucket_write_check.go +model_cluster_node_changing_progress.go +model_cluster_service_list_clusters_cluster_states_parameter_inner.go +model_cluster_service_list_node_instances_component_type_parameter.go +model_cluster_service_reset_root_password_body.go +model_cluster_service_update_cluster_request.go +model_cluster_storage_node_setting_storage_type.go +model_commonv1beta1_cluster_state.go +model_commonv1beta1_region.go +model_database_audit_log_service_create_audit_log_config_request.go +model_database_audit_log_service_create_audit_log_filter_rule_request.go +model_database_audit_log_service_update_audit_log_config_request.go +model_dedicatedv1beta1_audit_log_config.go +model_dedicatedv1beta1_cluster_pause_plan.go +model_dedicatedv1beta1_cluster_pause_plan_type.go +model_dedicatedv1beta1_component_type.go +model_dedicatedv1beta1_list_tidb_node_groups_response.go +model_dedicatedv1beta1_list_vpc_peerings_response.go +model_dedicatedv1beta1_maintenance_window.go +model_dedicatedv1beta1_node_spec.go +model_dedicatedv1beta1_pause_cluster_response.go +model_dedicatedv1beta1_private_link_service.go +model_dedicatedv1beta1_resume_cluster_response.go +model_dedicatedv1beta1_tidb_node_group.go +model_dedicatedv1beta1_tidb_node_group_endpoint.go +model_dedicatedv1beta1_tidb_node_group_state.go +model_dedicatedv1beta1_vpc_peering.go +model_dedicatedv1beta1_vpc_peering_state.go +model_endpoint_connection_type.go +model_googlerpc_status.go +model_maintenance_service_update_maintenance_window_request.go +model_private_endpoint_connection_endpoint_state.go +model_private_endpoint_connection_service_create_private_endpoint_connection_request.go +model_private_endpoint_connection_service_list_private_endpoint_connections_cloud_provider_parameter.go +model_protobuf_any.go +model_public_endpoint_setting_ip_access_list.go +model_show_node_quota_response_component_quota.go +model_tidb_cloud_open_apidedicatedv1beta1_cluster.go +model_tidb_cloud_open_apidedicatedv1beta1_list_clusters_response.go +model_tidb_cloud_open_apidedicatedv1beta1_list_regions_response.go +model_tidb_node_group_service_create_tidb_node_group_request.go +model_tidb_node_group_service_update_public_endpoint_setting_request.go +model_tidb_node_group_service_update_tidb_node_group_request.go +model_update_cluster_request_tidb_node_setting_tidb_node_group.go +model_v1beta1_audit_log_filter_rule.go +model_v1beta1_cluster_storage_node_setting.go +model_v1beta1_cluster_tidb_node_setting.go +model_v1beta1_list_audit_log_filter_rules_response.go +model_v1beta1_list_maintenance_tasks_response.go +model_v1beta1_list_maintenance_windows_response.go +model_v1beta1_list_network_containers_response.go +model_v1beta1_list_node_instances_response.go +model_v1beta1_list_node_specs_response.go +model_v1beta1_list_private_endpoint_connections_response.go +model_v1beta1_maintenance_task.go +model_v1beta1_maintenance_task_state.go +model_v1beta1_network_container.go +model_v1beta1_network_container_state.go +model_v1beta1_node_instance.go +model_v1beta1_node_instance_state.go +model_v1beta1_private_endpoint_connection.go +model_v1beta1_private_link_service_state.go +model_v1beta1_public_endpoint_setting.go +model_v1beta1_region_cloud_provider.go +model_v1beta1_show_cloud_providers_response.go +model_v1beta1_show_node_quota_response.go +model_v1beta1_show_object_storage_access_iam_principal_response.go +model_v1beta1_update_audit_log_config_request_audit_log_config.go +model_v1beta1_update_cluster_request_cluster.go +model_v1beta1_update_cluster_request_storage_node_setting.go +model_v1beta1_update_cluster_request_tidb_node_setting.go +model_v1beta1_update_maintenance_window_request_maintenance_window.go +model_v1beta1_update_tidb_node_group_request_tidb_node_group.go +response.go +utils.go diff --git a/pkg/tidbcloud/v1beta1/dedicated/.openapi-generator/VERSION b/pkg/tidbcloud/v1beta1/dedicated/.openapi-generator/VERSION new file mode 100644 index 00000000..09a6d308 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/.openapi-generator/VERSION @@ -0,0 +1 @@ +7.8.0 diff --git a/pkg/tidbcloud/v1beta1/dedicated/.travis.yml b/pkg/tidbcloud/v1beta1/dedicated/.travis.yml new file mode 100644 index 00000000..f5cb2ce9 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/.travis.yml @@ -0,0 +1,8 @@ +language: go + +install: + - go get -d -v . + +script: + - go build -v ./ + diff --git a/pkg/tidbcloud/v1beta1/dedicated/README.md b/pkg/tidbcloud/v1beta1/dedicated/README.md new file mode 100644 index 00000000..fc1766cf --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/README.md @@ -0,0 +1,255 @@ +# Go API client for dedicated + +TiDB Cloud Dedicated Open API. + +## Overview +This API client was generated by the [OpenAPI Generator](https://openapi-generator.tech) project. By using the [OpenAPI-spec](https://www.openapis.org/) from a remote server, you can easily generate an API client. + +- API version: v1beta1 +- Package version: 1.0.0 +- Generator version: 7.8.0 +- Build package: org.openapitools.codegen.languages.GoClientCodegen + +## Installation + +Install the following dependencies: + +```sh +go get github.com/stretchr/testify/assert +go get golang.org/x/net/context +``` + +Put the package under your project folder and add the following in import: + +```go +import dedicated "github.com/GIT_USER_ID/GIT_REPO_ID" +``` + +To use a proxy, set the environment variable `HTTP_PROXY`: + +```go +os.Setenv("HTTP_PROXY", "http://proxy_name:proxy_port") +``` + +## Configuration of Server URL + +Default configuration comes with `Servers` field that contains server objects as defined in the OpenAPI specification. + +### Select Server Configuration + +For using other server than the one defined on index 0 set context value `dedicated.ContextServerIndex` of type `int`. + +```go +ctx := context.WithValue(context.Background(), dedicated.ContextServerIndex, 1) +``` + +### Templated Server URL + +Templated server URL is formatted using default variables from configuration or from context value `dedicated.ContextServerVariables` of type `map[string]string`. + +```go +ctx := context.WithValue(context.Background(), dedicated.ContextServerVariables, map[string]string{ + "basePath": "v2", +}) +``` + +Note, enum values are always validated and all unused variables are silently ignored. + +### URLs Configuration per Operation + +Each operation can use different server URL defined using `OperationServers` map in the `Configuration`. +An operation is uniquely identified by `"{classname}Service.{nickname}"` string. +Similar rules for overriding default operation server index and variables applies by using `dedicated.ContextOperationServerIndices` and `dedicated.ContextOperationServerVariables` context maps. + +```go +ctx := context.WithValue(context.Background(), dedicated.ContextOperationServerIndices, map[string]int{ + "{classname}Service.{nickname}": 2, +}) +ctx = context.WithValue(context.Background(), dedicated.ContextOperationServerVariables, map[string]map[string]string{ + "{classname}Service.{nickname}": { + "port": "8443", + }, +}) +``` + +## Documentation for API Endpoints + +All URIs are relative to *https://dedicated.tidbapi.com/v1beta1* + +Class | Method | HTTP request | Description +------------ | ------------- | ------------- | ------------- +*ClusterServiceAPI* | [**ClusterServiceCreateCluster**](docs/ClusterServiceAPI.md#clusterservicecreatecluster) | **Post** /clusters | Create a cluster +*ClusterServiceAPI* | [**ClusterServiceDeleteCluster**](docs/ClusterServiceAPI.md#clusterservicedeletecluster) | **Delete** /clusters/{clusterId} | Delete a cluster +*ClusterServiceAPI* | [**ClusterServiceGetCluster**](docs/ClusterServiceAPI.md#clusterservicegetcluster) | **Get** /clusters/{clusterId} | Get a cluster +*ClusterServiceAPI* | [**ClusterServiceGetNodeInstance**](docs/ClusterServiceAPI.md#clusterservicegetnodeinstance) | **Get** /clusters/{clusterId}/nodeInstances/{instanceId} | Get a node instance +*ClusterServiceAPI* | [**ClusterServiceListClusters**](docs/ClusterServiceAPI.md#clusterservicelistclusters) | **Get** /clusters | List clusters +*ClusterServiceAPI* | [**ClusterServiceListNodeInstances**](docs/ClusterServiceAPI.md#clusterservicelistnodeinstances) | **Get** /clusters/{clusterId}/nodeInstances | List node instances +*ClusterServiceAPI* | [**ClusterServicePauseCluster**](docs/ClusterServiceAPI.md#clusterservicepausecluster) | **Post** /clusters/{clusterId}:pauseCluster | Pause a cluster +*ClusterServiceAPI* | [**ClusterServiceResetRootPassword**](docs/ClusterServiceAPI.md#clusterserviceresetrootpassword) | **Post** /clusters/{clusterId}:resetRootPassword | Reset the root password of a cluster +*ClusterServiceAPI* | [**ClusterServiceResumeCluster**](docs/ClusterServiceAPI.md#clusterserviceresumecluster) | **Post** /clusters/{clusterId}:resumeCluster | Resume a cluster +*ClusterServiceAPI* | [**ClusterServiceShowNodeQuota**](docs/ClusterServiceAPI.md#clusterserviceshownodequota) | **Get** /clusters:showNodeQuota | Show node quota across the caller's organization +*ClusterServiceAPI* | [**ClusterServiceUpdateCluster**](docs/ClusterServiceAPI.md#clusterserviceupdatecluster) | **Patch** /clusters/{cluster.clusterId} | Update a cluster +*DatabaseAuditLogServiceAPI* | [**DatabaseAuditLogServiceCreateAuditLogConfig**](docs/DatabaseAuditLogServiceAPI.md#databaseauditlogservicecreateauditlogconfig) | **Post** /clusters/{auditLogConfig.clusterId}/auditLogConfig | Create the audit log config for a cluster +*DatabaseAuditLogServiceAPI* | [**DatabaseAuditLogServiceCreateAuditLogFilterRule**](docs/DatabaseAuditLogServiceAPI.md#databaseauditlogservicecreateauditlogfilterrule) | **Post** /clusters/{auditLogFilterRule.clusterId}/auditLogFilterRules | Create an audit log filter rule +*DatabaseAuditLogServiceAPI* | [**DatabaseAuditLogServiceDeleteAuditLogFilterRule**](docs/DatabaseAuditLogServiceAPI.md#databaseauditlogservicedeleteauditlogfilterrule) | **Delete** /clusters/{clusterId}/auditLogFilterRules/{auditLogFilterRuleId} | Delete an audit log filter rule +*DatabaseAuditLogServiceAPI* | [**DatabaseAuditLogServiceGetAuditLogConfig**](docs/DatabaseAuditLogServiceAPI.md#databaseauditlogservicegetauditlogconfig) | **Get** /clusters/{clusterId}/auditLogConfig | Get the audit log config of a cluster +*DatabaseAuditLogServiceAPI* | [**DatabaseAuditLogServiceGetAuditLogFilterRule**](docs/DatabaseAuditLogServiceAPI.md#databaseauditlogservicegetauditlogfilterrule) | **Get** /clusters/{clusterId}/auditLogFilterRules/{auditLogFilterRuleId} | Get an audit log filter rule +*DatabaseAuditLogServiceAPI* | [**DatabaseAuditLogServiceListAuditLogFilterRules**](docs/DatabaseAuditLogServiceAPI.md#databaseauditlogservicelistauditlogfilterrules) | **Get** /clusters/{clusterId}/auditLogFilterRules | List audit log filter rules +*DatabaseAuditLogServiceAPI* | [**DatabaseAuditLogServiceShowObjectStorageAccessIamPrincipal**](docs/DatabaseAuditLogServiceAPI.md#databaseauditlogserviceshowobjectstorageaccessiamprincipal) | **Get** /clusters/{clusterId}/auditLogConfig:showObjectStorageAccessIamPrincipal | Show IAM principal of TiDB Cloud for accessing customer's object storage +*DatabaseAuditLogServiceAPI* | [**DatabaseAuditLogServiceUpdateAuditLogConfig**](docs/DatabaseAuditLogServiceAPI.md#databaseauditlogserviceupdateauditlogconfig) | **Patch** /clusters/{auditLogConfig.clusterId}/auditLogConfig | Update the audit log config of a cluster +*MaintenanceServiceAPI* | [**MaintenanceServiceDeferMaintenanceTask**](docs/MaintenanceServiceAPI.md#maintenanceservicedefermaintenancetask) | **Post** /maintenanceTasks/{maintenanceTaskId}:deferMaintenanceTask | Defer a maintenance task +*MaintenanceServiceAPI* | [**MaintenanceServiceGetMaintenanceTask**](docs/MaintenanceServiceAPI.md#maintenanceservicegetmaintenancetask) | **Get** /maintenanceTasks/{maintenanceTaskId} | Get a maintenance task +*MaintenanceServiceAPI* | [**MaintenanceServiceGetMaintenanceWindow**](docs/MaintenanceServiceAPI.md#maintenanceservicegetmaintenancewindow) | **Get** /maintenanceWindows/{maintenanceWindowId} | Get a maintenance window +*MaintenanceServiceAPI* | [**MaintenanceServiceListMaintenanceTasks**](docs/MaintenanceServiceAPI.md#maintenanceservicelistmaintenancetasks) | **Get** /maintenanceTasks | List maintenance tasks +*MaintenanceServiceAPI* | [**MaintenanceServiceListMaintenanceWindows**](docs/MaintenanceServiceAPI.md#maintenanceservicelistmaintenancewindows) | **Get** /maintenanceWindows | List maintenance windows +*MaintenanceServiceAPI* | [**MaintenanceServiceUpdateMaintenanceWindow**](docs/MaintenanceServiceAPI.md#maintenanceserviceupdatemaintenancewindow) | **Patch** /maintenanceWindows/{maintenanceWindow.maintenanceWindowId} | Update a maintenance window +*NetworkContainerServiceAPI* | [**NetworkContainerServiceCreateNetworkContainer**](docs/NetworkContainerServiceAPI.md#networkcontainerservicecreatenetworkcontainer) | **Post** /networkContainers | Create a network container +*NetworkContainerServiceAPI* | [**NetworkContainerServiceCreateVpcPeering**](docs/NetworkContainerServiceAPI.md#networkcontainerservicecreatevpcpeering) | **Post** /vpcPeerings | Create a VPC peering +*NetworkContainerServiceAPI* | [**NetworkContainerServiceDeleteNetworkContainer**](docs/NetworkContainerServiceAPI.md#networkcontainerservicedeletenetworkcontainer) | **Delete** /networkContainers/{networkContainerId} | Delete a network container +*NetworkContainerServiceAPI* | [**NetworkContainerServiceDeleteVpcPeering**](docs/NetworkContainerServiceAPI.md#networkcontainerservicedeletevpcpeering) | **Delete** /vpcPeerings/{vpcPeeringId} | Delete a VPC peering +*NetworkContainerServiceAPI* | [**NetworkContainerServiceGetNetworkContainer**](docs/NetworkContainerServiceAPI.md#networkcontainerservicegetnetworkcontainer) | **Get** /networkContainers/{networkContainerId} | Get a network container +*NetworkContainerServiceAPI* | [**NetworkContainerServiceGetVpcPeering**](docs/NetworkContainerServiceAPI.md#networkcontainerservicegetvpcpeering) | **Get** /vpcPeerings/{vpcPeeringId} | Get a VPC peering +*NetworkContainerServiceAPI* | [**NetworkContainerServiceListNetworkContainers**](docs/NetworkContainerServiceAPI.md#networkcontainerservicelistnetworkcontainers) | **Get** /networkContainers | List network containers +*NetworkContainerServiceAPI* | [**NetworkContainerServiceListVpcPeerings**](docs/NetworkContainerServiceAPI.md#networkcontainerservicelistvpcpeerings) | **Get** /vpcPeerings | List VPC peerings +*PrivateEndpointConnectionServiceAPI* | [**PrivateEndpointConnectionServiceCreatePrivateEndpointConnection**](docs/PrivateEndpointConnectionServiceAPI.md#privateendpointconnectionservicecreateprivateendpointconnection) | **Post** /clusters/{clusterId}/tidbNodeGroups/{privateEndpointConnection.tidbNodeGroupId}/privateEndpointConnections | Create a private endpoint connection +*PrivateEndpointConnectionServiceAPI* | [**PrivateEndpointConnectionServiceDeletePrivateEndpointConnection**](docs/PrivateEndpointConnectionServiceAPI.md#privateendpointconnectionservicedeleteprivateendpointconnection) | **Delete** /clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}/privateEndpointConnections/{privateEndpointConnectionId} | Delete a private endpoint connection +*PrivateEndpointConnectionServiceAPI* | [**PrivateEndpointConnectionServiceGetPrivateEndpointConnection**](docs/PrivateEndpointConnectionServiceAPI.md#privateendpointconnectionservicegetprivateendpointconnection) | **Get** /clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}/privateEndpointConnections/{privateEndpointConnectionId} | Get a private endpoint connection +*PrivateEndpointConnectionServiceAPI* | [**PrivateEndpointConnectionServiceGetPrivateLinkService**](docs/PrivateEndpointConnectionServiceAPI.md#privateendpointconnectionservicegetprivatelinkservice) | **Get** /clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}/privateLinkService | Get the private link service of a TiDB Node Group +*PrivateEndpointConnectionServiceAPI* | [**PrivateEndpointConnectionServiceListPrivateEndpointConnections**](docs/PrivateEndpointConnectionServiceAPI.md#privateendpointconnectionservicelistprivateendpointconnections) | **Get** /clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}/privateEndpointConnections | List private endpoint connections +*RegionServiceAPI* | [**RegionServiceGetNodeSpec**](docs/RegionServiceAPI.md#regionservicegetnodespec) | **Get** /regions/{regionId}/componentTypes/{componentType}/nodeSpecs/{nodeSpecKey} | Get a node spec +*RegionServiceAPI* | [**RegionServiceGetRegion**](docs/RegionServiceAPI.md#regionservicegetregion) | **Get** /regions/{regionId} | Get a region +*RegionServiceAPI* | [**RegionServiceListNodeSpecs**](docs/RegionServiceAPI.md#regionservicelistnodespecs) | **Get** /regions/{regionId}/nodeSpecs | List node specs for creating or scaling a cluster +*RegionServiceAPI* | [**RegionServiceListRegions**](docs/RegionServiceAPI.md#regionservicelistregions) | **Get** /regions | List regions for creating a cluster +*RegionServiceAPI* | [**RegionServiceShowCloudProviders**](docs/RegionServiceAPI.md#regionserviceshowcloudproviders) | **Get** /regions:showCloudProviders | Show cloud providers for creating a cluster +*TidbNodeGroupServiceAPI* | [**TidbNodeGroupServiceCreateTidbNodeGroup**](docs/TidbNodeGroupServiceAPI.md#tidbnodegroupservicecreatetidbnodegroup) | **Post** /clusters/{tidbNodeGroup.clusterId}/tidbNodeGroups | Create a TiDB Node Group +*TidbNodeGroupServiceAPI* | [**TidbNodeGroupServiceDeleteTidbNodeGroup**](docs/TidbNodeGroupServiceAPI.md#tidbnodegroupservicedeletetidbnodegroup) | **Delete** /clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId} | Delete a TiDB Node Group +*TidbNodeGroupServiceAPI* | [**TidbNodeGroupServiceGetPublicEndpointSetting**](docs/TidbNodeGroupServiceAPI.md#tidbnodegroupservicegetpublicendpointsetting) | **Get** /clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}/publicEndpointSetting | Get the public endpoint setting of a TiDB Node Group +*TidbNodeGroupServiceAPI* | [**TidbNodeGroupServiceGetTidbNodeGroup**](docs/TidbNodeGroupServiceAPI.md#tidbnodegroupservicegettidbnodegroup) | **Get** /clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId} | Get a TiDB Node Group +*TidbNodeGroupServiceAPI* | [**TidbNodeGroupServiceListTidbNodeGroups**](docs/TidbNodeGroupServiceAPI.md#tidbnodegroupservicelisttidbnodegroups) | **Get** /clusters/{clusterId}/tidbNodeGroups | List TiDB Node Groups +*TidbNodeGroupServiceAPI* | [**TidbNodeGroupServiceUpdatePublicEndpointSetting**](docs/TidbNodeGroupServiceAPI.md#tidbnodegroupserviceupdatepublicendpointsetting) | **Patch** /clusters/{clusterId}/tidbNodeGroups/{publicEndpointSetting.tidbNodeGroupId}/publicEndpointSetting | Update the public endpoint setting of a TiDB Node Group +*TidbNodeGroupServiceAPI* | [**TidbNodeGroupServiceUpdateTidbNodeGroup**](docs/TidbNodeGroupServiceAPI.md#tidbnodegroupserviceupdatetidbnodegroup) | **Patch** /clusters/{tidbNodeGroup.clusterId}/tidbNodeGroups/{tidbNodeGroup.tidbNodeGroupId} | Update a TiDB Node Group + + +## Documentation For Models + + - [AuditLogConfigBucketWriteCheck](docs/AuditLogConfigBucketWriteCheck.md) + - [ClusterNodeChangingProgress](docs/ClusterNodeChangingProgress.md) + - [ClusterServiceListClustersClusterStatesParameterInner](docs/ClusterServiceListClustersClusterStatesParameterInner.md) + - [ClusterServiceListNodeInstancesComponentTypeParameter](docs/ClusterServiceListNodeInstancesComponentTypeParameter.md) + - [ClusterServiceResetRootPasswordBody](docs/ClusterServiceResetRootPasswordBody.md) + - [ClusterServiceUpdateClusterRequest](docs/ClusterServiceUpdateClusterRequest.md) + - [ClusterStorageNodeSettingStorageType](docs/ClusterStorageNodeSettingStorageType.md) + - [Commonv1beta1ClusterState](docs/Commonv1beta1ClusterState.md) + - [Commonv1beta1Region](docs/Commonv1beta1Region.md) + - [DatabaseAuditLogServiceCreateAuditLogConfigRequest](docs/DatabaseAuditLogServiceCreateAuditLogConfigRequest.md) + - [DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest](docs/DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest.md) + - [DatabaseAuditLogServiceUpdateAuditLogConfigRequest](docs/DatabaseAuditLogServiceUpdateAuditLogConfigRequest.md) + - [Dedicatedv1beta1AuditLogConfig](docs/Dedicatedv1beta1AuditLogConfig.md) + - [Dedicatedv1beta1ClusterPausePlan](docs/Dedicatedv1beta1ClusterPausePlan.md) + - [Dedicatedv1beta1ClusterPausePlanType](docs/Dedicatedv1beta1ClusterPausePlanType.md) + - [Dedicatedv1beta1ComponentType](docs/Dedicatedv1beta1ComponentType.md) + - [Dedicatedv1beta1ListTidbNodeGroupsResponse](docs/Dedicatedv1beta1ListTidbNodeGroupsResponse.md) + - [Dedicatedv1beta1ListVpcPeeringsResponse](docs/Dedicatedv1beta1ListVpcPeeringsResponse.md) + - [Dedicatedv1beta1MaintenanceWindow](docs/Dedicatedv1beta1MaintenanceWindow.md) + - [Dedicatedv1beta1NodeSpec](docs/Dedicatedv1beta1NodeSpec.md) + - [Dedicatedv1beta1PauseClusterResponse](docs/Dedicatedv1beta1PauseClusterResponse.md) + - [Dedicatedv1beta1PrivateLinkService](docs/Dedicatedv1beta1PrivateLinkService.md) + - [Dedicatedv1beta1ResumeClusterResponse](docs/Dedicatedv1beta1ResumeClusterResponse.md) + - [Dedicatedv1beta1TidbNodeGroup](docs/Dedicatedv1beta1TidbNodeGroup.md) + - [Dedicatedv1beta1TidbNodeGroupEndpoint](docs/Dedicatedv1beta1TidbNodeGroupEndpoint.md) + - [Dedicatedv1beta1TidbNodeGroupState](docs/Dedicatedv1beta1TidbNodeGroupState.md) + - [Dedicatedv1beta1VpcPeering](docs/Dedicatedv1beta1VpcPeering.md) + - [Dedicatedv1beta1VpcPeeringState](docs/Dedicatedv1beta1VpcPeeringState.md) + - [EndpointConnectionType](docs/EndpointConnectionType.md) + - [GooglerpcStatus](docs/GooglerpcStatus.md) + - [MaintenanceServiceUpdateMaintenanceWindowRequest](docs/MaintenanceServiceUpdateMaintenanceWindowRequest.md) + - [PrivateEndpointConnectionEndpointState](docs/PrivateEndpointConnectionEndpointState.md) + - [PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest](docs/PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest.md) + - [PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter](docs/PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter.md) + - [ProtobufAny](docs/ProtobufAny.md) + - [PublicEndpointSettingIpAccessList](docs/PublicEndpointSettingIpAccessList.md) + - [ShowNodeQuotaResponseComponentQuota](docs/ShowNodeQuotaResponseComponentQuota.md) + - [TidbCloudOpenApidedicatedv1beta1Cluster](docs/TidbCloudOpenApidedicatedv1beta1Cluster.md) + - [TidbCloudOpenApidedicatedv1beta1ListClustersResponse](docs/TidbCloudOpenApidedicatedv1beta1ListClustersResponse.md) + - [TidbCloudOpenApidedicatedv1beta1ListRegionsResponse](docs/TidbCloudOpenApidedicatedv1beta1ListRegionsResponse.md) + - [TidbNodeGroupServiceCreateTidbNodeGroupRequest](docs/TidbNodeGroupServiceCreateTidbNodeGroupRequest.md) + - [TidbNodeGroupServiceUpdatePublicEndpointSettingRequest](docs/TidbNodeGroupServiceUpdatePublicEndpointSettingRequest.md) + - [TidbNodeGroupServiceUpdateTidbNodeGroupRequest](docs/TidbNodeGroupServiceUpdateTidbNodeGroupRequest.md) + - [UpdateClusterRequestTidbNodeSettingTidbNodeGroup](docs/UpdateClusterRequestTidbNodeSettingTidbNodeGroup.md) + - [V1beta1AuditLogFilterRule](docs/V1beta1AuditLogFilterRule.md) + - [V1beta1ClusterStorageNodeSetting](docs/V1beta1ClusterStorageNodeSetting.md) + - [V1beta1ClusterTidbNodeSetting](docs/V1beta1ClusterTidbNodeSetting.md) + - [V1beta1ListAuditLogFilterRulesResponse](docs/V1beta1ListAuditLogFilterRulesResponse.md) + - [V1beta1ListMaintenanceTasksResponse](docs/V1beta1ListMaintenanceTasksResponse.md) + - [V1beta1ListMaintenanceWindowsResponse](docs/V1beta1ListMaintenanceWindowsResponse.md) + - [V1beta1ListNetworkContainersResponse](docs/V1beta1ListNetworkContainersResponse.md) + - [V1beta1ListNodeInstancesResponse](docs/V1beta1ListNodeInstancesResponse.md) + - [V1beta1ListNodeSpecsResponse](docs/V1beta1ListNodeSpecsResponse.md) + - [V1beta1ListPrivateEndpointConnectionsResponse](docs/V1beta1ListPrivateEndpointConnectionsResponse.md) + - [V1beta1MaintenanceTask](docs/V1beta1MaintenanceTask.md) + - [V1beta1MaintenanceTaskState](docs/V1beta1MaintenanceTaskState.md) + - [V1beta1NetworkContainer](docs/V1beta1NetworkContainer.md) + - [V1beta1NetworkContainerState](docs/V1beta1NetworkContainerState.md) + - [V1beta1NodeInstance](docs/V1beta1NodeInstance.md) + - [V1beta1NodeInstanceState](docs/V1beta1NodeInstanceState.md) + - [V1beta1PrivateEndpointConnection](docs/V1beta1PrivateEndpointConnection.md) + - [V1beta1PrivateLinkServiceState](docs/V1beta1PrivateLinkServiceState.md) + - [V1beta1PublicEndpointSetting](docs/V1beta1PublicEndpointSetting.md) + - [V1beta1RegionCloudProvider](docs/V1beta1RegionCloudProvider.md) + - [V1beta1ShowCloudProvidersResponse](docs/V1beta1ShowCloudProvidersResponse.md) + - [V1beta1ShowNodeQuotaResponse](docs/V1beta1ShowNodeQuotaResponse.md) + - [V1beta1ShowObjectStorageAccessIamPrincipalResponse](docs/V1beta1ShowObjectStorageAccessIamPrincipalResponse.md) + - [V1beta1UpdateAuditLogConfigRequestAuditLogConfig](docs/V1beta1UpdateAuditLogConfigRequestAuditLogConfig.md) + - [V1beta1UpdateClusterRequestCluster](docs/V1beta1UpdateClusterRequestCluster.md) + - [V1beta1UpdateClusterRequestStorageNodeSetting](docs/V1beta1UpdateClusterRequestStorageNodeSetting.md) + - [V1beta1UpdateClusterRequestTidbNodeSetting](docs/V1beta1UpdateClusterRequestTidbNodeSetting.md) + - [V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow](docs/V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow.md) + - [V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup](docs/V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup.md) + + +## Documentation For Authorization + + +Authentication schemes defined for the API: +### Bearer + +- **Type**: API key +- **API key parameter name**: Authorization +- **Location**: HTTP header + +Note, each API key must be added to a map of `map[string]APIKey` where the key is: Authorization and passed in as the auth context for each request. + +Example + +```go +auth := context.WithValue( + context.Background(), + dedicated.ContextAPIKeys, + map[string]dedicated.APIKey{ + "Authorization": {Key: "API_KEY_STRING"}, + }, + ) +r, err := client.Service.Operation(auth, args) +``` + + +## Documentation for Utility Methods + +Due to the fact that model structure members are all pointers, this package contains +a number of utility functions to easily obtain pointers to values of basic types. +Each of these functions takes a value of the given basic type and returns a pointer to it: + +* `PtrBool` +* `PtrInt` +* `PtrInt32` +* `PtrInt64` +* `PtrFloat` +* `PtrFloat32` +* `PtrFloat64` +* `PtrString` +* `PtrTime` + +## Author + + + diff --git a/pkg/tidbcloud/v1beta1/dedicated/api/openapi.yaml b/pkg/tidbcloud/v1beta1/dedicated/api/openapi.yaml new file mode 100644 index 00000000..06c31a33 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/api/openapi.yaml @@ -0,0 +1,6018 @@ +openapi: 3.0.1 +info: + description: TiDB Cloud Dedicated Open API. + title: TiDB Cloud Dedicated Open API + version: v1beta1 +externalDocs: + description: More about TiDB Cloud API + url: https://docs.pingcap.com/tidbcloud/api-overview +servers: +- url: https://dedicated.tidbapi.com/v1beta1 +security: +- Bearer: [] +tags: +- name: ClusterService +- name: RegionService +- name: TidbNodeGroupService +- name: PrivateEndpointConnectionService +- name: NetworkContainerService +- name: MaintenanceService +- name: DatabaseAuditLogService +paths: + /clusters: + get: + operationId: ClusterService_ListClusters + parameters: + - description: "If unspecified, the project ID of default project is used." + in: query + name: projectId + schema: + type: string + - description: "If specified, only clusters in the specified cluster_ids will\ + \ be returned." + explode: true + in: query + name: clusterIds + schema: + items: + type: string + type: array + style: form + - description: "If specified, only clusters in the specified regions will be\ + \ returned." + explode: true + in: query + name: regionIds + schema: + items: + type: string + type: array + style: form + - description: |- + If specified, only clusters in the specified states will be returned. + + - CREATING: Cluster is being created. + - DELETING: Cluster is being deleted. + - ACTIVE: Cluster is active for use. + - RESTORING: Cluster data is being restored. + - MAINTENANCE: Cluster is under maintenance. + - DELETED: Cluster has been deleted. + - INACTIVE: Cluster is not active, but not being deleted. + - UPGRADING: Cluster is being updated. + Only for Dedicated Cluster. + - IMPORTING: Cluster is being imported. + Only for Dedicated Cluster. + - MODIFYING: Cluster is being modified. + Only for Dedicated Cluster. + - PAUSING: Cluster is being paused. + Only for Dedicated Cluster. + - PAUSED: Cluster is paused. + Only for Dedicated Cluster. + - RESUMING: Cluster is resuming. + Only for Dedicated Cluster. + explode: true + in: query + name: clusterStates + schema: + items: + $ref: '#/components/schemas/ClusterService_ListClusters_clusterStates_parameter_inner' + type: array + style: form + - description: |- + The maximum number of clusters to return. The service may return fewer than this value. + If unspecified, at most X clusters will be returned. + The maximum value is X; values above X will be coerced to X. + in: query + name: pageSize + schema: + format: int32 + type: integer + - description: |- + A page token, received from a previous `ListClusters` call. + Provide this to retrieve the subsequent page. + + When paginating, all other parameters provided to `ListClusters` must match + the call that provided the page token. + in: query + name: pageToken + schema: + type: string + - description: |- + The number of individual resources to skip before starting to return results. + If the skip value causes the cursor to move past the end of the collection, + the response will be 200 OK with an empty result set and no next_page_token. + in: query + name: skip + schema: + format: int32 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tidb_cloud_open_apidedicatedv1beta1ListClustersResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: List clusters + tags: + - ClusterService + post: + operationId: ClusterService_CreateCluster + parameters: + - description: "if validate_only is true, the request will be validated but\ + \ not executed." + in: query + name: validateOnly + schema: + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/tidb_cloud_open_apidedicatedv1beta1Cluster' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tidb_cloud_open_apidedicatedv1beta1Cluster' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Create a cluster + tags: + - ClusterService + x-codegen-request-body-name: cluster + /clusters/{clusterId}: + delete: + operationId: ClusterService_DeleteCluster + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + - description: "if validate_only is true, the request will be validated but\ + \ not executed." + in: query + name: validateOnly + schema: + type: boolean + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tidb_cloud_open_apidedicatedv1beta1Cluster' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Delete a cluster + tags: + - ClusterService + get: + operationId: ClusterService_GetCluster + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tidb_cloud_open_apidedicatedv1beta1Cluster' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Get a cluster + tags: + - ClusterService + /clusters/{cluster.clusterId}: + patch: + operationId: ClusterService_UpdateCluster + parameters: + - in: path + name: cluster.clusterId + required: true + schema: + type: string + - description: "if validate_only is true, the request will be validated but\ + \ not executed." + in: query + name: validateOnly + schema: + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ClusterService_UpdateCluster_request' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tidb_cloud_open_apidedicatedv1beta1Cluster' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Update a cluster + tags: + - ClusterService + x-codegen-request-body-name: cluster + /clusters/{clusterId}:pauseCluster: + post: + operationId: ClusterService_PauseCluster + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/dedicatedv1beta1PauseClusterResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Pause a cluster + tags: + - ClusterService + /clusters/{clusterId}:resumeCluster: + post: + operationId: ClusterService_ResumeCluster + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/dedicatedv1beta1ResumeClusterResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Resume a cluster + tags: + - ClusterService + /clusters/{clusterId}:resetRootPassword: + post: + operationId: ClusterService_ResetRootPassword + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ClusterServiceResetRootPasswordBody' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1ResetRootPasswordResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Reset the root password of a cluster + tags: + - ClusterService + x-codegen-request-body-name: body + /clusters/{clusterId}/nodeInstances: + get: + operationId: ClusterService_ListNodeInstances + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + - description: "If specified, only node instances of the specified component\ + \ type will be returned." + in: query + name: componentType + schema: + $ref: '#/components/schemas/ClusterService_ListNodeInstances_componentType_parameter' + - description: |- + The maximum number of node instances to return. The service may return fewer than this value. + If unspecified, at most X node instances will be returned. + The maximum value is X; values above X will be coerced to X. + in: query + name: pageSize + schema: + format: int32 + type: integer + - description: |- + A page token, received from a previous `ListNodeInstances` call. + Provide this to retrieve the subsequent page. + + When paginating, all other parameters provided to `ListNodeInstances` must match + the call that provided the page token. + in: query + name: pageToken + schema: + type: string + - description: |- + The number of individual resources to skip before starting to return results. + If the skip value causes the cursor to move past the end of the collection, + the response will be 200 OK with an empty result set and no next_page_token. + in: query + name: skip + schema: + format: int32 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1ListNodeInstancesResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: List node instances + tags: + - ClusterService + /clusters/{clusterId}/nodeInstances/{instanceId}: + get: + operationId: ClusterService_GetNodeInstance + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + - in: path + name: instanceId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1NodeInstance' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Get a node instance + tags: + - ClusterService + /clusters:showNodeQuota: + get: + operationId: ClusterService_ShowNodeQuota + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1ShowNodeQuotaResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Show node quota across the caller's organization + tags: + - ClusterService + /regions: + get: + operationId: RegionService_ListRegions + parameters: + - description: "If specified, only regions of the specified cloud provider will\ + \ be returned." + in: query + name: cloudProvider + schema: + type: string + - description: "If unspecified, the project ID of default project is used." + in: query + name: projectId + schema: + type: string + - description: |- + The maximum number of regions to return. The service may return fewer than this value. + If unspecified, at most X regions will be returned. + The maximum value is X; values above X will be coerced to X. + in: query + name: pageSize + schema: + format: int32 + type: integer + - description: |- + A page token, received from a previous `ListRegions` call. + Provide this to retrieve the subsequent page. + + When paginating, all other parameters provided to `ListRegions` must match + the call that provided the page token. + in: query + name: pageToken + schema: + type: string + - description: |- + The number of individual resources to skip before starting to return results. + If the skip value causes the cursor to move past the end of the collection, + the response will be 200 OK with an empty result set and no next_page_token. + in: query + name: skip + schema: + format: int32 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/tidb_cloud_open_apidedicatedv1beta1ListRegionsResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: List regions for creating a cluster + tags: + - RegionService + /regions/{regionId}: + get: + operationId: RegionService_GetRegion + parameters: + - description: "Format: {cloud_provider}-{region_code}" + in: path + name: regionId + required: true + schema: + type: string + - description: "If unspecified, the project ID of default project is used." + in: query + name: projectId + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/commonv1beta1Region' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Get a region + tags: + - RegionService + /regions:showCloudProviders: + get: + operationId: RegionService_ShowCloudProviders + parameters: + - description: "If unspecified, the project ID of default project is used." + in: query + name: projectId + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1ShowCloudProvidersResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Show cloud providers for creating a cluster + tags: + - RegionService + /regions/{regionId}/nodeSpecs: + get: + operationId: RegionService_ListNodeSpecs + parameters: + - description: "Format: {cloud_provider}-{region_code}" + in: path + name: regionId + required: true + schema: + type: string + - description: "If specified, only node specs of the specified component type\ + \ will be returned." + in: query + name: componentType + schema: + $ref: '#/components/schemas/ClusterService_ListNodeInstances_componentType_parameter' + - description: "If unspecified, the project ID of default project is used." + in: query + name: projectId + schema: + type: string + - description: |- + The maximum number of node specs to return. The service may return fewer than this value. + If unspecified, at most X node specs will be returned. + The maximum value is X; values above X will be coerced to X. + in: query + name: pageSize + schema: + format: int32 + type: integer + - description: |- + A page token, received from a previous `ListNodeSpecs` call. + Provide this to retrieve the subsequent page. + + When paginating, all other parameters provided to `ListNodeSpecs` must match + the call that provided the page token. + in: query + name: pageToken + schema: + type: string + - description: |- + The number of individual resources to skip before starting to return results. + If the skip value causes the cursor to move past the end of the collection, + the response will be 200 OK with an empty result set and no next_page_token. + in: query + name: skip + schema: + format: int32 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1ListNodeSpecsResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: List node specs for creating or scaling a cluster + tags: + - RegionService + /regions/{regionId}/componentTypes/{componentType}/nodeSpecs/{nodeSpecKey}: + get: + operationId: RegionService_GetNodeSpec + parameters: + - description: "Format: {cloud_provider}-{region_code}" + in: path + name: regionId + required: true + schema: + type: string + - in: path + name: componentType + required: true + schema: + $ref: '#/components/schemas/ClusterService_ListNodeInstances_componentType_parameter' + - in: path + name: nodeSpecKey + required: true + schema: + type: string + - description: "If unspecified, the project ID of default project is used." + in: query + name: projectId + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/dedicatedv1beta1NodeSpec' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Get a node spec + tags: + - RegionService + /clusters/{tidbNodeGroup.clusterId}/tidbNodeGroups: + post: + operationId: TidbNodeGroupService_CreateTidbNodeGroup + parameters: + - description: |- + The cluster ID of the TiDB group. + Optional when creating cluster with the default TiDB group. + Required when creating non-default TiDB group. + in: path + name: tidbNodeGroup.clusterId + required: true + schema: + type: string + - description: "if validate_only is true, the request will be validated but\ + \ not executed." + in: query + name: validateOnly + schema: + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TidbNodeGroupService_CreateTidbNodeGroup_request' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/dedicatedv1beta1TidbNodeGroup' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Create a TiDB Node Group + tags: + - TidbNodeGroupService + x-codegen-request-body-name: tidbNodeGroup + /clusters/{clusterId}/tidbNodeGroups: + get: + operationId: TidbNodeGroupService_ListTidbNodeGroups + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + - description: |- + The maximum number of TiDB groups to return. The service may return fewer than this value. + If unspecified, at most X TiDB groups will be returned. + The maximum value is X; values above X will be coerced to X. + in: query + name: pageSize + schema: + format: int32 + type: integer + - description: |- + A page token, received from a previous `ListTidbNodeGroups` call. + Provide this to retrieve the subsequent page. + + When paginating, all other parameters provided to `ListTidbNodeGroups` must match + the call that provided the page token. + in: query + name: pageToken + schema: + type: string + - description: |- + The number of individual resources to skip before starting to return results. + If the skip value causes the cursor to move past the end of the collection, + the response will be 200 OK with an empty result set and no next_page_token. + in: query + name: skip + schema: + format: int32 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/dedicatedv1beta1ListTidbNodeGroupsResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: List TiDB Node Groups + tags: + - TidbNodeGroupService + /clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}: + delete: + operationId: TidbNodeGroupService_DeleteTidbNodeGroup + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + - in: path + name: tidbNodeGroupId + required: true + schema: + type: string + - description: "if validate_only is true, the request will be validated but\ + \ not executed." + in: query + name: validateOnly + schema: + type: boolean + responses: + "200": + content: + application/json: + schema: + type: object + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Delete a TiDB Node Group + tags: + - TidbNodeGroupService + get: + operationId: TidbNodeGroupService_GetTidbNodeGroup + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + - in: path + name: tidbNodeGroupId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/dedicatedv1beta1TidbNodeGroup' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Get a TiDB Node Group + tags: + - TidbNodeGroupService + /clusters/{tidbNodeGroup.clusterId}/tidbNodeGroups/{tidbNodeGroup.tidbNodeGroupId}: + patch: + operationId: TidbNodeGroupService_UpdateTidbNodeGroup + parameters: + - in: path + name: tidbNodeGroup.clusterId + required: true + schema: + type: string + - in: path + name: tidbNodeGroup.tidbNodeGroupId + required: true + schema: + type: string + - description: "if validate_only is true, the request will be validated but\ + \ not executed." + in: query + name: validateOnly + schema: + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TidbNodeGroupService_UpdateTidbNodeGroup_request' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/dedicatedv1beta1TidbNodeGroup' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Update a TiDB Node Group + tags: + - TidbNodeGroupService + x-codegen-request-body-name: tidbNodeGroup + /clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}/publicEndpointSetting: + get: + operationId: TidbNodeGroupService_GetPublicEndpointSetting + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + - in: path + name: tidbNodeGroupId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1PublicEndpointSetting' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Get the public endpoint setting of a TiDB Node Group + tags: + - TidbNodeGroupService + /clusters/{clusterId}/tidbNodeGroups/{publicEndpointSetting.tidbNodeGroupId}/publicEndpointSetting: + patch: + operationId: TidbNodeGroupService_UpdatePublicEndpointSetting + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + - description: "If set to \"-\", the default TiDB group will be used." + in: path + name: publicEndpointSetting.tidbNodeGroupId + required: true + schema: + type: string + - description: "if validate_only is true, the request will be validated but\ + \ not executed." + in: query + name: validateOnly + schema: + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/TidbNodeGroupService_UpdatePublicEndpointSetting_request' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1PublicEndpointSetting' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Update the public endpoint setting of a TiDB Node Group + tags: + - TidbNodeGroupService + x-codegen-request-body-name: publicEndpointSetting + /clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}/privateLinkService: + get: + operationId: PrivateEndpointConnectionService_GetPrivateLinkService + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + - in: path + name: tidbNodeGroupId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/dedicatedv1beta1PrivateLinkService' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Get the private link service of a TiDB Node Group + tags: + - PrivateEndpointConnectionService + /clusters/{clusterId}/tidbNodeGroups/{privateEndpointConnection.tidbNodeGroupId}/privateEndpointConnections: + post: + operationId: PrivateEndpointConnectionService_CreatePrivateEndpointConnection + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + - in: path + name: privateEndpointConnection.tidbNodeGroupId + required: true + schema: + type: string + - description: |- + Default is false. If true, the request will not be applied and only validation will be performed. + At present, this field is only available for Azure provider. + in: query + name: validateOnly + schema: + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/PrivateEndpointConnectionService_CreatePrivateEndpointConnection_request' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1PrivateEndpointConnection' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Create a private endpoint connection + tags: + - PrivateEndpointConnectionService + x-codegen-request-body-name: privateEndpointConnection + /clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}/privateEndpointConnections: + get: + operationId: PrivateEndpointConnectionService_ListPrivateEndpointConnections + parameters: + - description: "To list private link connections across different clusters and\ + \ TiDB groups, set cluster_id to \"-\"." + in: path + name: clusterId + required: true + schema: + pattern: "[^/]+" + type: string + - description: "To list private link connections across different clusters and\ + \ TiDB groups, set tidb_node_group_id to \"-\"." + in: path + name: tidbNodeGroupId + required: true + schema: + pattern: "[^/]+" + type: string + - description: |- + Pass this project_id only when listing under a project across different clusters and TiDB groups. + Both cluster_id and tidb_node_group_id should be set to "-" in this case. + If unspecified, the project ID of the cluster is used. + in: query + name: projectId + schema: + type: string + - description: |- + If specified, only private link connections of the specified cloud provider will be returned. + + - aws: Amazon Web Services. + buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + - gcp: Google Cloud Platform. + buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + - azure: Microsoft Azure. + buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + in: query + name: cloudProvider + schema: + $ref: '#/components/schemas/PrivateEndpointConnectionService_ListPrivateEndpointConnections_cloudProvider_parameter' + - description: |- + The maximum number of private link connections to return. The service may return fewer than this value. + If unspecified, at most X private link connections will be returned. + The maximum value is X; values above X will be coerced to X. + in: query + name: pageSize + schema: + format: int32 + type: integer + - description: |- + A page token, received from a previous `ListPrivateLinkConnections` call. + Provide this to retrieve the subsequent page. + in: query + name: pageToken + schema: + type: string + - description: |- + The number of individual resources to skip before starting to return results. + If the skip value causes the cursor to move past the end of the collection, + the response will be 200 OK with an empty result set and no next_page_token. + in: query + name: skip + schema: + format: int32 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1ListPrivateEndpointConnectionsResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: List private endpoint connections + tags: + - PrivateEndpointConnectionService + /clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}/privateEndpointConnections/{privateEndpointConnectionId}: + delete: + operationId: PrivateEndpointConnectionService_DeletePrivateEndpointConnection + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + - in: path + name: tidbNodeGroupId + required: true + schema: + type: string + - in: path + name: privateEndpointConnectionId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + type: object + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Delete a private endpoint connection + tags: + - PrivateEndpointConnectionService + get: + operationId: PrivateEndpointConnectionService_GetPrivateEndpointConnection + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + - in: path + name: tidbNodeGroupId + required: true + schema: + type: string + - in: path + name: privateEndpointConnectionId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1PrivateEndpointConnection' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Get a private endpoint connection + tags: + - PrivateEndpointConnectionService + /networkContainers: + get: + operationId: NetworkContainerService_ListNetworkContainers + parameters: + - description: "If unspecified, the project ID of default project is used." + in: query + name: projectId + schema: + type: string + - description: |2- + - aws: Amazon Web Services. + buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + - gcp: Google Cloud Platform. + buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + - azure: Microsoft Azure. + buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + in: query + name: cloudProvider + schema: + $ref: '#/components/schemas/PrivateEndpointConnectionService_ListPrivateEndpointConnections_cloudProvider_parameter' + - description: |- + The maximum number of network containers to return. The service may return fewer than this value. + If unspecified, at most X network containers will be returned. + The maximum value is X; values above X will be coerced to X. + in: query + name: pageSize + schema: + format: int32 + type: integer + - description: |- + A page token, received from a previous `ListNetworkContainers` call. + Provide this to retrieve the subsequent page. + + When paginating, all other parameters provided to `ListNetworkContainers` must match + the call that provided the page token. + in: query + name: pageToken + schema: + type: string + - description: |- + The number of individual resources to skip before starting to return results. + If the skip value causes the cursor to move past the end of the collection, + the response will be 200 OK with an empty result set and no next_page_token. + in: query + name: skip + schema: + format: int32 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1ListNetworkContainersResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: List network containers + tags: + - NetworkContainerService + post: + operationId: NetworkContainerService_CreateNetworkContainer + parameters: + - in: query + name: validateOnly + schema: + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1NetworkContainer' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1NetworkContainer' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Create a network container + tags: + - NetworkContainerService + x-codegen-request-body-name: networkContainer + /networkContainers/{networkContainerId}: + delete: + operationId: NetworkContainerService_DeleteNetworkContainer + parameters: + - in: path + name: networkContainerId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + type: object + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Delete a network container + tags: + - NetworkContainerService + get: + operationId: NetworkContainerService_GetNetworkContainer + parameters: + - in: path + name: networkContainerId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1NetworkContainer' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Get a network container + tags: + - NetworkContainerService + /vpcPeerings: + get: + operationId: NetworkContainerService_ListVpcPeerings + parameters: + - description: "If unspecified, the project ID of default project is used." + in: query + name: projectId + schema: + type: string + - description: |- + If specified, only VPC peerings of the specified cloud provider will be returned. + + - aws: Amazon Web Services. + buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + - gcp: Google Cloud Platform. + buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + - azure: Microsoft Azure. + buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + in: query + name: cloudProvider + schema: + $ref: '#/components/schemas/PrivateEndpointConnectionService_ListPrivateEndpointConnections_cloudProvider_parameter' + - description: |- + The maximum number of VPC peerings to return. The service may return fewer than this value. + If unspecified, at most X VPC peerings will be returned. + The maximum value is X; values above X will be coerced to X. + in: query + name: pageSize + schema: + format: int32 + type: integer + - description: |- + A page token, received from a previous `ListVpcPeerings` call. + Provide this to retrieve the subsequent page. + + When paginating, all other parameters provided to `ListVpcPeerings` must match + the call that provided the page token. + in: query + name: pageToken + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/dedicatedv1beta1ListVpcPeeringsResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: List VPC peerings + tags: + - NetworkContainerService + post: + operationId: NetworkContainerService_CreateVpcPeering + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/dedicatedv1beta1VpcPeering' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/dedicatedv1beta1VpcPeering' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Create a VPC peering + tags: + - NetworkContainerService + x-codegen-request-body-name: vpcPeering + /vpcPeerings/{vpcPeeringId}: + delete: + operationId: NetworkContainerService_DeleteVpcPeering + parameters: + - description: "Format {cloud_provider}-{random_suffix}" + in: path + name: vpcPeeringId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + type: object + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Delete a VPC peering + tags: + - NetworkContainerService + get: + operationId: NetworkContainerService_GetVpcPeering + parameters: + - description: "Format {cloud_provider}-{random_suffix}" + in: path + name: vpcPeeringId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/dedicatedv1beta1VpcPeering' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Get a VPC peering + tags: + - NetworkContainerService + /maintenanceWindows/{maintenanceWindowId}: + get: + operationId: MaintenanceService_GetMaintenanceWindow + parameters: + - description: "Format: project-{project_id}" + in: path + name: maintenanceWindowId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/dedicatedv1beta1MaintenanceWindow' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Get a maintenance window + tags: + - MaintenanceService + /maintenanceWindows: + get: + operationId: MaintenanceService_ListMaintenanceWindows + parameters: + - description: "If unspecified, the project ID of default project is used." + in: query + name: projectId + schema: + type: string + - description: |- + The maximum number of maintenance windows to return. The service may return fewer than this value. + If unspecified, at most X maintenance windows will be returned. + The maximum value is X; values above X will be coerced to X. + in: query + name: pageSize + schema: + format: int32 + type: integer + - description: |- + A page token, received from a previous `ListMaintenanceWindows` call. + Provide this to retrieve the subsequent page. + + When paginating, all other parameters provided to `ListMaintenanceWindows` must match + the call that provided the page token. + in: query + name: pageToken + schema: + type: string + - description: |- + The number of individual resources to skip before starting to return results. + If the skip value causes the cursor to move past the end of the collection, + the response will be 200 OK with an empty result set and no next_page_token. + in: query + name: skip + schema: + format: int32 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1ListMaintenanceWindowsResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: List maintenance windows + tags: + - MaintenanceService + /maintenanceWindows/{maintenanceWindow.maintenanceWindowId}: + patch: + operationId: MaintenanceService_UpdateMaintenanceWindow + parameters: + - description: "Format: project-{project_id}" + in: path + name: maintenanceWindow.maintenanceWindowId + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/MaintenanceService_UpdateMaintenanceWindow_request' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/dedicatedv1beta1MaintenanceWindow' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Update a maintenance window + tags: + - MaintenanceService + x-codegen-request-body-name: maintenanceWindow + /maintenanceTasks: + get: + operationId: MaintenanceService_ListMaintenanceTasks + parameters: + - description: "If unspecified, the project ID of default project is used." + in: query + name: projectId + schema: + type: string + - description: |- + The maximum number of maintenance tasks to return. The service may return fewer than this value. + If unspecified, at most X maintenance tasks will be returned. + The maximum value is X; values above X will be coerced to X. + in: query + name: pageSize + schema: + format: int32 + type: integer + - description: |- + A page token, received from a previous `ListMaintenanceTasks` call. + Provide this to retrieve the subsequent page. + + When paginating, all other parameters provided to `ListMaintenanceTasks` must match + the call that provided the page token. + in: query + name: pageToken + schema: + type: string + - description: |- + The number of individual resources to skip before starting to return results. + If the skip value causes the cursor to move past the end of the collection, + the response will be 200 OK with an empty result set and no next_page_token. + in: query + name: skip + schema: + format: int32 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1ListMaintenanceTasksResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: List maintenance tasks + tags: + - MaintenanceService + /maintenanceTasks/{maintenanceTaskId}: + get: + operationId: MaintenanceService_GetMaintenanceTask + parameters: + - in: path + name: maintenanceTaskId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1MaintenanceTask' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Get a maintenance task + tags: + - MaintenanceService + /maintenanceTasks/{maintenanceTaskId}:deferMaintenanceTask: + post: + operationId: MaintenanceService_DeferMaintenanceTask + parameters: + - in: path + name: maintenanceTaskId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1DeferMaintenanceTaskResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Defer a maintenance task + tags: + - MaintenanceService + /clusters/{auditLogConfig.clusterId}/auditLogConfig: + patch: + operationId: DatabaseAuditLogService_UpdateAuditLogConfig + parameters: + - in: path + name: auditLogConfig.clusterId + required: true + schema: + type: string + - in: query + name: validateOnly + schema: + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DatabaseAuditLogService_UpdateAuditLogConfig_request' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/dedicatedv1beta1AuditLogConfig' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Update the audit log config of a cluster + tags: + - DatabaseAuditLogService + x-codegen-request-body-name: auditLogConfig + post: + operationId: DatabaseAuditLogService_CreateAuditLogConfig + parameters: + - in: path + name: auditLogConfig.clusterId + required: true + schema: + type: string + - in: query + name: validateOnly + schema: + type: boolean + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DatabaseAuditLogService_CreateAuditLogConfig_request' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/dedicatedv1beta1AuditLogConfig' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Create the audit log config for a cluster + tags: + - DatabaseAuditLogService + x-codegen-request-body-name: auditLogConfig + /clusters/{clusterId}/auditLogConfig: + get: + operationId: DatabaseAuditLogService_GetAuditLogConfig + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/dedicatedv1beta1AuditLogConfig' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Get the audit log config of a cluster + tags: + - DatabaseAuditLogService + /clusters/{auditLogFilterRule.clusterId}/auditLogFilterRules: + post: + operationId: DatabaseAuditLogService_CreateAuditLogFilterRule + parameters: + - in: path + name: auditLogFilterRule.clusterId + required: true + schema: + type: string + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/DatabaseAuditLogService_CreateAuditLogFilterRule_request' + required: true + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1AuditLogFilterRule' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Create an audit log filter rule + tags: + - DatabaseAuditLogService + x-codegen-request-body-name: auditLogFilterRule + /clusters/{clusterId}/auditLogFilterRules/{auditLogFilterRuleId}: + delete: + operationId: DatabaseAuditLogService_DeleteAuditLogFilterRule + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + - in: path + name: auditLogFilterRuleId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + type: object + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Delete an audit log filter rule + tags: + - DatabaseAuditLogService + get: + operationId: DatabaseAuditLogService_GetAuditLogFilterRule + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + - in: path + name: auditLogFilterRuleId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1AuditLogFilterRule' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Get an audit log filter rule + tags: + - DatabaseAuditLogService + /clusters/{clusterId}/auditLogFilterRules: + get: + operationId: DatabaseAuditLogService_ListAuditLogFilterRules + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + - in: query + name: pageSize + schema: + format: int32 + type: integer + - in: query + name: pageToken + schema: + type: string + - description: |- + The number of individual resources to skip before starting to return results. + If the skip value causes the cursor to move past the end of the collection, + the response will be 200 OK with an empty result set and no next_page_token. + in: query + name: skip + schema: + format: int32 + type: integer + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1ListAuditLogFilterRulesResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: List audit log filter rules + tags: + - DatabaseAuditLogService + /clusters/{clusterId}/auditLogConfig:showObjectStorageAccessIamPrincipal: + get: + operationId: DatabaseAuditLogService_ShowObjectStorageAccessIamPrincipal + parameters: + - in: path + name: clusterId + required: true + schema: + type: string + responses: + "200": + content: + application/json: + schema: + $ref: '#/components/schemas/v1beta1ShowObjectStorageAccessIamPrincipalResponse' + description: A successful response. + "400": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Bad Request + "401": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Unauthorized + "403": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Forbidden + "429": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Too Many Requests + "500": + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: Internal Server Error + default: + content: + application/json: + schema: + $ref: '#/components/schemas/googlerpcStatus' + description: An unexpected error response. + summary: Show IAM principal of TiDB Cloud for accessing customer's object storage + tags: + - DatabaseAuditLogService +components: + schemas: + AuditLogConfigBucketWriteCheck: + properties: + writable: + readOnly: true + type: boolean + errorReason: + description: The reason why the bucket is not writable. Output only when + `writable` is false. + readOnly: true + type: string + type: object + ClusterNodeChangingProgress: + properties: + matchingNodeSpecNodeCount: + format: int32 + readOnly: true + type: integer + remainingDeletionNodeCount: + description: available if some nodes are deleting. + format: int32 + readOnly: true + type: integer + type: object + ClusterServiceResetRootPasswordBody: + example: + rootPassword: rootPassword + properties: + rootPassword: + type: string + required: + - rootPassword + type: object + ClusterStorageNodeSettingStorageType: + enum: + - BASIC + - BASICV2 + - OPTIMIZED + - PLUS + title: |- + - BASIC: default + - BASICV2: separate raft-log and data storage, only for tikv + - OPTIMIZED: separate raft-log and data storage, and use high performance storage volume for raft-log, only for tikv + - PLUS: use high performance storage volume + type: string + EndpointConnectionType: + description: |2- + - PUBLIC: The endpoint is a public endpoint. + - VPC_PEERING: The endpoint is a VPC peering endpoint. + - PRIVATE_ENDPOINT: The endpoint is a private link endpoint. + enum: + - PUBLIC + - VPC_PEERING + - PRIVATE_ENDPOINT + type: string + PrivateEndpointConnectionEndpointState: + description: |2- + - PENDING: Customer has posted to TiDB cloud API, + but endpoint connection has not been accepted **asynchronously** by TiDB Cloud. + - DISCOVERED: Customer has created the endpoint in their vpc, but has not posted to TiDB Cloud API. + enum: + - PENDING + - ACTIVE + - DELETING + - FAILED + - DISCOVERED + type: string + PublicEndpointSettingIpAccessList: + example: + description: description + cidrNotation: cidrNotation + properties: + cidrNotation: + type: string + description: + type: string + required: + - cidrNotation + type: object + ShowNodeQuotaResponseComponentQuota: + example: + componentType: TIKV + quota: 0 + properties: + componentType: + $ref: '#/components/schemas/dedicatedv1beta1ComponentType' + quota: + format: int32 + type: integer + type: object + UpdateClusterRequestTidbNodeSettingTidbNodeGroup: + properties: + tidbNodeGroupId: + title: "if tidb_node_group_id is empty, it means scale default tidb group" + type: string + nodeCount: + format: int32 + nullable: true + type: integer + type: object + commonv1beta1ClusterState: + description: |- + Enum of possible states of a cluster. + + - CREATING: Cluster is being created. + - DELETING: Cluster is being deleted. + - ACTIVE: Cluster is active for use. + - RESTORING: Cluster data is being restored. + - MAINTENANCE: Cluster is under maintenance. + - DELETED: Cluster has been deleted. + - INACTIVE: Cluster is not active, but not being deleted. + - UPGRADING: Cluster is being updated. + Only for Dedicated Cluster. + - IMPORTING: Cluster is being imported. + Only for Dedicated Cluster. + - MODIFYING: Cluster is being modified. + Only for Dedicated Cluster. + - PAUSING: Cluster is being paused. + Only for Dedicated Cluster. + - PAUSED: Cluster is paused. + Only for Dedicated Cluster. + - RESUMING: Cluster is resuming. + Only for Dedicated Cluster. + enum: + - CREATING + - DELETING + - ACTIVE + - RESTORING + - MAINTENANCE + - DELETED + - INACTIVE + - UPGRADING + - IMPORTING + - MODIFYING + - PAUSING + - PAUSED + - RESUMING + type: string + commonv1beta1Region: + description: A representation of a region for deploying TiDB clusters. + example: + regionId: regionId + provider: provider + displayName: displayName + cloudProvider: "{}" + name: regions/aws-us-west-2 + properties: + name: + example: regions/aws-us-west-2 + pattern: ^regions/(aws|gcp|azure)-(.+)$ + title: |- + The unique name of the region. + Format: regions/{region_id} + type: string + regionId: + description: |- + Format: {cloud_provider}-{region_code} + Region code: us-west-2, asia-east1. + readOnly: true + type: string + cloudProvider: + allOf: + - $ref: '#/components/schemas/v1beta1RegionCloudProvider' + description: The cloud provider for the region. + type: object + displayName: + description: User-friendly display name of the region. + readOnly: true + type: string + provider: + description: |- + Optional provider name for the region. + Only used for serverless cluster. + Deprecated. + nullable: true + readOnly: true + type: string + type: object + dedicatedv1beta1AuditLogConfig: + example: + bucketUri: bucketUri + azureSasToken: azureSasToken + bucketWriteCheck: "{}" + name: name + bucketRegionId: bucketRegionId + clusterId: clusterId + enabled: true + awsRoleArn: awsRoleArn + properties: + name: + readOnly: true + title: "Format: clusters/{cluster_id}/auditLogConfig" + type: string + clusterId: + type: string + enabled: + description: Default is false. + type: boolean + bucketUri: + type: string + bucketRegionId: + title: "Format: {cloud_provider}-{region_code}" + type: string + awsRoleArn: + type: string + azureSasToken: + type: string + bucketWriteCheck: + allOf: + - $ref: '#/components/schemas/AuditLogConfigBucketWriteCheck' + type: object + required: + - bucketUri + - clusterId + type: object + dedicatedv1beta1ClusterPausePlan: + properties: + pauseType: + $ref: '#/components/schemas/dedicatedv1beta1ClusterPausePlanType' + scheduledResumeTime: + format: date-time + readOnly: true + type: string + required: + - pauseType + type: object + dedicatedv1beta1ClusterPausePlanType: + enum: + - NORMAL + - DEPRECATE + title: |- + - NORMAL: default pause plan + - DEPRECATE: old pause plan, will be removed + type: string + dedicatedv1beta1ComponentType: + enum: + - TIKV + - TIDB + - TIFLASH + - PD + - TIPROXY + type: string + dedicatedv1beta1ListTidbNodeGroupsResponse: + example: + tidbNodeGroups: + - isDefaultGroup: true + endpoints: + - port: 6 + host: host + connectionType: "{}" + - port: 6 + host: host + connectionType: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + displayName: displayName + tidbNodeGroupId: tidbNodeGroupId + name: name + nodeCount: 0 + clusterId: clusterId + state: "{}" + - isDefaultGroup: true + endpoints: + - port: 6 + host: host + connectionType: "{}" + - port: 6 + host: host + connectionType: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + displayName: displayName + tidbNodeGroupId: tidbNodeGroupId + name: name + nodeCount: 0 + clusterId: clusterId + state: "{}" + totalSize: 0 + nextPageToken: nextPageToken + properties: + tidbNodeGroups: + items: + $ref: '#/components/schemas/dedicatedv1beta1TidbNodeGroup' + type: array + totalSize: + description: The total number of TiDB groups that matched the query. + format: int32 + type: integer + nextPageToken: + description: |- + A token, which can be sent as `page_token` to retrieve the next page. + If this field is omitted, there are no subsequent pages. + type: string + type: object + dedicatedv1beta1ListVpcPeeringsResponse: + example: + totalSize: 0 + nextPageToken: nextPageToken + vpcPeerings: + - tidbCloudVpcCidr: tidbCloudVpcCidr + labels: + key: labels + customerVpcCidr: customerVpcCidr + customerRegionId: customerRegionId + customerAccountId: customerAccountId + tidbCloudVpcId: tidbCloudVpcId + name: name + vpcPeeringId: vpcPeeringId + state: "{}" + customerVpcId: customerVpcId + tidbCloudCloudProvider: "{}" + tidbCloudAccountId: tidbCloudAccountId + awsVpcPeeringConnectionId: awsVpcPeeringConnectionId + tidbCloudRegionId: tidbCloudRegionId + - tidbCloudVpcCidr: tidbCloudVpcCidr + labels: + key: labels + customerVpcCidr: customerVpcCidr + customerRegionId: customerRegionId + customerAccountId: customerAccountId + tidbCloudVpcId: tidbCloudVpcId + name: name + vpcPeeringId: vpcPeeringId + state: "{}" + customerVpcId: customerVpcId + tidbCloudCloudProvider: "{}" + tidbCloudAccountId: tidbCloudAccountId + awsVpcPeeringConnectionId: awsVpcPeeringConnectionId + tidbCloudRegionId: tidbCloudRegionId + properties: + vpcPeerings: + items: + $ref: '#/components/schemas/dedicatedv1beta1VpcPeering' + type: array + totalSize: + description: The total number of VPC peerings that matched the query. + format: int32 + type: integer + nextPageToken: + description: |- + A token, which can be sent as `page_token` to retrieve the next page. + If this field is omitted, there are no subsequent pages. + type: string + type: object + dedicatedv1beta1MaintenanceWindow: + description: MaintenanceWindow is a singleton resource that represents the maintenance + window under a project. + example: + dayHour: 6 + maintenanceWindowId: maintenanceWindowId + unchangedMaintenanceTasks: + - maintenanceTaskId: maintenanceTaskId + createTime: 2000-01-23T04:56:07.000+00:00 + name: name + description: description + scheduledApplyTime: 2000-01-23T04:56:07.000+00:00 + state: "{}" + deadline: 2000-01-23T04:56:07.000+00:00 + projectId: projectId + - maintenanceTaskId: maintenanceTaskId + createTime: 2000-01-23T04:56:07.000+00:00 + name: name + description: description + scheduledApplyTime: 2000-01-23T04:56:07.000+00:00 + state: "{}" + deadline: 2000-01-23T04:56:07.000+00:00 + projectId: projectId + weekDay: 0 + nextMaintenanceDate: 2000-01-23T04:56:07.000+00:00 + name: name + hourMinute: 1 + projectId: projectId + properties: + name: + readOnly: true + title: "Format: maintenanceWindows/{maintenance_window_id}" + type: string + maintenanceWindowId: + readOnly: true + title: "Format: project-{project_id}" + type: string + projectId: + type: string + weekDay: + description: "0-6, 0 is Sunday." + format: int32 + type: integer + dayHour: + description: 0-23 in UTC. + format: int32 + type: integer + hourMinute: + description: 0-59 in UTC. + format: int32 + type: integer + nextMaintenanceDate: + format: date-time + readOnly: true + type: string + unchangedMaintenanceTasks: + items: + $ref: '#/components/schemas/v1beta1MaintenanceTask' + readOnly: true + type: array + required: + - dayHour + - hourMinute + - projectId + - weekDay + type: object + dedicatedv1beta1NodeSpec: + example: + componentType: "{}" + minStorageSizeGi: 5 + nodeSpecKey: nodeSpecKey + defaultStorageSizeGi: 1 + vCpu: 0 + regionId: regionId + displayName: displayName + maxStorageSizeGi: 5 + defaultNodeCount: 2 + name: name + storageTypes: + - BASIC + - BASIC + memorySizeGi: 6 + properties: + name: + readOnly: true + title: "Format: regions/{region_id}/componentTypes/{component_type}/nodeSpecs/{node_spec_key}" + type: string + regionId: + readOnly: true + title: "Format: {cloud_provider}-{region_code}" + type: string + componentType: + allOf: + - $ref: '#/components/schemas/dedicatedv1beta1ComponentType' + type: object + nodeSpecKey: + readOnly: true + type: string + displayName: + readOnly: true + type: string + vCpu: + format: int32 + readOnly: true + type: integer + memorySizeGi: + format: int32 + readOnly: true + type: integer + defaultStorageSizeGi: + format: int32 + readOnly: true + type: integer + maxStorageSizeGi: + format: int32 + readOnly: true + type: integer + minStorageSizeGi: + format: int32 + readOnly: true + type: integer + defaultNodeCount: + format: int32 + readOnly: true + type: integer + storageTypes: + items: + $ref: '#/components/schemas/ClusterStorageNodeSettingStorageType' + readOnly: true + type: array + type: object + dedicatedv1beta1PauseClusterResponse: + example: + cluster: + tiflashNodeSetting: + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + storageSizeGi: 5 + storageType: BASIC + nodeCount: 1 + displayName: foo-bar + annotations: + key: annotations + updateTime: 2000-01-23T04:56:07.000+00:00 + clusterId: clusterId + version: version + labels: + key: labels + pausePlan: "{}" + regionDisplayName: regionDisplayName + tikvNodeSetting: + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + storageSizeGi: 5 + storageType: BASIC + nodeCount: 1 + regionId: regionId + port: 5 + createdBy: createdBy + createTime: 2000-01-23T04:56:07.000+00:00 + cloudProvider: "{}" + name: name + tidbNodeSetting: + tidbNodeGroups: + - isDefaultGroup: true + endpoints: + - port: 6 + host: host + connectionType: "{}" + - port: 6 + host: host + connectionType: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + displayName: displayName + tidbNodeGroupId: tidbNodeGroupId + name: name + nodeCount: 0 + clusterId: clusterId + state: "{}" + - isDefaultGroup: true + endpoints: + - port: 6 + host: host + connectionType: "{}" + - port: 6 + host: host + connectionType: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + displayName: displayName + tidbNodeGroupId: tidbNodeGroupId + name: name + nodeCount: 0 + clusterId: clusterId + state: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + state: "{}" + rootPassword: my-shining-password + properties: + cluster: + $ref: '#/components/schemas/tidb_cloud_open_apidedicatedv1beta1Cluster' + required: + - cluster + type: object + dedicatedv1beta1PrivateLinkService: + example: + regionDisplayName: regionDisplayName + serviceDnsName: serviceDnsName + availableZones: + - availableZones + - availableZones + regionId: regionId + tidbNodeGroupId: tidbNodeGroupId + cloudProvider: "{}" + name: name + state: "{}" + serviceName: serviceName + properties: + name: + readOnly: true + title: "Format: tidbNodeGroups/{tidb_node_group_id}/privateLinkService" + type: string + tidbNodeGroupId: + readOnly: true + type: string + serviceName: + description: |- + For AWS, it's the service name of the Private Link Service. + For GCP, it's the resource name of the service attachment. + For Azure, it's service resource ID of the Private Link Service. + readOnly: true + type: string + serviceDnsName: + description: |- + For AWS, it's the fully qualified domain name (FQDN) shared for all private endpoints, despite which VPC the endpoint located in. + For GCP, it's the zone name (suffix of FQDN) shared for all private endpoints located in a single VPC network. The format of FQDN is `.`. + For Azure, it's the zone name shared across public internet. The format of FQDN is `-.`. + readOnly: true + type: string + availableZones: + description: |- + Only available for AWS. + Same as the `AvailabilityZones` field in response body of + `github.com/aws/aws-sdk-go-v2/service/ec2.DescribeVpcEndpointServices` method. + items: + type: string + readOnly: true + type: array + state: + allOf: + - $ref: '#/components/schemas/v1beta1PrivateLinkServiceState' + type: object + regionId: + readOnly: true + title: "Format: {cloud_provider}-{region_code}" + type: string + regionDisplayName: + readOnly: true + type: string + cloudProvider: + allOf: + - $ref: '#/components/schemas/v1beta1RegionCloudProvider' + type: object + type: object + dedicatedv1beta1ResumeClusterResponse: + example: + cluster: + tiflashNodeSetting: + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + storageSizeGi: 5 + storageType: BASIC + nodeCount: 1 + displayName: foo-bar + annotations: + key: annotations + updateTime: 2000-01-23T04:56:07.000+00:00 + clusterId: clusterId + version: version + labels: + key: labels + pausePlan: "{}" + regionDisplayName: regionDisplayName + tikvNodeSetting: + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + storageSizeGi: 5 + storageType: BASIC + nodeCount: 1 + regionId: regionId + port: 5 + createdBy: createdBy + createTime: 2000-01-23T04:56:07.000+00:00 + cloudProvider: "{}" + name: name + tidbNodeSetting: + tidbNodeGroups: + - isDefaultGroup: true + endpoints: + - port: 6 + host: host + connectionType: "{}" + - port: 6 + host: host + connectionType: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + displayName: displayName + tidbNodeGroupId: tidbNodeGroupId + name: name + nodeCount: 0 + clusterId: clusterId + state: "{}" + - isDefaultGroup: true + endpoints: + - port: 6 + host: host + connectionType: "{}" + - port: 6 + host: host + connectionType: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + displayName: displayName + tidbNodeGroupId: tidbNodeGroupId + name: name + nodeCount: 0 + clusterId: clusterId + state: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + state: "{}" + rootPassword: my-shining-password + properties: + cluster: + $ref: '#/components/schemas/tidb_cloud_open_apidedicatedv1beta1Cluster' + required: + - cluster + type: object + dedicatedv1beta1TidbNodeGroup: + example: + isDefaultGroup: true + endpoints: + - port: 6 + host: host + connectionType: "{}" + - port: 6 + host: host + connectionType: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + displayName: displayName + tidbNodeGroupId: tidbNodeGroupId + name: name + nodeCount: 0 + clusterId: clusterId + state: "{}" + properties: + name: + readOnly: true + title: "Format: tidbNodeGroups/{tidb_node_group_id}" + type: string + tidbNodeGroupId: + description: The unique ID of the TiDB group. + readOnly: true + type: string + clusterId: + description: |- + The cluster ID of the TiDB group. + Optional when creating cluster with the default TiDB group. + Required when creating non-default TiDB group. + type: string + displayName: + description: The display name of the TiDB group. + type: string + nodeCount: + description: The number of TiDB nodes in the TiDB group. + format: int32 + type: integer + endpoints: + items: + $ref: '#/components/schemas/dedicatedv1beta1TidbNodeGroupEndpoint' + readOnly: true + type: array + nodeSpecKey: + readOnly: true + type: string + nodeSpecDisplayName: + readOnly: true + type: string + isDefaultGroup: + readOnly: true + type: boolean + state: + allOf: + - $ref: '#/components/schemas/dedicatedv1beta1TidbNodeGroupState' + type: object + nodeChangingProgress: + allOf: + - $ref: '#/components/schemas/ClusterNodeChangingProgress' + type: object + required: + - nodeCount + type: object + dedicatedv1beta1TidbNodeGroupEndpoint: + example: + port: 6 + host: host + connectionType: "{}" + properties: + host: + description: |- + When endpoint's type is `PRIVATE_ENDPOINT`, the `host` field behave differently across cloud providers: + For AWS clusters, the `host` field is available right after the private link service is ready. + For GCP and Azure clusters, the `host` field is available after the user creates a `PrivateEndpointConnection`. + readOnly: true + type: string + port: + format: int32 + readOnly: true + type: integer + connectionType: + allOf: + - $ref: '#/components/schemas/EndpointConnectionType' + type: object + type: object + dedicatedv1beta1TidbNodeGroupState: + description: |2- + - ACTIVE: All nodes are ready. + - MODIFYING: When TiDB group is modifying. + - PAUSED: When cluster is paused. + enum: + - ACTIVE + - MODIFYING + - PAUSED + type: string + dedicatedv1beta1VpcPeering: + example: + tidbCloudVpcCidr: tidbCloudVpcCidr + labels: + key: labels + customerVpcCidr: customerVpcCidr + customerRegionId: customerRegionId + customerAccountId: customerAccountId + tidbCloudVpcId: tidbCloudVpcId + name: name + vpcPeeringId: vpcPeeringId + state: "{}" + customerVpcId: customerVpcId + tidbCloudCloudProvider: "{}" + tidbCloudAccountId: tidbCloudAccountId + awsVpcPeeringConnectionId: awsVpcPeeringConnectionId + tidbCloudRegionId: tidbCloudRegionId + properties: + name: + readOnly: true + title: "Format: vpcPeerings/{vpc_peering_id}" + type: string + vpcPeeringId: + readOnly: true + title: "Format {cloud_provider}-{random_suffix}" + type: string + labels: + additionalProperties: + type: string + description: The labels of the vpc peering. It always contains the `project_id` + label. + readOnly: true + type: object + tidbCloudRegionId: + title: "Format: {cloud_provider}-{region_code}" + type: string + customerRegionId: + description: |- + Format: {cloud_provider}-{region_code} + For AWS, it's required. + For GCP, it's optional. Since GCP does not require region_id when creating VPC peering. + type: string + customerAccountId: + description: |- + In AWS, it is the account ID. + In GCP, it is the project name. + type: string + customerVpcId: + description: |- + In AWS, it is the VPC ID. + In GCP, it is the network name. + type: string + customerVpcCidr: + type: string + tidbCloudCloudProvider: + allOf: + - $ref: '#/components/schemas/v1beta1RegionCloudProvider' + type: object + tidbCloudAccountId: + description: |- + In AWS, it is the account ID. + In GCP, it is the project name. + readOnly: true + type: string + tidbCloudVpcId: + description: |- + In AWS, it is the VPC ID. + In GCP, it is the network name. + readOnly: true + type: string + tidbCloudVpcCidr: + readOnly: true + type: string + state: + allOf: + - $ref: '#/components/schemas/dedicatedv1beta1VpcPeeringState' + type: object + awsVpcPeeringConnectionId: + description: Only for AWS vpc peerings. + nullable: true + readOnly: true + type: string + required: + - customerAccountId + - customerVpcCidr + - customerVpcId + - tidbCloudRegionId + type: object + dedicatedv1beta1VpcPeeringState: + enum: + - PENDING + - FAILED + - ACTIVE + type: string + googlerpcStatus: + description: |- + The `Status` type defines a logical error model that is suitable for + different programming environments, including REST APIs and RPC APIs. It is + used by [gRPC](https://github.com/grpc). Each `Status` message contains + three pieces of data: error code, error message, and error details. + + You can find out more about this error model and how to work with it in the + [API Design Guide](https://cloud.google.com/apis/design/errors). + example: + code: 7 + details: + - '@type': '@type' + - '@type': '@type' + message: message + properties: + code: + description: |- + The status code, which should be an enum value of + [google.rpc.Code][google.rpc.Code]. + format: int32 + type: integer + message: + description: |- + A developer-facing error message, which should be in English. Any + user-facing error message should be localized and sent in the + [google.rpc.Status.details][google.rpc.Status.details] field, or localized + by the client. + type: string + details: + description: |- + A list of messages that carry the error details. There is a common set of + message types for APIs to use. + items: + $ref: '#/components/schemas/protobufAny' + type: array + type: object + protobufAny: + additionalProperties: + type: object + description: |- + `Any` contains an arbitrary serialized protocol buffer message along with a + URL that describes the type of the serialized message. + + Protobuf library provides support to pack/unpack Any values in the form + of utility functions or additional generated methods of the Any type. + + Example 1: Pack and unpack a message in C++. + + Foo foo = ...; + Any any; + any.PackFrom(foo); + ... + if (any.UnpackTo(&foo)) { + ... + } + + Example 2: Pack and unpack a message in Java. + + Foo foo = ...; + Any any = Any.pack(foo); + ... + if (any.is(Foo.class)) { + foo = any.unpack(Foo.class); + } + // or ... + if (any.isSameTypeAs(Foo.getDefaultInstance())) { + foo = any.unpack(Foo.getDefaultInstance()); + } + + Example 3: Pack and unpack a message in Python. + + foo = Foo(...) + any = Any() + any.Pack(foo) + ... + if any.Is(Foo.DESCRIPTOR): + any.Unpack(foo) + ... + + Example 4: Pack and unpack a message in Go + + foo := &pb.Foo{...} + any, err := anypb.New(foo) + if err != nil { + ... + } + ... + foo := &pb.Foo{} + if err := any.UnmarshalTo(foo); err != nil { + ... + } + + The pack methods provided by protobuf library will by default use + 'type.googleapis.com/full.type.name' as the type URL and the unpack + methods only use the fully qualified type name after the last '/' + in the type URL, for example "foo.bar.com/x/y.z" will yield type + name "y.z". + + JSON + ==== + The JSON representation of an `Any` value uses the regular + representation of the deserialized, embedded message, with an + additional field `@type` which contains the type URL. Example: + + package google.profile; + message Person { + string first_name = 1; + string last_name = 2; + } + + { + "@type": "type.googleapis.com/google.profile.Person", + "firstName": , + "lastName": + } + + If the embedded message type is well-known and has a custom JSON + representation, that representation will be embedded adding a field + `value` which holds the custom JSON in addition to the `@type` + field. Example (for message [google.protobuf.Duration][]): + + { + "@type": "type.googleapis.com/google.protobuf.Duration", + "value": "1.212s" + } + example: + '@type': '@type' + properties: + '@type': + description: |- + A URL/resource name that uniquely identifies the type of the serialized + protocol buffer message. This string must contain at least + one "/" character. The last segment of the URL's path must represent + the fully qualified name of the type (as in + `path/google.protobuf.Duration`). The name should be in a canonical form + (e.g., leading "." is not accepted). + + In practice, teams usually precompile into the binary all types that they + expect it to use in the context of Any. However, for URLs which use the + scheme `http`, `https`, or no scheme, one can optionally set up a type + server that maps type URLs to message definitions as follows: + + * If no scheme is provided, `https` is assumed. + * An HTTP GET on the URL must yield a [google.protobuf.Type][] + value in binary format, or produce an error. + * Applications are allowed to cache lookup results based on the + URL, or have them precompiled into a binary to avoid any + lookup. Therefore, binary compatibility needs to be preserved + on changes to types. (Use versioned type names to manage + breaking changes.) + + Note: this functionality is not currently available in the official + protobuf release, and it is not used for type URLs beginning with + type.googleapis.com. As of May 2023, there are no widely used type server + implementations and no plans to implement one. + + Schemes other than `http`, `https` (or the empty scheme) might be + used with implementation specific semantics. + type: string + type: object + tidb_cloud_open_apidedicatedv1beta1Cluster: + description: Cluster represents a dedicated TiDB cluster. + example: + tiflashNodeSetting: + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + storageSizeGi: 5 + storageType: BASIC + nodeCount: 1 + displayName: foo-bar + annotations: + key: annotations + updateTime: 2000-01-23T04:56:07.000+00:00 + clusterId: clusterId + version: version + labels: + key: labels + pausePlan: "{}" + regionDisplayName: regionDisplayName + tikvNodeSetting: + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + storageSizeGi: 5 + storageType: BASIC + nodeCount: 1 + regionId: regionId + port: 5 + createdBy: createdBy + createTime: 2000-01-23T04:56:07.000+00:00 + cloudProvider: "{}" + name: name + tidbNodeSetting: + tidbNodeGroups: + - isDefaultGroup: true + endpoints: + - port: 6 + host: host + connectionType: "{}" + - port: 6 + host: host + connectionType: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + displayName: displayName + tidbNodeGroupId: tidbNodeGroupId + name: name + nodeCount: 0 + clusterId: clusterId + state: "{}" + - isDefaultGroup: true + endpoints: + - port: 6 + host: host + connectionType: "{}" + - port: 6 + host: host + connectionType: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + displayName: displayName + tidbNodeGroupId: tidbNodeGroupId + name: name + nodeCount: 0 + clusterId: clusterId + state: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + state: "{}" + rootPassword: my-shining-password + properties: + name: + readOnly: true + title: |- + The name of TiDB cluster resource. + Format: clusters/{cluster_id} + type: string + clusterId: + description: The unique ID of the cluster. + readOnly: true + type: string + displayName: + description: The display name of the cluster. + example: foo-bar + maxLength: 64 + minLength: 4 + pattern: "^[A-Za-z0-9][-A-Za-z0-9]{2,62}[A-Za-z0-9]$" + type: string + regionId: + title: |- + Required. Region where the cluster will be created. + Format: {cloud_provider}-{region_code} + type: string + labels: + additionalProperties: + type: string + description: |- + The labels of the cluster. + If there is no "project_id" in labels, resource should be in the default project of the creator's organization. + type: object + tidbNodeSetting: + $ref: '#/components/schemas/v1beta1ClusterTidbNodeSetting' + tikvNodeSetting: + $ref: '#/components/schemas/v1beta1ClusterStorageNodeSetting' + tiflashNodeSetting: + $ref: '#/components/schemas/v1beta1ClusterStorageNodeSetting' + port: + description: The port of the cluster. This port applies to all network endpoints + of the cluster. + format: int32 + type: integer + rootPassword: + example: my-shining-password + maxLength: 64 + minLength: 8 + pattern: "^.{8,64}$" + type: string + state: + allOf: + - $ref: '#/components/schemas/commonv1beta1ClusterState' + description: The current state of the cluster. + type: object + version: + description: The TiDB version of the cluster. + readOnly: true + type: string + createdBy: + description: The email address or public api key of the creator of the cluster. + readOnly: true + type: string + createTime: + description: Timestamp when the cluster was created. + format: date-time + readOnly: true + type: string + updateTime: + description: Timestamp when the cluster was last updated. + format: date-time + readOnly: true + type: string + pausePlan: + allOf: + - $ref: '#/components/schemas/dedicatedv1beta1ClusterPausePlan' + description: Pause plan of the cluster. + type: object + regionDisplayName: + readOnly: true + type: string + cloudProvider: + allOf: + - $ref: '#/components/schemas/v1beta1RegionCloudProvider' + type: object + annotations: + additionalProperties: + type: string + description: |- + 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. + readOnly: true + type: object + required: + - displayName + - port + - regionId + - tidbNodeSetting + - tikvNodeSetting + type: object + tidb_cloud_open_apidedicatedv1beta1ListClustersResponse: + example: + totalSize: 2 + nextPageToken: nextPageToken + clusters: + - tiflashNodeSetting: + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + storageSizeGi: 5 + storageType: BASIC + nodeCount: 1 + displayName: foo-bar + annotations: + key: annotations + updateTime: 2000-01-23T04:56:07.000+00:00 + clusterId: clusterId + version: version + labels: + key: labels + pausePlan: "{}" + regionDisplayName: regionDisplayName + tikvNodeSetting: + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + storageSizeGi: 5 + storageType: BASIC + nodeCount: 1 + regionId: regionId + port: 5 + createdBy: createdBy + createTime: 2000-01-23T04:56:07.000+00:00 + cloudProvider: "{}" + name: name + tidbNodeSetting: + tidbNodeGroups: + - isDefaultGroup: true + endpoints: + - port: 6 + host: host + connectionType: "{}" + - port: 6 + host: host + connectionType: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + displayName: displayName + tidbNodeGroupId: tidbNodeGroupId + name: name + nodeCount: 0 + clusterId: clusterId + state: "{}" + - isDefaultGroup: true + endpoints: + - port: 6 + host: host + connectionType: "{}" + - port: 6 + host: host + connectionType: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + displayName: displayName + tidbNodeGroupId: tidbNodeGroupId + name: name + nodeCount: 0 + clusterId: clusterId + state: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + state: "{}" + rootPassword: my-shining-password + - tiflashNodeSetting: + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + storageSizeGi: 5 + storageType: BASIC + nodeCount: 1 + displayName: foo-bar + annotations: + key: annotations + updateTime: 2000-01-23T04:56:07.000+00:00 + clusterId: clusterId + version: version + labels: + key: labels + pausePlan: "{}" + regionDisplayName: regionDisplayName + tikvNodeSetting: + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + storageSizeGi: 5 + storageType: BASIC + nodeCount: 1 + regionId: regionId + port: 5 + createdBy: createdBy + createTime: 2000-01-23T04:56:07.000+00:00 + cloudProvider: "{}" + name: name + tidbNodeSetting: + tidbNodeGroups: + - isDefaultGroup: true + endpoints: + - port: 6 + host: host + connectionType: "{}" + - port: 6 + host: host + connectionType: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + displayName: displayName + tidbNodeGroupId: tidbNodeGroupId + name: name + nodeCount: 0 + clusterId: clusterId + state: "{}" + - isDefaultGroup: true + endpoints: + - port: 6 + host: host + connectionType: "{}" + - port: 6 + host: host + connectionType: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + displayName: displayName + tidbNodeGroupId: tidbNodeGroupId + name: name + nodeCount: 0 + clusterId: clusterId + state: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + state: "{}" + rootPassword: my-shining-password + properties: + clusters: + items: + $ref: '#/components/schemas/tidb_cloud_open_apidedicatedv1beta1Cluster' + type: array + totalSize: + description: The total number of clusters that matched the query. + format: int32 + type: integer + nextPageToken: + description: |- + A token, which can be sent as `page_token` to retrieve the next page. + If this field is omitted, there are no subsequent pages. + type: string + type: object + tidb_cloud_open_apidedicatedv1beta1ListRegionsResponse: + example: + regions: + - regionId: regionId + provider: provider + displayName: displayName + cloudProvider: "{}" + name: regions/aws-us-west-2 + - regionId: regionId + provider: provider + displayName: displayName + cloudProvider: "{}" + name: regions/aws-us-west-2 + totalSize: 0 + nextPageToken: nextPageToken + properties: + regions: + items: + $ref: '#/components/schemas/commonv1beta1Region' + type: array + totalSize: + description: The total number of regions that matched the query. + format: int32 + type: integer + nextPageToken: + description: |- + A token, which can be sent as `page_token` to retrieve the next page. + If this field is omitted, there are no subsequent pages. + type: string + type: object + v1beta1AuditLogFilterRule: + example: + tableExpr: tableExpr + userExpr: userExpr + name: name + accessTypeList: + - accessTypeList + - accessTypeList + dbExpr: dbExpr + auditLogFilterRuleId: auditLogFilterRuleId + clusterId: clusterId + properties: + name: + readOnly: true + title: "Format: auditLogFilterRules/{audit_log_filter_rule_id}" + type: string + auditLogFilterRuleId: + readOnly: true + type: string + clusterId: + type: string + userExpr: + type: string + dbExpr: + type: string + tableExpr: + type: string + accessTypeList: + items: + type: string + type: array + required: + - clusterId + type: object + v1beta1ClusterStorageNodeSetting: + example: + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + storageSizeGi: 5 + storageType: BASIC + nodeCount: 1 + properties: + nodeCount: + format: int32 + type: integer + nodeSpecKey: + type: string + storageSizeGi: + format: int32 + type: integer + storageType: + $ref: '#/components/schemas/ClusterStorageNodeSettingStorageType' + nodeSpecDisplayName: + readOnly: true + title: output only + type: string + nodeChangingProgress: + allOf: + - $ref: '#/components/schemas/ClusterNodeChangingProgress' + type: object + required: + - nodeCount + - nodeSpecKey + - storageSizeGi + - storageType + type: object + v1beta1ClusterTidbNodeSetting: + example: + tidbNodeGroups: + - isDefaultGroup: true + endpoints: + - port: 6 + host: host + connectionType: "{}" + - port: 6 + host: host + connectionType: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + displayName: displayName + tidbNodeGroupId: tidbNodeGroupId + name: name + nodeCount: 0 + clusterId: clusterId + state: "{}" + - isDefaultGroup: true + endpoints: + - port: 6 + host: host + connectionType: "{}" + - port: 6 + host: host + connectionType: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + nodeChangingProgress: "{}" + displayName: displayName + tidbNodeGroupId: tidbNodeGroupId + name: name + nodeCount: 0 + clusterId: clusterId + state: "{}" + nodeSpecKey: nodeSpecKey + nodeSpecDisplayName: nodeSpecDisplayName + properties: + nodeSpecKey: + type: string + tidbNodeGroups: + description: |- + When creating a cluster, the length of the `tidb_node_groups` should be 1 + and the `node_count` field of `TidbNodeGroup` should be set. + items: + $ref: '#/components/schemas/dedicatedv1beta1TidbNodeGroup' + type: array + nodeSpecDisplayName: + readOnly: true + type: string + required: + - nodeSpecKey + - tidbNodeGroups + type: object + v1beta1DeferMaintenanceTaskResponse: + type: object + v1beta1ListAuditLogFilterRulesResponse: + example: + totalSize: 0 + nextPageToken: nextPageToken + auditLogFilterRules: + - tableExpr: tableExpr + userExpr: userExpr + name: name + accessTypeList: + - accessTypeList + - accessTypeList + dbExpr: dbExpr + auditLogFilterRuleId: auditLogFilterRuleId + clusterId: clusterId + - tableExpr: tableExpr + userExpr: userExpr + name: name + accessTypeList: + - accessTypeList + - accessTypeList + dbExpr: dbExpr + auditLogFilterRuleId: auditLogFilterRuleId + clusterId: clusterId + properties: + auditLogFilterRules: + items: + $ref: '#/components/schemas/v1beta1AuditLogFilterRule' + type: array + totalSize: + format: int32 + type: integer + nextPageToken: + type: string + type: object + v1beta1ListMaintenanceTasksResponse: + example: + maintenanceTasks: + - maintenanceTaskId: maintenanceTaskId + createTime: 2000-01-23T04:56:07.000+00:00 + name: name + description: description + scheduledApplyTime: 2000-01-23T04:56:07.000+00:00 + state: "{}" + deadline: 2000-01-23T04:56:07.000+00:00 + projectId: projectId + - maintenanceTaskId: maintenanceTaskId + createTime: 2000-01-23T04:56:07.000+00:00 + name: name + description: description + scheduledApplyTime: 2000-01-23T04:56:07.000+00:00 + state: "{}" + deadline: 2000-01-23T04:56:07.000+00:00 + projectId: projectId + totalSize: 0 + nextPageToken: nextPageToken + properties: + maintenanceTasks: + items: + $ref: '#/components/schemas/v1beta1MaintenanceTask' + type: array + totalSize: + description: The total number of maintenance tasks that matched the query. + format: int32 + type: integer + nextPageToken: + description: |- + A token, which can be sent as `page_token` to retrieve the next page. + If this field is omitted, there are no subsequent pages. + type: string + type: object + v1beta1ListMaintenanceWindowsResponse: + example: + totalSize: 0 + nextPageToken: nextPageToken + maintenanceWindows: + - dayHour: 6 + maintenanceWindowId: maintenanceWindowId + unchangedMaintenanceTasks: + - maintenanceTaskId: maintenanceTaskId + createTime: 2000-01-23T04:56:07.000+00:00 + name: name + description: description + scheduledApplyTime: 2000-01-23T04:56:07.000+00:00 + state: "{}" + deadline: 2000-01-23T04:56:07.000+00:00 + projectId: projectId + - maintenanceTaskId: maintenanceTaskId + createTime: 2000-01-23T04:56:07.000+00:00 + name: name + description: description + scheduledApplyTime: 2000-01-23T04:56:07.000+00:00 + state: "{}" + deadline: 2000-01-23T04:56:07.000+00:00 + projectId: projectId + weekDay: 0 + nextMaintenanceDate: 2000-01-23T04:56:07.000+00:00 + name: name + hourMinute: 1 + projectId: projectId + - dayHour: 6 + maintenanceWindowId: maintenanceWindowId + unchangedMaintenanceTasks: + - maintenanceTaskId: maintenanceTaskId + createTime: 2000-01-23T04:56:07.000+00:00 + name: name + description: description + scheduledApplyTime: 2000-01-23T04:56:07.000+00:00 + state: "{}" + deadline: 2000-01-23T04:56:07.000+00:00 + projectId: projectId + - maintenanceTaskId: maintenanceTaskId + createTime: 2000-01-23T04:56:07.000+00:00 + name: name + description: description + scheduledApplyTime: 2000-01-23T04:56:07.000+00:00 + state: "{}" + deadline: 2000-01-23T04:56:07.000+00:00 + projectId: projectId + weekDay: 0 + nextMaintenanceDate: 2000-01-23T04:56:07.000+00:00 + name: name + hourMinute: 1 + projectId: projectId + properties: + maintenanceWindows: + items: + $ref: '#/components/schemas/dedicatedv1beta1MaintenanceWindow' + type: array + totalSize: + description: The total number of maintenance windows that matched the query. + format: int32 + type: integer + nextPageToken: + description: |- + A token, which can be sent as `page_token` to retrieve the next page. + If this field is omitted, there are no subsequent pages. + type: string + type: object + v1beta1ListNetworkContainersResponse: + example: + totalSize: 0 + nextPageToken: nextPageToken + networkContainers: + - regionDisplayName: regionDisplayName + regionId: regionId + cloudProvider: "{}" + vpcId: vpcId + name: name + networkContainerId: networkContainerId + cidrNotion: cidrNotion + state: "{}" + labels: + key: labels + - regionDisplayName: regionDisplayName + regionId: regionId + cloudProvider: "{}" + vpcId: vpcId + name: name + networkContainerId: networkContainerId + cidrNotion: cidrNotion + state: "{}" + labels: + key: labels + properties: + networkContainers: + items: + $ref: '#/components/schemas/v1beta1NetworkContainer' + type: array + totalSize: + description: The total number of network containers that matched the query. + format: int32 + type: integer + nextPageToken: + description: |- + A token, which can be sent as `page_token` to retrieve the next page. + If this field is omitted, there are no subsequent pages. + type: string + type: object + v1beta1ListNodeInstancesResponse: + example: + totalSize: 5 + nextPageToken: nextPageToken + nodeInstances: + - componentType: "{}" + instanceId: instanceId + vCpu: 0 + storageSizeGi: 1 + tidbNodeGroupId: tidbNodeGroupId + name: name + clusterId: clusterId + state: "{}" + availabilityZone: availabilityZone + isDefaultTidbNodeGroup: true + memorySizeGi: 6 + tidbNodeGroupDisplayName: tidbNodeGroupDisplayName + - componentType: "{}" + instanceId: instanceId + vCpu: 0 + storageSizeGi: 1 + tidbNodeGroupId: tidbNodeGroupId + name: name + clusterId: clusterId + state: "{}" + availabilityZone: availabilityZone + isDefaultTidbNodeGroup: true + memorySizeGi: 6 + tidbNodeGroupDisplayName: tidbNodeGroupDisplayName + properties: + nodeInstances: + items: + $ref: '#/components/schemas/v1beta1NodeInstance' + type: array + totalSize: + description: The total number of node instances that matched the query. + format: int32 + type: integer + nextPageToken: + description: |- + A token, which can be sent as `page_token` to retrieve the next page. + If this field is omitted, there are no subsequent pages. + type: string + type: object + v1beta1ListNodeSpecsResponse: + example: + totalSize: 7 + nextPageToken: nextPageToken + nodeSpecs: + - componentType: "{}" + minStorageSizeGi: 5 + nodeSpecKey: nodeSpecKey + defaultStorageSizeGi: 1 + vCpu: 0 + regionId: regionId + displayName: displayName + maxStorageSizeGi: 5 + defaultNodeCount: 2 + name: name + storageTypes: + - BASIC + - BASIC + memorySizeGi: 6 + - componentType: "{}" + minStorageSizeGi: 5 + nodeSpecKey: nodeSpecKey + defaultStorageSizeGi: 1 + vCpu: 0 + regionId: regionId + displayName: displayName + maxStorageSizeGi: 5 + defaultNodeCount: 2 + name: name + storageTypes: + - BASIC + - BASIC + memorySizeGi: 6 + properties: + nodeSpecs: + items: + $ref: '#/components/schemas/dedicatedv1beta1NodeSpec' + type: array + totalSize: + description: The total number of node specs that matched the query. + format: int32 + type: integer + nextPageToken: + description: |- + A token, which can be sent as `page_token` to retrieve the next page. + If this field is omitted, there are no subsequent pages. + type: string + type: object + v1beta1ListPrivateEndpointConnectionsResponse: + example: + privateEndpointConnections: + - privateLinkServiceState: "{}" + clusterDisplayName: clusterDisplayName + endpointId: endpointId + tidbNodeGroupId: tidbNodeGroupId + privateEndpointConnectionId: privateEndpointConnectionId + clusterId: clusterId + privateIpAddress: privateIpAddress + labels: + key: labels + tidbNodeGroupDisplayName: tidbNodeGroupDisplayName + endpointState: "{}" + privateLinkServiceName: privateLinkServiceName + accountId: accountId + regionDisplayName: regionDisplayName + regionId: regionId + port: 0 + cloudProvider: "{}" + name: name + host: host + massage: massage + - privateLinkServiceState: "{}" + clusterDisplayName: clusterDisplayName + endpointId: endpointId + tidbNodeGroupId: tidbNodeGroupId + privateEndpointConnectionId: privateEndpointConnectionId + clusterId: clusterId + privateIpAddress: privateIpAddress + labels: + key: labels + tidbNodeGroupDisplayName: tidbNodeGroupDisplayName + endpointState: "{}" + privateLinkServiceName: privateLinkServiceName + accountId: accountId + regionDisplayName: regionDisplayName + regionId: regionId + port: 0 + cloudProvider: "{}" + name: name + host: host + massage: massage + totalSize: 0 + nextPageToken: nextPageToken + properties: + privateEndpointConnections: + items: + $ref: '#/components/schemas/v1beta1PrivateEndpointConnection' + type: array + totalSize: + description: The total number of private link connections that matched the + query. + format: int32 + type: integer + nextPageToken: + description: |- + A token, which can be sent as `page_token` to retrieve the next page. + If this field is omitted, there are no subsequent pages. + type: string + type: object + v1beta1MaintenanceTask: + example: + maintenanceTaskId: maintenanceTaskId + createTime: 2000-01-23T04:56:07.000+00:00 + name: name + description: description + scheduledApplyTime: 2000-01-23T04:56:07.000+00:00 + state: "{}" + deadline: 2000-01-23T04:56:07.000+00:00 + projectId: projectId + properties: + name: + readOnly: true + title: "Format: maintenanceTasks/{maintenance_task_id}" + type: string + maintenanceTaskId: + readOnly: true + type: string + projectId: + readOnly: true + type: string + description: + readOnly: true + type: string + state: + allOf: + - $ref: '#/components/schemas/v1beta1MaintenanceTaskState' + type: object + createTime: + description: Timestamp when the task was created. + format: date-time + readOnly: true + type: string + scheduledApplyTime: + description: Timestamp when the task run. + format: date-time + readOnly: true + type: string + deadline: + description: Timestamp when the task will be expired. + format: date-time + readOnly: true + type: string + type: object + v1beta1MaintenanceTaskState: + enum: + - PENDING + - RUNNING + - DONE + type: string + v1beta1NetworkContainer: + example: + regionDisplayName: regionDisplayName + regionId: regionId + cloudProvider: "{}" + vpcId: vpcId + name: name + networkContainerId: networkContainerId + cidrNotion: cidrNotion + state: "{}" + labels: + key: labels + properties: + name: + readOnly: true + title: "Format: networkContainers/{network_container_id}" + type: string + networkContainerId: + readOnly: true + type: string + labels: + additionalProperties: + type: string + description: |- + The labels of the cluster. + If there is no "project_id" in labels, resource should be in the default project of the creator's organization. + type: object + regionId: + title: "Format: {cloud_provider}-{region_code}" + type: string + cidrNotion: + description: "If not set, the default cidr of the region will be used." + type: string + cloudProvider: + allOf: + - $ref: '#/components/schemas/v1beta1RegionCloudProvider' + type: object + state: + allOf: + - $ref: '#/components/schemas/v1beta1NetworkContainerState' + type: object + regionDisplayName: + readOnly: true + type: string + vpcId: + description: |- + For AWS, it is the vpc id. + For GCP, it is the network name. + For Azure, it is the vnet name. + readOnly: true + type: string + required: + - regionId + type: object + v1beta1NetworkContainerState: + enum: + - ACTIVE + - INACTIVE + type: string + v1beta1NodeInstance: + example: + componentType: "{}" + instanceId: instanceId + vCpu: 0 + storageSizeGi: 1 + tidbNodeGroupId: tidbNodeGroupId + name: name + clusterId: clusterId + state: "{}" + availabilityZone: availabilityZone + isDefaultTidbNodeGroup: true + memorySizeGi: 6 + tidbNodeGroupDisplayName: tidbNodeGroupDisplayName + properties: + name: + readOnly: true + title: "Format: clusters/{cluster_id}/nodeInstances/{instance_id}" + type: string + clusterId: + readOnly: true + type: string + instanceId: + readOnly: true + title: |- + Format for TiDB instances in the default TiDB group: tidb-{index} + Format for TiDB instances in non-default TiDB groups: {tidb_group_name}-tidb-{index} + Format for other instances: {component_type}-{index} + type: string + componentType: + allOf: + - $ref: '#/components/schemas/dedicatedv1beta1ComponentType' + type: object + state: + allOf: + - $ref: '#/components/schemas/v1beta1NodeInstanceState' + description: "the state of the instance, e.g. \"Available\"." + type: object + vCpu: + description: "the cpu size of the instance, e.g. 2." + format: int32 + readOnly: true + type: integer + memorySizeGi: + description: "the memory size of the instance, e.g. 8." + format: int32 + readOnly: true + type: integer + availabilityZone: + description: "the availability zone of the instance, e.g. \"us-west1-a\"\ + ." + readOnly: true + type: string + storageSizeGi: + description: "the storage size of the instance, e.g. 100." + format: int32 + readOnly: true + type: integer + tidbNodeGroupId: + nullable: true + readOnly: true + type: string + tidbNodeGroupDisplayName: + nullable: true + readOnly: true + type: string + isDefaultTidbNodeGroup: + nullable: true + readOnly: true + type: boolean + type: object + v1beta1NodeInstanceState: + enum: + - CREATING + - AVAILABLE + - DELETING + - UNAVAILABLE + type: string + v1beta1PrivateEndpointConnection: + example: + privateLinkServiceState: "{}" + clusterDisplayName: clusterDisplayName + endpointId: endpointId + tidbNodeGroupId: tidbNodeGroupId + privateEndpointConnectionId: privateEndpointConnectionId + clusterId: clusterId + privateIpAddress: privateIpAddress + labels: + key: labels + tidbNodeGroupDisplayName: tidbNodeGroupDisplayName + endpointState: "{}" + privateLinkServiceName: privateLinkServiceName + accountId: accountId + regionDisplayName: regionDisplayName + regionId: regionId + port: 0 + cloudProvider: "{}" + name: name + host: host + massage: massage + properties: + name: + readOnly: true + title: "Format: tidbNodeGroups/{tidb_node_group_id}/privateEndpointConnections/{private_endpoint_connection_id}" + type: string + tidbNodeGroupId: + type: string + privateEndpointConnectionId: + readOnly: true + type: string + clusterId: + readOnly: true + type: string + clusterDisplayName: + readOnly: true + type: string + labels: + additionalProperties: + type: string + description: The labels of private link connection. It always contains the + `project_id` label. + readOnly: true + type: object + endpointId: + description: |- + The endpoint ID of the private link connection. + For AWS, it's VPC endpoint ID. + For GCP, it's private service connect endpoint ID. + For Azure, it's private endpoint resource ID. + type: string + privateIpAddress: + description: |- + The private IP address of the private endpoint in the user's vNet. + TiDB Cloud will setup a public DNS record for this private IP address. So the user can use DNS address to connect to the cluster. + Only available for Azure clusters. + nullable: true + type: string + endpointState: + allOf: + - $ref: '#/components/schemas/PrivateEndpointConnectionEndpointState' + type: object + massage: + readOnly: true + type: string + regionId: + readOnly: true + title: "Format: {cloud_provider}-{region_code}" + type: string + regionDisplayName: + readOnly: true + type: string + cloudProvider: + allOf: + - $ref: '#/components/schemas/v1beta1RegionCloudProvider' + type: object + privateLinkServiceName: + readOnly: true + type: string + privateLinkServiceState: + allOf: + - $ref: '#/components/schemas/v1beta1PrivateLinkServiceState' + type: object + tidbNodeGroupDisplayName: + readOnly: true + type: string + accountId: + description: Only for GCP private service connections. It's GCP project + name. + nullable: true + readOnly: true + type: string + host: + readOnly: true + type: string + port: + format: int32 + readOnly: true + type: integer + required: + - endpointId + - tidbNodeGroupId + type: object + v1beta1PrivateLinkServiceState: + enum: + - CREATING + - ACTIVE + - DELETING + type: string + v1beta1PublicEndpointSetting: + example: + tidbNodeGroupId: tidbNodeGroupId + name: name + enabled: true + ipAccessList: + - description: description + cidrNotation: cidrNotation + - description: description + cidrNotation: cidrNotation + properties: + name: + readOnly: true + title: "Format: tidbNodeGroups/{tidb_node_group_id}/publicEndpointSetting" + type: string + tidbNodeGroupId: + description: "If set to \"-\", the default TiDB group will be used." + type: string + enabled: + nullable: true + type: boolean + ipAccessList: + items: + $ref: '#/components/schemas/PublicEndpointSettingIpAccessList' + type: array + required: + - tidbNodeGroupId + type: object + v1beta1RegionCloudProvider: + description: |- + Enum of cloud provider names. + + - aws: Amazon Web Services. + buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + - gcp: Google Cloud Platform. + buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + - azure: Microsoft Azure. + buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE + enum: + - aws + - gcp + - azure + type: string + v1beta1ResetRootPasswordResponse: + type: object + v1beta1ShowCloudProvidersResponse: + example: + cloudProviders: + - aws + - aws + properties: + cloudProviders: + items: + $ref: '#/components/schemas/v1beta1RegionCloudProvider' + type: array + type: object + v1beta1ShowNodeQuotaResponse: + example: + componentQuotas: + - componentType: TIKV + quota: 0 + - componentType: TIKV + quota: 0 + properties: + componentQuotas: + items: + $ref: '#/components/schemas/ShowNodeQuotaResponseComponentQuota' + type: array + type: object + v1beta1ShowObjectStorageAccessIamPrincipalResponse: + example: + iamPrincipal: iamPrincipal + properties: + iamPrincipal: + type: string + type: object + v1beta1UpdateAuditLogConfigRequestAuditLogConfig: + properties: + clusterId: + type: string + enabled: + nullable: true + type: boolean + bucketUri: + type: string + bucketRegionId: + title: "Format: {cloud_provider}-{region_code}" + type: string + awsRoleArn: + type: string + azureSasToken: + type: string + required: + - clusterId + type: object + v1beta1UpdateClusterRequestCluster: + properties: + clusterId: + type: string + tidbNodeSetting: + $ref: '#/components/schemas/v1beta1UpdateClusterRequestTidbNodeSetting' + tikvNodeSetting: + $ref: '#/components/schemas/v1beta1UpdateClusterRequestStorageNodeSetting' + tiflashNodeSetting: + $ref: '#/components/schemas/v1beta1UpdateClusterRequestStorageNodeSetting' + displayName: + type: string + labels: + additionalProperties: + type: string + description: "The project_id key cannot be updated. If the project_id key\ + \ is specified, it will be ignored." + type: object + required: + - clusterId + type: object + v1beta1UpdateClusterRequestStorageNodeSetting: + properties: + nodeSpecKey: + type: string + nodeCount: + description: |- + When update TiFlash node setting: + - If the node count is set to 0, the TiFlash node will be removed. + - If the node count is null, the TiFlash node count won't change. + For other components, if the node count is set to 0, server will ignore the node count. + format: int32 + nullable: true + type: integer + storageSizeGi: + format: int32 + type: integer + type: object + v1beta1UpdateClusterRequestTidbNodeSetting: + properties: + nodeSpecKey: + type: string + tidbNodeGroups: + items: + $ref: '#/components/schemas/UpdateClusterRequestTidbNodeSettingTidbNodeGroup' + type: array + type: object + v1beta1UpdateMaintenanceWindowRequestMaintenanceWindow: + properties: + maintenanceWindowId: + title: "Format: project-{project_id}" + type: string + weekDay: + format: int32 + type: integer + dayHour: + format: int32 + type: integer + hourMinute: + format: int32 + type: integer + required: + - maintenanceWindowId + type: object + v1beta1UpdateTidbNodeGroupRequestTidbNodeGroup: + properties: + clusterId: + type: string + tidbNodeGroupId: + type: string + displayName: + type: string + nodeCount: + format: int32 + nullable: true + type: integer + required: + - clusterId + - tidbNodeGroupId + type: object + ClusterService_ListClusters_clusterStates_parameter_inner: + enum: + - CREATING + - DELETING + - ACTIVE + - RESTORING + - MAINTENANCE + - DELETED + - INACTIVE + - UPGRADING + - IMPORTING + - MODIFYING + - PAUSING + - PAUSED + - RESUMING + type: string + ClusterService_UpdateCluster_request: + properties: + tidbNodeSetting: + $ref: '#/components/schemas/v1beta1UpdateClusterRequestTidbNodeSetting' + tikvNodeSetting: + $ref: '#/components/schemas/v1beta1UpdateClusterRequestStorageNodeSetting' + tiflashNodeSetting: + $ref: '#/components/schemas/v1beta1UpdateClusterRequestStorageNodeSetting' + displayName: + type: string + labels: + additionalProperties: + type: string + description: "The project_id key cannot be updated. If the project_id key\ + \ is specified, it will be ignored." + type: object + type: object + ClusterService_ListNodeInstances_componentType_parameter: + enum: + - TIKV + - TIDB + - TIFLASH + - PD + - TIPROXY + type: string + TidbNodeGroupService_CreateTidbNodeGroup_request: + properties: + name: + readOnly: true + title: "Format: tidbNodeGroups/{tidb_node_group_id}" + type: string + tidbNodeGroupId: + description: The unique ID of the TiDB group. + readOnly: true + type: string + displayName: + description: The display name of the TiDB group. + type: string + nodeCount: + description: The number of TiDB nodes in the TiDB group. + format: int32 + type: integer + endpoints: + items: + $ref: '#/components/schemas/dedicatedv1beta1TidbNodeGroupEndpoint' + readOnly: true + type: array + nodeSpecKey: + readOnly: true + type: string + nodeSpecDisplayName: + readOnly: true + type: string + isDefaultGroup: + readOnly: true + type: boolean + state: + allOf: + - $ref: '#/components/schemas/dedicatedv1beta1TidbNodeGroupState' + type: object + nodeChangingProgress: + allOf: + - $ref: '#/components/schemas/ClusterNodeChangingProgress' + type: object + required: + - nodeCount + type: object + TidbNodeGroupService_UpdateTidbNodeGroup_request: + properties: + displayName: + type: string + nodeCount: + format: int32 + nullable: true + type: integer + type: object + TidbNodeGroupService_UpdatePublicEndpointSetting_request: + properties: + name: + readOnly: true + title: "Format: tidbNodeGroups/{tidb_node_group_id}/publicEndpointSetting" + type: string + enabled: + nullable: true + type: boolean + ipAccessList: + items: + $ref: '#/components/schemas/PublicEndpointSettingIpAccessList' + type: array + type: object + PrivateEndpointConnectionService_CreatePrivateEndpointConnection_request: + properties: + name: + readOnly: true + title: "Format: tidbNodeGroups/{tidb_node_group_id}/privateEndpointConnections/{private_endpoint_connection_id}" + type: string + privateEndpointConnectionId: + readOnly: true + type: string + clusterId: + readOnly: true + type: string + clusterDisplayName: + readOnly: true + type: string + labels: + additionalProperties: + type: string + description: The labels of private link connection. It always contains the + `project_id` label. + readOnly: true + type: object + endpointId: + description: |- + The endpoint ID of the private link connection. + For AWS, it's VPC endpoint ID. + For GCP, it's private service connect endpoint ID. + For Azure, it's private endpoint resource ID. + type: string + privateIpAddress: + description: |- + The private IP address of the private endpoint in the user's vNet. + TiDB Cloud will setup a public DNS record for this private IP address. So the user can use DNS address to connect to the cluster. + Only available for Azure clusters. + nullable: true + type: string + endpointState: + allOf: + - $ref: '#/components/schemas/PrivateEndpointConnectionEndpointState' + type: object + massage: + readOnly: true + type: string + regionId: + readOnly: true + title: "Format: {cloud_provider}-{region_code}" + type: string + regionDisplayName: + readOnly: true + type: string + cloudProvider: + allOf: + - $ref: '#/components/schemas/v1beta1RegionCloudProvider' + type: object + privateLinkServiceName: + readOnly: true + type: string + privateLinkServiceState: + allOf: + - $ref: '#/components/schemas/v1beta1PrivateLinkServiceState' + type: object + tidbNodeGroupDisplayName: + readOnly: true + type: string + accountId: + description: Only for GCP private service connections. It's GCP project + name. + nullable: true + readOnly: true + type: string + host: + readOnly: true + type: string + port: + format: int32 + readOnly: true + type: integer + required: + - endpointId + type: object + PrivateEndpointConnectionService_ListPrivateEndpointConnections_cloudProvider_parameter: + enum: + - aws + - gcp + - azure + type: string + MaintenanceService_UpdateMaintenanceWindow_request: + properties: + weekDay: + format: int32 + type: integer + dayHour: + format: int32 + type: integer + hourMinute: + format: int32 + type: integer + type: object + DatabaseAuditLogService_CreateAuditLogConfig_request: + properties: + name: + readOnly: true + title: "Format: clusters/{cluster_id}/auditLogConfig" + type: string + enabled: + description: Default is false. + type: boolean + bucketUri: + type: string + bucketRegionId: + title: "Format: {cloud_provider}-{region_code}" + type: string + awsRoleArn: + type: string + azureSasToken: + type: string + bucketWriteCheck: + allOf: + - $ref: '#/components/schemas/AuditLogConfigBucketWriteCheck' + type: object + required: + - bucketUri + type: object + DatabaseAuditLogService_UpdateAuditLogConfig_request: + properties: + enabled: + nullable: true + type: boolean + bucketUri: + type: string + bucketRegionId: + title: "Format: {cloud_provider}-{region_code}" + type: string + awsRoleArn: + type: string + azureSasToken: + type: string + type: object + DatabaseAuditLogService_CreateAuditLogFilterRule_request: + properties: + name: + readOnly: true + title: "Format: auditLogFilterRules/{audit_log_filter_rule_id}" + type: string + auditLogFilterRuleId: + readOnly: true + type: string + userExpr: + type: string + dbExpr: + type: string + tableExpr: + type: string + accessTypeList: + items: + type: string + type: array + type: object + securitySchemes: + Bearer: + description: "Enter the token with the `Bearer: ` prefix, e.g. \"Bearer abcde12345\"\ + ." + in: header + name: Authorization + type: apiKey +x-original-swagger-version: "2.0" diff --git a/pkg/tidbcloud/v1beta1/dedicated/api_cluster_service.go b/pkg/tidbcloud/v1beta1/dedicated/api_cluster_service.go new file mode 100644 index 00000000..9af0cae7 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/api_cluster_service.go @@ -0,0 +1,2182 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "reflect" + "strings" +) + +// ClusterServiceAPIService ClusterServiceAPI service +type ClusterServiceAPIService service + +type ApiClusterServiceCreateClusterRequest struct { + ctx context.Context + ApiService *ClusterServiceAPIService + cluster *TidbCloudOpenApidedicatedv1beta1Cluster + validateOnly *bool +} + +func (r ApiClusterServiceCreateClusterRequest) Cluster(cluster TidbCloudOpenApidedicatedv1beta1Cluster) ApiClusterServiceCreateClusterRequest { + r.cluster = &cluster + return r +} + +// if validate_only is true, the request will be validated but not executed. +func (r ApiClusterServiceCreateClusterRequest) ValidateOnly(validateOnly bool) ApiClusterServiceCreateClusterRequest { + r.validateOnly = &validateOnly + return r +} + +func (r ApiClusterServiceCreateClusterRequest) Execute() (*TidbCloudOpenApidedicatedv1beta1Cluster, *http.Response, error) { + return r.ApiService.ClusterServiceCreateClusterExecute(r) +} + +/* +ClusterServiceCreateCluster Create a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiClusterServiceCreateClusterRequest +*/ +func (a *ClusterServiceAPIService) ClusterServiceCreateCluster(ctx context.Context) ApiClusterServiceCreateClusterRequest { + return ApiClusterServiceCreateClusterRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return TidbCloudOpenApidedicatedv1beta1Cluster +func (a *ClusterServiceAPIService) ClusterServiceCreateClusterExecute(r ApiClusterServiceCreateClusterRequest) (*TidbCloudOpenApidedicatedv1beta1Cluster, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TidbCloudOpenApidedicatedv1beta1Cluster + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ClusterServiceAPIService.ClusterServiceCreateCluster") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.cluster == nil { + return localVarReturnValue, nil, reportError("cluster is required and must be specified") + } + + if r.validateOnly != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "validateOnly", r.validateOnly, "", "") + } + // 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.cluster + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiClusterServiceDeleteClusterRequest struct { + ctx context.Context + ApiService *ClusterServiceAPIService + clusterId string + validateOnly *bool +} + +// if validate_only is true, the request will be validated but not executed. +func (r ApiClusterServiceDeleteClusterRequest) ValidateOnly(validateOnly bool) ApiClusterServiceDeleteClusterRequest { + r.validateOnly = &validateOnly + return r +} + +func (r ApiClusterServiceDeleteClusterRequest) Execute() (*TidbCloudOpenApidedicatedv1beta1Cluster, *http.Response, error) { + return r.ApiService.ClusterServiceDeleteClusterExecute(r) +} + +/* +ClusterServiceDeleteCluster Delete a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @return ApiClusterServiceDeleteClusterRequest +*/ +func (a *ClusterServiceAPIService) ClusterServiceDeleteCluster(ctx context.Context, clusterId string) ApiClusterServiceDeleteClusterRequest { + return ApiClusterServiceDeleteClusterRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +// Execute executes the request +// +// @return TidbCloudOpenApidedicatedv1beta1Cluster +func (a *ClusterServiceAPIService) ClusterServiceDeleteClusterExecute(r ApiClusterServiceDeleteClusterRequest) (*TidbCloudOpenApidedicatedv1beta1Cluster, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TidbCloudOpenApidedicatedv1beta1Cluster + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ClusterServiceAPIService.ClusterServiceDeleteCluster") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.validateOnly != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "validateOnly", r.validateOnly, "", "") + } + // 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiClusterServiceGetClusterRequest struct { + ctx context.Context + ApiService *ClusterServiceAPIService + clusterId string +} + +func (r ApiClusterServiceGetClusterRequest) Execute() (*TidbCloudOpenApidedicatedv1beta1Cluster, *http.Response, error) { + return r.ApiService.ClusterServiceGetClusterExecute(r) +} + +/* +ClusterServiceGetCluster Get a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @return ApiClusterServiceGetClusterRequest +*/ +func (a *ClusterServiceAPIService) ClusterServiceGetCluster(ctx context.Context, clusterId string) ApiClusterServiceGetClusterRequest { + return ApiClusterServiceGetClusterRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +// Execute executes the request +// +// @return TidbCloudOpenApidedicatedv1beta1Cluster +func (a *ClusterServiceAPIService) ClusterServiceGetClusterExecute(r ApiClusterServiceGetClusterRequest) (*TidbCloudOpenApidedicatedv1beta1Cluster, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TidbCloudOpenApidedicatedv1beta1Cluster + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ClusterServiceAPIService.ClusterServiceGetCluster") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiClusterServiceGetNodeInstanceRequest struct { + ctx context.Context + ApiService *ClusterServiceAPIService + clusterId string + instanceId string +} + +func (r ApiClusterServiceGetNodeInstanceRequest) Execute() (*V1beta1NodeInstance, *http.Response, error) { + return r.ApiService.ClusterServiceGetNodeInstanceExecute(r) +} + +/* +ClusterServiceGetNodeInstance Get a node instance + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @param instanceId + @return ApiClusterServiceGetNodeInstanceRequest +*/ +func (a *ClusterServiceAPIService) ClusterServiceGetNodeInstance(ctx context.Context, clusterId string, instanceId string) ApiClusterServiceGetNodeInstanceRequest { + return ApiClusterServiceGetNodeInstanceRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + instanceId: instanceId, + } +} + +// Execute executes the request +// +// @return V1beta1NodeInstance +func (a *ClusterServiceAPIService) ClusterServiceGetNodeInstanceExecute(r ApiClusterServiceGetNodeInstanceRequest) (*V1beta1NodeInstance, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1NodeInstance + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ClusterServiceAPIService.ClusterServiceGetNodeInstance") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/nodeInstances/{instanceId}" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"instanceId"+"}", url.PathEscape(parameterValueToString(r.instanceId, "instanceId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiClusterServiceListClustersRequest struct { + ctx context.Context + ApiService *ClusterServiceAPIService + projectId *string + clusterIds *[]string + regionIds *[]string + clusterStates *[]ClusterServiceListClustersClusterStatesParameterInner + pageSize *int32 + pageToken *string + skip *int32 +} + +// If unspecified, the project ID of default project is used. +func (r ApiClusterServiceListClustersRequest) ProjectId(projectId string) ApiClusterServiceListClustersRequest { + r.projectId = &projectId + return r +} + +// If specified, only clusters in the specified cluster_ids will be returned. +func (r ApiClusterServiceListClustersRequest) ClusterIds(clusterIds []string) ApiClusterServiceListClustersRequest { + r.clusterIds = &clusterIds + return r +} + +// If specified, only clusters in the specified regions will be returned. +func (r ApiClusterServiceListClustersRequest) RegionIds(regionIds []string) ApiClusterServiceListClustersRequest { + r.regionIds = ®ionIds + return r +} + +// If specified, only clusters in the specified states will be returned. - CREATING: Cluster is being created. - DELETING: Cluster is being deleted. - ACTIVE: Cluster is active for use. - RESTORING: Cluster data is being restored. - MAINTENANCE: Cluster is under maintenance. - DELETED: Cluster has been deleted. - INACTIVE: Cluster is not active, but not being deleted. - UPGRADING: Cluster is being updated. Only for Dedicated Cluster. - IMPORTING: Cluster is being imported. Only for Dedicated Cluster. - MODIFYING: Cluster is being modified. Only for Dedicated Cluster. - PAUSING: Cluster is being paused. Only for Dedicated Cluster. - PAUSED: Cluster is paused. Only for Dedicated Cluster. - RESUMING: Cluster is resuming. Only for Dedicated Cluster. +func (r ApiClusterServiceListClustersRequest) ClusterStates(clusterStates []ClusterServiceListClustersClusterStatesParameterInner) ApiClusterServiceListClustersRequest { + r.clusterStates = &clusterStates + return r +} + +// The maximum number of clusters to return. The service may return fewer than this value. If unspecified, at most X clusters will be returned. The maximum value is X; values above X will be coerced to X. +func (r ApiClusterServiceListClustersRequest) PageSize(pageSize int32) ApiClusterServiceListClustersRequest { + r.pageSize = &pageSize + return r +} + +// A page token, received from a previous `ListClusters` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListClusters` must match the call that provided the page token. +func (r ApiClusterServiceListClustersRequest) PageToken(pageToken string) ApiClusterServiceListClustersRequest { + r.pageToken = &pageToken + return r +} + +// The number of individual resources to skip before starting to return results. If the skip value causes the cursor to move past the end of the collection, the response will be 200 OK with an empty result set and no next_page_token. +func (r ApiClusterServiceListClustersRequest) Skip(skip int32) ApiClusterServiceListClustersRequest { + r.skip = &skip + return r +} + +func (r ApiClusterServiceListClustersRequest) Execute() (*TidbCloudOpenApidedicatedv1beta1ListClustersResponse, *http.Response, error) { + return r.ApiService.ClusterServiceListClustersExecute(r) +} + +/* +ClusterServiceListClusters List clusters + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiClusterServiceListClustersRequest +*/ +func (a *ClusterServiceAPIService) ClusterServiceListClusters(ctx context.Context) ApiClusterServiceListClustersRequest { + return ApiClusterServiceListClustersRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return TidbCloudOpenApidedicatedv1beta1ListClustersResponse +func (a *ClusterServiceAPIService) ClusterServiceListClustersExecute(r ApiClusterServiceListClustersRequest) (*TidbCloudOpenApidedicatedv1beta1ListClustersResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TidbCloudOpenApidedicatedv1beta1ListClustersResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ClusterServiceAPIService.ClusterServiceListClusters") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.projectId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "projectId", r.projectId, "", "") + } + if r.clusterIds != nil { + 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.regionIds != nil { + t := *r.regionIds + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + parameterAddToHeaderOrQuery(localVarQueryParams, "regionIds", s.Index(i).Interface(), "form", "multi") + } + } else { + parameterAddToHeaderOrQuery(localVarQueryParams, "regionIds", t, "form", "multi") + } + } + if r.clusterStates != nil { + t := *r.clusterStates + if reflect.TypeOf(t).Kind() == reflect.Slice { + s := reflect.ValueOf(t) + for i := 0; i < s.Len(); i++ { + parameterAddToHeaderOrQuery(localVarQueryParams, "clusterStates", s.Index(i).Interface(), "form", "multi") + } + } else { + parameterAddToHeaderOrQuery(localVarQueryParams, "clusterStates", t, "form", "multi") + } + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "", "") + } + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "", "") + } + if r.skip != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "skip", r.skip, "", "") + } + // 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiClusterServiceListNodeInstancesRequest struct { + ctx context.Context + ApiService *ClusterServiceAPIService + clusterId string + componentType *ClusterServiceListNodeInstancesComponentTypeParameter + pageSize *int32 + pageToken *string + skip *int32 +} + +// If specified, only node instances of the specified component type will be returned. +func (r ApiClusterServiceListNodeInstancesRequest) ComponentType(componentType ClusterServiceListNodeInstancesComponentTypeParameter) ApiClusterServiceListNodeInstancesRequest { + r.componentType = &componentType + return r +} + +// The maximum number of node instances to return. The service may return fewer than this value. If unspecified, at most X node instances will be returned. The maximum value is X; values above X will be coerced to X. +func (r ApiClusterServiceListNodeInstancesRequest) PageSize(pageSize int32) ApiClusterServiceListNodeInstancesRequest { + r.pageSize = &pageSize + return r +} + +// A page token, received from a previous `ListNodeInstances` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListNodeInstances` must match the call that provided the page token. +func (r ApiClusterServiceListNodeInstancesRequest) PageToken(pageToken string) ApiClusterServiceListNodeInstancesRequest { + r.pageToken = &pageToken + return r +} + +// The number of individual resources to skip before starting to return results. If the skip value causes the cursor to move past the end of the collection, the response will be 200 OK with an empty result set and no next_page_token. +func (r ApiClusterServiceListNodeInstancesRequest) Skip(skip int32) ApiClusterServiceListNodeInstancesRequest { + r.skip = &skip + return r +} + +func (r ApiClusterServiceListNodeInstancesRequest) Execute() (*V1beta1ListNodeInstancesResponse, *http.Response, error) { + return r.ApiService.ClusterServiceListNodeInstancesExecute(r) +} + +/* +ClusterServiceListNodeInstances List node instances + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @return ApiClusterServiceListNodeInstancesRequest +*/ +func (a *ClusterServiceAPIService) ClusterServiceListNodeInstances(ctx context.Context, clusterId string) ApiClusterServiceListNodeInstancesRequest { + return ApiClusterServiceListNodeInstancesRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +// Execute executes the request +// +// @return V1beta1ListNodeInstancesResponse +func (a *ClusterServiceAPIService) ClusterServiceListNodeInstancesExecute(r ApiClusterServiceListNodeInstancesRequest) (*V1beta1ListNodeInstancesResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1ListNodeInstancesResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ClusterServiceAPIService.ClusterServiceListNodeInstances") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/nodeInstances" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.componentType != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "componentType", r.componentType, "", "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "", "") + } + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "", "") + } + if r.skip != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "skip", r.skip, "", "") + } + // 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiClusterServicePauseClusterRequest struct { + ctx context.Context + ApiService *ClusterServiceAPIService + clusterId string +} + +func (r ApiClusterServicePauseClusterRequest) Execute() (*Dedicatedv1beta1PauseClusterResponse, *http.Response, error) { + return r.ApiService.ClusterServicePauseClusterExecute(r) +} + +/* +ClusterServicePauseCluster Pause a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @return ApiClusterServicePauseClusterRequest +*/ +func (a *ClusterServiceAPIService) ClusterServicePauseCluster(ctx context.Context, clusterId string) ApiClusterServicePauseClusterRequest { + return ApiClusterServicePauseClusterRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +// Execute executes the request +// +// @return Dedicatedv1beta1PauseClusterResponse +func (a *ClusterServiceAPIService) ClusterServicePauseClusterExecute(r ApiClusterServicePauseClusterRequest) (*Dedicatedv1beta1PauseClusterResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Dedicatedv1beta1PauseClusterResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ClusterServiceAPIService.ClusterServicePauseCluster") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}:pauseCluster" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiClusterServiceResetRootPasswordRequest struct { + ctx context.Context + ApiService *ClusterServiceAPIService + clusterId string + body *ClusterServiceResetRootPasswordBody +} + +func (r ApiClusterServiceResetRootPasswordRequest) Body(body ClusterServiceResetRootPasswordBody) ApiClusterServiceResetRootPasswordRequest { + r.body = &body + return r +} + +func (r ApiClusterServiceResetRootPasswordRequest) Execute() (map[string]interface{}, *http.Response, error) { + return r.ApiService.ClusterServiceResetRootPasswordExecute(r) +} + +/* +ClusterServiceResetRootPassword Reset the root password of a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @return ApiClusterServiceResetRootPasswordRequest +*/ +func (a *ClusterServiceAPIService) ClusterServiceResetRootPassword(ctx context.Context, clusterId string) ApiClusterServiceResetRootPasswordRequest { + return ApiClusterServiceResetRootPasswordRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +// Execute executes the request +// +// @return map[string]interface{} +func (a *ClusterServiceAPIService) ClusterServiceResetRootPasswordExecute(r ApiClusterServiceResetRootPasswordRequest) (map[string]interface{}, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ClusterServiceAPIService.ClusterServiceResetRootPassword") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}:resetRootPassword" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + + 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 + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiClusterServiceResumeClusterRequest struct { + ctx context.Context + ApiService *ClusterServiceAPIService + clusterId string +} + +func (r ApiClusterServiceResumeClusterRequest) Execute() (*Dedicatedv1beta1ResumeClusterResponse, *http.Response, error) { + return r.ApiService.ClusterServiceResumeClusterExecute(r) +} + +/* +ClusterServiceResumeCluster Resume a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @return ApiClusterServiceResumeClusterRequest +*/ +func (a *ClusterServiceAPIService) ClusterServiceResumeCluster(ctx context.Context, clusterId string) ApiClusterServiceResumeClusterRequest { + return ApiClusterServiceResumeClusterRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +// Execute executes the request +// +// @return Dedicatedv1beta1ResumeClusterResponse +func (a *ClusterServiceAPIService) ClusterServiceResumeClusterExecute(r ApiClusterServiceResumeClusterRequest) (*Dedicatedv1beta1ResumeClusterResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Dedicatedv1beta1ResumeClusterResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ClusterServiceAPIService.ClusterServiceResumeCluster") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}:resumeCluster" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiClusterServiceShowNodeQuotaRequest struct { + ctx context.Context + ApiService *ClusterServiceAPIService +} + +func (r ApiClusterServiceShowNodeQuotaRequest) Execute() (*V1beta1ShowNodeQuotaResponse, *http.Response, error) { + return r.ApiService.ClusterServiceShowNodeQuotaExecute(r) +} + +/* +ClusterServiceShowNodeQuota Show node quota across the caller's organization + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiClusterServiceShowNodeQuotaRequest +*/ +func (a *ClusterServiceAPIService) ClusterServiceShowNodeQuota(ctx context.Context) ApiClusterServiceShowNodeQuotaRequest { + return ApiClusterServiceShowNodeQuotaRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return V1beta1ShowNodeQuotaResponse +func (a *ClusterServiceAPIService) ClusterServiceShowNodeQuotaExecute(r ApiClusterServiceShowNodeQuotaRequest) (*V1beta1ShowNodeQuotaResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1ShowNodeQuotaResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ClusterServiceAPIService.ClusterServiceShowNodeQuota") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters:showNodeQuota" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiClusterServiceUpdateClusterRequest struct { + ctx context.Context + ApiService *ClusterServiceAPIService + clusterClusterId string + cluster *ClusterServiceUpdateClusterRequest + validateOnly *bool +} + +func (r ApiClusterServiceUpdateClusterRequest) Cluster(cluster ClusterServiceUpdateClusterRequest) ApiClusterServiceUpdateClusterRequest { + r.cluster = &cluster + return r +} + +// if validate_only is true, the request will be validated but not executed. +func (r ApiClusterServiceUpdateClusterRequest) ValidateOnly(validateOnly bool) ApiClusterServiceUpdateClusterRequest { + r.validateOnly = &validateOnly + return r +} + +func (r ApiClusterServiceUpdateClusterRequest) Execute() (*TidbCloudOpenApidedicatedv1beta1Cluster, *http.Response, error) { + return r.ApiService.ClusterServiceUpdateClusterExecute(r) +} + +/* +ClusterServiceUpdateCluster Update a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterClusterId + @return ApiClusterServiceUpdateClusterRequest +*/ +func (a *ClusterServiceAPIService) ClusterServiceUpdateCluster(ctx context.Context, clusterClusterId string) ApiClusterServiceUpdateClusterRequest { + return ApiClusterServiceUpdateClusterRequest{ + ApiService: a, + ctx: ctx, + clusterClusterId: clusterClusterId, + } +} + +// Execute executes the request +// +// @return TidbCloudOpenApidedicatedv1beta1Cluster +func (a *ClusterServiceAPIService) ClusterServiceUpdateClusterExecute(r ApiClusterServiceUpdateClusterRequest) (*TidbCloudOpenApidedicatedv1beta1Cluster, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TidbCloudOpenApidedicatedv1beta1Cluster + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "ClusterServiceAPIService.ClusterServiceUpdateCluster") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{cluster.clusterId}" + localVarPath = strings.Replace(localVarPath, "{"+"cluster.clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterClusterId, "clusterClusterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.cluster == nil { + return localVarReturnValue, nil, reportError("cluster is required and must be specified") + } + + if r.validateOnly != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "validateOnly", r.validateOnly, "", "") + } + // 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.cluster + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/api_database_audit_log_service.go b/pkg/tidbcloud/v1beta1/dedicated/api_database_audit_log_service.go new file mode 100644 index 00000000..83504d4f --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/api_database_audit_log_service.go @@ -0,0 +1,1542 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// DatabaseAuditLogServiceAPIService DatabaseAuditLogServiceAPI service +type DatabaseAuditLogServiceAPIService service + +type ApiDatabaseAuditLogServiceCreateAuditLogConfigRequest struct { + ctx context.Context + ApiService *DatabaseAuditLogServiceAPIService + auditLogConfigClusterId string + auditLogConfig *DatabaseAuditLogServiceCreateAuditLogConfigRequest + validateOnly *bool +} + +func (r ApiDatabaseAuditLogServiceCreateAuditLogConfigRequest) AuditLogConfig(auditLogConfig DatabaseAuditLogServiceCreateAuditLogConfigRequest) ApiDatabaseAuditLogServiceCreateAuditLogConfigRequest { + r.auditLogConfig = &auditLogConfig + return r +} + +func (r ApiDatabaseAuditLogServiceCreateAuditLogConfigRequest) ValidateOnly(validateOnly bool) ApiDatabaseAuditLogServiceCreateAuditLogConfigRequest { + r.validateOnly = &validateOnly + return r +} + +func (r ApiDatabaseAuditLogServiceCreateAuditLogConfigRequest) Execute() (*Dedicatedv1beta1AuditLogConfig, *http.Response, error) { + return r.ApiService.DatabaseAuditLogServiceCreateAuditLogConfigExecute(r) +} + +/* +DatabaseAuditLogServiceCreateAuditLogConfig Create the audit log config for a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param auditLogConfigClusterId + @return ApiDatabaseAuditLogServiceCreateAuditLogConfigRequest +*/ +func (a *DatabaseAuditLogServiceAPIService) DatabaseAuditLogServiceCreateAuditLogConfig(ctx context.Context, auditLogConfigClusterId string) ApiDatabaseAuditLogServiceCreateAuditLogConfigRequest { + return ApiDatabaseAuditLogServiceCreateAuditLogConfigRequest{ + ApiService: a, + ctx: ctx, + auditLogConfigClusterId: auditLogConfigClusterId, + } +} + +// Execute executes the request +// +// @return Dedicatedv1beta1AuditLogConfig +func (a *DatabaseAuditLogServiceAPIService) DatabaseAuditLogServiceCreateAuditLogConfigExecute(r ApiDatabaseAuditLogServiceCreateAuditLogConfigRequest) (*Dedicatedv1beta1AuditLogConfig, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Dedicatedv1beta1AuditLogConfig + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DatabaseAuditLogServiceAPIService.DatabaseAuditLogServiceCreateAuditLogConfig") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{auditLogConfig.clusterId}/auditLogConfig" + localVarPath = strings.Replace(localVarPath, "{"+"auditLogConfig.clusterId"+"}", url.PathEscape(parameterValueToString(r.auditLogConfigClusterId, "auditLogConfigClusterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.auditLogConfig == nil { + return localVarReturnValue, nil, reportError("auditLogConfig is required and must be specified") + } + + if r.validateOnly != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "validateOnly", r.validateOnly, "", "") + } + // 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.auditLogConfig + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest struct { + ctx context.Context + ApiService *DatabaseAuditLogServiceAPIService + auditLogFilterRuleClusterId string + auditLogFilterRule *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest +} + +func (r ApiDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) AuditLogFilterRule(auditLogFilterRule DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) ApiDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest { + r.auditLogFilterRule = &auditLogFilterRule + return r +} + +func (r ApiDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) Execute() (*V1beta1AuditLogFilterRule, *http.Response, error) { + return r.ApiService.DatabaseAuditLogServiceCreateAuditLogFilterRuleExecute(r) +} + +/* +DatabaseAuditLogServiceCreateAuditLogFilterRule Create an audit log filter rule + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param auditLogFilterRuleClusterId + @return ApiDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest +*/ +func (a *DatabaseAuditLogServiceAPIService) DatabaseAuditLogServiceCreateAuditLogFilterRule(ctx context.Context, auditLogFilterRuleClusterId string) ApiDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest { + return ApiDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest{ + ApiService: a, + ctx: ctx, + auditLogFilterRuleClusterId: auditLogFilterRuleClusterId, + } +} + +// Execute executes the request +// +// @return V1beta1AuditLogFilterRule +func (a *DatabaseAuditLogServiceAPIService) DatabaseAuditLogServiceCreateAuditLogFilterRuleExecute(r ApiDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) (*V1beta1AuditLogFilterRule, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1AuditLogFilterRule + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DatabaseAuditLogServiceAPIService.DatabaseAuditLogServiceCreateAuditLogFilterRule") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{auditLogFilterRule.clusterId}/auditLogFilterRules" + localVarPath = strings.Replace(localVarPath, "{"+"auditLogFilterRule.clusterId"+"}", url.PathEscape(parameterValueToString(r.auditLogFilterRuleClusterId, "auditLogFilterRuleClusterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.auditLogFilterRule == nil { + return localVarReturnValue, nil, reportError("auditLogFilterRule 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.auditLogFilterRule + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiDatabaseAuditLogServiceDeleteAuditLogFilterRuleRequest struct { + ctx context.Context + ApiService *DatabaseAuditLogServiceAPIService + clusterId string + auditLogFilterRuleId string +} + +func (r ApiDatabaseAuditLogServiceDeleteAuditLogFilterRuleRequest) Execute() (map[string]interface{}, *http.Response, error) { + return r.ApiService.DatabaseAuditLogServiceDeleteAuditLogFilterRuleExecute(r) +} + +/* +DatabaseAuditLogServiceDeleteAuditLogFilterRule Delete an audit log filter rule + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @param auditLogFilterRuleId + @return ApiDatabaseAuditLogServiceDeleteAuditLogFilterRuleRequest +*/ +func (a *DatabaseAuditLogServiceAPIService) DatabaseAuditLogServiceDeleteAuditLogFilterRule(ctx context.Context, clusterId string, auditLogFilterRuleId string) ApiDatabaseAuditLogServiceDeleteAuditLogFilterRuleRequest { + return ApiDatabaseAuditLogServiceDeleteAuditLogFilterRuleRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + auditLogFilterRuleId: auditLogFilterRuleId, + } +} + +// Execute executes the request +// +// @return map[string]interface{} +func (a *DatabaseAuditLogServiceAPIService) DatabaseAuditLogServiceDeleteAuditLogFilterRuleExecute(r ApiDatabaseAuditLogServiceDeleteAuditLogFilterRuleRequest) (map[string]interface{}, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DatabaseAuditLogServiceAPIService.DatabaseAuditLogServiceDeleteAuditLogFilterRule") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/auditLogFilterRules/{auditLogFilterRuleId}" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"auditLogFilterRuleId"+"}", url.PathEscape(parameterValueToString(r.auditLogFilterRuleId, "auditLogFilterRuleId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiDatabaseAuditLogServiceGetAuditLogConfigRequest struct { + ctx context.Context + ApiService *DatabaseAuditLogServiceAPIService + clusterId string +} + +func (r ApiDatabaseAuditLogServiceGetAuditLogConfigRequest) Execute() (*Dedicatedv1beta1AuditLogConfig, *http.Response, error) { + return r.ApiService.DatabaseAuditLogServiceGetAuditLogConfigExecute(r) +} + +/* +DatabaseAuditLogServiceGetAuditLogConfig Get the audit log config of a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @return ApiDatabaseAuditLogServiceGetAuditLogConfigRequest +*/ +func (a *DatabaseAuditLogServiceAPIService) DatabaseAuditLogServiceGetAuditLogConfig(ctx context.Context, clusterId string) ApiDatabaseAuditLogServiceGetAuditLogConfigRequest { + return ApiDatabaseAuditLogServiceGetAuditLogConfigRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +// Execute executes the request +// +// @return Dedicatedv1beta1AuditLogConfig +func (a *DatabaseAuditLogServiceAPIService) DatabaseAuditLogServiceGetAuditLogConfigExecute(r ApiDatabaseAuditLogServiceGetAuditLogConfigRequest) (*Dedicatedv1beta1AuditLogConfig, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Dedicatedv1beta1AuditLogConfig + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DatabaseAuditLogServiceAPIService.DatabaseAuditLogServiceGetAuditLogConfig") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/auditLogConfig" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiDatabaseAuditLogServiceGetAuditLogFilterRuleRequest struct { + ctx context.Context + ApiService *DatabaseAuditLogServiceAPIService + clusterId string + auditLogFilterRuleId string +} + +func (r ApiDatabaseAuditLogServiceGetAuditLogFilterRuleRequest) Execute() (*V1beta1AuditLogFilterRule, *http.Response, error) { + return r.ApiService.DatabaseAuditLogServiceGetAuditLogFilterRuleExecute(r) +} + +/* +DatabaseAuditLogServiceGetAuditLogFilterRule Get an audit log filter rule + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @param auditLogFilterRuleId + @return ApiDatabaseAuditLogServiceGetAuditLogFilterRuleRequest +*/ +func (a *DatabaseAuditLogServiceAPIService) DatabaseAuditLogServiceGetAuditLogFilterRule(ctx context.Context, clusterId string, auditLogFilterRuleId string) ApiDatabaseAuditLogServiceGetAuditLogFilterRuleRequest { + return ApiDatabaseAuditLogServiceGetAuditLogFilterRuleRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + auditLogFilterRuleId: auditLogFilterRuleId, + } +} + +// Execute executes the request +// +// @return V1beta1AuditLogFilterRule +func (a *DatabaseAuditLogServiceAPIService) DatabaseAuditLogServiceGetAuditLogFilterRuleExecute(r ApiDatabaseAuditLogServiceGetAuditLogFilterRuleRequest) (*V1beta1AuditLogFilterRule, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1AuditLogFilterRule + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DatabaseAuditLogServiceAPIService.DatabaseAuditLogServiceGetAuditLogFilterRule") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/auditLogFilterRules/{auditLogFilterRuleId}" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"auditLogFilterRuleId"+"}", url.PathEscape(parameterValueToString(r.auditLogFilterRuleId, "auditLogFilterRuleId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiDatabaseAuditLogServiceListAuditLogFilterRulesRequest struct { + ctx context.Context + ApiService *DatabaseAuditLogServiceAPIService + clusterId string + pageSize *int32 + pageToken *string + skip *int32 +} + +func (r ApiDatabaseAuditLogServiceListAuditLogFilterRulesRequest) PageSize(pageSize int32) ApiDatabaseAuditLogServiceListAuditLogFilterRulesRequest { + r.pageSize = &pageSize + return r +} + +func (r ApiDatabaseAuditLogServiceListAuditLogFilterRulesRequest) PageToken(pageToken string) ApiDatabaseAuditLogServiceListAuditLogFilterRulesRequest { + r.pageToken = &pageToken + return r +} + +// The number of individual resources to skip before starting to return results. If the skip value causes the cursor to move past the end of the collection, the response will be 200 OK with an empty result set and no next_page_token. +func (r ApiDatabaseAuditLogServiceListAuditLogFilterRulesRequest) Skip(skip int32) ApiDatabaseAuditLogServiceListAuditLogFilterRulesRequest { + r.skip = &skip + return r +} + +func (r ApiDatabaseAuditLogServiceListAuditLogFilterRulesRequest) Execute() (*V1beta1ListAuditLogFilterRulesResponse, *http.Response, error) { + return r.ApiService.DatabaseAuditLogServiceListAuditLogFilterRulesExecute(r) +} + +/* +DatabaseAuditLogServiceListAuditLogFilterRules List audit log filter rules + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @return ApiDatabaseAuditLogServiceListAuditLogFilterRulesRequest +*/ +func (a *DatabaseAuditLogServiceAPIService) DatabaseAuditLogServiceListAuditLogFilterRules(ctx context.Context, clusterId string) ApiDatabaseAuditLogServiceListAuditLogFilterRulesRequest { + return ApiDatabaseAuditLogServiceListAuditLogFilterRulesRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +// Execute executes the request +// +// @return V1beta1ListAuditLogFilterRulesResponse +func (a *DatabaseAuditLogServiceAPIService) DatabaseAuditLogServiceListAuditLogFilterRulesExecute(r ApiDatabaseAuditLogServiceListAuditLogFilterRulesRequest) (*V1beta1ListAuditLogFilterRulesResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1ListAuditLogFilterRulesResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DatabaseAuditLogServiceAPIService.DatabaseAuditLogServiceListAuditLogFilterRules") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/auditLogFilterRules" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "", "") + } + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "", "") + } + if r.skip != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "skip", r.skip, "", "") + } + // 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiDatabaseAuditLogServiceShowObjectStorageAccessIamPrincipalRequest struct { + ctx context.Context + ApiService *DatabaseAuditLogServiceAPIService + clusterId string +} + +func (r ApiDatabaseAuditLogServiceShowObjectStorageAccessIamPrincipalRequest) Execute() (*V1beta1ShowObjectStorageAccessIamPrincipalResponse, *http.Response, error) { + return r.ApiService.DatabaseAuditLogServiceShowObjectStorageAccessIamPrincipalExecute(r) +} + +/* +DatabaseAuditLogServiceShowObjectStorageAccessIamPrincipal Show IAM principal of TiDB Cloud for accessing customer's object storage + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @return ApiDatabaseAuditLogServiceShowObjectStorageAccessIamPrincipalRequest +*/ +func (a *DatabaseAuditLogServiceAPIService) DatabaseAuditLogServiceShowObjectStorageAccessIamPrincipal(ctx context.Context, clusterId string) ApiDatabaseAuditLogServiceShowObjectStorageAccessIamPrincipalRequest { + return ApiDatabaseAuditLogServiceShowObjectStorageAccessIamPrincipalRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +// Execute executes the request +// +// @return V1beta1ShowObjectStorageAccessIamPrincipalResponse +func (a *DatabaseAuditLogServiceAPIService) DatabaseAuditLogServiceShowObjectStorageAccessIamPrincipalExecute(r ApiDatabaseAuditLogServiceShowObjectStorageAccessIamPrincipalRequest) (*V1beta1ShowObjectStorageAccessIamPrincipalResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1ShowObjectStorageAccessIamPrincipalResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DatabaseAuditLogServiceAPIService.DatabaseAuditLogServiceShowObjectStorageAccessIamPrincipal") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/auditLogConfig:showObjectStorageAccessIamPrincipal" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiDatabaseAuditLogServiceUpdateAuditLogConfigRequest struct { + ctx context.Context + ApiService *DatabaseAuditLogServiceAPIService + auditLogConfigClusterId string + auditLogConfig *DatabaseAuditLogServiceUpdateAuditLogConfigRequest + validateOnly *bool +} + +func (r ApiDatabaseAuditLogServiceUpdateAuditLogConfigRequest) AuditLogConfig(auditLogConfig DatabaseAuditLogServiceUpdateAuditLogConfigRequest) ApiDatabaseAuditLogServiceUpdateAuditLogConfigRequest { + r.auditLogConfig = &auditLogConfig + return r +} + +func (r ApiDatabaseAuditLogServiceUpdateAuditLogConfigRequest) ValidateOnly(validateOnly bool) ApiDatabaseAuditLogServiceUpdateAuditLogConfigRequest { + r.validateOnly = &validateOnly + return r +} + +func (r ApiDatabaseAuditLogServiceUpdateAuditLogConfigRequest) Execute() (*Dedicatedv1beta1AuditLogConfig, *http.Response, error) { + return r.ApiService.DatabaseAuditLogServiceUpdateAuditLogConfigExecute(r) +} + +/* +DatabaseAuditLogServiceUpdateAuditLogConfig Update the audit log config of a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param auditLogConfigClusterId + @return ApiDatabaseAuditLogServiceUpdateAuditLogConfigRequest +*/ +func (a *DatabaseAuditLogServiceAPIService) DatabaseAuditLogServiceUpdateAuditLogConfig(ctx context.Context, auditLogConfigClusterId string) ApiDatabaseAuditLogServiceUpdateAuditLogConfigRequest { + return ApiDatabaseAuditLogServiceUpdateAuditLogConfigRequest{ + ApiService: a, + ctx: ctx, + auditLogConfigClusterId: auditLogConfigClusterId, + } +} + +// Execute executes the request +// +// @return Dedicatedv1beta1AuditLogConfig +func (a *DatabaseAuditLogServiceAPIService) DatabaseAuditLogServiceUpdateAuditLogConfigExecute(r ApiDatabaseAuditLogServiceUpdateAuditLogConfigRequest) (*Dedicatedv1beta1AuditLogConfig, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Dedicatedv1beta1AuditLogConfig + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "DatabaseAuditLogServiceAPIService.DatabaseAuditLogServiceUpdateAuditLogConfig") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{auditLogConfig.clusterId}/auditLogConfig" + localVarPath = strings.Replace(localVarPath, "{"+"auditLogConfig.clusterId"+"}", url.PathEscape(parameterValueToString(r.auditLogConfigClusterId, "auditLogConfigClusterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.auditLogConfig == nil { + return localVarReturnValue, nil, reportError("auditLogConfig is required and must be specified") + } + + if r.validateOnly != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "validateOnly", r.validateOnly, "", "") + } + // 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.auditLogConfig + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/api_maintenance_service.go b/pkg/tidbcloud/v1beta1/dedicated/api_maintenance_service.go new file mode 100644 index 00000000..cd7eda66 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/api_maintenance_service.go @@ -0,0 +1,1180 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// MaintenanceServiceAPIService MaintenanceServiceAPI service +type MaintenanceServiceAPIService service + +type ApiMaintenanceServiceDeferMaintenanceTaskRequest struct { + ctx context.Context + ApiService *MaintenanceServiceAPIService + maintenanceTaskId string +} + +func (r ApiMaintenanceServiceDeferMaintenanceTaskRequest) Execute() (map[string]interface{}, *http.Response, error) { + return r.ApiService.MaintenanceServiceDeferMaintenanceTaskExecute(r) +} + +/* +MaintenanceServiceDeferMaintenanceTask Defer a maintenance task + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param maintenanceTaskId + @return ApiMaintenanceServiceDeferMaintenanceTaskRequest +*/ +func (a *MaintenanceServiceAPIService) MaintenanceServiceDeferMaintenanceTask(ctx context.Context, maintenanceTaskId string) ApiMaintenanceServiceDeferMaintenanceTaskRequest { + return ApiMaintenanceServiceDeferMaintenanceTaskRequest{ + ApiService: a, + ctx: ctx, + maintenanceTaskId: maintenanceTaskId, + } +} + +// Execute executes the request +// +// @return map[string]interface{} +func (a *MaintenanceServiceAPIService) MaintenanceServiceDeferMaintenanceTaskExecute(r ApiMaintenanceServiceDeferMaintenanceTaskRequest) (map[string]interface{}, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MaintenanceServiceAPIService.MaintenanceServiceDeferMaintenanceTask") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/maintenanceTasks/{maintenanceTaskId}:deferMaintenanceTask" + localVarPath = strings.Replace(localVarPath, "{"+"maintenanceTaskId"+"}", url.PathEscape(parameterValueToString(r.maintenanceTaskId, "maintenanceTaskId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiMaintenanceServiceGetMaintenanceTaskRequest struct { + ctx context.Context + ApiService *MaintenanceServiceAPIService + maintenanceTaskId string +} + +func (r ApiMaintenanceServiceGetMaintenanceTaskRequest) Execute() (*V1beta1MaintenanceTask, *http.Response, error) { + return r.ApiService.MaintenanceServiceGetMaintenanceTaskExecute(r) +} + +/* +MaintenanceServiceGetMaintenanceTask Get a maintenance task + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param maintenanceTaskId + @return ApiMaintenanceServiceGetMaintenanceTaskRequest +*/ +func (a *MaintenanceServiceAPIService) MaintenanceServiceGetMaintenanceTask(ctx context.Context, maintenanceTaskId string) ApiMaintenanceServiceGetMaintenanceTaskRequest { + return ApiMaintenanceServiceGetMaintenanceTaskRequest{ + ApiService: a, + ctx: ctx, + maintenanceTaskId: maintenanceTaskId, + } +} + +// Execute executes the request +// +// @return V1beta1MaintenanceTask +func (a *MaintenanceServiceAPIService) MaintenanceServiceGetMaintenanceTaskExecute(r ApiMaintenanceServiceGetMaintenanceTaskRequest) (*V1beta1MaintenanceTask, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1MaintenanceTask + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MaintenanceServiceAPIService.MaintenanceServiceGetMaintenanceTask") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/maintenanceTasks/{maintenanceTaskId}" + localVarPath = strings.Replace(localVarPath, "{"+"maintenanceTaskId"+"}", url.PathEscape(parameterValueToString(r.maintenanceTaskId, "maintenanceTaskId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiMaintenanceServiceGetMaintenanceWindowRequest struct { + ctx context.Context + ApiService *MaintenanceServiceAPIService + maintenanceWindowId string +} + +func (r ApiMaintenanceServiceGetMaintenanceWindowRequest) Execute() (*Dedicatedv1beta1MaintenanceWindow, *http.Response, error) { + return r.ApiService.MaintenanceServiceGetMaintenanceWindowExecute(r) +} + +/* +MaintenanceServiceGetMaintenanceWindow Get a maintenance window + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param maintenanceWindowId Format: project-{project_id} + @return ApiMaintenanceServiceGetMaintenanceWindowRequest +*/ +func (a *MaintenanceServiceAPIService) MaintenanceServiceGetMaintenanceWindow(ctx context.Context, maintenanceWindowId string) ApiMaintenanceServiceGetMaintenanceWindowRequest { + return ApiMaintenanceServiceGetMaintenanceWindowRequest{ + ApiService: a, + ctx: ctx, + maintenanceWindowId: maintenanceWindowId, + } +} + +// Execute executes the request +// +// @return Dedicatedv1beta1MaintenanceWindow +func (a *MaintenanceServiceAPIService) MaintenanceServiceGetMaintenanceWindowExecute(r ApiMaintenanceServiceGetMaintenanceWindowRequest) (*Dedicatedv1beta1MaintenanceWindow, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Dedicatedv1beta1MaintenanceWindow + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MaintenanceServiceAPIService.MaintenanceServiceGetMaintenanceWindow") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/maintenanceWindows/{maintenanceWindowId}" + localVarPath = strings.Replace(localVarPath, "{"+"maintenanceWindowId"+"}", url.PathEscape(parameterValueToString(r.maintenanceWindowId, "maintenanceWindowId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiMaintenanceServiceListMaintenanceTasksRequest struct { + ctx context.Context + ApiService *MaintenanceServiceAPIService + projectId *string + pageSize *int32 + pageToken *string + skip *int32 +} + +// If unspecified, the project ID of default project is used. +func (r ApiMaintenanceServiceListMaintenanceTasksRequest) ProjectId(projectId string) ApiMaintenanceServiceListMaintenanceTasksRequest { + r.projectId = &projectId + return r +} + +// The maximum number of maintenance tasks to return. The service may return fewer than this value. If unspecified, at most X maintenance tasks will be returned. The maximum value is X; values above X will be coerced to X. +func (r ApiMaintenanceServiceListMaintenanceTasksRequest) PageSize(pageSize int32) ApiMaintenanceServiceListMaintenanceTasksRequest { + r.pageSize = &pageSize + return r +} + +// A page token, received from a previous `ListMaintenanceTasks` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListMaintenanceTasks` must match the call that provided the page token. +func (r ApiMaintenanceServiceListMaintenanceTasksRequest) PageToken(pageToken string) ApiMaintenanceServiceListMaintenanceTasksRequest { + r.pageToken = &pageToken + return r +} + +// The number of individual resources to skip before starting to return results. If the skip value causes the cursor to move past the end of the collection, the response will be 200 OK with an empty result set and no next_page_token. +func (r ApiMaintenanceServiceListMaintenanceTasksRequest) Skip(skip int32) ApiMaintenanceServiceListMaintenanceTasksRequest { + r.skip = &skip + return r +} + +func (r ApiMaintenanceServiceListMaintenanceTasksRequest) Execute() (*V1beta1ListMaintenanceTasksResponse, *http.Response, error) { + return r.ApiService.MaintenanceServiceListMaintenanceTasksExecute(r) +} + +/* +MaintenanceServiceListMaintenanceTasks List maintenance tasks + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiMaintenanceServiceListMaintenanceTasksRequest +*/ +func (a *MaintenanceServiceAPIService) MaintenanceServiceListMaintenanceTasks(ctx context.Context) ApiMaintenanceServiceListMaintenanceTasksRequest { + return ApiMaintenanceServiceListMaintenanceTasksRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return V1beta1ListMaintenanceTasksResponse +func (a *MaintenanceServiceAPIService) MaintenanceServiceListMaintenanceTasksExecute(r ApiMaintenanceServiceListMaintenanceTasksRequest) (*V1beta1ListMaintenanceTasksResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1ListMaintenanceTasksResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MaintenanceServiceAPIService.MaintenanceServiceListMaintenanceTasks") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/maintenanceTasks" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.projectId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "projectId", r.projectId, "", "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "", "") + } + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "", "") + } + if r.skip != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "skip", r.skip, "", "") + } + // 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiMaintenanceServiceListMaintenanceWindowsRequest struct { + ctx context.Context + ApiService *MaintenanceServiceAPIService + projectId *string + pageSize *int32 + pageToken *string + skip *int32 +} + +// If unspecified, the project ID of default project is used. +func (r ApiMaintenanceServiceListMaintenanceWindowsRequest) ProjectId(projectId string) ApiMaintenanceServiceListMaintenanceWindowsRequest { + r.projectId = &projectId + return r +} + +// The maximum number of maintenance windows to return. The service may return fewer than this value. If unspecified, at most X maintenance windows will be returned. The maximum value is X; values above X will be coerced to X. +func (r ApiMaintenanceServiceListMaintenanceWindowsRequest) PageSize(pageSize int32) ApiMaintenanceServiceListMaintenanceWindowsRequest { + r.pageSize = &pageSize + return r +} + +// A page token, received from a previous `ListMaintenanceWindows` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListMaintenanceWindows` must match the call that provided the page token. +func (r ApiMaintenanceServiceListMaintenanceWindowsRequest) PageToken(pageToken string) ApiMaintenanceServiceListMaintenanceWindowsRequest { + r.pageToken = &pageToken + return r +} + +// The number of individual resources to skip before starting to return results. If the skip value causes the cursor to move past the end of the collection, the response will be 200 OK with an empty result set and no next_page_token. +func (r ApiMaintenanceServiceListMaintenanceWindowsRequest) Skip(skip int32) ApiMaintenanceServiceListMaintenanceWindowsRequest { + r.skip = &skip + return r +} + +func (r ApiMaintenanceServiceListMaintenanceWindowsRequest) Execute() (*V1beta1ListMaintenanceWindowsResponse, *http.Response, error) { + return r.ApiService.MaintenanceServiceListMaintenanceWindowsExecute(r) +} + +/* +MaintenanceServiceListMaintenanceWindows List maintenance windows + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiMaintenanceServiceListMaintenanceWindowsRequest +*/ +func (a *MaintenanceServiceAPIService) MaintenanceServiceListMaintenanceWindows(ctx context.Context) ApiMaintenanceServiceListMaintenanceWindowsRequest { + return ApiMaintenanceServiceListMaintenanceWindowsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return V1beta1ListMaintenanceWindowsResponse +func (a *MaintenanceServiceAPIService) MaintenanceServiceListMaintenanceWindowsExecute(r ApiMaintenanceServiceListMaintenanceWindowsRequest) (*V1beta1ListMaintenanceWindowsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1ListMaintenanceWindowsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MaintenanceServiceAPIService.MaintenanceServiceListMaintenanceWindows") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/maintenanceWindows" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.projectId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "projectId", r.projectId, "", "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "", "") + } + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "", "") + } + if r.skip != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "skip", r.skip, "", "") + } + // 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiMaintenanceServiceUpdateMaintenanceWindowRequest struct { + ctx context.Context + ApiService *MaintenanceServiceAPIService + maintenanceWindowMaintenanceWindowId string + maintenanceWindow *MaintenanceServiceUpdateMaintenanceWindowRequest +} + +func (r ApiMaintenanceServiceUpdateMaintenanceWindowRequest) MaintenanceWindow(maintenanceWindow MaintenanceServiceUpdateMaintenanceWindowRequest) ApiMaintenanceServiceUpdateMaintenanceWindowRequest { + r.maintenanceWindow = &maintenanceWindow + return r +} + +func (r ApiMaintenanceServiceUpdateMaintenanceWindowRequest) Execute() (*Dedicatedv1beta1MaintenanceWindow, *http.Response, error) { + return r.ApiService.MaintenanceServiceUpdateMaintenanceWindowExecute(r) +} + +/* +MaintenanceServiceUpdateMaintenanceWindow Update a maintenance window + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param maintenanceWindowMaintenanceWindowId Format: project-{project_id} + @return ApiMaintenanceServiceUpdateMaintenanceWindowRequest +*/ +func (a *MaintenanceServiceAPIService) MaintenanceServiceUpdateMaintenanceWindow(ctx context.Context, maintenanceWindowMaintenanceWindowId string) ApiMaintenanceServiceUpdateMaintenanceWindowRequest { + return ApiMaintenanceServiceUpdateMaintenanceWindowRequest{ + ApiService: a, + ctx: ctx, + maintenanceWindowMaintenanceWindowId: maintenanceWindowMaintenanceWindowId, + } +} + +// Execute executes the request +// +// @return Dedicatedv1beta1MaintenanceWindow +func (a *MaintenanceServiceAPIService) MaintenanceServiceUpdateMaintenanceWindowExecute(r ApiMaintenanceServiceUpdateMaintenanceWindowRequest) (*Dedicatedv1beta1MaintenanceWindow, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Dedicatedv1beta1MaintenanceWindow + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "MaintenanceServiceAPIService.MaintenanceServiceUpdateMaintenanceWindow") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/maintenanceWindows/{maintenanceWindow.maintenanceWindowId}" + localVarPath = strings.Replace(localVarPath, "{"+"maintenanceWindow.maintenanceWindowId"+"}", url.PathEscape(parameterValueToString(r.maintenanceWindowMaintenanceWindowId, "maintenanceWindowMaintenanceWindowId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.maintenanceWindow == nil { + return localVarReturnValue, nil, reportError("maintenanceWindow 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.maintenanceWindow + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/api_network_container_service.go b/pkg/tidbcloud/v1beta1/dedicated/api_network_container_service.go new file mode 100644 index 00000000..e48fefb9 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/api_network_container_service.go @@ -0,0 +1,1560 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// NetworkContainerServiceAPIService NetworkContainerServiceAPI service +type NetworkContainerServiceAPIService service + +type ApiNetworkContainerServiceCreateNetworkContainerRequest struct { + ctx context.Context + ApiService *NetworkContainerServiceAPIService + networkContainer *V1beta1NetworkContainer + validateOnly *bool +} + +func (r ApiNetworkContainerServiceCreateNetworkContainerRequest) NetworkContainer(networkContainer V1beta1NetworkContainer) ApiNetworkContainerServiceCreateNetworkContainerRequest { + r.networkContainer = &networkContainer + return r +} + +func (r ApiNetworkContainerServiceCreateNetworkContainerRequest) ValidateOnly(validateOnly bool) ApiNetworkContainerServiceCreateNetworkContainerRequest { + r.validateOnly = &validateOnly + return r +} + +func (r ApiNetworkContainerServiceCreateNetworkContainerRequest) Execute() (*V1beta1NetworkContainer, *http.Response, error) { + return r.ApiService.NetworkContainerServiceCreateNetworkContainerExecute(r) +} + +/* +NetworkContainerServiceCreateNetworkContainer Create a network container + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiNetworkContainerServiceCreateNetworkContainerRequest +*/ +func (a *NetworkContainerServiceAPIService) NetworkContainerServiceCreateNetworkContainer(ctx context.Context) ApiNetworkContainerServiceCreateNetworkContainerRequest { + return ApiNetworkContainerServiceCreateNetworkContainerRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return V1beta1NetworkContainer +func (a *NetworkContainerServiceAPIService) NetworkContainerServiceCreateNetworkContainerExecute(r ApiNetworkContainerServiceCreateNetworkContainerRequest) (*V1beta1NetworkContainer, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1NetworkContainer + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkContainerServiceAPIService.NetworkContainerServiceCreateNetworkContainer") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/networkContainers" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.networkContainer == nil { + return localVarReturnValue, nil, reportError("networkContainer is required and must be specified") + } + + if r.validateOnly != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "validateOnly", r.validateOnly, "", "") + } + // 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.networkContainer + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiNetworkContainerServiceCreateVpcPeeringRequest struct { + ctx context.Context + ApiService *NetworkContainerServiceAPIService + vpcPeering *Dedicatedv1beta1VpcPeering +} + +func (r ApiNetworkContainerServiceCreateVpcPeeringRequest) VpcPeering(vpcPeering Dedicatedv1beta1VpcPeering) ApiNetworkContainerServiceCreateVpcPeeringRequest { + r.vpcPeering = &vpcPeering + return r +} + +func (r ApiNetworkContainerServiceCreateVpcPeeringRequest) Execute() (*Dedicatedv1beta1VpcPeering, *http.Response, error) { + return r.ApiService.NetworkContainerServiceCreateVpcPeeringExecute(r) +} + +/* +NetworkContainerServiceCreateVpcPeering Create a VPC peering + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiNetworkContainerServiceCreateVpcPeeringRequest +*/ +func (a *NetworkContainerServiceAPIService) NetworkContainerServiceCreateVpcPeering(ctx context.Context) ApiNetworkContainerServiceCreateVpcPeeringRequest { + return ApiNetworkContainerServiceCreateVpcPeeringRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return Dedicatedv1beta1VpcPeering +func (a *NetworkContainerServiceAPIService) NetworkContainerServiceCreateVpcPeeringExecute(r ApiNetworkContainerServiceCreateVpcPeeringRequest) (*Dedicatedv1beta1VpcPeering, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Dedicatedv1beta1VpcPeering + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkContainerServiceAPIService.NetworkContainerServiceCreateVpcPeering") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/vpcPeerings" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.vpcPeering == nil { + return localVarReturnValue, nil, reportError("vpcPeering 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.vpcPeering + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiNetworkContainerServiceDeleteNetworkContainerRequest struct { + ctx context.Context + ApiService *NetworkContainerServiceAPIService + networkContainerId string +} + +func (r ApiNetworkContainerServiceDeleteNetworkContainerRequest) Execute() (map[string]interface{}, *http.Response, error) { + return r.ApiService.NetworkContainerServiceDeleteNetworkContainerExecute(r) +} + +/* +NetworkContainerServiceDeleteNetworkContainer Delete a network container + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param networkContainerId + @return ApiNetworkContainerServiceDeleteNetworkContainerRequest +*/ +func (a *NetworkContainerServiceAPIService) NetworkContainerServiceDeleteNetworkContainer(ctx context.Context, networkContainerId string) ApiNetworkContainerServiceDeleteNetworkContainerRequest { + return ApiNetworkContainerServiceDeleteNetworkContainerRequest{ + ApiService: a, + ctx: ctx, + networkContainerId: networkContainerId, + } +} + +// Execute executes the request +// +// @return map[string]interface{} +func (a *NetworkContainerServiceAPIService) NetworkContainerServiceDeleteNetworkContainerExecute(r ApiNetworkContainerServiceDeleteNetworkContainerRequest) (map[string]interface{}, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkContainerServiceAPIService.NetworkContainerServiceDeleteNetworkContainer") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/networkContainers/{networkContainerId}" + localVarPath = strings.Replace(localVarPath, "{"+"networkContainerId"+"}", url.PathEscape(parameterValueToString(r.networkContainerId, "networkContainerId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiNetworkContainerServiceDeleteVpcPeeringRequest struct { + ctx context.Context + ApiService *NetworkContainerServiceAPIService + vpcPeeringId string +} + +func (r ApiNetworkContainerServiceDeleteVpcPeeringRequest) Execute() (map[string]interface{}, *http.Response, error) { + return r.ApiService.NetworkContainerServiceDeleteVpcPeeringExecute(r) +} + +/* +NetworkContainerServiceDeleteVpcPeering Delete a VPC peering + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param vpcPeeringId Format {cloud_provider}-{random_suffix} + @return ApiNetworkContainerServiceDeleteVpcPeeringRequest +*/ +func (a *NetworkContainerServiceAPIService) NetworkContainerServiceDeleteVpcPeering(ctx context.Context, vpcPeeringId string) ApiNetworkContainerServiceDeleteVpcPeeringRequest { + return ApiNetworkContainerServiceDeleteVpcPeeringRequest{ + ApiService: a, + ctx: ctx, + vpcPeeringId: vpcPeeringId, + } +} + +// Execute executes the request +// +// @return map[string]interface{} +func (a *NetworkContainerServiceAPIService) NetworkContainerServiceDeleteVpcPeeringExecute(r ApiNetworkContainerServiceDeleteVpcPeeringRequest) (map[string]interface{}, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkContainerServiceAPIService.NetworkContainerServiceDeleteVpcPeering") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/vpcPeerings/{vpcPeeringId}" + localVarPath = strings.Replace(localVarPath, "{"+"vpcPeeringId"+"}", url.PathEscape(parameterValueToString(r.vpcPeeringId, "vpcPeeringId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiNetworkContainerServiceGetNetworkContainerRequest struct { + ctx context.Context + ApiService *NetworkContainerServiceAPIService + networkContainerId string +} + +func (r ApiNetworkContainerServiceGetNetworkContainerRequest) Execute() (*V1beta1NetworkContainer, *http.Response, error) { + return r.ApiService.NetworkContainerServiceGetNetworkContainerExecute(r) +} + +/* +NetworkContainerServiceGetNetworkContainer Get a network container + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param networkContainerId + @return ApiNetworkContainerServiceGetNetworkContainerRequest +*/ +func (a *NetworkContainerServiceAPIService) NetworkContainerServiceGetNetworkContainer(ctx context.Context, networkContainerId string) ApiNetworkContainerServiceGetNetworkContainerRequest { + return ApiNetworkContainerServiceGetNetworkContainerRequest{ + ApiService: a, + ctx: ctx, + networkContainerId: networkContainerId, + } +} + +// Execute executes the request +// +// @return V1beta1NetworkContainer +func (a *NetworkContainerServiceAPIService) NetworkContainerServiceGetNetworkContainerExecute(r ApiNetworkContainerServiceGetNetworkContainerRequest) (*V1beta1NetworkContainer, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1NetworkContainer + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkContainerServiceAPIService.NetworkContainerServiceGetNetworkContainer") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/networkContainers/{networkContainerId}" + localVarPath = strings.Replace(localVarPath, "{"+"networkContainerId"+"}", url.PathEscape(parameterValueToString(r.networkContainerId, "networkContainerId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiNetworkContainerServiceGetVpcPeeringRequest struct { + ctx context.Context + ApiService *NetworkContainerServiceAPIService + vpcPeeringId string +} + +func (r ApiNetworkContainerServiceGetVpcPeeringRequest) Execute() (*Dedicatedv1beta1VpcPeering, *http.Response, error) { + return r.ApiService.NetworkContainerServiceGetVpcPeeringExecute(r) +} + +/* +NetworkContainerServiceGetVpcPeering Get a VPC peering + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param vpcPeeringId Format {cloud_provider}-{random_suffix} + @return ApiNetworkContainerServiceGetVpcPeeringRequest +*/ +func (a *NetworkContainerServiceAPIService) NetworkContainerServiceGetVpcPeering(ctx context.Context, vpcPeeringId string) ApiNetworkContainerServiceGetVpcPeeringRequest { + return ApiNetworkContainerServiceGetVpcPeeringRequest{ + ApiService: a, + ctx: ctx, + vpcPeeringId: vpcPeeringId, + } +} + +// Execute executes the request +// +// @return Dedicatedv1beta1VpcPeering +func (a *NetworkContainerServiceAPIService) NetworkContainerServiceGetVpcPeeringExecute(r ApiNetworkContainerServiceGetVpcPeeringRequest) (*Dedicatedv1beta1VpcPeering, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Dedicatedv1beta1VpcPeering + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkContainerServiceAPIService.NetworkContainerServiceGetVpcPeering") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/vpcPeerings/{vpcPeeringId}" + localVarPath = strings.Replace(localVarPath, "{"+"vpcPeeringId"+"}", url.PathEscape(parameterValueToString(r.vpcPeeringId, "vpcPeeringId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiNetworkContainerServiceListNetworkContainersRequest struct { + ctx context.Context + ApiService *NetworkContainerServiceAPIService + projectId *string + cloudProvider *PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter + pageSize *int32 + pageToken *string + skip *int32 +} + +// If unspecified, the project ID of default project is used. +func (r ApiNetworkContainerServiceListNetworkContainersRequest) ProjectId(projectId string) ApiNetworkContainerServiceListNetworkContainersRequest { + r.projectId = &projectId + return r +} + +// - aws: Amazon Web Services. buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - gcp: Google Cloud Platform. buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - azure: Microsoft Azure. buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE +func (r ApiNetworkContainerServiceListNetworkContainersRequest) CloudProvider(cloudProvider PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter) ApiNetworkContainerServiceListNetworkContainersRequest { + r.cloudProvider = &cloudProvider + return r +} + +// The maximum number of network containers to return. The service may return fewer than this value. If unspecified, at most X network containers will be returned. The maximum value is X; values above X will be coerced to X. +func (r ApiNetworkContainerServiceListNetworkContainersRequest) PageSize(pageSize int32) ApiNetworkContainerServiceListNetworkContainersRequest { + r.pageSize = &pageSize + return r +} + +// A page token, received from a previous `ListNetworkContainers` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListNetworkContainers` must match the call that provided the page token. +func (r ApiNetworkContainerServiceListNetworkContainersRequest) PageToken(pageToken string) ApiNetworkContainerServiceListNetworkContainersRequest { + r.pageToken = &pageToken + return r +} + +// The number of individual resources to skip before starting to return results. If the skip value causes the cursor to move past the end of the collection, the response will be 200 OK with an empty result set and no next_page_token. +func (r ApiNetworkContainerServiceListNetworkContainersRequest) Skip(skip int32) ApiNetworkContainerServiceListNetworkContainersRequest { + r.skip = &skip + return r +} + +func (r ApiNetworkContainerServiceListNetworkContainersRequest) Execute() (*V1beta1ListNetworkContainersResponse, *http.Response, error) { + return r.ApiService.NetworkContainerServiceListNetworkContainersExecute(r) +} + +/* +NetworkContainerServiceListNetworkContainers List network containers + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiNetworkContainerServiceListNetworkContainersRequest +*/ +func (a *NetworkContainerServiceAPIService) NetworkContainerServiceListNetworkContainers(ctx context.Context) ApiNetworkContainerServiceListNetworkContainersRequest { + return ApiNetworkContainerServiceListNetworkContainersRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return V1beta1ListNetworkContainersResponse +func (a *NetworkContainerServiceAPIService) NetworkContainerServiceListNetworkContainersExecute(r ApiNetworkContainerServiceListNetworkContainersRequest) (*V1beta1ListNetworkContainersResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1ListNetworkContainersResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkContainerServiceAPIService.NetworkContainerServiceListNetworkContainers") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/networkContainers" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.projectId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "projectId", r.projectId, "", "") + } + if r.cloudProvider != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "cloudProvider", r.cloudProvider, "", "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "", "") + } + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "", "") + } + if r.skip != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "skip", r.skip, "", "") + } + // 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiNetworkContainerServiceListVpcPeeringsRequest struct { + ctx context.Context + ApiService *NetworkContainerServiceAPIService + projectId *string + cloudProvider *PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter + pageSize *int32 + pageToken *string +} + +// If unspecified, the project ID of default project is used. +func (r ApiNetworkContainerServiceListVpcPeeringsRequest) ProjectId(projectId string) ApiNetworkContainerServiceListVpcPeeringsRequest { + r.projectId = &projectId + return r +} + +// If specified, only VPC peerings of the specified cloud provider will be returned. - aws: Amazon Web Services. buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - gcp: Google Cloud Platform. buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - azure: Microsoft Azure. buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE +func (r ApiNetworkContainerServiceListVpcPeeringsRequest) CloudProvider(cloudProvider PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter) ApiNetworkContainerServiceListVpcPeeringsRequest { + r.cloudProvider = &cloudProvider + return r +} + +// The maximum number of VPC peerings to return. The service may return fewer than this value. If unspecified, at most X VPC peerings will be returned. The maximum value is X; values above X will be coerced to X. +func (r ApiNetworkContainerServiceListVpcPeeringsRequest) PageSize(pageSize int32) ApiNetworkContainerServiceListVpcPeeringsRequest { + r.pageSize = &pageSize + return r +} + +// A page token, received from a previous `ListVpcPeerings` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListVpcPeerings` must match the call that provided the page token. +func (r ApiNetworkContainerServiceListVpcPeeringsRequest) PageToken(pageToken string) ApiNetworkContainerServiceListVpcPeeringsRequest { + r.pageToken = &pageToken + return r +} + +func (r ApiNetworkContainerServiceListVpcPeeringsRequest) Execute() (*Dedicatedv1beta1ListVpcPeeringsResponse, *http.Response, error) { + return r.ApiService.NetworkContainerServiceListVpcPeeringsExecute(r) +} + +/* +NetworkContainerServiceListVpcPeerings List VPC peerings + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiNetworkContainerServiceListVpcPeeringsRequest +*/ +func (a *NetworkContainerServiceAPIService) NetworkContainerServiceListVpcPeerings(ctx context.Context) ApiNetworkContainerServiceListVpcPeeringsRequest { + return ApiNetworkContainerServiceListVpcPeeringsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return Dedicatedv1beta1ListVpcPeeringsResponse +func (a *NetworkContainerServiceAPIService) NetworkContainerServiceListVpcPeeringsExecute(r ApiNetworkContainerServiceListVpcPeeringsRequest) (*Dedicatedv1beta1ListVpcPeeringsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Dedicatedv1beta1ListVpcPeeringsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "NetworkContainerServiceAPIService.NetworkContainerServiceListVpcPeerings") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/vpcPeerings" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.projectId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "projectId", r.projectId, "", "") + } + if r.cloudProvider != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "cloudProvider", r.cloudProvider, "", "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "", "") + } + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "", "") + } + // 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/api_private_endpoint_connection_service.go b/pkg/tidbcloud/v1beta1/dedicated/api_private_endpoint_connection_service.go new file mode 100644 index 00000000..cb6cf4b4 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/api_private_endpoint_connection_service.go @@ -0,0 +1,1017 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// PrivateEndpointConnectionServiceAPIService PrivateEndpointConnectionServiceAPI service +type PrivateEndpointConnectionServiceAPIService service + +type ApiPrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest struct { + ctx context.Context + ApiService *PrivateEndpointConnectionServiceAPIService + clusterId string + privateEndpointConnectionTidbNodeGroupId string + privateEndpointConnection *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest + validateOnly *bool +} + +func (r ApiPrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) PrivateEndpointConnection(privateEndpointConnection PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) ApiPrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest { + r.privateEndpointConnection = &privateEndpointConnection + return r +} + +// Default is false. If true, the request will not be applied and only validation will be performed. At present, this field is only available for Azure provider. +func (r ApiPrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) ValidateOnly(validateOnly bool) ApiPrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest { + r.validateOnly = &validateOnly + return r +} + +func (r ApiPrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) Execute() (*V1beta1PrivateEndpointConnection, *http.Response, error) { + return r.ApiService.PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionExecute(r) +} + +/* +PrivateEndpointConnectionServiceCreatePrivateEndpointConnection Create a private endpoint connection + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @param privateEndpointConnectionTidbNodeGroupId + @return ApiPrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest +*/ +func (a *PrivateEndpointConnectionServiceAPIService) PrivateEndpointConnectionServiceCreatePrivateEndpointConnection(ctx context.Context, clusterId string, privateEndpointConnectionTidbNodeGroupId string) ApiPrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest { + return ApiPrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + privateEndpointConnectionTidbNodeGroupId: privateEndpointConnectionTidbNodeGroupId, + } +} + +// Execute executes the request +// +// @return V1beta1PrivateEndpointConnection +func (a *PrivateEndpointConnectionServiceAPIService) PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionExecute(r ApiPrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) (*V1beta1PrivateEndpointConnection, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1PrivateEndpointConnection + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PrivateEndpointConnectionServiceAPIService.PrivateEndpointConnectionServiceCreatePrivateEndpointConnection") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/tidbNodeGroups/{privateEndpointConnection.tidbNodeGroupId}/privateEndpointConnections" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"privateEndpointConnection.tidbNodeGroupId"+"}", url.PathEscape(parameterValueToString(r.privateEndpointConnectionTidbNodeGroupId, "privateEndpointConnectionTidbNodeGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.privateEndpointConnection == nil { + return localVarReturnValue, nil, reportError("privateEndpointConnection is required and must be specified") + } + + if r.validateOnly != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "validateOnly", r.validateOnly, "", "") + } + // 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.privateEndpointConnection + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiPrivateEndpointConnectionServiceDeletePrivateEndpointConnectionRequest struct { + ctx context.Context + ApiService *PrivateEndpointConnectionServiceAPIService + clusterId string + tidbNodeGroupId string + privateEndpointConnectionId string +} + +func (r ApiPrivateEndpointConnectionServiceDeletePrivateEndpointConnectionRequest) Execute() (map[string]interface{}, *http.Response, error) { + return r.ApiService.PrivateEndpointConnectionServiceDeletePrivateEndpointConnectionExecute(r) +} + +/* +PrivateEndpointConnectionServiceDeletePrivateEndpointConnection Delete a private endpoint connection + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @param tidbNodeGroupId + @param privateEndpointConnectionId + @return ApiPrivateEndpointConnectionServiceDeletePrivateEndpointConnectionRequest +*/ +func (a *PrivateEndpointConnectionServiceAPIService) PrivateEndpointConnectionServiceDeletePrivateEndpointConnection(ctx context.Context, clusterId string, tidbNodeGroupId string, privateEndpointConnectionId string) ApiPrivateEndpointConnectionServiceDeletePrivateEndpointConnectionRequest { + return ApiPrivateEndpointConnectionServiceDeletePrivateEndpointConnectionRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + tidbNodeGroupId: tidbNodeGroupId, + privateEndpointConnectionId: privateEndpointConnectionId, + } +} + +// Execute executes the request +// +// @return map[string]interface{} +func (a *PrivateEndpointConnectionServiceAPIService) PrivateEndpointConnectionServiceDeletePrivateEndpointConnectionExecute(r ApiPrivateEndpointConnectionServiceDeletePrivateEndpointConnectionRequest) (map[string]interface{}, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PrivateEndpointConnectionServiceAPIService.PrivateEndpointConnectionServiceDeletePrivateEndpointConnection") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}/privateEndpointConnections/{privateEndpointConnectionId}" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tidbNodeGroupId"+"}", url.PathEscape(parameterValueToString(r.tidbNodeGroupId, "tidbNodeGroupId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"privateEndpointConnectionId"+"}", url.PathEscape(parameterValueToString(r.privateEndpointConnectionId, "privateEndpointConnectionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiPrivateEndpointConnectionServiceGetPrivateEndpointConnectionRequest struct { + ctx context.Context + ApiService *PrivateEndpointConnectionServiceAPIService + clusterId string + tidbNodeGroupId string + privateEndpointConnectionId string +} + +func (r ApiPrivateEndpointConnectionServiceGetPrivateEndpointConnectionRequest) Execute() (*V1beta1PrivateEndpointConnection, *http.Response, error) { + return r.ApiService.PrivateEndpointConnectionServiceGetPrivateEndpointConnectionExecute(r) +} + +/* +PrivateEndpointConnectionServiceGetPrivateEndpointConnection Get a private endpoint connection + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @param tidbNodeGroupId + @param privateEndpointConnectionId + @return ApiPrivateEndpointConnectionServiceGetPrivateEndpointConnectionRequest +*/ +func (a *PrivateEndpointConnectionServiceAPIService) PrivateEndpointConnectionServiceGetPrivateEndpointConnection(ctx context.Context, clusterId string, tidbNodeGroupId string, privateEndpointConnectionId string) ApiPrivateEndpointConnectionServiceGetPrivateEndpointConnectionRequest { + return ApiPrivateEndpointConnectionServiceGetPrivateEndpointConnectionRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + tidbNodeGroupId: tidbNodeGroupId, + privateEndpointConnectionId: privateEndpointConnectionId, + } +} + +// Execute executes the request +// +// @return V1beta1PrivateEndpointConnection +func (a *PrivateEndpointConnectionServiceAPIService) PrivateEndpointConnectionServiceGetPrivateEndpointConnectionExecute(r ApiPrivateEndpointConnectionServiceGetPrivateEndpointConnectionRequest) (*V1beta1PrivateEndpointConnection, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1PrivateEndpointConnection + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PrivateEndpointConnectionServiceAPIService.PrivateEndpointConnectionServiceGetPrivateEndpointConnection") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}/privateEndpointConnections/{privateEndpointConnectionId}" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tidbNodeGroupId"+"}", url.PathEscape(parameterValueToString(r.tidbNodeGroupId, "tidbNodeGroupId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"privateEndpointConnectionId"+"}", url.PathEscape(parameterValueToString(r.privateEndpointConnectionId, "privateEndpointConnectionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiPrivateEndpointConnectionServiceGetPrivateLinkServiceRequest struct { + ctx context.Context + ApiService *PrivateEndpointConnectionServiceAPIService + clusterId string + tidbNodeGroupId string +} + +func (r ApiPrivateEndpointConnectionServiceGetPrivateLinkServiceRequest) Execute() (*Dedicatedv1beta1PrivateLinkService, *http.Response, error) { + return r.ApiService.PrivateEndpointConnectionServiceGetPrivateLinkServiceExecute(r) +} + +/* +PrivateEndpointConnectionServiceGetPrivateLinkService Get the private link service of a TiDB Node Group + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @param tidbNodeGroupId + @return ApiPrivateEndpointConnectionServiceGetPrivateLinkServiceRequest +*/ +func (a *PrivateEndpointConnectionServiceAPIService) PrivateEndpointConnectionServiceGetPrivateLinkService(ctx context.Context, clusterId string, tidbNodeGroupId string) ApiPrivateEndpointConnectionServiceGetPrivateLinkServiceRequest { + return ApiPrivateEndpointConnectionServiceGetPrivateLinkServiceRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + tidbNodeGroupId: tidbNodeGroupId, + } +} + +// Execute executes the request +// +// @return Dedicatedv1beta1PrivateLinkService +func (a *PrivateEndpointConnectionServiceAPIService) PrivateEndpointConnectionServiceGetPrivateLinkServiceExecute(r ApiPrivateEndpointConnectionServiceGetPrivateLinkServiceRequest) (*Dedicatedv1beta1PrivateLinkService, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Dedicatedv1beta1PrivateLinkService + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PrivateEndpointConnectionServiceAPIService.PrivateEndpointConnectionServiceGetPrivateLinkService") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}/privateLinkService" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tidbNodeGroupId"+"}", url.PathEscape(parameterValueToString(r.tidbNodeGroupId, "tidbNodeGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiPrivateEndpointConnectionServiceListPrivateEndpointConnectionsRequest struct { + ctx context.Context + ApiService *PrivateEndpointConnectionServiceAPIService + clusterId string + tidbNodeGroupId string + projectId *string + cloudProvider *PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter + pageSize *int32 + pageToken *string + skip *int32 +} + +// Pass this project_id only when listing under a project across different clusters and TiDB groups. Both cluster_id and tidb_node_group_id should be set to \"-\" in this case. If unspecified, the project ID of the cluster is used. +func (r ApiPrivateEndpointConnectionServiceListPrivateEndpointConnectionsRequest) ProjectId(projectId string) ApiPrivateEndpointConnectionServiceListPrivateEndpointConnectionsRequest { + r.projectId = &projectId + return r +} + +// If specified, only private link connections of the specified cloud provider will be returned. - aws: Amazon Web Services. buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - gcp: Google Cloud Platform. buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - azure: Microsoft Azure. buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE +func (r ApiPrivateEndpointConnectionServiceListPrivateEndpointConnectionsRequest) CloudProvider(cloudProvider PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter) ApiPrivateEndpointConnectionServiceListPrivateEndpointConnectionsRequest { + r.cloudProvider = &cloudProvider + return r +} + +// The maximum number of private link connections to return. The service may return fewer than this value. If unspecified, at most X private link connections will be returned. The maximum value is X; values above X will be coerced to X. +func (r ApiPrivateEndpointConnectionServiceListPrivateEndpointConnectionsRequest) PageSize(pageSize int32) ApiPrivateEndpointConnectionServiceListPrivateEndpointConnectionsRequest { + r.pageSize = &pageSize + return r +} + +// A page token, received from a previous `ListPrivateLinkConnections` call. Provide this to retrieve the subsequent page. +func (r ApiPrivateEndpointConnectionServiceListPrivateEndpointConnectionsRequest) PageToken(pageToken string) ApiPrivateEndpointConnectionServiceListPrivateEndpointConnectionsRequest { + r.pageToken = &pageToken + return r +} + +// The number of individual resources to skip before starting to return results. If the skip value causes the cursor to move past the end of the collection, the response will be 200 OK with an empty result set and no next_page_token. +func (r ApiPrivateEndpointConnectionServiceListPrivateEndpointConnectionsRequest) Skip(skip int32) ApiPrivateEndpointConnectionServiceListPrivateEndpointConnectionsRequest { + r.skip = &skip + return r +} + +func (r ApiPrivateEndpointConnectionServiceListPrivateEndpointConnectionsRequest) Execute() (*V1beta1ListPrivateEndpointConnectionsResponse, *http.Response, error) { + return r.ApiService.PrivateEndpointConnectionServiceListPrivateEndpointConnectionsExecute(r) +} + +/* +PrivateEndpointConnectionServiceListPrivateEndpointConnections List private endpoint connections + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId To list private link connections across different clusters and TiDB groups, set cluster_id to \"-\". + @param tidbNodeGroupId To list private link connections across different clusters and TiDB groups, set tidb_node_group_id to \"-\". + @return ApiPrivateEndpointConnectionServiceListPrivateEndpointConnectionsRequest +*/ +func (a *PrivateEndpointConnectionServiceAPIService) PrivateEndpointConnectionServiceListPrivateEndpointConnections(ctx context.Context, clusterId string, tidbNodeGroupId string) ApiPrivateEndpointConnectionServiceListPrivateEndpointConnectionsRequest { + return ApiPrivateEndpointConnectionServiceListPrivateEndpointConnectionsRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + tidbNodeGroupId: tidbNodeGroupId, + } +} + +// Execute executes the request +// +// @return V1beta1ListPrivateEndpointConnectionsResponse +func (a *PrivateEndpointConnectionServiceAPIService) PrivateEndpointConnectionServiceListPrivateEndpointConnectionsExecute(r ApiPrivateEndpointConnectionServiceListPrivateEndpointConnectionsRequest) (*V1beta1ListPrivateEndpointConnectionsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1ListPrivateEndpointConnectionsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "PrivateEndpointConnectionServiceAPIService.PrivateEndpointConnectionServiceListPrivateEndpointConnections") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}/privateEndpointConnections" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tidbNodeGroupId"+"}", url.PathEscape(parameterValueToString(r.tidbNodeGroupId, "tidbNodeGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.projectId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "projectId", r.projectId, "", "") + } + if r.cloudProvider != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "cloudProvider", r.cloudProvider, "", "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "", "") + } + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "", "") + } + if r.skip != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "skip", r.skip, "", "") + } + // 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/api_region_service.go b/pkg/tidbcloud/v1beta1/dedicated/api_region_service.go new file mode 100644 index 00000000..323d98ad --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/api_region_service.go @@ -0,0 +1,1048 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// RegionServiceAPIService RegionServiceAPI service +type RegionServiceAPIService service + +type ApiRegionServiceGetNodeSpecRequest struct { + ctx context.Context + ApiService *RegionServiceAPIService + regionId string + componentType ClusterServiceListNodeInstancesComponentTypeParameter + nodeSpecKey string + projectId *string +} + +// If unspecified, the project ID of default project is used. +func (r ApiRegionServiceGetNodeSpecRequest) ProjectId(projectId string) ApiRegionServiceGetNodeSpecRequest { + r.projectId = &projectId + return r +} + +func (r ApiRegionServiceGetNodeSpecRequest) Execute() (*Dedicatedv1beta1NodeSpec, *http.Response, error) { + return r.ApiService.RegionServiceGetNodeSpecExecute(r) +} + +/* +RegionServiceGetNodeSpec Get a node spec + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param regionId Format: {cloud_provider}-{region_code} + @param componentType + @param nodeSpecKey + @return ApiRegionServiceGetNodeSpecRequest +*/ +func (a *RegionServiceAPIService) RegionServiceGetNodeSpec(ctx context.Context, regionId string, componentType ClusterServiceListNodeInstancesComponentTypeParameter, nodeSpecKey string) ApiRegionServiceGetNodeSpecRequest { + return ApiRegionServiceGetNodeSpecRequest{ + ApiService: a, + ctx: ctx, + regionId: regionId, + componentType: componentType, + nodeSpecKey: nodeSpecKey, + } +} + +// Execute executes the request +// +// @return Dedicatedv1beta1NodeSpec +func (a *RegionServiceAPIService) RegionServiceGetNodeSpecExecute(r ApiRegionServiceGetNodeSpecRequest) (*Dedicatedv1beta1NodeSpec, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Dedicatedv1beta1NodeSpec + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RegionServiceAPIService.RegionServiceGetNodeSpec") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/regions/{regionId}/componentTypes/{componentType}/nodeSpecs/{nodeSpecKey}" + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"componentType"+"}", url.PathEscape(parameterValueToString(r.componentType, "componentType")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"nodeSpecKey"+"}", url.PathEscape(parameterValueToString(r.nodeSpecKey, "nodeSpecKey")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.projectId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "projectId", r.projectId, "", "") + } + // 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiRegionServiceGetRegionRequest struct { + ctx context.Context + ApiService *RegionServiceAPIService + regionId string + projectId *string +} + +// If unspecified, the project ID of default project is used. +func (r ApiRegionServiceGetRegionRequest) ProjectId(projectId string) ApiRegionServiceGetRegionRequest { + r.projectId = &projectId + return r +} + +func (r ApiRegionServiceGetRegionRequest) Execute() (*Commonv1beta1Region, *http.Response, error) { + return r.ApiService.RegionServiceGetRegionExecute(r) +} + +/* +RegionServiceGetRegion Get a region + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param regionId Format: {cloud_provider}-{region_code} + @return ApiRegionServiceGetRegionRequest +*/ +func (a *RegionServiceAPIService) RegionServiceGetRegion(ctx context.Context, regionId string) ApiRegionServiceGetRegionRequest { + return ApiRegionServiceGetRegionRequest{ + ApiService: a, + ctx: ctx, + regionId: regionId, + } +} + +// Execute executes the request +// +// @return Commonv1beta1Region +func (a *RegionServiceAPIService) RegionServiceGetRegionExecute(r ApiRegionServiceGetRegionRequest) (*Commonv1beta1Region, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Commonv1beta1Region + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RegionServiceAPIService.RegionServiceGetRegion") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/regions/{regionId}" + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.projectId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "projectId", r.projectId, "", "") + } + // 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiRegionServiceListNodeSpecsRequest struct { + ctx context.Context + ApiService *RegionServiceAPIService + regionId string + componentType *ClusterServiceListNodeInstancesComponentTypeParameter + projectId *string + pageSize *int32 + pageToken *string + skip *int32 +} + +// If specified, only node specs of the specified component type will be returned. +func (r ApiRegionServiceListNodeSpecsRequest) ComponentType(componentType ClusterServiceListNodeInstancesComponentTypeParameter) ApiRegionServiceListNodeSpecsRequest { + r.componentType = &componentType + return r +} + +// If unspecified, the project ID of default project is used. +func (r ApiRegionServiceListNodeSpecsRequest) ProjectId(projectId string) ApiRegionServiceListNodeSpecsRequest { + r.projectId = &projectId + return r +} + +// The maximum number of node specs to return. The service may return fewer than this value. If unspecified, at most X node specs will be returned. The maximum value is X; values above X will be coerced to X. +func (r ApiRegionServiceListNodeSpecsRequest) PageSize(pageSize int32) ApiRegionServiceListNodeSpecsRequest { + r.pageSize = &pageSize + return r +} + +// A page token, received from a previous `ListNodeSpecs` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListNodeSpecs` must match the call that provided the page token. +func (r ApiRegionServiceListNodeSpecsRequest) PageToken(pageToken string) ApiRegionServiceListNodeSpecsRequest { + r.pageToken = &pageToken + return r +} + +// The number of individual resources to skip before starting to return results. If the skip value causes the cursor to move past the end of the collection, the response will be 200 OK with an empty result set and no next_page_token. +func (r ApiRegionServiceListNodeSpecsRequest) Skip(skip int32) ApiRegionServiceListNodeSpecsRequest { + r.skip = &skip + return r +} + +func (r ApiRegionServiceListNodeSpecsRequest) Execute() (*V1beta1ListNodeSpecsResponse, *http.Response, error) { + return r.ApiService.RegionServiceListNodeSpecsExecute(r) +} + +/* +RegionServiceListNodeSpecs List node specs for creating or scaling a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param regionId Format: {cloud_provider}-{region_code} + @return ApiRegionServiceListNodeSpecsRequest +*/ +func (a *RegionServiceAPIService) RegionServiceListNodeSpecs(ctx context.Context, regionId string) ApiRegionServiceListNodeSpecsRequest { + return ApiRegionServiceListNodeSpecsRequest{ + ApiService: a, + ctx: ctx, + regionId: regionId, + } +} + +// Execute executes the request +// +// @return V1beta1ListNodeSpecsResponse +func (a *RegionServiceAPIService) RegionServiceListNodeSpecsExecute(r ApiRegionServiceListNodeSpecsRequest) (*V1beta1ListNodeSpecsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1ListNodeSpecsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RegionServiceAPIService.RegionServiceListNodeSpecs") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/regions/{regionId}/nodeSpecs" + localVarPath = strings.Replace(localVarPath, "{"+"regionId"+"}", url.PathEscape(parameterValueToString(r.regionId, "regionId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.componentType != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "componentType", r.componentType, "", "") + } + if r.projectId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "projectId", r.projectId, "", "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "", "") + } + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "", "") + } + if r.skip != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "skip", r.skip, "", "") + } + // 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiRegionServiceListRegionsRequest struct { + ctx context.Context + ApiService *RegionServiceAPIService + cloudProvider *string + projectId *string + pageSize *int32 + pageToken *string + skip *int32 +} + +// If specified, only regions of the specified cloud provider will be returned. +func (r ApiRegionServiceListRegionsRequest) CloudProvider(cloudProvider string) ApiRegionServiceListRegionsRequest { + r.cloudProvider = &cloudProvider + return r +} + +// If unspecified, the project ID of default project is used. +func (r ApiRegionServiceListRegionsRequest) ProjectId(projectId string) ApiRegionServiceListRegionsRequest { + r.projectId = &projectId + return r +} + +// The maximum number of regions to return. The service may return fewer than this value. If unspecified, at most X regions will be returned. The maximum value is X; values above X will be coerced to X. +func (r ApiRegionServiceListRegionsRequest) PageSize(pageSize int32) ApiRegionServiceListRegionsRequest { + r.pageSize = &pageSize + return r +} + +// A page token, received from a previous `ListRegions` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListRegions` must match the call that provided the page token. +func (r ApiRegionServiceListRegionsRequest) PageToken(pageToken string) ApiRegionServiceListRegionsRequest { + r.pageToken = &pageToken + return r +} + +// The number of individual resources to skip before starting to return results. If the skip value causes the cursor to move past the end of the collection, the response will be 200 OK with an empty result set and no next_page_token. +func (r ApiRegionServiceListRegionsRequest) Skip(skip int32) ApiRegionServiceListRegionsRequest { + r.skip = &skip + return r +} + +func (r ApiRegionServiceListRegionsRequest) Execute() (*TidbCloudOpenApidedicatedv1beta1ListRegionsResponse, *http.Response, error) { + return r.ApiService.RegionServiceListRegionsExecute(r) +} + +/* +RegionServiceListRegions List regions for creating a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiRegionServiceListRegionsRequest +*/ +func (a *RegionServiceAPIService) RegionServiceListRegions(ctx context.Context) ApiRegionServiceListRegionsRequest { + return ApiRegionServiceListRegionsRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return TidbCloudOpenApidedicatedv1beta1ListRegionsResponse +func (a *RegionServiceAPIService) RegionServiceListRegionsExecute(r ApiRegionServiceListRegionsRequest) (*TidbCloudOpenApidedicatedv1beta1ListRegionsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RegionServiceAPIService.RegionServiceListRegions") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/regions" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.cloudProvider != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "cloudProvider", r.cloudProvider, "", "") + } + if r.projectId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "projectId", r.projectId, "", "") + } + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "", "") + } + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "", "") + } + if r.skip != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "skip", r.skip, "", "") + } + // 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiRegionServiceShowCloudProvidersRequest struct { + ctx context.Context + ApiService *RegionServiceAPIService + projectId *string +} + +// If unspecified, the project ID of default project is used. +func (r ApiRegionServiceShowCloudProvidersRequest) ProjectId(projectId string) ApiRegionServiceShowCloudProvidersRequest { + r.projectId = &projectId + return r +} + +func (r ApiRegionServiceShowCloudProvidersRequest) Execute() (*V1beta1ShowCloudProvidersResponse, *http.Response, error) { + return r.ApiService.RegionServiceShowCloudProvidersExecute(r) +} + +/* +RegionServiceShowCloudProviders Show cloud providers for creating a cluster + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @return ApiRegionServiceShowCloudProvidersRequest +*/ +func (a *RegionServiceAPIService) RegionServiceShowCloudProviders(ctx context.Context) ApiRegionServiceShowCloudProvidersRequest { + return ApiRegionServiceShowCloudProvidersRequest{ + ApiService: a, + ctx: ctx, + } +} + +// Execute executes the request +// +// @return V1beta1ShowCloudProvidersResponse +func (a *RegionServiceAPIService) RegionServiceShowCloudProvidersExecute(r ApiRegionServiceShowCloudProvidersRequest) (*V1beta1ShowCloudProvidersResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1ShowCloudProvidersResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "RegionServiceAPIService.RegionServiceShowCloudProviders") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/regions:showCloudProviders" + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.projectId != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "projectId", r.projectId, "", "") + } + // 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/api_tidb_node_group_service.go b/pkg/tidbcloud/v1beta1/dedicated/api_tidb_node_group_service.go new file mode 100644 index 00000000..a1a018c8 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/api_tidb_node_group_service.go @@ -0,0 +1,1399 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "bytes" + "context" + "io" + "net/http" + "net/url" + "strings" +) + +// TidbNodeGroupServiceAPIService TidbNodeGroupServiceAPI service +type TidbNodeGroupServiceAPIService service + +type ApiTidbNodeGroupServiceCreateTidbNodeGroupRequest struct { + ctx context.Context + ApiService *TidbNodeGroupServiceAPIService + tidbNodeGroupClusterId string + tidbNodeGroup *TidbNodeGroupServiceCreateTidbNodeGroupRequest + validateOnly *bool +} + +func (r ApiTidbNodeGroupServiceCreateTidbNodeGroupRequest) TidbNodeGroup(tidbNodeGroup TidbNodeGroupServiceCreateTidbNodeGroupRequest) ApiTidbNodeGroupServiceCreateTidbNodeGroupRequest { + r.tidbNodeGroup = &tidbNodeGroup + return r +} + +// if validate_only is true, the request will be validated but not executed. +func (r ApiTidbNodeGroupServiceCreateTidbNodeGroupRequest) ValidateOnly(validateOnly bool) ApiTidbNodeGroupServiceCreateTidbNodeGroupRequest { + r.validateOnly = &validateOnly + return r +} + +func (r ApiTidbNodeGroupServiceCreateTidbNodeGroupRequest) Execute() (*Dedicatedv1beta1TidbNodeGroup, *http.Response, error) { + return r.ApiService.TidbNodeGroupServiceCreateTidbNodeGroupExecute(r) +} + +/* +TidbNodeGroupServiceCreateTidbNodeGroup Create a TiDB Node Group + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param tidbNodeGroupClusterId The cluster ID of the TiDB group. Optional when creating cluster with the default TiDB group. Required when creating non-default TiDB group. + @return ApiTidbNodeGroupServiceCreateTidbNodeGroupRequest +*/ +func (a *TidbNodeGroupServiceAPIService) TidbNodeGroupServiceCreateTidbNodeGroup(ctx context.Context, tidbNodeGroupClusterId string) ApiTidbNodeGroupServiceCreateTidbNodeGroupRequest { + return ApiTidbNodeGroupServiceCreateTidbNodeGroupRequest{ + ApiService: a, + ctx: ctx, + tidbNodeGroupClusterId: tidbNodeGroupClusterId, + } +} + +// Execute executes the request +// +// @return Dedicatedv1beta1TidbNodeGroup +func (a *TidbNodeGroupServiceAPIService) TidbNodeGroupServiceCreateTidbNodeGroupExecute(r ApiTidbNodeGroupServiceCreateTidbNodeGroupRequest) (*Dedicatedv1beta1TidbNodeGroup, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPost + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Dedicatedv1beta1TidbNodeGroup + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TidbNodeGroupServiceAPIService.TidbNodeGroupServiceCreateTidbNodeGroup") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{tidbNodeGroup.clusterId}/tidbNodeGroups" + localVarPath = strings.Replace(localVarPath, "{"+"tidbNodeGroup.clusterId"+"}", url.PathEscape(parameterValueToString(r.tidbNodeGroupClusterId, "tidbNodeGroupClusterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.tidbNodeGroup == nil { + return localVarReturnValue, nil, reportError("tidbNodeGroup is required and must be specified") + } + + if r.validateOnly != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "validateOnly", r.validateOnly, "", "") + } + // 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.tidbNodeGroup + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiTidbNodeGroupServiceDeleteTidbNodeGroupRequest struct { + ctx context.Context + ApiService *TidbNodeGroupServiceAPIService + clusterId string + tidbNodeGroupId string + validateOnly *bool +} + +// if validate_only is true, the request will be validated but not executed. +func (r ApiTidbNodeGroupServiceDeleteTidbNodeGroupRequest) ValidateOnly(validateOnly bool) ApiTidbNodeGroupServiceDeleteTidbNodeGroupRequest { + r.validateOnly = &validateOnly + return r +} + +func (r ApiTidbNodeGroupServiceDeleteTidbNodeGroupRequest) Execute() (map[string]interface{}, *http.Response, error) { + return r.ApiService.TidbNodeGroupServiceDeleteTidbNodeGroupExecute(r) +} + +/* +TidbNodeGroupServiceDeleteTidbNodeGroup Delete a TiDB Node Group + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @param tidbNodeGroupId + @return ApiTidbNodeGroupServiceDeleteTidbNodeGroupRequest +*/ +func (a *TidbNodeGroupServiceAPIService) TidbNodeGroupServiceDeleteTidbNodeGroup(ctx context.Context, clusterId string, tidbNodeGroupId string) ApiTidbNodeGroupServiceDeleteTidbNodeGroupRequest { + return ApiTidbNodeGroupServiceDeleteTidbNodeGroupRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + tidbNodeGroupId: tidbNodeGroupId, + } +} + +// Execute executes the request +// +// @return map[string]interface{} +func (a *TidbNodeGroupServiceAPIService) TidbNodeGroupServiceDeleteTidbNodeGroupExecute(r ApiTidbNodeGroupServiceDeleteTidbNodeGroupRequest) (map[string]interface{}, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodDelete + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue map[string]interface{} + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TidbNodeGroupServiceAPIService.TidbNodeGroupServiceDeleteTidbNodeGroup") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tidbNodeGroupId"+"}", url.PathEscape(parameterValueToString(r.tidbNodeGroupId, "tidbNodeGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.validateOnly != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "validateOnly", r.validateOnly, "", "") + } + // 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiTidbNodeGroupServiceGetPublicEndpointSettingRequest struct { + ctx context.Context + ApiService *TidbNodeGroupServiceAPIService + clusterId string + tidbNodeGroupId string +} + +func (r ApiTidbNodeGroupServiceGetPublicEndpointSettingRequest) Execute() (*V1beta1PublicEndpointSetting, *http.Response, error) { + return r.ApiService.TidbNodeGroupServiceGetPublicEndpointSettingExecute(r) +} + +/* +TidbNodeGroupServiceGetPublicEndpointSetting Get the public endpoint setting of a TiDB Node Group + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @param tidbNodeGroupId + @return ApiTidbNodeGroupServiceGetPublicEndpointSettingRequest +*/ +func (a *TidbNodeGroupServiceAPIService) TidbNodeGroupServiceGetPublicEndpointSetting(ctx context.Context, clusterId string, tidbNodeGroupId string) ApiTidbNodeGroupServiceGetPublicEndpointSettingRequest { + return ApiTidbNodeGroupServiceGetPublicEndpointSettingRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + tidbNodeGroupId: tidbNodeGroupId, + } +} + +// Execute executes the request +// +// @return V1beta1PublicEndpointSetting +func (a *TidbNodeGroupServiceAPIService) TidbNodeGroupServiceGetPublicEndpointSettingExecute(r ApiTidbNodeGroupServiceGetPublicEndpointSettingRequest) (*V1beta1PublicEndpointSetting, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1PublicEndpointSetting + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TidbNodeGroupServiceAPIService.TidbNodeGroupServiceGetPublicEndpointSetting") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}/publicEndpointSetting" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tidbNodeGroupId"+"}", url.PathEscape(parameterValueToString(r.tidbNodeGroupId, "tidbNodeGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiTidbNodeGroupServiceGetTidbNodeGroupRequest struct { + ctx context.Context + ApiService *TidbNodeGroupServiceAPIService + clusterId string + tidbNodeGroupId string +} + +func (r ApiTidbNodeGroupServiceGetTidbNodeGroupRequest) Execute() (*Dedicatedv1beta1TidbNodeGroup, *http.Response, error) { + return r.ApiService.TidbNodeGroupServiceGetTidbNodeGroupExecute(r) +} + +/* +TidbNodeGroupServiceGetTidbNodeGroup Get a TiDB Node Group + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @param tidbNodeGroupId + @return ApiTidbNodeGroupServiceGetTidbNodeGroupRequest +*/ +func (a *TidbNodeGroupServiceAPIService) TidbNodeGroupServiceGetTidbNodeGroup(ctx context.Context, clusterId string, tidbNodeGroupId string) ApiTidbNodeGroupServiceGetTidbNodeGroupRequest { + return ApiTidbNodeGroupServiceGetTidbNodeGroupRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + tidbNodeGroupId: tidbNodeGroupId, + } +} + +// Execute executes the request +// +// @return Dedicatedv1beta1TidbNodeGroup +func (a *TidbNodeGroupServiceAPIService) TidbNodeGroupServiceGetTidbNodeGroupExecute(r ApiTidbNodeGroupServiceGetTidbNodeGroupRequest) (*Dedicatedv1beta1TidbNodeGroup, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Dedicatedv1beta1TidbNodeGroup + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TidbNodeGroupServiceAPIService.TidbNodeGroupServiceGetTidbNodeGroup") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/tidbNodeGroups/{tidbNodeGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tidbNodeGroupId"+"}", url.PathEscape(parameterValueToString(r.tidbNodeGroupId, "tidbNodeGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + // to determine the Content-Type header + localVarHTTPContentTypes := []string{} + + // set Content-Type header + localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) + if localVarHTTPContentType != "" { + localVarHeaderParams["Content-Type"] = localVarHTTPContentType + } + + // to determine the Accept header + localVarHTTPHeaderAccepts := []string{"application/json"} + + // set Accept header + localVarHTTPHeaderAccept := selectHeaderAccept(localVarHTTPHeaderAccepts) + if localVarHTTPHeaderAccept != "" { + localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiTidbNodeGroupServiceListTidbNodeGroupsRequest struct { + ctx context.Context + ApiService *TidbNodeGroupServiceAPIService + clusterId string + pageSize *int32 + pageToken *string + skip *int32 +} + +// The maximum number of TiDB groups to return. The service may return fewer than this value. If unspecified, at most X TiDB groups will be returned. The maximum value is X; values above X will be coerced to X. +func (r ApiTidbNodeGroupServiceListTidbNodeGroupsRequest) PageSize(pageSize int32) ApiTidbNodeGroupServiceListTidbNodeGroupsRequest { + r.pageSize = &pageSize + return r +} + +// A page token, received from a previous `ListTidbNodeGroups` call. Provide this to retrieve the subsequent page. When paginating, all other parameters provided to `ListTidbNodeGroups` must match the call that provided the page token. +func (r ApiTidbNodeGroupServiceListTidbNodeGroupsRequest) PageToken(pageToken string) ApiTidbNodeGroupServiceListTidbNodeGroupsRequest { + r.pageToken = &pageToken + return r +} + +// The number of individual resources to skip before starting to return results. If the skip value causes the cursor to move past the end of the collection, the response will be 200 OK with an empty result set and no next_page_token. +func (r ApiTidbNodeGroupServiceListTidbNodeGroupsRequest) Skip(skip int32) ApiTidbNodeGroupServiceListTidbNodeGroupsRequest { + r.skip = &skip + return r +} + +func (r ApiTidbNodeGroupServiceListTidbNodeGroupsRequest) Execute() (*Dedicatedv1beta1ListTidbNodeGroupsResponse, *http.Response, error) { + return r.ApiService.TidbNodeGroupServiceListTidbNodeGroupsExecute(r) +} + +/* +TidbNodeGroupServiceListTidbNodeGroups List TiDB Node Groups + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @return ApiTidbNodeGroupServiceListTidbNodeGroupsRequest +*/ +func (a *TidbNodeGroupServiceAPIService) TidbNodeGroupServiceListTidbNodeGroups(ctx context.Context, clusterId string) ApiTidbNodeGroupServiceListTidbNodeGroupsRequest { + return ApiTidbNodeGroupServiceListTidbNodeGroupsRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + } +} + +// Execute executes the request +// +// @return Dedicatedv1beta1ListTidbNodeGroupsResponse +func (a *TidbNodeGroupServiceAPIService) TidbNodeGroupServiceListTidbNodeGroupsExecute(r ApiTidbNodeGroupServiceListTidbNodeGroupsRequest) (*Dedicatedv1beta1ListTidbNodeGroupsResponse, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodGet + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Dedicatedv1beta1ListTidbNodeGroupsResponse + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TidbNodeGroupServiceAPIService.TidbNodeGroupServiceListTidbNodeGroups") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/tidbNodeGroups" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + + if r.pageSize != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageSize", r.pageSize, "", "") + } + if r.pageToken != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "pageToken", r.pageToken, "", "") + } + if r.skip != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "skip", r.skip, "", "") + } + // 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 + } + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiTidbNodeGroupServiceUpdatePublicEndpointSettingRequest struct { + ctx context.Context + ApiService *TidbNodeGroupServiceAPIService + clusterId string + publicEndpointSettingTidbNodeGroupId string + publicEndpointSetting *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest + validateOnly *bool +} + +func (r ApiTidbNodeGroupServiceUpdatePublicEndpointSettingRequest) PublicEndpointSetting(publicEndpointSetting TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) ApiTidbNodeGroupServiceUpdatePublicEndpointSettingRequest { + r.publicEndpointSetting = &publicEndpointSetting + return r +} + +// if validate_only is true, the request will be validated but not executed. +func (r ApiTidbNodeGroupServiceUpdatePublicEndpointSettingRequest) ValidateOnly(validateOnly bool) ApiTidbNodeGroupServiceUpdatePublicEndpointSettingRequest { + r.validateOnly = &validateOnly + return r +} + +func (r ApiTidbNodeGroupServiceUpdatePublicEndpointSettingRequest) Execute() (*V1beta1PublicEndpointSetting, *http.Response, error) { + return r.ApiService.TidbNodeGroupServiceUpdatePublicEndpointSettingExecute(r) +} + +/* +TidbNodeGroupServiceUpdatePublicEndpointSetting Update the public endpoint setting of a TiDB Node Group + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param clusterId + @param publicEndpointSettingTidbNodeGroupId If set to \"-\", the default TiDB group will be used. + @return ApiTidbNodeGroupServiceUpdatePublicEndpointSettingRequest +*/ +func (a *TidbNodeGroupServiceAPIService) TidbNodeGroupServiceUpdatePublicEndpointSetting(ctx context.Context, clusterId string, publicEndpointSettingTidbNodeGroupId string) ApiTidbNodeGroupServiceUpdatePublicEndpointSettingRequest { + return ApiTidbNodeGroupServiceUpdatePublicEndpointSettingRequest{ + ApiService: a, + ctx: ctx, + clusterId: clusterId, + publicEndpointSettingTidbNodeGroupId: publicEndpointSettingTidbNodeGroupId, + } +} + +// Execute executes the request +// +// @return V1beta1PublicEndpointSetting +func (a *TidbNodeGroupServiceAPIService) TidbNodeGroupServiceUpdatePublicEndpointSettingExecute(r ApiTidbNodeGroupServiceUpdatePublicEndpointSettingRequest) (*V1beta1PublicEndpointSetting, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *V1beta1PublicEndpointSetting + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TidbNodeGroupServiceAPIService.TidbNodeGroupServiceUpdatePublicEndpointSetting") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{clusterId}/tidbNodeGroups/{publicEndpointSetting.tidbNodeGroupId}/publicEndpointSetting" + localVarPath = strings.Replace(localVarPath, "{"+"clusterId"+"}", url.PathEscape(parameterValueToString(r.clusterId, "clusterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"publicEndpointSetting.tidbNodeGroupId"+"}", url.PathEscape(parameterValueToString(r.publicEndpointSettingTidbNodeGroupId, "publicEndpointSettingTidbNodeGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.publicEndpointSetting == nil { + return localVarReturnValue, nil, reportError("publicEndpointSetting is required and must be specified") + } + + if r.validateOnly != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "validateOnly", r.validateOnly, "", "") + } + // 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.publicEndpointSetting + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 ApiTidbNodeGroupServiceUpdateTidbNodeGroupRequest struct { + ctx context.Context + ApiService *TidbNodeGroupServiceAPIService + tidbNodeGroupClusterId string + tidbNodeGroupTidbNodeGroupId string + tidbNodeGroup *TidbNodeGroupServiceUpdateTidbNodeGroupRequest + validateOnly *bool +} + +func (r ApiTidbNodeGroupServiceUpdateTidbNodeGroupRequest) TidbNodeGroup(tidbNodeGroup TidbNodeGroupServiceUpdateTidbNodeGroupRequest) ApiTidbNodeGroupServiceUpdateTidbNodeGroupRequest { + r.tidbNodeGroup = &tidbNodeGroup + return r +} + +// if validate_only is true, the request will be validated but not executed. +func (r ApiTidbNodeGroupServiceUpdateTidbNodeGroupRequest) ValidateOnly(validateOnly bool) ApiTidbNodeGroupServiceUpdateTidbNodeGroupRequest { + r.validateOnly = &validateOnly + return r +} + +func (r ApiTidbNodeGroupServiceUpdateTidbNodeGroupRequest) Execute() (*Dedicatedv1beta1TidbNodeGroup, *http.Response, error) { + return r.ApiService.TidbNodeGroupServiceUpdateTidbNodeGroupExecute(r) +} + +/* +TidbNodeGroupServiceUpdateTidbNodeGroup Update a TiDB Node Group + + @param ctx context.Context - for authentication, logging, cancellation, deadlines, tracing, etc. Passed from http.Request or context.Background(). + @param tidbNodeGroupClusterId + @param tidbNodeGroupTidbNodeGroupId + @return ApiTidbNodeGroupServiceUpdateTidbNodeGroupRequest +*/ +func (a *TidbNodeGroupServiceAPIService) TidbNodeGroupServiceUpdateTidbNodeGroup(ctx context.Context, tidbNodeGroupClusterId string, tidbNodeGroupTidbNodeGroupId string) ApiTidbNodeGroupServiceUpdateTidbNodeGroupRequest { + return ApiTidbNodeGroupServiceUpdateTidbNodeGroupRequest{ + ApiService: a, + ctx: ctx, + tidbNodeGroupClusterId: tidbNodeGroupClusterId, + tidbNodeGroupTidbNodeGroupId: tidbNodeGroupTidbNodeGroupId, + } +} + +// Execute executes the request +// +// @return Dedicatedv1beta1TidbNodeGroup +func (a *TidbNodeGroupServiceAPIService) TidbNodeGroupServiceUpdateTidbNodeGroupExecute(r ApiTidbNodeGroupServiceUpdateTidbNodeGroupRequest) (*Dedicatedv1beta1TidbNodeGroup, *http.Response, error) { + var ( + localVarHTTPMethod = http.MethodPatch + localVarPostBody interface{} + formFiles []formFile + localVarReturnValue *Dedicatedv1beta1TidbNodeGroup + ) + + localBasePath, err := a.client.cfg.ServerURLWithContext(r.ctx, "TidbNodeGroupServiceAPIService.TidbNodeGroupServiceUpdateTidbNodeGroup") + if err != nil { + return localVarReturnValue, nil, &GenericOpenAPIError{error: err.Error()} + } + + localVarPath := localBasePath + "/clusters/{tidbNodeGroup.clusterId}/tidbNodeGroups/{tidbNodeGroup.tidbNodeGroupId}" + localVarPath = strings.Replace(localVarPath, "{"+"tidbNodeGroup.clusterId"+"}", url.PathEscape(parameterValueToString(r.tidbNodeGroupClusterId, "tidbNodeGroupClusterId")), -1) + localVarPath = strings.Replace(localVarPath, "{"+"tidbNodeGroup.tidbNodeGroupId"+"}", url.PathEscape(parameterValueToString(r.tidbNodeGroupTidbNodeGroupId, "tidbNodeGroupTidbNodeGroupId")), -1) + + localVarHeaderParams := make(map[string]string) + localVarQueryParams := url.Values{} + localVarFormParams := url.Values{} + if r.tidbNodeGroup == nil { + return localVarReturnValue, nil, reportError("tidbNodeGroup is required and must be specified") + } + + if r.validateOnly != nil { + parameterAddToHeaderOrQuery(localVarQueryParams, "validateOnly", r.validateOnly, "", "") + } + // 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.tidbNodeGroup + if r.ctx != nil { + // API Key Authentication + if auth, ok := r.ctx.Value(ContextAPIKeys).(map[string]APIKey); ok { + if apiKey, ok := auth["Bearer"]; 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, 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, + } + if localVarHTTPResponse.StatusCode == 400 { + 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 + } + if localVarHTTPResponse.StatusCode == 401 { + 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 + } + if localVarHTTPResponse.StatusCode == 403 { + 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 + } + if localVarHTTPResponse.StatusCode == 429 { + 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 + } + if localVarHTTPResponse.StatusCode == 500 { + 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 + } + 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 +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/client.go b/pkg/tidbcloud/v1beta1/dedicated/client.go new file mode 100644 index 00000000..1e61eeb1 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/client.go @@ -0,0 +1,669 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "bytes" + "context" + "encoding/json" + "encoding/xml" + "errors" + "fmt" + "io" + "log" + "mime/multipart" + "net/http" + "net/http/httputil" + "net/url" + "os" + "path/filepath" + "reflect" + "regexp" + "strconv" + "strings" + "time" + "unicode/utf8" +) + +var ( + JsonCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?json)`) + XmlCheck = regexp.MustCompile(`(?i:(?:application|text)/(?:[^;]+\+)?xml)`) + queryParamSplit = regexp.MustCompile(`(^|&)([^&]+)`) + queryDescape = strings.NewReplacer("%5B", "[", "%5D", "]") +) + +// APIClient manages communication with the TiDB Cloud Dedicated Open API API vv1beta1 +// In most cases there should be only one, shared, APIClient. +type APIClient struct { + cfg *Configuration + common service // Reuse a single struct instead of allocating one for each service on the heap. + + // API Services + + ClusterServiceAPI *ClusterServiceAPIService + + DatabaseAuditLogServiceAPI *DatabaseAuditLogServiceAPIService + + MaintenanceServiceAPI *MaintenanceServiceAPIService + + NetworkContainerServiceAPI *NetworkContainerServiceAPIService + + PrivateEndpointConnectionServiceAPI *PrivateEndpointConnectionServiceAPIService + + RegionServiceAPI *RegionServiceAPIService + + TidbNodeGroupServiceAPI *TidbNodeGroupServiceAPIService +} + +type service struct { + client *APIClient +} + +// NewAPIClient creates a new API client. Requires a userAgent string describing your application. +// optionally a custom http.Client to allow for advanced features such as caching. +func NewAPIClient(cfg *Configuration) *APIClient { + if cfg.HTTPClient == nil { + cfg.HTTPClient = http.DefaultClient + } + + c := &APIClient{} + c.cfg = cfg + c.common.client = c + + // API Services + c.ClusterServiceAPI = (*ClusterServiceAPIService)(&c.common) + c.DatabaseAuditLogServiceAPI = (*DatabaseAuditLogServiceAPIService)(&c.common) + c.MaintenanceServiceAPI = (*MaintenanceServiceAPIService)(&c.common) + c.NetworkContainerServiceAPI = (*NetworkContainerServiceAPIService)(&c.common) + c.PrivateEndpointConnectionServiceAPI = (*PrivateEndpointConnectionServiceAPIService)(&c.common) + c.RegionServiceAPI = (*RegionServiceAPIService)(&c.common) + c.TidbNodeGroupServiceAPI = (*TidbNodeGroupServiceAPIService)(&c.common) + + return c +} + +func atoi(in string) (int, error) { + return strconv.Atoi(in) +} + +// selectHeaderContentType select a content type from the available list. +func selectHeaderContentType(contentTypes []string) string { + if len(contentTypes) == 0 { + return "" + } + if contains(contentTypes, "application/json") { + return "application/json" + } + return contentTypes[0] // use the first content type specified in 'consumes' +} + +// selectHeaderAccept join all accept types and return +func selectHeaderAccept(accepts []string) string { + if len(accepts) == 0 { + return "" + } + + if contains(accepts, "application/json") { + return "application/json" + } + + return strings.Join(accepts, ",") +} + +// contains is a case insensitive match, finding needle in a haystack +func contains(haystack []string, needle string) bool { + for _, a := range haystack { + if strings.EqualFold(a, needle) { + return true + } + } + return false +} + +// Verify optional parameters are of the correct type. +func typeCheckParameter(obj interface{}, expected string, name string) error { + // Make sure there is an object. + if obj == nil { + return nil + } + + // Check the type is as expected. + if reflect.TypeOf(obj).String() != expected { + return fmt.Errorf("expected %s to be of type %s but received %s", name, expected, reflect.TypeOf(obj).String()) + } + return nil +} + +func parameterValueToString(obj interface{}, key string) string { + if reflect.TypeOf(obj).Kind() != reflect.Ptr { + return fmt.Sprintf("%v", obj) + } + var param, ok = obj.(MappedNullable) + if !ok { + return "" + } + dataMap, err := param.ToMap() + if err != nil { + return "" + } + return fmt.Sprintf("%v", dataMap[key]) +} + +// parameterAddToHeaderOrQuery adds the provided object to the request header or url query +// supporting deep object syntax +func parameterAddToHeaderOrQuery(headerOrQueryParams interface{}, keyPrefix string, obj interface{}, style string, collectionType string) { + var v = reflect.ValueOf(obj) + var value = "" + if v == reflect.ValueOf(nil) { + value = "null" + } else { + switch v.Kind() { + case reflect.Invalid: + value = "invalid" + + case reflect.Struct: + if t, ok := obj.(MappedNullable); ok { + dataMap, err := t.ToMap() + if err != nil { + return + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, dataMap, style, collectionType) + return + } + if t, ok := obj.(time.Time); ok { + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, t.Format(time.RFC3339Nano), style, collectionType) + return + } + value = v.Type().String() + " value" + case reflect.Slice: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + var lenIndValue = indValue.Len() + for i := 0; i < lenIndValue; i++ { + var arrayValue = indValue.Index(i) + var keyPrefixForCollectionType = keyPrefix + if style == "deepObject" { + keyPrefixForCollectionType = keyPrefix + "[" + strconv.Itoa(i) + "]" + } + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefixForCollectionType, arrayValue.Interface(), style, collectionType) + } + return + + case reflect.Map: + var indValue = reflect.ValueOf(obj) + if indValue == reflect.ValueOf(nil) { + return + } + iter := indValue.MapRange() + for iter.Next() { + k, v := iter.Key(), iter.Value() + parameterAddToHeaderOrQuery(headerOrQueryParams, fmt.Sprintf("%s[%s]", keyPrefix, k.String()), v.Interface(), style, collectionType) + } + return + + case reflect.Interface: + fallthrough + case reflect.Ptr: + parameterAddToHeaderOrQuery(headerOrQueryParams, keyPrefix, v.Elem().Interface(), style, collectionType) + return + + case reflect.Int, reflect.Int8, reflect.Int16, + reflect.Int32, reflect.Int64: + value = strconv.FormatInt(v.Int(), 10) + case reflect.Uint, reflect.Uint8, reflect.Uint16, + reflect.Uint32, reflect.Uint64, reflect.Uintptr: + value = strconv.FormatUint(v.Uint(), 10) + case reflect.Float32, reflect.Float64: + value = strconv.FormatFloat(v.Float(), 'g', -1, 32) + case reflect.Bool: + value = strconv.FormatBool(v.Bool()) + case reflect.String: + value = v.String() + default: + value = v.Type().String() + " value" + } + } + + switch valuesMap := headerOrQueryParams.(type) { + case url.Values: + if collectionType == "csv" && valuesMap.Get(keyPrefix) != "" { + valuesMap.Set(keyPrefix, valuesMap.Get(keyPrefix)+","+value) + } else { + valuesMap.Add(keyPrefix, value) + } + break + case map[string]string: + valuesMap[keyPrefix] = value + break + } +} + +// helper for converting interface{} parameters to json strings +func parameterToJson(obj interface{}) (string, error) { + jsonBuf, err := json.Marshal(obj) + if err != nil { + return "", err + } + return string(jsonBuf), err +} + +// callAPI do the request. +func (c *APIClient) callAPI(request *http.Request) (*http.Response, error) { + if c.cfg.Debug { + dump, err := httputil.DumpRequestOut(request, true) + if err != nil { + return nil, err + } + log.Printf("\n%s\n", string(dump)) + } + + resp, err := c.cfg.HTTPClient.Do(request) + if err != nil { + return resp, err + } + + if c.cfg.Debug { + dump, err := httputil.DumpResponse(resp, true) + if err != nil { + return resp, err + } + log.Printf("\n%s\n", string(dump)) + } + return resp, err +} + +// Allow modification of underlying config for alternate implementations and testing +// Caution: modifying the configuration while live can cause data races and potentially unwanted behavior +func (c *APIClient) GetConfig() *Configuration { + return c.cfg +} + +type formFile struct { + fileBytes []byte + fileName string + formFileName string +} + +// prepareRequest build the request +func (c *APIClient) prepareRequest( + ctx context.Context, + path string, method string, + postBody interface{}, + headerParams map[string]string, + queryParams url.Values, + formParams url.Values, + formFiles []formFile) (localVarRequest *http.Request, err error) { + + var body *bytes.Buffer + + // Detect postBody type and post. + if postBody != nil { + contentType := headerParams["Content-Type"] + if contentType == "" { + contentType = detectContentType(postBody) + headerParams["Content-Type"] = contentType + } + + body, err = setBody(postBody, contentType) + if err != nil { + return nil, err + } + } + + // add form parameters and file if available. + if strings.HasPrefix(headerParams["Content-Type"], "multipart/form-data") && len(formParams) > 0 || (len(formFiles) > 0) { + if body != nil { + return nil, errors.New("Cannot specify postBody and multipart form at the same time.") + } + body = &bytes.Buffer{} + w := multipart.NewWriter(body) + + for k, v := range formParams { + for _, iv := range v { + if strings.HasPrefix(k, "@") { // file + err = addFile(w, k[1:], iv) + if err != nil { + return nil, err + } + } else { // form value + w.WriteField(k, iv) + } + } + } + for _, formFile := range formFiles { + if len(formFile.fileBytes) > 0 && formFile.fileName != "" { + w.Boundary() + part, err := w.CreateFormFile(formFile.formFileName, filepath.Base(formFile.fileName)) + if err != nil { + return nil, err + } + _, err = part.Write(formFile.fileBytes) + if err != nil { + return nil, err + } + } + } + + // Set the Boundary in the Content-Type + headerParams["Content-Type"] = w.FormDataContentType() + + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + w.Close() + } + + if strings.HasPrefix(headerParams["Content-Type"], "application/x-www-form-urlencoded") && len(formParams) > 0 { + if body != nil { + return nil, errors.New("Cannot specify postBody and x-www-form-urlencoded form at the same time.") + } + body = &bytes.Buffer{} + body.WriteString(formParams.Encode()) + // Set Content-Length + headerParams["Content-Length"] = fmt.Sprintf("%d", body.Len()) + } + + // Setup path and query parameters + url, err := url.Parse(path) + if err != nil { + return nil, err + } + + // Override request host, if applicable + if c.cfg.Host != "" { + url.Host = c.cfg.Host + } + + // Override request scheme, if applicable + if c.cfg.Scheme != "" { + url.Scheme = c.cfg.Scheme + } + + // Adding Query Param + query := url.Query() + for k, v := range queryParams { + for _, iv := range v { + query.Add(k, iv) + } + } + + // Encode the parameters. + url.RawQuery = queryParamSplit.ReplaceAllStringFunc(query.Encode(), func(s string) string { + pieces := strings.Split(s, "=") + pieces[0] = queryDescape.Replace(pieces[0]) + return strings.Join(pieces, "=") + }) + + // Generate a new request + if body != nil { + localVarRequest, err = http.NewRequest(method, url.String(), body) + } else { + localVarRequest, err = http.NewRequest(method, url.String(), nil) + } + if err != nil { + return nil, err + } + + // add header parameters, if any + if len(headerParams) > 0 { + headers := http.Header{} + for h, v := range headerParams { + headers[h] = []string{v} + } + localVarRequest.Header = headers + } + + // Add the user agent to the request. + localVarRequest.Header.Add("User-Agent", c.cfg.UserAgent) + + if ctx != nil { + // add context to the request + localVarRequest = localVarRequest.WithContext(ctx) + + // Walk through any authentication. + + } + + for header, value := range c.cfg.DefaultHeader { + localVarRequest.Header.Add(header, value) + } + return localVarRequest, nil +} + +func (c *APIClient) decode(v interface{}, b []byte, contentType string) (err error) { + if len(b) == 0 { + return nil + } + if s, ok := v.(*string); ok { + *s = string(b) + return nil + } + if f, ok := v.(*os.File); ok { + f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = f.Write(b) + if err != nil { + return + } + _, err = f.Seek(0, io.SeekStart) + return + } + if f, ok := v.(**os.File); ok { + *f, err = os.CreateTemp("", "HttpClientFile") + if err != nil { + return + } + _, err = (*f).Write(b) + if err != nil { + return + } + _, err = (*f).Seek(0, io.SeekStart) + return + } + if XmlCheck.MatchString(contentType) { + if err = xml.Unmarshal(b, v); err != nil { + return err + } + return nil + } + if JsonCheck.MatchString(contentType) { + if actualObj, ok := v.(interface{ GetActualInstance() interface{} }); ok { // oneOf, anyOf schemas + if unmarshalObj, ok := actualObj.(interface{ UnmarshalJSON([]byte) error }); ok { // make sure it has UnmarshalJSON defined + if err = unmarshalObj.UnmarshalJSON(b); err != nil { + return err + } + } else { + return errors.New("Unknown type with GetActualInstance but no unmarshalObj.UnmarshalJSON defined") + } + } else if err = json.Unmarshal(b, v); err != nil { // simple model + return err + } + return nil + } + return errors.New("undefined response type") +} + +// Add a file to the multipart request +func addFile(w *multipart.Writer, fieldName, path string) error { + file, err := os.Open(filepath.Clean(path)) + if err != nil { + return err + } + err = file.Close() + if err != nil { + return err + } + + part, err := w.CreateFormFile(fieldName, filepath.Base(path)) + if err != nil { + return err + } + _, err = io.Copy(part, file) + + return err +} + +// Set request body from an interface{} +func setBody(body interface{}, contentType string) (bodyBuf *bytes.Buffer, err error) { + if bodyBuf == nil { + bodyBuf = &bytes.Buffer{} + } + + if reader, ok := body.(io.Reader); ok { + _, err = bodyBuf.ReadFrom(reader) + } else if fp, ok := body.(*os.File); ok { + _, err = bodyBuf.ReadFrom(fp) + } else if b, ok := body.([]byte); ok { + _, err = bodyBuf.Write(b) + } else if s, ok := body.(string); ok { + _, err = bodyBuf.WriteString(s) + } else if s, ok := body.(*string); ok { + _, err = bodyBuf.WriteString(*s) + } else if JsonCheck.MatchString(contentType) { + err = json.NewEncoder(bodyBuf).Encode(body) + } else if XmlCheck.MatchString(contentType) { + var bs []byte + bs, err = xml.Marshal(body) + if err == nil { + bodyBuf.Write(bs) + } + } + + if err != nil { + return nil, err + } + + if bodyBuf.Len() == 0 { + err = fmt.Errorf("invalid body type %s\n", contentType) + return nil, err + } + return bodyBuf, nil +} + +// detectContentType method is used to figure out `Request.Body` content type for request header +func detectContentType(body interface{}) string { + contentType := "text/plain; charset=utf-8" + kind := reflect.TypeOf(body).Kind() + + switch kind { + case reflect.Struct, reflect.Map, reflect.Ptr: + contentType = "application/json; charset=utf-8" + case reflect.String: + contentType = "text/plain; charset=utf-8" + default: + if b, ok := body.([]byte); ok { + contentType = http.DetectContentType(b) + } else if kind == reflect.Slice { + contentType = "application/json; charset=utf-8" + } + } + + return contentType +} + +// Ripped from https://github.com/gregjones/httpcache/blob/master/httpcache.go +type cacheControl map[string]string + +func parseCacheControl(headers http.Header) cacheControl { + cc := cacheControl{} + ccHeader := headers.Get("Cache-Control") + for _, part := range strings.Split(ccHeader, ",") { + part = strings.Trim(part, " ") + if part == "" { + continue + } + if strings.ContainsRune(part, '=') { + keyval := strings.Split(part, "=") + cc[strings.Trim(keyval[0], " ")] = strings.Trim(keyval[1], ",") + } else { + cc[part] = "" + } + } + return cc +} + +// CacheExpires helper function to determine remaining time before repeating a request. +func CacheExpires(r *http.Response) time.Time { + // Figure out when the cache expires. + var expires time.Time + now, err := time.Parse(time.RFC1123, r.Header.Get("date")) + if err != nil { + return time.Now() + } + respCacheControl := parseCacheControl(r.Header) + + if maxAge, ok := respCacheControl["max-age"]; ok { + lifetime, err := time.ParseDuration(maxAge + "s") + if err != nil { + expires = now + } else { + expires = now.Add(lifetime) + } + } else { + expiresHeader := r.Header.Get("Expires") + if expiresHeader != "" { + expires, err = time.Parse(time.RFC1123, expiresHeader) + if err != nil { + expires = now + } + } + } + return expires +} + +func strlen(s string) int { + return utf8.RuneCountInString(s) +} + +// GenericOpenAPIError Provides access to the body, error and model on returned errors. +type GenericOpenAPIError struct { + body []byte + error string + model interface{} +} + +// Error returns non-empty string if there was an error. +func (e GenericOpenAPIError) Error() string { + return e.error +} + +// Body returns the raw bytes of the response +func (e GenericOpenAPIError) Body() []byte { + return e.body +} + +// Model returns the unpacked model of the error +func (e GenericOpenAPIError) Model() interface{} { + return e.model +} + +// format error message using title and detail when model implements rfc7807 +func formatErrorMessage(status string, v interface{}) string { + str := "" + metaValue := reflect.ValueOf(v).Elem() + + if metaValue.Kind() == reflect.Struct { + field := metaValue.FieldByName("Title") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s", field.Interface()) + } + + field = metaValue.FieldByName("Detail") + if field != (reflect.Value{}) { + str = fmt.Sprintf("%s (%s)", str, field.Interface()) + } + } + + return strings.TrimSpace(fmt.Sprintf("%s %s", status, str)) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/configuration.go b/pkg/tidbcloud/v1beta1/dedicated/configuration.go new file mode 100644 index 00000000..5e610536 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/configuration.go @@ -0,0 +1,217 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "context" + "fmt" + "net/http" + "strings" +) + +// contextKeys are used to identify the type of value in the context. +// Since these are string, it is possible to get a short description of the +// context key for logging and debugging using key.String(). + +type contextKey string + +func (c contextKey) String() string { + return "auth " + string(c) +} + +var ( + // ContextAPIKeys takes a string apikey as authentication for the request + ContextAPIKeys = contextKey("apiKeys") + + // ContextServerIndex uses a server configuration from the index. + ContextServerIndex = contextKey("serverIndex") + + // ContextOperationServerIndices uses a server configuration from the index mapping. + ContextOperationServerIndices = contextKey("serverOperationIndices") + + // ContextServerVariables overrides a server configuration variables. + ContextServerVariables = contextKey("serverVariables") + + // ContextOperationServerVariables overrides a server configuration variables using operation specific values. + ContextOperationServerVariables = contextKey("serverOperationVariables") +) + +// BasicAuth provides basic http authentication to a request passed via context using ContextBasicAuth +type BasicAuth struct { + UserName string `json:"userName,omitempty"` + Password string `json:"password,omitempty"` +} + +// APIKey provides API key based authentication to a request passed via context using ContextAPIKey +type APIKey struct { + Key string + Prefix string +} + +// ServerVariable stores the information about a server variable +type ServerVariable struct { + Description string + DefaultValue string + EnumValues []string +} + +// ServerConfiguration stores the information about a server +type ServerConfiguration struct { + URL string + Description string + Variables map[string]ServerVariable +} + +// ServerConfigurations stores multiple ServerConfiguration items +type ServerConfigurations []ServerConfiguration + +// Configuration stores the configuration of the API client +type Configuration struct { + Host string `json:"host,omitempty"` + Scheme string `json:"scheme,omitempty"` + DefaultHeader map[string]string `json:"defaultHeader,omitempty"` + UserAgent string `json:"userAgent,omitempty"` + Debug bool `json:"debug,omitempty"` + Servers ServerConfigurations + OperationServers map[string]ServerConfigurations + HTTPClient *http.Client +} + +// NewConfiguration returns a new Configuration object +func NewConfiguration() *Configuration { + cfg := &Configuration{ + DefaultHeader: make(map[string]string), + UserAgent: "OpenAPI-Generator/1.0.0/go", + Debug: false, + Servers: ServerConfigurations{ + { + URL: "https://dedicated.tidbapi.com/v1beta1", + Description: "No description provided", + }, + }, + OperationServers: map[string]ServerConfigurations{}, + } + return cfg +} + +// AddDefaultHeader adds a new HTTP header to the default header in the request +func (c *Configuration) AddDefaultHeader(key string, value string) { + c.DefaultHeader[key] = value +} + +// URL formats template on a index using given variables +func (sc ServerConfigurations) URL(index int, variables map[string]string) (string, error) { + if index < 0 || len(sc) <= index { + return "", fmt.Errorf("index %v out of range %v", index, len(sc)-1) + } + server := sc[index] + url := server.URL + + // go through variables and replace placeholders + for name, variable := range server.Variables { + if value, ok := variables[name]; ok { + found := bool(len(variable.EnumValues) == 0) + for _, enumValue := range variable.EnumValues { + if value == enumValue { + found = true + } + } + if !found { + return "", fmt.Errorf("the variable %s in the server URL has invalid value %v. Must be %v", name, value, variable.EnumValues) + } + url = strings.Replace(url, "{"+name+"}", value, -1) + } else { + url = strings.Replace(url, "{"+name+"}", variable.DefaultValue, -1) + } + } + return url, nil +} + +// ServerURL returns URL based on server settings +func (c *Configuration) ServerURL(index int, variables map[string]string) (string, error) { + return c.Servers.URL(index, variables) +} + +func getServerIndex(ctx context.Context) (int, error) { + si := ctx.Value(ContextServerIndex) + if si != nil { + if index, ok := si.(int); ok { + return index, nil + } + return 0, reportError("Invalid type %T should be int", si) + } + return 0, nil +} + +func getServerOperationIndex(ctx context.Context, endpoint string) (int, error) { + osi := ctx.Value(ContextOperationServerIndices) + if osi != nil { + if operationIndices, ok := osi.(map[string]int); !ok { + return 0, reportError("Invalid type %T should be map[string]int", osi) + } else { + index, ok := operationIndices[endpoint] + if ok { + return index, nil + } + } + } + return getServerIndex(ctx) +} + +func getServerVariables(ctx context.Context) (map[string]string, error) { + sv := ctx.Value(ContextServerVariables) + if sv != nil { + if variables, ok := sv.(map[string]string); ok { + return variables, nil + } + return nil, reportError("ctx value of ContextServerVariables has invalid type %T should be map[string]string", sv) + } + return nil, nil +} + +func getServerOperationVariables(ctx context.Context, endpoint string) (map[string]string, error) { + osv := ctx.Value(ContextOperationServerVariables) + if osv != nil { + if operationVariables, ok := osv.(map[string]map[string]string); !ok { + return nil, reportError("ctx value of ContextOperationServerVariables has invalid type %T should be map[string]map[string]string", osv) + } else { + variables, ok := operationVariables[endpoint] + if ok { + return variables, nil + } + } + } + return getServerVariables(ctx) +} + +// ServerURLWithContext returns a new server URL given an endpoint +func (c *Configuration) ServerURLWithContext(ctx context.Context, endpoint string) (string, error) { + sc, ok := c.OperationServers[endpoint] + if !ok { + sc = c.Servers + } + + if ctx == nil { + return sc.URL(0, nil) + } + + index, err := getServerOperationIndex(ctx, endpoint) + if err != nil { + return "", err + } + + variables, err := getServerOperationVariables(ctx, endpoint) + if err != nil { + return "", err + } + + return sc.URL(index, variables) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/git_push.sh b/pkg/tidbcloud/v1beta1/dedicated/git_push.sh new file mode 100644 index 00000000..f53a75d4 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/git_push.sh @@ -0,0 +1,57 @@ +#!/bin/sh +# ref: https://help.github.com/articles/adding-an-existing-project-to-github-using-the-command-line/ +# +# Usage example: /bin/sh ./git_push.sh wing328 openapi-petstore-perl "minor update" "gitlab.com" + +git_user_id=$1 +git_repo_id=$2 +release_note=$3 +git_host=$4 + +if [ "$git_host" = "" ]; then + git_host="github.com" + echo "[INFO] No command line input provided. Set \$git_host to $git_host" +fi + +if [ "$git_user_id" = "" ]; then + git_user_id="GIT_USER_ID" + echo "[INFO] No command line input provided. Set \$git_user_id to $git_user_id" +fi + +if [ "$git_repo_id" = "" ]; then + git_repo_id="GIT_REPO_ID" + echo "[INFO] No command line input provided. Set \$git_repo_id to $git_repo_id" +fi + +if [ "$release_note" = "" ]; then + release_note="Minor update" + echo "[INFO] No command line input provided. Set \$release_note to $release_note" +fi + +# Initialize the local directory as a Git repository +git init + +# Adds the files in the local repository and stages them for commit. +git add . + +# Commits the tracked changes and prepares them to be pushed to a remote repository. +git commit -m "$release_note" + +# Sets the new remote +git_remote=$(git remote) +if [ "$git_remote" = "" ]; then # git remote not defined + + if [ "$GIT_TOKEN" = "" ]; then + echo "[INFO] \$GIT_TOKEN (environment variable) is not set. Using the git credential in your environment." + git remote add origin https://${git_host}/${git_user_id}/${git_repo_id}.git + else + git remote add origin https://${git_user_id}:"${GIT_TOKEN}"@${git_host}/${git_user_id}/${git_repo_id}.git + fi + +fi + +git pull origin master + +# Pushes (Forces) the changes in the local repository up to the remote repository +echo "Git pushing to https://${git_host}/${git_user_id}/${git_repo_id}.git" +git push origin master 2>&1 | grep -v 'To https' diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_audit_log_config_bucket_write_check.go b/pkg/tidbcloud/v1beta1/dedicated/model_audit_log_config_bucket_write_check.go new file mode 100644 index 00000000..7c6cb257 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_audit_log_config_bucket_write_check.go @@ -0,0 +1,191 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the AuditLogConfigBucketWriteCheck type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &AuditLogConfigBucketWriteCheck{} + +// AuditLogConfigBucketWriteCheck struct for AuditLogConfigBucketWriteCheck +type AuditLogConfigBucketWriteCheck struct { + Writable *bool `json:"writable,omitempty"` + // The reason why the bucket is not writable. Output only when `writable` is false. + ErrorReason *string `json:"errorReason,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _AuditLogConfigBucketWriteCheck AuditLogConfigBucketWriteCheck + +// NewAuditLogConfigBucketWriteCheck instantiates a new AuditLogConfigBucketWriteCheck 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 NewAuditLogConfigBucketWriteCheck() *AuditLogConfigBucketWriteCheck { + this := AuditLogConfigBucketWriteCheck{} + return &this +} + +// NewAuditLogConfigBucketWriteCheckWithDefaults instantiates a new AuditLogConfigBucketWriteCheck 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 NewAuditLogConfigBucketWriteCheckWithDefaults() *AuditLogConfigBucketWriteCheck { + this := AuditLogConfigBucketWriteCheck{} + return &this +} + +// GetWritable returns the Writable field value if set, zero value otherwise. +func (o *AuditLogConfigBucketWriteCheck) GetWritable() bool { + if o == nil || IsNil(o.Writable) { + var ret bool + return ret + } + return *o.Writable +} + +// GetWritableOk returns a tuple with the Writable field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogConfigBucketWriteCheck) GetWritableOk() (*bool, bool) { + if o == nil || IsNil(o.Writable) { + return nil, false + } + return o.Writable, true +} + +// HasWritable returns a boolean if a field has been set. +func (o *AuditLogConfigBucketWriteCheck) HasWritable() bool { + if o != nil && !IsNil(o.Writable) { + return true + } + + return false +} + +// SetWritable gets a reference to the given bool and assigns it to the Writable field. +func (o *AuditLogConfigBucketWriteCheck) SetWritable(v bool) { + o.Writable = &v +} + +// GetErrorReason returns the ErrorReason field value if set, zero value otherwise. +func (o *AuditLogConfigBucketWriteCheck) GetErrorReason() string { + if o == nil || IsNil(o.ErrorReason) { + var ret string + return ret + } + return *o.ErrorReason +} + +// GetErrorReasonOk returns a tuple with the ErrorReason field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *AuditLogConfigBucketWriteCheck) GetErrorReasonOk() (*string, bool) { + if o == nil || IsNil(o.ErrorReason) { + return nil, false + } + return o.ErrorReason, true +} + +// HasErrorReason returns a boolean if a field has been set. +func (o *AuditLogConfigBucketWriteCheck) HasErrorReason() bool { + if o != nil && !IsNil(o.ErrorReason) { + return true + } + + return false +} + +// SetErrorReason gets a reference to the given string and assigns it to the ErrorReason field. +func (o *AuditLogConfigBucketWriteCheck) SetErrorReason(v string) { + o.ErrorReason = &v +} + +func (o AuditLogConfigBucketWriteCheck) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o AuditLogConfigBucketWriteCheck) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Writable) { + toSerialize["writable"] = o.Writable + } + if !IsNil(o.ErrorReason) { + toSerialize["errorReason"] = o.ErrorReason + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *AuditLogConfigBucketWriteCheck) UnmarshalJSON(data []byte) (err error) { + varAuditLogConfigBucketWriteCheck := _AuditLogConfigBucketWriteCheck{} + + err = json.Unmarshal(data, &varAuditLogConfigBucketWriteCheck) + + if err != nil { + return err + } + + *o = AuditLogConfigBucketWriteCheck(varAuditLogConfigBucketWriteCheck) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "writable") + delete(additionalProperties, "errorReason") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableAuditLogConfigBucketWriteCheck struct { + value *AuditLogConfigBucketWriteCheck + isSet bool +} + +func (v NullableAuditLogConfigBucketWriteCheck) Get() *AuditLogConfigBucketWriteCheck { + return v.value +} + +func (v *NullableAuditLogConfigBucketWriteCheck) Set(val *AuditLogConfigBucketWriteCheck) { + v.value = val + v.isSet = true +} + +func (v NullableAuditLogConfigBucketWriteCheck) IsSet() bool { + return v.isSet +} + +func (v *NullableAuditLogConfigBucketWriteCheck) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableAuditLogConfigBucketWriteCheck(val *AuditLogConfigBucketWriteCheck) *NullableAuditLogConfigBucketWriteCheck { + return &NullableAuditLogConfigBucketWriteCheck{value: val, isSet: true} +} + +func (v NullableAuditLogConfigBucketWriteCheck) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableAuditLogConfigBucketWriteCheck) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_cluster_node_changing_progress.go b/pkg/tidbcloud/v1beta1/dedicated/model_cluster_node_changing_progress.go new file mode 100644 index 00000000..258ff280 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_cluster_node_changing_progress.go @@ -0,0 +1,191 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the ClusterNodeChangingProgress type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ClusterNodeChangingProgress{} + +// ClusterNodeChangingProgress struct for ClusterNodeChangingProgress +type ClusterNodeChangingProgress struct { + MatchingNodeSpecNodeCount *int32 `json:"matchingNodeSpecNodeCount,omitempty"` + // available if some nodes are deleting. + RemainingDeletionNodeCount *int32 `json:"remainingDeletionNodeCount,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ClusterNodeChangingProgress ClusterNodeChangingProgress + +// NewClusterNodeChangingProgress instantiates a new ClusterNodeChangingProgress 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 NewClusterNodeChangingProgress() *ClusterNodeChangingProgress { + this := ClusterNodeChangingProgress{} + return &this +} + +// NewClusterNodeChangingProgressWithDefaults instantiates a new ClusterNodeChangingProgress 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 NewClusterNodeChangingProgressWithDefaults() *ClusterNodeChangingProgress { + this := ClusterNodeChangingProgress{} + return &this +} + +// GetMatchingNodeSpecNodeCount returns the MatchingNodeSpecNodeCount field value if set, zero value otherwise. +func (o *ClusterNodeChangingProgress) GetMatchingNodeSpecNodeCount() int32 { + if o == nil || IsNil(o.MatchingNodeSpecNodeCount) { + var ret int32 + return ret + } + return *o.MatchingNodeSpecNodeCount +} + +// GetMatchingNodeSpecNodeCountOk returns a tuple with the MatchingNodeSpecNodeCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ClusterNodeChangingProgress) GetMatchingNodeSpecNodeCountOk() (*int32, bool) { + if o == nil || IsNil(o.MatchingNodeSpecNodeCount) { + return nil, false + } + return o.MatchingNodeSpecNodeCount, true +} + +// HasMatchingNodeSpecNodeCount returns a boolean if a field has been set. +func (o *ClusterNodeChangingProgress) HasMatchingNodeSpecNodeCount() bool { + if o != nil && !IsNil(o.MatchingNodeSpecNodeCount) { + return true + } + + return false +} + +// SetMatchingNodeSpecNodeCount gets a reference to the given int32 and assigns it to the MatchingNodeSpecNodeCount field. +func (o *ClusterNodeChangingProgress) SetMatchingNodeSpecNodeCount(v int32) { + o.MatchingNodeSpecNodeCount = &v +} + +// GetRemainingDeletionNodeCount returns the RemainingDeletionNodeCount field value if set, zero value otherwise. +func (o *ClusterNodeChangingProgress) GetRemainingDeletionNodeCount() int32 { + if o == nil || IsNil(o.RemainingDeletionNodeCount) { + var ret int32 + return ret + } + return *o.RemainingDeletionNodeCount +} + +// GetRemainingDeletionNodeCountOk returns a tuple with the RemainingDeletionNodeCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ClusterNodeChangingProgress) GetRemainingDeletionNodeCountOk() (*int32, bool) { + if o == nil || IsNil(o.RemainingDeletionNodeCount) { + return nil, false + } + return o.RemainingDeletionNodeCount, true +} + +// HasRemainingDeletionNodeCount returns a boolean if a field has been set. +func (o *ClusterNodeChangingProgress) HasRemainingDeletionNodeCount() bool { + if o != nil && !IsNil(o.RemainingDeletionNodeCount) { + return true + } + + return false +} + +// SetRemainingDeletionNodeCount gets a reference to the given int32 and assigns it to the RemainingDeletionNodeCount field. +func (o *ClusterNodeChangingProgress) SetRemainingDeletionNodeCount(v int32) { + o.RemainingDeletionNodeCount = &v +} + +func (o ClusterNodeChangingProgress) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ClusterNodeChangingProgress) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.MatchingNodeSpecNodeCount) { + toSerialize["matchingNodeSpecNodeCount"] = o.MatchingNodeSpecNodeCount + } + if !IsNil(o.RemainingDeletionNodeCount) { + toSerialize["remainingDeletionNodeCount"] = o.RemainingDeletionNodeCount + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ClusterNodeChangingProgress) UnmarshalJSON(data []byte) (err error) { + varClusterNodeChangingProgress := _ClusterNodeChangingProgress{} + + err = json.Unmarshal(data, &varClusterNodeChangingProgress) + + if err != nil { + return err + } + + *o = ClusterNodeChangingProgress(varClusterNodeChangingProgress) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "matchingNodeSpecNodeCount") + delete(additionalProperties, "remainingDeletionNodeCount") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableClusterNodeChangingProgress struct { + value *ClusterNodeChangingProgress + isSet bool +} + +func (v NullableClusterNodeChangingProgress) Get() *ClusterNodeChangingProgress { + return v.value +} + +func (v *NullableClusterNodeChangingProgress) Set(val *ClusterNodeChangingProgress) { + v.value = val + v.isSet = true +} + +func (v NullableClusterNodeChangingProgress) IsSet() bool { + return v.isSet +} + +func (v *NullableClusterNodeChangingProgress) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClusterNodeChangingProgress(val *ClusterNodeChangingProgress) *NullableClusterNodeChangingProgress { + return &NullableClusterNodeChangingProgress{value: val, isSet: true} +} + +func (v NullableClusterNodeChangingProgress) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClusterNodeChangingProgress) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_cluster_service_list_clusters_cluster_states_parameter_inner.go b/pkg/tidbcloud/v1beta1/dedicated/model_cluster_service_list_clusters_cluster_states_parameter_inner.go new file mode 100644 index 00000000..3e56adb1 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_cluster_service_list_clusters_cluster_states_parameter_inner.go @@ -0,0 +1,132 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// ClusterServiceListClustersClusterStatesParameterInner the model 'ClusterServiceListClustersClusterStatesParameterInner' +type ClusterServiceListClustersClusterStatesParameterInner string + +// List of ClusterService_ListClusters_clusterStates_parameter_inner +const ( + CLUSTERSERVICELISTCLUSTERSCLUSTERSTATESPARAMETERINNER_CREATING ClusterServiceListClustersClusterStatesParameterInner = "CREATING" + CLUSTERSERVICELISTCLUSTERSCLUSTERSTATESPARAMETERINNER_DELETING ClusterServiceListClustersClusterStatesParameterInner = "DELETING" + CLUSTERSERVICELISTCLUSTERSCLUSTERSTATESPARAMETERINNER_ACTIVE ClusterServiceListClustersClusterStatesParameterInner = "ACTIVE" + CLUSTERSERVICELISTCLUSTERSCLUSTERSTATESPARAMETERINNER_RESTORING ClusterServiceListClustersClusterStatesParameterInner = "RESTORING" + CLUSTERSERVICELISTCLUSTERSCLUSTERSTATESPARAMETERINNER_MAINTENANCE ClusterServiceListClustersClusterStatesParameterInner = "MAINTENANCE" + CLUSTERSERVICELISTCLUSTERSCLUSTERSTATESPARAMETERINNER_DELETED ClusterServiceListClustersClusterStatesParameterInner = "DELETED" + CLUSTERSERVICELISTCLUSTERSCLUSTERSTATESPARAMETERINNER_INACTIVE ClusterServiceListClustersClusterStatesParameterInner = "INACTIVE" + CLUSTERSERVICELISTCLUSTERSCLUSTERSTATESPARAMETERINNER_UPGRADING ClusterServiceListClustersClusterStatesParameterInner = "UPGRADING" + CLUSTERSERVICELISTCLUSTERSCLUSTERSTATESPARAMETERINNER_IMPORTING ClusterServiceListClustersClusterStatesParameterInner = "IMPORTING" + CLUSTERSERVICELISTCLUSTERSCLUSTERSTATESPARAMETERINNER_MODIFYING ClusterServiceListClustersClusterStatesParameterInner = "MODIFYING" + CLUSTERSERVICELISTCLUSTERSCLUSTERSTATESPARAMETERINNER_PAUSING ClusterServiceListClustersClusterStatesParameterInner = "PAUSING" + CLUSTERSERVICELISTCLUSTERSCLUSTERSTATESPARAMETERINNER_PAUSED ClusterServiceListClustersClusterStatesParameterInner = "PAUSED" + CLUSTERSERVICELISTCLUSTERSCLUSTERSTATESPARAMETERINNER_RESUMING ClusterServiceListClustersClusterStatesParameterInner = "RESUMING" +) + +// All allowed values of ClusterServiceListClustersClusterStatesParameterInner enum +var AllowedClusterServiceListClustersClusterStatesParameterInnerEnumValues = []ClusterServiceListClustersClusterStatesParameterInner{ + "CREATING", + "DELETING", + "ACTIVE", + "RESTORING", + "MAINTENANCE", + "DELETED", + "INACTIVE", + "UPGRADING", + "IMPORTING", + "MODIFYING", + "PAUSING", + "PAUSED", + "RESUMING", +} + +func (v *ClusterServiceListClustersClusterStatesParameterInner) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ClusterServiceListClustersClusterStatesParameterInner(value) + for _, existing := range AllowedClusterServiceListClustersClusterStatesParameterInnerEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ClusterServiceListClustersClusterStatesParameterInner", value) +} + +// NewClusterServiceListClustersClusterStatesParameterInnerFromValue returns a pointer to a valid ClusterServiceListClustersClusterStatesParameterInner +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewClusterServiceListClustersClusterStatesParameterInnerFromValue(v string) (*ClusterServiceListClustersClusterStatesParameterInner, error) { + ev := ClusterServiceListClustersClusterStatesParameterInner(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ClusterServiceListClustersClusterStatesParameterInner: valid values are %v", v, AllowedClusterServiceListClustersClusterStatesParameterInnerEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ClusterServiceListClustersClusterStatesParameterInner) IsValid() bool { + for _, existing := range AllowedClusterServiceListClustersClusterStatesParameterInnerEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ClusterService_ListClusters_clusterStates_parameter_inner value +func (v ClusterServiceListClustersClusterStatesParameterInner) Ptr() *ClusterServiceListClustersClusterStatesParameterInner { + return &v +} + +type NullableClusterServiceListClustersClusterStatesParameterInner struct { + value *ClusterServiceListClustersClusterStatesParameterInner + isSet bool +} + +func (v NullableClusterServiceListClustersClusterStatesParameterInner) Get() *ClusterServiceListClustersClusterStatesParameterInner { + return v.value +} + +func (v *NullableClusterServiceListClustersClusterStatesParameterInner) Set(val *ClusterServiceListClustersClusterStatesParameterInner) { + v.value = val + v.isSet = true +} + +func (v NullableClusterServiceListClustersClusterStatesParameterInner) IsSet() bool { + return v.isSet +} + +func (v *NullableClusterServiceListClustersClusterStatesParameterInner) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClusterServiceListClustersClusterStatesParameterInner(val *ClusterServiceListClustersClusterStatesParameterInner) *NullableClusterServiceListClustersClusterStatesParameterInner { + return &NullableClusterServiceListClustersClusterStatesParameterInner{value: val, isSet: true} +} + +func (v NullableClusterServiceListClustersClusterStatesParameterInner) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClusterServiceListClustersClusterStatesParameterInner) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_cluster_service_list_node_instances_component_type_parameter.go b/pkg/tidbcloud/v1beta1/dedicated/model_cluster_service_list_node_instances_component_type_parameter.go new file mode 100644 index 00000000..320451c0 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_cluster_service_list_node_instances_component_type_parameter.go @@ -0,0 +1,116 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// ClusterServiceListNodeInstancesComponentTypeParameter the model 'ClusterServiceListNodeInstancesComponentTypeParameter' +type ClusterServiceListNodeInstancesComponentTypeParameter string + +// List of ClusterService_ListNodeInstances_componentType_parameter +const ( + CLUSTERSERVICELISTNODEINSTANCESCOMPONENTTYPEPARAMETER_TIKV ClusterServiceListNodeInstancesComponentTypeParameter = "TIKV" + CLUSTERSERVICELISTNODEINSTANCESCOMPONENTTYPEPARAMETER_TIDB ClusterServiceListNodeInstancesComponentTypeParameter = "TIDB" + CLUSTERSERVICELISTNODEINSTANCESCOMPONENTTYPEPARAMETER_TIFLASH ClusterServiceListNodeInstancesComponentTypeParameter = "TIFLASH" + CLUSTERSERVICELISTNODEINSTANCESCOMPONENTTYPEPARAMETER_PD ClusterServiceListNodeInstancesComponentTypeParameter = "PD" + CLUSTERSERVICELISTNODEINSTANCESCOMPONENTTYPEPARAMETER_TIPROXY ClusterServiceListNodeInstancesComponentTypeParameter = "TIPROXY" +) + +// All allowed values of ClusterServiceListNodeInstancesComponentTypeParameter enum +var AllowedClusterServiceListNodeInstancesComponentTypeParameterEnumValues = []ClusterServiceListNodeInstancesComponentTypeParameter{ + "TIKV", + "TIDB", + "TIFLASH", + "PD", + "TIPROXY", +} + +func (v *ClusterServiceListNodeInstancesComponentTypeParameter) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ClusterServiceListNodeInstancesComponentTypeParameter(value) + for _, existing := range AllowedClusterServiceListNodeInstancesComponentTypeParameterEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ClusterServiceListNodeInstancesComponentTypeParameter", value) +} + +// NewClusterServiceListNodeInstancesComponentTypeParameterFromValue returns a pointer to a valid ClusterServiceListNodeInstancesComponentTypeParameter +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewClusterServiceListNodeInstancesComponentTypeParameterFromValue(v string) (*ClusterServiceListNodeInstancesComponentTypeParameter, error) { + ev := ClusterServiceListNodeInstancesComponentTypeParameter(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ClusterServiceListNodeInstancesComponentTypeParameter: valid values are %v", v, AllowedClusterServiceListNodeInstancesComponentTypeParameterEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ClusterServiceListNodeInstancesComponentTypeParameter) IsValid() bool { + for _, existing := range AllowedClusterServiceListNodeInstancesComponentTypeParameterEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ClusterService_ListNodeInstances_componentType_parameter value +func (v ClusterServiceListNodeInstancesComponentTypeParameter) Ptr() *ClusterServiceListNodeInstancesComponentTypeParameter { + return &v +} + +type NullableClusterServiceListNodeInstancesComponentTypeParameter struct { + value *ClusterServiceListNodeInstancesComponentTypeParameter + isSet bool +} + +func (v NullableClusterServiceListNodeInstancesComponentTypeParameter) Get() *ClusterServiceListNodeInstancesComponentTypeParameter { + return v.value +} + +func (v *NullableClusterServiceListNodeInstancesComponentTypeParameter) Set(val *ClusterServiceListNodeInstancesComponentTypeParameter) { + v.value = val + v.isSet = true +} + +func (v NullableClusterServiceListNodeInstancesComponentTypeParameter) IsSet() bool { + return v.isSet +} + +func (v *NullableClusterServiceListNodeInstancesComponentTypeParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClusterServiceListNodeInstancesComponentTypeParameter(val *ClusterServiceListNodeInstancesComponentTypeParameter) *NullableClusterServiceListNodeInstancesComponentTypeParameter { + return &NullableClusterServiceListNodeInstancesComponentTypeParameter{value: val, isSet: true} +} + +func (v NullableClusterServiceListNodeInstancesComponentTypeParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClusterServiceListNodeInstancesComponentTypeParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_cluster_service_reset_root_password_body.go b/pkg/tidbcloud/v1beta1/dedicated/model_cluster_service_reset_root_password_body.go new file mode 100644 index 00000000..49a33d97 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_cluster_service_reset_root_password_body.go @@ -0,0 +1,166 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the ClusterServiceResetRootPasswordBody type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ClusterServiceResetRootPasswordBody{} + +// ClusterServiceResetRootPasswordBody struct for ClusterServiceResetRootPasswordBody +type ClusterServiceResetRootPasswordBody struct { + RootPassword string `json:"rootPassword"` + AdditionalProperties map[string]interface{} +} + +type _ClusterServiceResetRootPasswordBody ClusterServiceResetRootPasswordBody + +// NewClusterServiceResetRootPasswordBody instantiates a new ClusterServiceResetRootPasswordBody 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 NewClusterServiceResetRootPasswordBody(rootPassword string) *ClusterServiceResetRootPasswordBody { + this := ClusterServiceResetRootPasswordBody{} + this.RootPassword = rootPassword + return &this +} + +// NewClusterServiceResetRootPasswordBodyWithDefaults instantiates a new ClusterServiceResetRootPasswordBody 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 NewClusterServiceResetRootPasswordBodyWithDefaults() *ClusterServiceResetRootPasswordBody { + this := ClusterServiceResetRootPasswordBody{} + return &this +} + +// GetRootPassword returns the RootPassword field value +func (o *ClusterServiceResetRootPasswordBody) GetRootPassword() string { + if o == nil { + var ret string + return ret + } + + return o.RootPassword +} + +// GetRootPasswordOk returns a tuple with the RootPassword field value +// and a boolean to check if the value has been set. +func (o *ClusterServiceResetRootPasswordBody) GetRootPasswordOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RootPassword, true +} + +// SetRootPassword sets field value +func (o *ClusterServiceResetRootPasswordBody) SetRootPassword(v string) { + o.RootPassword = v +} + +func (o ClusterServiceResetRootPasswordBody) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ClusterServiceResetRootPasswordBody) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["rootPassword"] = o.RootPassword + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ClusterServiceResetRootPasswordBody) 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{ + "rootPassword", + } + + 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) + } + } + + varClusterServiceResetRootPasswordBody := _ClusterServiceResetRootPasswordBody{} + + err = json.Unmarshal(data, &varClusterServiceResetRootPasswordBody) + + if err != nil { + return err + } + + *o = ClusterServiceResetRootPasswordBody(varClusterServiceResetRootPasswordBody) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "rootPassword") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableClusterServiceResetRootPasswordBody struct { + value *ClusterServiceResetRootPasswordBody + isSet bool +} + +func (v NullableClusterServiceResetRootPasswordBody) Get() *ClusterServiceResetRootPasswordBody { + return v.value +} + +func (v *NullableClusterServiceResetRootPasswordBody) Set(val *ClusterServiceResetRootPasswordBody) { + v.value = val + v.isSet = true +} + +func (v NullableClusterServiceResetRootPasswordBody) IsSet() bool { + return v.isSet +} + +func (v *NullableClusterServiceResetRootPasswordBody) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClusterServiceResetRootPasswordBody(val *ClusterServiceResetRootPasswordBody) *NullableClusterServiceResetRootPasswordBody { + return &NullableClusterServiceResetRootPasswordBody{value: val, isSet: true} +} + +func (v NullableClusterServiceResetRootPasswordBody) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClusterServiceResetRootPasswordBody) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_cluster_service_update_cluster_request.go b/pkg/tidbcloud/v1beta1/dedicated/model_cluster_service_update_cluster_request.go new file mode 100644 index 00000000..a22b3fae --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_cluster_service_update_cluster_request.go @@ -0,0 +1,302 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the ClusterServiceUpdateClusterRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ClusterServiceUpdateClusterRequest{} + +// ClusterServiceUpdateClusterRequest struct for ClusterServiceUpdateClusterRequest +type ClusterServiceUpdateClusterRequest struct { + TidbNodeSetting *V1beta1UpdateClusterRequestTidbNodeSetting `json:"tidbNodeSetting,omitempty"` + TikvNodeSetting *V1beta1UpdateClusterRequestStorageNodeSetting `json:"tikvNodeSetting,omitempty"` + TiflashNodeSetting *V1beta1UpdateClusterRequestStorageNodeSetting `json:"tiflashNodeSetting,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + // The project_id key cannot be updated. If the project_id key is specified, it will be ignored. + Labels *map[string]string `json:"labels,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ClusterServiceUpdateClusterRequest ClusterServiceUpdateClusterRequest + +// NewClusterServiceUpdateClusterRequest instantiates a new ClusterServiceUpdateClusterRequest 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 NewClusterServiceUpdateClusterRequest() *ClusterServiceUpdateClusterRequest { + this := ClusterServiceUpdateClusterRequest{} + return &this +} + +// NewClusterServiceUpdateClusterRequestWithDefaults instantiates a new ClusterServiceUpdateClusterRequest 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 NewClusterServiceUpdateClusterRequestWithDefaults() *ClusterServiceUpdateClusterRequest { + this := ClusterServiceUpdateClusterRequest{} + return &this +} + +// GetTidbNodeSetting returns the TidbNodeSetting field value if set, zero value otherwise. +func (o *ClusterServiceUpdateClusterRequest) GetTidbNodeSetting() V1beta1UpdateClusterRequestTidbNodeSetting { + if o == nil || IsNil(o.TidbNodeSetting) { + var ret V1beta1UpdateClusterRequestTidbNodeSetting + return ret + } + return *o.TidbNodeSetting +} + +// GetTidbNodeSettingOk returns a tuple with the TidbNodeSetting field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ClusterServiceUpdateClusterRequest) GetTidbNodeSettingOk() (*V1beta1UpdateClusterRequestTidbNodeSetting, bool) { + if o == nil || IsNil(o.TidbNodeSetting) { + return nil, false + } + return o.TidbNodeSetting, true +} + +// HasTidbNodeSetting returns a boolean if a field has been set. +func (o *ClusterServiceUpdateClusterRequest) HasTidbNodeSetting() bool { + if o != nil && !IsNil(o.TidbNodeSetting) { + return true + } + + return false +} + +// SetTidbNodeSetting gets a reference to the given V1beta1UpdateClusterRequestTidbNodeSetting and assigns it to the TidbNodeSetting field. +func (o *ClusterServiceUpdateClusterRequest) SetTidbNodeSetting(v V1beta1UpdateClusterRequestTidbNodeSetting) { + o.TidbNodeSetting = &v +} + +// GetTikvNodeSetting returns the TikvNodeSetting field value if set, zero value otherwise. +func (o *ClusterServiceUpdateClusterRequest) GetTikvNodeSetting() V1beta1UpdateClusterRequestStorageNodeSetting { + if o == nil || IsNil(o.TikvNodeSetting) { + var ret V1beta1UpdateClusterRequestStorageNodeSetting + return ret + } + return *o.TikvNodeSetting +} + +// GetTikvNodeSettingOk returns a tuple with the TikvNodeSetting field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ClusterServiceUpdateClusterRequest) GetTikvNodeSettingOk() (*V1beta1UpdateClusterRequestStorageNodeSetting, bool) { + if o == nil || IsNil(o.TikvNodeSetting) { + return nil, false + } + return o.TikvNodeSetting, true +} + +// HasTikvNodeSetting returns a boolean if a field has been set. +func (o *ClusterServiceUpdateClusterRequest) HasTikvNodeSetting() bool { + if o != nil && !IsNil(o.TikvNodeSetting) { + return true + } + + return false +} + +// SetTikvNodeSetting gets a reference to the given V1beta1UpdateClusterRequestStorageNodeSetting and assigns it to the TikvNodeSetting field. +func (o *ClusterServiceUpdateClusterRequest) SetTikvNodeSetting(v V1beta1UpdateClusterRequestStorageNodeSetting) { + o.TikvNodeSetting = &v +} + +// GetTiflashNodeSetting returns the TiflashNodeSetting field value if set, zero value otherwise. +func (o *ClusterServiceUpdateClusterRequest) GetTiflashNodeSetting() V1beta1UpdateClusterRequestStorageNodeSetting { + if o == nil || IsNil(o.TiflashNodeSetting) { + var ret V1beta1UpdateClusterRequestStorageNodeSetting + return ret + } + return *o.TiflashNodeSetting +} + +// GetTiflashNodeSettingOk returns a tuple with the TiflashNodeSetting field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ClusterServiceUpdateClusterRequest) GetTiflashNodeSettingOk() (*V1beta1UpdateClusterRequestStorageNodeSetting, bool) { + if o == nil || IsNil(o.TiflashNodeSetting) { + return nil, false + } + return o.TiflashNodeSetting, true +} + +// HasTiflashNodeSetting returns a boolean if a field has been set. +func (o *ClusterServiceUpdateClusterRequest) HasTiflashNodeSetting() bool { + if o != nil && !IsNil(o.TiflashNodeSetting) { + return true + } + + return false +} + +// SetTiflashNodeSetting gets a reference to the given V1beta1UpdateClusterRequestStorageNodeSetting and assigns it to the TiflashNodeSetting field. +func (o *ClusterServiceUpdateClusterRequest) SetTiflashNodeSetting(v V1beta1UpdateClusterRequestStorageNodeSetting) { + o.TiflashNodeSetting = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *ClusterServiceUpdateClusterRequest) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ClusterServiceUpdateClusterRequest) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *ClusterServiceUpdateClusterRequest) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *ClusterServiceUpdateClusterRequest) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *ClusterServiceUpdateClusterRequest) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ClusterServiceUpdateClusterRequest) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *ClusterServiceUpdateClusterRequest) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *ClusterServiceUpdateClusterRequest) SetLabels(v map[string]string) { + o.Labels = &v +} + +func (o ClusterServiceUpdateClusterRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ClusterServiceUpdateClusterRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.TidbNodeSetting) { + toSerialize["tidbNodeSetting"] = o.TidbNodeSetting + } + if !IsNil(o.TikvNodeSetting) { + toSerialize["tikvNodeSetting"] = o.TikvNodeSetting + } + if !IsNil(o.TiflashNodeSetting) { + toSerialize["tiflashNodeSetting"] = o.TiflashNodeSetting + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ClusterServiceUpdateClusterRequest) UnmarshalJSON(data []byte) (err error) { + varClusterServiceUpdateClusterRequest := _ClusterServiceUpdateClusterRequest{} + + err = json.Unmarshal(data, &varClusterServiceUpdateClusterRequest) + + if err != nil { + return err + } + + *o = ClusterServiceUpdateClusterRequest(varClusterServiceUpdateClusterRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "tidbNodeSetting") + delete(additionalProperties, "tikvNodeSetting") + delete(additionalProperties, "tiflashNodeSetting") + delete(additionalProperties, "displayName") + delete(additionalProperties, "labels") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableClusterServiceUpdateClusterRequest struct { + value *ClusterServiceUpdateClusterRequest + isSet bool +} + +func (v NullableClusterServiceUpdateClusterRequest) Get() *ClusterServiceUpdateClusterRequest { + return v.value +} + +func (v *NullableClusterServiceUpdateClusterRequest) Set(val *ClusterServiceUpdateClusterRequest) { + v.value = val + v.isSet = true +} + +func (v NullableClusterServiceUpdateClusterRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableClusterServiceUpdateClusterRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClusterServiceUpdateClusterRequest(val *ClusterServiceUpdateClusterRequest) *NullableClusterServiceUpdateClusterRequest { + return &NullableClusterServiceUpdateClusterRequest{value: val, isSet: true} +} + +func (v NullableClusterServiceUpdateClusterRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClusterServiceUpdateClusterRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_cluster_storage_node_setting_storage_type.go b/pkg/tidbcloud/v1beta1/dedicated/model_cluster_storage_node_setting_storage_type.go new file mode 100644 index 00000000..52b818c2 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_cluster_storage_node_setting_storage_type.go @@ -0,0 +1,114 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// ClusterStorageNodeSettingStorageType the model 'ClusterStorageNodeSettingStorageType' +type ClusterStorageNodeSettingStorageType string + +// List of ClusterStorageNodeSettingStorageType +const ( + CLUSTERSTORAGENODESETTINGSTORAGETYPE_BASIC ClusterStorageNodeSettingStorageType = "BASIC" + CLUSTERSTORAGENODESETTINGSTORAGETYPE_BASICV2 ClusterStorageNodeSettingStorageType = "BASICV2" + CLUSTERSTORAGENODESETTINGSTORAGETYPE_OPTIMIZED ClusterStorageNodeSettingStorageType = "OPTIMIZED" + CLUSTERSTORAGENODESETTINGSTORAGETYPE_PLUS ClusterStorageNodeSettingStorageType = "PLUS" +) + +// All allowed values of ClusterStorageNodeSettingStorageType enum +var AllowedClusterStorageNodeSettingStorageTypeEnumValues = []ClusterStorageNodeSettingStorageType{ + "BASIC", + "BASICV2", + "OPTIMIZED", + "PLUS", +} + +func (v *ClusterStorageNodeSettingStorageType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := ClusterStorageNodeSettingStorageType(value) + for _, existing := range AllowedClusterStorageNodeSettingStorageTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid ClusterStorageNodeSettingStorageType", value) +} + +// NewClusterStorageNodeSettingStorageTypeFromValue returns a pointer to a valid ClusterStorageNodeSettingStorageType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewClusterStorageNodeSettingStorageTypeFromValue(v string) (*ClusterStorageNodeSettingStorageType, error) { + ev := ClusterStorageNodeSettingStorageType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for ClusterStorageNodeSettingStorageType: valid values are %v", v, AllowedClusterStorageNodeSettingStorageTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v ClusterStorageNodeSettingStorageType) IsValid() bool { + for _, existing := range AllowedClusterStorageNodeSettingStorageTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to ClusterStorageNodeSettingStorageType value +func (v ClusterStorageNodeSettingStorageType) Ptr() *ClusterStorageNodeSettingStorageType { + return &v +} + +type NullableClusterStorageNodeSettingStorageType struct { + value *ClusterStorageNodeSettingStorageType + isSet bool +} + +func (v NullableClusterStorageNodeSettingStorageType) Get() *ClusterStorageNodeSettingStorageType { + return v.value +} + +func (v *NullableClusterStorageNodeSettingStorageType) Set(val *ClusterStorageNodeSettingStorageType) { + v.value = val + v.isSet = true +} + +func (v NullableClusterStorageNodeSettingStorageType) IsSet() bool { + return v.isSet +} + +func (v *NullableClusterStorageNodeSettingStorageType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableClusterStorageNodeSettingStorageType(val *ClusterStorageNodeSettingStorageType) *NullableClusterStorageNodeSettingStorageType { + return &NullableClusterStorageNodeSettingStorageType{value: val, isSet: true} +} + +func (v NullableClusterStorageNodeSettingStorageType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableClusterStorageNodeSettingStorageType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_commonv1beta1_cluster_state.go b/pkg/tidbcloud/v1beta1/dedicated/model_commonv1beta1_cluster_state.go new file mode 100644 index 00000000..c33826e2 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_commonv1beta1_cluster_state.go @@ -0,0 +1,132 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// Commonv1beta1ClusterState Enum of possible states of a cluster. - CREATING: Cluster is being created. - DELETING: Cluster is being deleted. - ACTIVE: Cluster is active for use. - RESTORING: Cluster data is being restored. - MAINTENANCE: Cluster is under maintenance. - DELETED: Cluster has been deleted. - INACTIVE: Cluster is not active, but not being deleted. - UPGRADING: Cluster is being updated. Only for Dedicated Cluster. - IMPORTING: Cluster is being imported. Only for Dedicated Cluster. - MODIFYING: Cluster is being modified. Only for Dedicated Cluster. - PAUSING: Cluster is being paused. Only for Dedicated Cluster. - PAUSED: Cluster is paused. Only for Dedicated Cluster. - RESUMING: Cluster is resuming. Only for Dedicated Cluster. +type Commonv1beta1ClusterState string + +// List of commonv1beta1ClusterState +const ( + COMMONV1BETA1CLUSTERSTATE_CREATING Commonv1beta1ClusterState = "CREATING" + COMMONV1BETA1CLUSTERSTATE_DELETING Commonv1beta1ClusterState = "DELETING" + COMMONV1BETA1CLUSTERSTATE_ACTIVE Commonv1beta1ClusterState = "ACTIVE" + COMMONV1BETA1CLUSTERSTATE_RESTORING Commonv1beta1ClusterState = "RESTORING" + COMMONV1BETA1CLUSTERSTATE_MAINTENANCE Commonv1beta1ClusterState = "MAINTENANCE" + COMMONV1BETA1CLUSTERSTATE_DELETED Commonv1beta1ClusterState = "DELETED" + COMMONV1BETA1CLUSTERSTATE_INACTIVE Commonv1beta1ClusterState = "INACTIVE" + COMMONV1BETA1CLUSTERSTATE_UPGRADING Commonv1beta1ClusterState = "UPGRADING" + COMMONV1BETA1CLUSTERSTATE_IMPORTING Commonv1beta1ClusterState = "IMPORTING" + COMMONV1BETA1CLUSTERSTATE_MODIFYING Commonv1beta1ClusterState = "MODIFYING" + COMMONV1BETA1CLUSTERSTATE_PAUSING Commonv1beta1ClusterState = "PAUSING" + COMMONV1BETA1CLUSTERSTATE_PAUSED Commonv1beta1ClusterState = "PAUSED" + COMMONV1BETA1CLUSTERSTATE_RESUMING Commonv1beta1ClusterState = "RESUMING" +) + +// All allowed values of Commonv1beta1ClusterState enum +var AllowedCommonv1beta1ClusterStateEnumValues = []Commonv1beta1ClusterState{ + "CREATING", + "DELETING", + "ACTIVE", + "RESTORING", + "MAINTENANCE", + "DELETED", + "INACTIVE", + "UPGRADING", + "IMPORTING", + "MODIFYING", + "PAUSING", + "PAUSED", + "RESUMING", +} + +func (v *Commonv1beta1ClusterState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := Commonv1beta1ClusterState(value) + for _, existing := range AllowedCommonv1beta1ClusterStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Commonv1beta1ClusterState", value) +} + +// NewCommonv1beta1ClusterStateFromValue returns a pointer to a valid Commonv1beta1ClusterState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewCommonv1beta1ClusterStateFromValue(v string) (*Commonv1beta1ClusterState, error) { + ev := Commonv1beta1ClusterState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Commonv1beta1ClusterState: valid values are %v", v, AllowedCommonv1beta1ClusterStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Commonv1beta1ClusterState) IsValid() bool { + for _, existing := range AllowedCommonv1beta1ClusterStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to commonv1beta1ClusterState value +func (v Commonv1beta1ClusterState) Ptr() *Commonv1beta1ClusterState { + return &v +} + +type NullableCommonv1beta1ClusterState struct { + value *Commonv1beta1ClusterState + isSet bool +} + +func (v NullableCommonv1beta1ClusterState) Get() *Commonv1beta1ClusterState { + return v.value +} + +func (v *NullableCommonv1beta1ClusterState) Set(val *Commonv1beta1ClusterState) { + v.value = val + v.isSet = true +} + +func (v NullableCommonv1beta1ClusterState) IsSet() bool { + return v.isSet +} + +func (v *NullableCommonv1beta1ClusterState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCommonv1beta1ClusterState(val *Commonv1beta1ClusterState) *NullableCommonv1beta1ClusterState { + return &NullableCommonv1beta1ClusterState{value: val, isSet: true} +} + +func (v NullableCommonv1beta1ClusterState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCommonv1beta1ClusterState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_commonv1beta1_region.go b/pkg/tidbcloud/v1beta1/dedicated/model_commonv1beta1_region.go new file mode 100644 index 00000000..816af31a --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_commonv1beta1_region.go @@ -0,0 +1,316 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the Commonv1beta1Region type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Commonv1beta1Region{} + +// Commonv1beta1Region A representation of a region for deploying TiDB clusters. +type Commonv1beta1Region struct { + Name *string `json:"name,omitempty" validate:"regexp=^regions\\/(aws|gcp|azure)-(.+)$"` + // Format: {cloud_provider}-{region_code} Region code: us-west-2, asia-east1. + RegionId *string `json:"regionId,omitempty"` + // The cloud provider for the region. + CloudProvider *V1beta1RegionCloudProvider `json:"cloudProvider,omitempty"` + // User-friendly display name of the region. + DisplayName *string `json:"displayName,omitempty"` + // Optional provider name for the region. Only used for serverless cluster. Deprecated. + Provider NullableString `json:"provider,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Commonv1beta1Region Commonv1beta1Region + +// NewCommonv1beta1Region instantiates a new Commonv1beta1Region 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 NewCommonv1beta1Region() *Commonv1beta1Region { + this := Commonv1beta1Region{} + return &this +} + +// NewCommonv1beta1RegionWithDefaults instantiates a new Commonv1beta1Region 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 NewCommonv1beta1RegionWithDefaults() *Commonv1beta1Region { + this := Commonv1beta1Region{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Commonv1beta1Region) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Commonv1beta1Region) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Commonv1beta1Region) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Commonv1beta1Region) SetName(v string) { + o.Name = &v +} + +// GetRegionId returns the RegionId field value if set, zero value otherwise. +func (o *Commonv1beta1Region) GetRegionId() string { + if o == nil || IsNil(o.RegionId) { + var ret string + return ret + } + return *o.RegionId +} + +// GetRegionIdOk returns a tuple with the RegionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Commonv1beta1Region) GetRegionIdOk() (*string, bool) { + if o == nil || IsNil(o.RegionId) { + return nil, false + } + return o.RegionId, true +} + +// HasRegionId returns a boolean if a field has been set. +func (o *Commonv1beta1Region) HasRegionId() bool { + if o != nil && !IsNil(o.RegionId) { + return true + } + + return false +} + +// SetRegionId gets a reference to the given string and assigns it to the RegionId field. +func (o *Commonv1beta1Region) SetRegionId(v string) { + o.RegionId = &v +} + +// GetCloudProvider returns the CloudProvider field value if set, zero value otherwise. +func (o *Commonv1beta1Region) GetCloudProvider() V1beta1RegionCloudProvider { + if o == nil || IsNil(o.CloudProvider) { + var ret V1beta1RegionCloudProvider + return ret + } + return *o.CloudProvider +} + +// GetCloudProviderOk returns a tuple with the CloudProvider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Commonv1beta1Region) GetCloudProviderOk() (*V1beta1RegionCloudProvider, bool) { + if o == nil || IsNil(o.CloudProvider) { + return nil, false + } + return o.CloudProvider, true +} + +// HasCloudProvider returns a boolean if a field has been set. +func (o *Commonv1beta1Region) HasCloudProvider() bool { + if o != nil && !IsNil(o.CloudProvider) { + return true + } + + return false +} + +// SetCloudProvider gets a reference to the given V1beta1RegionCloudProvider and assigns it to the CloudProvider field. +func (o *Commonv1beta1Region) SetCloudProvider(v V1beta1RegionCloudProvider) { + o.CloudProvider = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *Commonv1beta1Region) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Commonv1beta1Region) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *Commonv1beta1Region) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *Commonv1beta1Region) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetProvider returns the Provider field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Commonv1beta1Region) GetProvider() string { + if o == nil || IsNil(o.Provider.Get()) { + var ret string + return ret + } + return *o.Provider.Get() +} + +// GetProviderOk returns a tuple with the Provider field value if set, nil otherwise +// 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 *Commonv1beta1Region) GetProviderOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.Provider.Get(), o.Provider.IsSet() +} + +// HasProvider returns a boolean if a field has been set. +func (o *Commonv1beta1Region) HasProvider() bool { + if o != nil && o.Provider.IsSet() { + return true + } + + return false +} + +// SetProvider gets a reference to the given NullableString and assigns it to the Provider field. +func (o *Commonv1beta1Region) SetProvider(v string) { + o.Provider.Set(&v) +} + +// SetProviderNil sets the value for Provider to be an explicit nil +func (o *Commonv1beta1Region) SetProviderNil() { + o.Provider.Set(nil) +} + +// UnsetProvider ensures that no value is present for Provider, not even an explicit nil +func (o *Commonv1beta1Region) UnsetProvider() { + o.Provider.Unset() +} + +func (o Commonv1beta1Region) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Commonv1beta1Region) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.RegionId) { + toSerialize["regionId"] = o.RegionId + } + if !IsNil(o.CloudProvider) { + toSerialize["cloudProvider"] = o.CloudProvider + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + if o.Provider.IsSet() { + toSerialize["provider"] = o.Provider.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Commonv1beta1Region) UnmarshalJSON(data []byte) (err error) { + varCommonv1beta1Region := _Commonv1beta1Region{} + + err = json.Unmarshal(data, &varCommonv1beta1Region) + + if err != nil { + return err + } + + *o = Commonv1beta1Region(varCommonv1beta1Region) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "regionId") + delete(additionalProperties, "cloudProvider") + delete(additionalProperties, "displayName") + delete(additionalProperties, "provider") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableCommonv1beta1Region struct { + value *Commonv1beta1Region + isSet bool +} + +func (v NullableCommonv1beta1Region) Get() *Commonv1beta1Region { + return v.value +} + +func (v *NullableCommonv1beta1Region) Set(val *Commonv1beta1Region) { + v.value = val + v.isSet = true +} + +func (v NullableCommonv1beta1Region) IsSet() bool { + return v.isSet +} + +func (v *NullableCommonv1beta1Region) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableCommonv1beta1Region(val *Commonv1beta1Region) *NullableCommonv1beta1Region { + return &NullableCommonv1beta1Region{value: val, isSet: true} +} + +func (v NullableCommonv1beta1Region) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableCommonv1beta1Region) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_database_audit_log_service_create_audit_log_config_request.go b/pkg/tidbcloud/v1beta1/dedicated/model_database_audit_log_service_create_audit_log_config_request.go new file mode 100644 index 00000000..7bf96a12 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_database_audit_log_service_create_audit_log_config_request.go @@ -0,0 +1,389 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the DatabaseAuditLogServiceCreateAuditLogConfigRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DatabaseAuditLogServiceCreateAuditLogConfigRequest{} + +// DatabaseAuditLogServiceCreateAuditLogConfigRequest struct for DatabaseAuditLogServiceCreateAuditLogConfigRequest +type DatabaseAuditLogServiceCreateAuditLogConfigRequest struct { + Name *string `json:"name,omitempty"` + // Default is false. + Enabled *bool `json:"enabled,omitempty"` + BucketUri string `json:"bucketUri"` + BucketRegionId *string `json:"bucketRegionId,omitempty"` + AwsRoleArn *string `json:"awsRoleArn,omitempty"` + AzureSasToken *string `json:"azureSasToken,omitempty"` + BucketWriteCheck *AuditLogConfigBucketWriteCheck `json:"bucketWriteCheck,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DatabaseAuditLogServiceCreateAuditLogConfigRequest DatabaseAuditLogServiceCreateAuditLogConfigRequest + +// NewDatabaseAuditLogServiceCreateAuditLogConfigRequest instantiates a new DatabaseAuditLogServiceCreateAuditLogConfigRequest 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 NewDatabaseAuditLogServiceCreateAuditLogConfigRequest(bucketUri string) *DatabaseAuditLogServiceCreateAuditLogConfigRequest { + this := DatabaseAuditLogServiceCreateAuditLogConfigRequest{} + this.BucketUri = bucketUri + return &this +} + +// NewDatabaseAuditLogServiceCreateAuditLogConfigRequestWithDefaults instantiates a new DatabaseAuditLogServiceCreateAuditLogConfigRequest 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 NewDatabaseAuditLogServiceCreateAuditLogConfigRequestWithDefaults() *DatabaseAuditLogServiceCreateAuditLogConfigRequest { + this := DatabaseAuditLogServiceCreateAuditLogConfigRequest{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) SetName(v string) { + o.Name = &v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) GetEnabled() bool { + if o == nil || IsNil(o.Enabled) { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) GetEnabledOk() (*bool, bool) { + if o == nil || IsNil(o.Enabled) { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) HasEnabled() bool { + if o != nil && !IsNil(o.Enabled) { + return true + } + + return false +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetBucketUri returns the BucketUri field value +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) GetBucketUri() string { + if o == nil { + var ret string + return ret + } + + return o.BucketUri +} + +// GetBucketUriOk returns a tuple with the BucketUri field value +// and a boolean to check if the value has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) GetBucketUriOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BucketUri, true +} + +// SetBucketUri sets field value +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) SetBucketUri(v string) { + o.BucketUri = v +} + +// GetBucketRegionId returns the BucketRegionId field value if set, zero value otherwise. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) GetBucketRegionId() string { + if o == nil || IsNil(o.BucketRegionId) { + var ret string + return ret + } + return *o.BucketRegionId +} + +// GetBucketRegionIdOk returns a tuple with the BucketRegionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) GetBucketRegionIdOk() (*string, bool) { + if o == nil || IsNil(o.BucketRegionId) { + return nil, false + } + return o.BucketRegionId, true +} + +// HasBucketRegionId returns a boolean if a field has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) HasBucketRegionId() bool { + if o != nil && !IsNil(o.BucketRegionId) { + return true + } + + return false +} + +// SetBucketRegionId gets a reference to the given string and assigns it to the BucketRegionId field. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) SetBucketRegionId(v string) { + o.BucketRegionId = &v +} + +// GetAwsRoleArn returns the AwsRoleArn field value if set, zero value otherwise. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) GetAwsRoleArn() string { + if o == nil || IsNil(o.AwsRoleArn) { + var ret string + return ret + } + return *o.AwsRoleArn +} + +// GetAwsRoleArnOk returns a tuple with the AwsRoleArn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) GetAwsRoleArnOk() (*string, bool) { + if o == nil || IsNil(o.AwsRoleArn) { + return nil, false + } + return o.AwsRoleArn, true +} + +// HasAwsRoleArn returns a boolean if a field has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) HasAwsRoleArn() bool { + if o != nil && !IsNil(o.AwsRoleArn) { + return true + } + + return false +} + +// SetAwsRoleArn gets a reference to the given string and assigns it to the AwsRoleArn field. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) SetAwsRoleArn(v string) { + o.AwsRoleArn = &v +} + +// GetAzureSasToken returns the AzureSasToken field value if set, zero value otherwise. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) GetAzureSasToken() string { + if o == nil || IsNil(o.AzureSasToken) { + var ret string + return ret + } + return *o.AzureSasToken +} + +// GetAzureSasTokenOk returns a tuple with the AzureSasToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) GetAzureSasTokenOk() (*string, bool) { + if o == nil || IsNil(o.AzureSasToken) { + return nil, false + } + return o.AzureSasToken, true +} + +// HasAzureSasToken returns a boolean if a field has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) HasAzureSasToken() bool { + if o != nil && !IsNil(o.AzureSasToken) { + return true + } + + return false +} + +// SetAzureSasToken gets a reference to the given string and assigns it to the AzureSasToken field. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) SetAzureSasToken(v string) { + o.AzureSasToken = &v +} + +// GetBucketWriteCheck returns the BucketWriteCheck field value if set, zero value otherwise. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) GetBucketWriteCheck() AuditLogConfigBucketWriteCheck { + if o == nil || IsNil(o.BucketWriteCheck) { + var ret AuditLogConfigBucketWriteCheck + return ret + } + return *o.BucketWriteCheck +} + +// GetBucketWriteCheckOk returns a tuple with the BucketWriteCheck field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) GetBucketWriteCheckOk() (*AuditLogConfigBucketWriteCheck, bool) { + if o == nil || IsNil(o.BucketWriteCheck) { + return nil, false + } + return o.BucketWriteCheck, true +} + +// HasBucketWriteCheck returns a boolean if a field has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) HasBucketWriteCheck() bool { + if o != nil && !IsNil(o.BucketWriteCheck) { + return true + } + + return false +} + +// SetBucketWriteCheck gets a reference to the given AuditLogConfigBucketWriteCheck and assigns it to the BucketWriteCheck field. +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) SetBucketWriteCheck(v AuditLogConfigBucketWriteCheck) { + o.BucketWriteCheck = &v +} + +func (o DatabaseAuditLogServiceCreateAuditLogConfigRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DatabaseAuditLogServiceCreateAuditLogConfigRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.Enabled) { + toSerialize["enabled"] = o.Enabled + } + toSerialize["bucketUri"] = o.BucketUri + if !IsNil(o.BucketRegionId) { + toSerialize["bucketRegionId"] = o.BucketRegionId + } + if !IsNil(o.AwsRoleArn) { + toSerialize["awsRoleArn"] = o.AwsRoleArn + } + if !IsNil(o.AzureSasToken) { + toSerialize["azureSasToken"] = o.AzureSasToken + } + if !IsNil(o.BucketWriteCheck) { + toSerialize["bucketWriteCheck"] = o.BucketWriteCheck + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DatabaseAuditLogServiceCreateAuditLogConfigRequest) 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{ + "bucketUri", + } + + 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) + } + } + + varDatabaseAuditLogServiceCreateAuditLogConfigRequest := _DatabaseAuditLogServiceCreateAuditLogConfigRequest{} + + err = json.Unmarshal(data, &varDatabaseAuditLogServiceCreateAuditLogConfigRequest) + + if err != nil { + return err + } + + *o = DatabaseAuditLogServiceCreateAuditLogConfigRequest(varDatabaseAuditLogServiceCreateAuditLogConfigRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "enabled") + delete(additionalProperties, "bucketUri") + delete(additionalProperties, "bucketRegionId") + delete(additionalProperties, "awsRoleArn") + delete(additionalProperties, "azureSasToken") + delete(additionalProperties, "bucketWriteCheck") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDatabaseAuditLogServiceCreateAuditLogConfigRequest struct { + value *DatabaseAuditLogServiceCreateAuditLogConfigRequest + isSet bool +} + +func (v NullableDatabaseAuditLogServiceCreateAuditLogConfigRequest) Get() *DatabaseAuditLogServiceCreateAuditLogConfigRequest { + return v.value +} + +func (v *NullableDatabaseAuditLogServiceCreateAuditLogConfigRequest) Set(val *DatabaseAuditLogServiceCreateAuditLogConfigRequest) { + v.value = val + v.isSet = true +} + +func (v NullableDatabaseAuditLogServiceCreateAuditLogConfigRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableDatabaseAuditLogServiceCreateAuditLogConfigRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDatabaseAuditLogServiceCreateAuditLogConfigRequest(val *DatabaseAuditLogServiceCreateAuditLogConfigRequest) *NullableDatabaseAuditLogServiceCreateAuditLogConfigRequest { + return &NullableDatabaseAuditLogServiceCreateAuditLogConfigRequest{value: val, isSet: true} +} + +func (v NullableDatabaseAuditLogServiceCreateAuditLogConfigRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDatabaseAuditLogServiceCreateAuditLogConfigRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_database_audit_log_service_create_audit_log_filter_rule_request.go b/pkg/tidbcloud/v1beta1/dedicated/model_database_audit_log_service_create_audit_log_filter_rule_request.go new file mode 100644 index 00000000..82c5960e --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_database_audit_log_service_create_audit_log_filter_rule_request.go @@ -0,0 +1,338 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest{} + +// DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest struct for DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest +type DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest struct { + Name *string `json:"name,omitempty"` + AuditLogFilterRuleId *string `json:"auditLogFilterRuleId,omitempty"` + UserExpr *string `json:"userExpr,omitempty"` + DbExpr *string `json:"dbExpr,omitempty"` + TableExpr *string `json:"tableExpr,omitempty"` + AccessTypeList []string `json:"accessTypeList,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest + +// NewDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest instantiates a new DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest 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 NewDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest() *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest { + this := DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest{} + return &this +} + +// NewDatabaseAuditLogServiceCreateAuditLogFilterRuleRequestWithDefaults instantiates a new DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest 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 NewDatabaseAuditLogServiceCreateAuditLogFilterRuleRequestWithDefaults() *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest { + this := DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) SetName(v string) { + o.Name = &v +} + +// GetAuditLogFilterRuleId returns the AuditLogFilterRuleId field value if set, zero value otherwise. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) GetAuditLogFilterRuleId() string { + if o == nil || IsNil(o.AuditLogFilterRuleId) { + var ret string + return ret + } + return *o.AuditLogFilterRuleId +} + +// GetAuditLogFilterRuleIdOk returns a tuple with the AuditLogFilterRuleId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) GetAuditLogFilterRuleIdOk() (*string, bool) { + if o == nil || IsNil(o.AuditLogFilterRuleId) { + return nil, false + } + return o.AuditLogFilterRuleId, true +} + +// HasAuditLogFilterRuleId returns a boolean if a field has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) HasAuditLogFilterRuleId() bool { + if o != nil && !IsNil(o.AuditLogFilterRuleId) { + return true + } + + return false +} + +// SetAuditLogFilterRuleId gets a reference to the given string and assigns it to the AuditLogFilterRuleId field. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) SetAuditLogFilterRuleId(v string) { + o.AuditLogFilterRuleId = &v +} + +// GetUserExpr returns the UserExpr field value if set, zero value otherwise. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) GetUserExpr() string { + if o == nil || IsNil(o.UserExpr) { + var ret string + return ret + } + return *o.UserExpr +} + +// GetUserExprOk returns a tuple with the UserExpr field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) GetUserExprOk() (*string, bool) { + if o == nil || IsNil(o.UserExpr) { + return nil, false + } + return o.UserExpr, true +} + +// HasUserExpr returns a boolean if a field has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) HasUserExpr() bool { + if o != nil && !IsNil(o.UserExpr) { + return true + } + + return false +} + +// SetUserExpr gets a reference to the given string and assigns it to the UserExpr field. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) SetUserExpr(v string) { + o.UserExpr = &v +} + +// GetDbExpr returns the DbExpr field value if set, zero value otherwise. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) GetDbExpr() string { + if o == nil || IsNil(o.DbExpr) { + var ret string + return ret + } + return *o.DbExpr +} + +// GetDbExprOk returns a tuple with the DbExpr field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) GetDbExprOk() (*string, bool) { + if o == nil || IsNil(o.DbExpr) { + return nil, false + } + return o.DbExpr, true +} + +// HasDbExpr returns a boolean if a field has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) HasDbExpr() bool { + if o != nil && !IsNil(o.DbExpr) { + return true + } + + return false +} + +// SetDbExpr gets a reference to the given string and assigns it to the DbExpr field. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) SetDbExpr(v string) { + o.DbExpr = &v +} + +// GetTableExpr returns the TableExpr field value if set, zero value otherwise. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) GetTableExpr() string { + if o == nil || IsNil(o.TableExpr) { + var ret string + return ret + } + return *o.TableExpr +} + +// GetTableExprOk returns a tuple with the TableExpr field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) GetTableExprOk() (*string, bool) { + if o == nil || IsNil(o.TableExpr) { + return nil, false + } + return o.TableExpr, true +} + +// HasTableExpr returns a boolean if a field has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) HasTableExpr() bool { + if o != nil && !IsNil(o.TableExpr) { + return true + } + + return false +} + +// SetTableExpr gets a reference to the given string and assigns it to the TableExpr field. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) SetTableExpr(v string) { + o.TableExpr = &v +} + +// GetAccessTypeList returns the AccessTypeList field value if set, zero value otherwise. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) GetAccessTypeList() []string { + if o == nil || IsNil(o.AccessTypeList) { + var ret []string + return ret + } + return o.AccessTypeList +} + +// GetAccessTypeListOk returns a tuple with the AccessTypeList field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) GetAccessTypeListOk() ([]string, bool) { + if o == nil || IsNil(o.AccessTypeList) { + return nil, false + } + return o.AccessTypeList, true +} + +// HasAccessTypeList returns a boolean if a field has been set. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) HasAccessTypeList() bool { + if o != nil && !IsNil(o.AccessTypeList) { + return true + } + + return false +} + +// SetAccessTypeList gets a reference to the given []string and assigns it to the AccessTypeList field. +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) SetAccessTypeList(v []string) { + o.AccessTypeList = v +} + +func (o DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.AuditLogFilterRuleId) { + toSerialize["auditLogFilterRuleId"] = o.AuditLogFilterRuleId + } + if !IsNil(o.UserExpr) { + toSerialize["userExpr"] = o.UserExpr + } + if !IsNil(o.DbExpr) { + toSerialize["dbExpr"] = o.DbExpr + } + if !IsNil(o.TableExpr) { + toSerialize["tableExpr"] = o.TableExpr + } + if !IsNil(o.AccessTypeList) { + toSerialize["accessTypeList"] = o.AccessTypeList + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) UnmarshalJSON(data []byte) (err error) { + varDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest := _DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest{} + + err = json.Unmarshal(data, &varDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) + + if err != nil { + return err + } + + *o = DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest(varDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "auditLogFilterRuleId") + delete(additionalProperties, "userExpr") + delete(additionalProperties, "dbExpr") + delete(additionalProperties, "tableExpr") + delete(additionalProperties, "accessTypeList") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest struct { + value *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest + isSet bool +} + +func (v NullableDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) Get() *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest { + return v.value +} + +func (v *NullableDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) Set(val *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) { + v.value = val + v.isSet = true +} + +func (v NullableDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest(val *DatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) *NullableDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest { + return &NullableDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest{value: val, isSet: true} +} + +func (v NullableDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDatabaseAuditLogServiceCreateAuditLogFilterRuleRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_database_audit_log_service_update_audit_log_config_request.go b/pkg/tidbcloud/v1beta1/dedicated/model_database_audit_log_service_update_audit_log_config_request.go new file mode 100644 index 00000000..97630f2a --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_database_audit_log_service_update_audit_log_config_request.go @@ -0,0 +1,312 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the DatabaseAuditLogServiceUpdateAuditLogConfigRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &DatabaseAuditLogServiceUpdateAuditLogConfigRequest{} + +// DatabaseAuditLogServiceUpdateAuditLogConfigRequest struct for DatabaseAuditLogServiceUpdateAuditLogConfigRequest +type DatabaseAuditLogServiceUpdateAuditLogConfigRequest struct { + Enabled NullableBool `json:"enabled,omitempty"` + BucketUri *string `json:"bucketUri,omitempty"` + BucketRegionId *string `json:"bucketRegionId,omitempty"` + AwsRoleArn *string `json:"awsRoleArn,omitempty"` + AzureSasToken *string `json:"azureSasToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _DatabaseAuditLogServiceUpdateAuditLogConfigRequest DatabaseAuditLogServiceUpdateAuditLogConfigRequest + +// NewDatabaseAuditLogServiceUpdateAuditLogConfigRequest instantiates a new DatabaseAuditLogServiceUpdateAuditLogConfigRequest 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 NewDatabaseAuditLogServiceUpdateAuditLogConfigRequest() *DatabaseAuditLogServiceUpdateAuditLogConfigRequest { + this := DatabaseAuditLogServiceUpdateAuditLogConfigRequest{} + return &this +} + +// NewDatabaseAuditLogServiceUpdateAuditLogConfigRequestWithDefaults instantiates a new DatabaseAuditLogServiceUpdateAuditLogConfigRequest 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 NewDatabaseAuditLogServiceUpdateAuditLogConfigRequestWithDefaults() *DatabaseAuditLogServiceUpdateAuditLogConfigRequest { + this := DatabaseAuditLogServiceUpdateAuditLogConfigRequest{} + return &this +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) GetEnabled() bool { + if o == nil || IsNil(o.Enabled.Get()) { + var ret bool + return ret + } + return *o.Enabled.Get() +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// 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 *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) GetEnabledOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.Enabled.Get(), o.Enabled.IsSet() +} + +// HasEnabled returns a boolean if a field has been set. +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) HasEnabled() bool { + if o != nil && o.Enabled.IsSet() { + return true + } + + return false +} + +// SetEnabled gets a reference to the given NullableBool and assigns it to the Enabled field. +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) SetEnabled(v bool) { + o.Enabled.Set(&v) +} + +// SetEnabledNil sets the value for Enabled to be an explicit nil +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) SetEnabledNil() { + o.Enabled.Set(nil) +} + +// UnsetEnabled ensures that no value is present for Enabled, not even an explicit nil +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) UnsetEnabled() { + o.Enabled.Unset() +} + +// GetBucketUri returns the BucketUri field value if set, zero value otherwise. +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) GetBucketUri() string { + if o == nil || IsNil(o.BucketUri) { + var ret string + return ret + } + return *o.BucketUri +} + +// GetBucketUriOk returns a tuple with the BucketUri field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) GetBucketUriOk() (*string, bool) { + if o == nil || IsNil(o.BucketUri) { + return nil, false + } + return o.BucketUri, true +} + +// HasBucketUri returns a boolean if a field has been set. +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) HasBucketUri() bool { + if o != nil && !IsNil(o.BucketUri) { + return true + } + + return false +} + +// SetBucketUri gets a reference to the given string and assigns it to the BucketUri field. +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) SetBucketUri(v string) { + o.BucketUri = &v +} + +// GetBucketRegionId returns the BucketRegionId field value if set, zero value otherwise. +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) GetBucketRegionId() string { + if o == nil || IsNil(o.BucketRegionId) { + var ret string + return ret + } + return *o.BucketRegionId +} + +// GetBucketRegionIdOk returns a tuple with the BucketRegionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) GetBucketRegionIdOk() (*string, bool) { + if o == nil || IsNil(o.BucketRegionId) { + return nil, false + } + return o.BucketRegionId, true +} + +// HasBucketRegionId returns a boolean if a field has been set. +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) HasBucketRegionId() bool { + if o != nil && !IsNil(o.BucketRegionId) { + return true + } + + return false +} + +// SetBucketRegionId gets a reference to the given string and assigns it to the BucketRegionId field. +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) SetBucketRegionId(v string) { + o.BucketRegionId = &v +} + +// GetAwsRoleArn returns the AwsRoleArn field value if set, zero value otherwise. +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) GetAwsRoleArn() string { + if o == nil || IsNil(o.AwsRoleArn) { + var ret string + return ret + } + return *o.AwsRoleArn +} + +// GetAwsRoleArnOk returns a tuple with the AwsRoleArn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) GetAwsRoleArnOk() (*string, bool) { + if o == nil || IsNil(o.AwsRoleArn) { + return nil, false + } + return o.AwsRoleArn, true +} + +// HasAwsRoleArn returns a boolean if a field has been set. +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) HasAwsRoleArn() bool { + if o != nil && !IsNil(o.AwsRoleArn) { + return true + } + + return false +} + +// SetAwsRoleArn gets a reference to the given string and assigns it to the AwsRoleArn field. +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) SetAwsRoleArn(v string) { + o.AwsRoleArn = &v +} + +// GetAzureSasToken returns the AzureSasToken field value if set, zero value otherwise. +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) GetAzureSasToken() string { + if o == nil || IsNil(o.AzureSasToken) { + var ret string + return ret + } + return *o.AzureSasToken +} + +// GetAzureSasTokenOk returns a tuple with the AzureSasToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) GetAzureSasTokenOk() (*string, bool) { + if o == nil || IsNil(o.AzureSasToken) { + return nil, false + } + return o.AzureSasToken, true +} + +// HasAzureSasToken returns a boolean if a field has been set. +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) HasAzureSasToken() bool { + if o != nil && !IsNil(o.AzureSasToken) { + return true + } + + return false +} + +// SetAzureSasToken gets a reference to the given string and assigns it to the AzureSasToken field. +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) SetAzureSasToken(v string) { + o.AzureSasToken = &v +} + +func (o DatabaseAuditLogServiceUpdateAuditLogConfigRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o DatabaseAuditLogServiceUpdateAuditLogConfigRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if o.Enabled.IsSet() { + toSerialize["enabled"] = o.Enabled.Get() + } + if !IsNil(o.BucketUri) { + toSerialize["bucketUri"] = o.BucketUri + } + if !IsNil(o.BucketRegionId) { + toSerialize["bucketRegionId"] = o.BucketRegionId + } + if !IsNil(o.AwsRoleArn) { + toSerialize["awsRoleArn"] = o.AwsRoleArn + } + if !IsNil(o.AzureSasToken) { + toSerialize["azureSasToken"] = o.AzureSasToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) UnmarshalJSON(data []byte) (err error) { + varDatabaseAuditLogServiceUpdateAuditLogConfigRequest := _DatabaseAuditLogServiceUpdateAuditLogConfigRequest{} + + err = json.Unmarshal(data, &varDatabaseAuditLogServiceUpdateAuditLogConfigRequest) + + if err != nil { + return err + } + + *o = DatabaseAuditLogServiceUpdateAuditLogConfigRequest(varDatabaseAuditLogServiceUpdateAuditLogConfigRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "enabled") + delete(additionalProperties, "bucketUri") + delete(additionalProperties, "bucketRegionId") + delete(additionalProperties, "awsRoleArn") + delete(additionalProperties, "azureSasToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDatabaseAuditLogServiceUpdateAuditLogConfigRequest struct { + value *DatabaseAuditLogServiceUpdateAuditLogConfigRequest + isSet bool +} + +func (v NullableDatabaseAuditLogServiceUpdateAuditLogConfigRequest) Get() *DatabaseAuditLogServiceUpdateAuditLogConfigRequest { + return v.value +} + +func (v *NullableDatabaseAuditLogServiceUpdateAuditLogConfigRequest) Set(val *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) { + v.value = val + v.isSet = true +} + +func (v NullableDatabaseAuditLogServiceUpdateAuditLogConfigRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableDatabaseAuditLogServiceUpdateAuditLogConfigRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDatabaseAuditLogServiceUpdateAuditLogConfigRequest(val *DatabaseAuditLogServiceUpdateAuditLogConfigRequest) *NullableDatabaseAuditLogServiceUpdateAuditLogConfigRequest { + return &NullableDatabaseAuditLogServiceUpdateAuditLogConfigRequest{value: val, isSet: true} +} + +func (v NullableDatabaseAuditLogServiceUpdateAuditLogConfigRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDatabaseAuditLogServiceUpdateAuditLogConfigRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_audit_log_config.go b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_audit_log_config.go new file mode 100644 index 00000000..7f76573f --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_audit_log_config.go @@ -0,0 +1,418 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the Dedicatedv1beta1AuditLogConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Dedicatedv1beta1AuditLogConfig{} + +// Dedicatedv1beta1AuditLogConfig struct for Dedicatedv1beta1AuditLogConfig +type Dedicatedv1beta1AuditLogConfig struct { + Name *string `json:"name,omitempty"` + ClusterId string `json:"clusterId"` + // Default is false. + Enabled *bool `json:"enabled,omitempty"` + BucketUri string `json:"bucketUri"` + BucketRegionId *string `json:"bucketRegionId,omitempty"` + AwsRoleArn *string `json:"awsRoleArn,omitempty"` + AzureSasToken *string `json:"azureSasToken,omitempty"` + BucketWriteCheck *AuditLogConfigBucketWriteCheck `json:"bucketWriteCheck,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Dedicatedv1beta1AuditLogConfig Dedicatedv1beta1AuditLogConfig + +// NewDedicatedv1beta1AuditLogConfig instantiates a new Dedicatedv1beta1AuditLogConfig 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 NewDedicatedv1beta1AuditLogConfig(clusterId string, bucketUri string) *Dedicatedv1beta1AuditLogConfig { + this := Dedicatedv1beta1AuditLogConfig{} + this.ClusterId = clusterId + this.BucketUri = bucketUri + return &this +} + +// NewDedicatedv1beta1AuditLogConfigWithDefaults instantiates a new Dedicatedv1beta1AuditLogConfig 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 NewDedicatedv1beta1AuditLogConfigWithDefaults() *Dedicatedv1beta1AuditLogConfig { + this := Dedicatedv1beta1AuditLogConfig{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Dedicatedv1beta1AuditLogConfig) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1AuditLogConfig) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Dedicatedv1beta1AuditLogConfig) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Dedicatedv1beta1AuditLogConfig) SetName(v string) { + o.Name = &v +} + +// GetClusterId returns the ClusterId field value +func (o *Dedicatedv1beta1AuditLogConfig) GetClusterId() string { + if o == nil { + var ret string + return ret + } + + return o.ClusterId +} + +// GetClusterIdOk returns a tuple with the ClusterId field value +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1AuditLogConfig) GetClusterIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClusterId, true +} + +// SetClusterId sets field value +func (o *Dedicatedv1beta1AuditLogConfig) SetClusterId(v string) { + o.ClusterId = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise. +func (o *Dedicatedv1beta1AuditLogConfig) GetEnabled() bool { + if o == nil || IsNil(o.Enabled) { + var ret bool + return ret + } + return *o.Enabled +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1AuditLogConfig) GetEnabledOk() (*bool, bool) { + if o == nil || IsNil(o.Enabled) { + return nil, false + } + return o.Enabled, true +} + +// HasEnabled returns a boolean if a field has been set. +func (o *Dedicatedv1beta1AuditLogConfig) HasEnabled() bool { + if o != nil && !IsNil(o.Enabled) { + return true + } + + return false +} + +// SetEnabled gets a reference to the given bool and assigns it to the Enabled field. +func (o *Dedicatedv1beta1AuditLogConfig) SetEnabled(v bool) { + o.Enabled = &v +} + +// GetBucketUri returns the BucketUri field value +func (o *Dedicatedv1beta1AuditLogConfig) GetBucketUri() string { + if o == nil { + var ret string + return ret + } + + return o.BucketUri +} + +// GetBucketUriOk returns a tuple with the BucketUri field value +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1AuditLogConfig) GetBucketUriOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.BucketUri, true +} + +// SetBucketUri sets field value +func (o *Dedicatedv1beta1AuditLogConfig) SetBucketUri(v string) { + o.BucketUri = v +} + +// GetBucketRegionId returns the BucketRegionId field value if set, zero value otherwise. +func (o *Dedicatedv1beta1AuditLogConfig) GetBucketRegionId() string { + if o == nil || IsNil(o.BucketRegionId) { + var ret string + return ret + } + return *o.BucketRegionId +} + +// GetBucketRegionIdOk returns a tuple with the BucketRegionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1AuditLogConfig) GetBucketRegionIdOk() (*string, bool) { + if o == nil || IsNil(o.BucketRegionId) { + return nil, false + } + return o.BucketRegionId, true +} + +// HasBucketRegionId returns a boolean if a field has been set. +func (o *Dedicatedv1beta1AuditLogConfig) HasBucketRegionId() bool { + if o != nil && !IsNil(o.BucketRegionId) { + return true + } + + return false +} + +// SetBucketRegionId gets a reference to the given string and assigns it to the BucketRegionId field. +func (o *Dedicatedv1beta1AuditLogConfig) SetBucketRegionId(v string) { + o.BucketRegionId = &v +} + +// GetAwsRoleArn returns the AwsRoleArn field value if set, zero value otherwise. +func (o *Dedicatedv1beta1AuditLogConfig) GetAwsRoleArn() string { + if o == nil || IsNil(o.AwsRoleArn) { + var ret string + return ret + } + return *o.AwsRoleArn +} + +// GetAwsRoleArnOk returns a tuple with the AwsRoleArn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1AuditLogConfig) GetAwsRoleArnOk() (*string, bool) { + if o == nil || IsNil(o.AwsRoleArn) { + return nil, false + } + return o.AwsRoleArn, true +} + +// HasAwsRoleArn returns a boolean if a field has been set. +func (o *Dedicatedv1beta1AuditLogConfig) HasAwsRoleArn() bool { + if o != nil && !IsNil(o.AwsRoleArn) { + return true + } + + return false +} + +// SetAwsRoleArn gets a reference to the given string and assigns it to the AwsRoleArn field. +func (o *Dedicatedv1beta1AuditLogConfig) SetAwsRoleArn(v string) { + o.AwsRoleArn = &v +} + +// GetAzureSasToken returns the AzureSasToken field value if set, zero value otherwise. +func (o *Dedicatedv1beta1AuditLogConfig) GetAzureSasToken() string { + if o == nil || IsNil(o.AzureSasToken) { + var ret string + return ret + } + return *o.AzureSasToken +} + +// GetAzureSasTokenOk returns a tuple with the AzureSasToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1AuditLogConfig) GetAzureSasTokenOk() (*string, bool) { + if o == nil || IsNil(o.AzureSasToken) { + return nil, false + } + return o.AzureSasToken, true +} + +// HasAzureSasToken returns a boolean if a field has been set. +func (o *Dedicatedv1beta1AuditLogConfig) HasAzureSasToken() bool { + if o != nil && !IsNil(o.AzureSasToken) { + return true + } + + return false +} + +// SetAzureSasToken gets a reference to the given string and assigns it to the AzureSasToken field. +func (o *Dedicatedv1beta1AuditLogConfig) SetAzureSasToken(v string) { + o.AzureSasToken = &v +} + +// GetBucketWriteCheck returns the BucketWriteCheck field value if set, zero value otherwise. +func (o *Dedicatedv1beta1AuditLogConfig) GetBucketWriteCheck() AuditLogConfigBucketWriteCheck { + if o == nil || IsNil(o.BucketWriteCheck) { + var ret AuditLogConfigBucketWriteCheck + return ret + } + return *o.BucketWriteCheck +} + +// GetBucketWriteCheckOk returns a tuple with the BucketWriteCheck field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1AuditLogConfig) GetBucketWriteCheckOk() (*AuditLogConfigBucketWriteCheck, bool) { + if o == nil || IsNil(o.BucketWriteCheck) { + return nil, false + } + return o.BucketWriteCheck, true +} + +// HasBucketWriteCheck returns a boolean if a field has been set. +func (o *Dedicatedv1beta1AuditLogConfig) HasBucketWriteCheck() bool { + if o != nil && !IsNil(o.BucketWriteCheck) { + return true + } + + return false +} + +// SetBucketWriteCheck gets a reference to the given AuditLogConfigBucketWriteCheck and assigns it to the BucketWriteCheck field. +func (o *Dedicatedv1beta1AuditLogConfig) SetBucketWriteCheck(v AuditLogConfigBucketWriteCheck) { + o.BucketWriteCheck = &v +} + +func (o Dedicatedv1beta1AuditLogConfig) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Dedicatedv1beta1AuditLogConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + toSerialize["clusterId"] = o.ClusterId + if !IsNil(o.Enabled) { + toSerialize["enabled"] = o.Enabled + } + toSerialize["bucketUri"] = o.BucketUri + if !IsNil(o.BucketRegionId) { + toSerialize["bucketRegionId"] = o.BucketRegionId + } + if !IsNil(o.AwsRoleArn) { + toSerialize["awsRoleArn"] = o.AwsRoleArn + } + if !IsNil(o.AzureSasToken) { + toSerialize["azureSasToken"] = o.AzureSasToken + } + if !IsNil(o.BucketWriteCheck) { + toSerialize["bucketWriteCheck"] = o.BucketWriteCheck + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Dedicatedv1beta1AuditLogConfig) 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{ + "clusterId", + "bucketUri", + } + + 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) + } + } + + varDedicatedv1beta1AuditLogConfig := _Dedicatedv1beta1AuditLogConfig{} + + err = json.Unmarshal(data, &varDedicatedv1beta1AuditLogConfig) + + if err != nil { + return err + } + + *o = Dedicatedv1beta1AuditLogConfig(varDedicatedv1beta1AuditLogConfig) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "clusterId") + delete(additionalProperties, "enabled") + delete(additionalProperties, "bucketUri") + delete(additionalProperties, "bucketRegionId") + delete(additionalProperties, "awsRoleArn") + delete(additionalProperties, "azureSasToken") + delete(additionalProperties, "bucketWriteCheck") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDedicatedv1beta1AuditLogConfig struct { + value *Dedicatedv1beta1AuditLogConfig + isSet bool +} + +func (v NullableDedicatedv1beta1AuditLogConfig) Get() *Dedicatedv1beta1AuditLogConfig { + return v.value +} + +func (v *NullableDedicatedv1beta1AuditLogConfig) Set(val *Dedicatedv1beta1AuditLogConfig) { + v.value = val + v.isSet = true +} + +func (v NullableDedicatedv1beta1AuditLogConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableDedicatedv1beta1AuditLogConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDedicatedv1beta1AuditLogConfig(val *Dedicatedv1beta1AuditLogConfig) *NullableDedicatedv1beta1AuditLogConfig { + return &NullableDedicatedv1beta1AuditLogConfig{value: val, isSet: true} +} + +func (v NullableDedicatedv1beta1AuditLogConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDedicatedv1beta1AuditLogConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_cluster_pause_plan.go b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_cluster_pause_plan.go new file mode 100644 index 00000000..93e1a78d --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_cluster_pause_plan.go @@ -0,0 +1,204 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the Dedicatedv1beta1ClusterPausePlan type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Dedicatedv1beta1ClusterPausePlan{} + +// Dedicatedv1beta1ClusterPausePlan struct for Dedicatedv1beta1ClusterPausePlan +type Dedicatedv1beta1ClusterPausePlan struct { + PauseType Dedicatedv1beta1ClusterPausePlanType `json:"pauseType"` + ScheduledResumeTime *time.Time `json:"scheduledResumeTime,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Dedicatedv1beta1ClusterPausePlan Dedicatedv1beta1ClusterPausePlan + +// NewDedicatedv1beta1ClusterPausePlan instantiates a new Dedicatedv1beta1ClusterPausePlan 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 NewDedicatedv1beta1ClusterPausePlan(pauseType Dedicatedv1beta1ClusterPausePlanType) *Dedicatedv1beta1ClusterPausePlan { + this := Dedicatedv1beta1ClusterPausePlan{} + this.PauseType = pauseType + return &this +} + +// NewDedicatedv1beta1ClusterPausePlanWithDefaults instantiates a new Dedicatedv1beta1ClusterPausePlan 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 NewDedicatedv1beta1ClusterPausePlanWithDefaults() *Dedicatedv1beta1ClusterPausePlan { + this := Dedicatedv1beta1ClusterPausePlan{} + return &this +} + +// GetPauseType returns the PauseType field value +func (o *Dedicatedv1beta1ClusterPausePlan) GetPauseType() Dedicatedv1beta1ClusterPausePlanType { + if o == nil { + var ret Dedicatedv1beta1ClusterPausePlanType + return ret + } + + return o.PauseType +} + +// GetPauseTypeOk returns a tuple with the PauseType field value +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1ClusterPausePlan) GetPauseTypeOk() (*Dedicatedv1beta1ClusterPausePlanType, bool) { + if o == nil { + return nil, false + } + return &o.PauseType, true +} + +// SetPauseType sets field value +func (o *Dedicatedv1beta1ClusterPausePlan) SetPauseType(v Dedicatedv1beta1ClusterPausePlanType) { + o.PauseType = v +} + +// GetScheduledResumeTime returns the ScheduledResumeTime field value if set, zero value otherwise. +func (o *Dedicatedv1beta1ClusterPausePlan) GetScheduledResumeTime() time.Time { + if o == nil || IsNil(o.ScheduledResumeTime) { + var ret time.Time + return ret + } + return *o.ScheduledResumeTime +} + +// GetScheduledResumeTimeOk returns a tuple with the ScheduledResumeTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1ClusterPausePlan) GetScheduledResumeTimeOk() (*time.Time, bool) { + if o == nil || IsNil(o.ScheduledResumeTime) { + return nil, false + } + return o.ScheduledResumeTime, true +} + +// HasScheduledResumeTime returns a boolean if a field has been set. +func (o *Dedicatedv1beta1ClusterPausePlan) HasScheduledResumeTime() bool { + if o != nil && !IsNil(o.ScheduledResumeTime) { + return true + } + + return false +} + +// SetScheduledResumeTime gets a reference to the given time.Time and assigns it to the ScheduledResumeTime field. +func (o *Dedicatedv1beta1ClusterPausePlan) SetScheduledResumeTime(v time.Time) { + o.ScheduledResumeTime = &v +} + +func (o Dedicatedv1beta1ClusterPausePlan) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Dedicatedv1beta1ClusterPausePlan) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["pauseType"] = o.PauseType + if !IsNil(o.ScheduledResumeTime) { + toSerialize["scheduledResumeTime"] = o.ScheduledResumeTime + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Dedicatedv1beta1ClusterPausePlan) 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{ + "pauseType", + } + + 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) + } + } + + varDedicatedv1beta1ClusterPausePlan := _Dedicatedv1beta1ClusterPausePlan{} + + err = json.Unmarshal(data, &varDedicatedv1beta1ClusterPausePlan) + + if err != nil { + return err + } + + *o = Dedicatedv1beta1ClusterPausePlan(varDedicatedv1beta1ClusterPausePlan) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "pauseType") + delete(additionalProperties, "scheduledResumeTime") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDedicatedv1beta1ClusterPausePlan struct { + value *Dedicatedv1beta1ClusterPausePlan + isSet bool +} + +func (v NullableDedicatedv1beta1ClusterPausePlan) Get() *Dedicatedv1beta1ClusterPausePlan { + return v.value +} + +func (v *NullableDedicatedv1beta1ClusterPausePlan) Set(val *Dedicatedv1beta1ClusterPausePlan) { + v.value = val + v.isSet = true +} + +func (v NullableDedicatedv1beta1ClusterPausePlan) IsSet() bool { + return v.isSet +} + +func (v *NullableDedicatedv1beta1ClusterPausePlan) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDedicatedv1beta1ClusterPausePlan(val *Dedicatedv1beta1ClusterPausePlan) *NullableDedicatedv1beta1ClusterPausePlan { + return &NullableDedicatedv1beta1ClusterPausePlan{value: val, isSet: true} +} + +func (v NullableDedicatedv1beta1ClusterPausePlan) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDedicatedv1beta1ClusterPausePlan) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_cluster_pause_plan_type.go b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_cluster_pause_plan_type.go new file mode 100644 index 00000000..6258c1b9 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_cluster_pause_plan_type.go @@ -0,0 +1,110 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// Dedicatedv1beta1ClusterPausePlanType the model 'Dedicatedv1beta1ClusterPausePlanType' +type Dedicatedv1beta1ClusterPausePlanType string + +// List of dedicatedv1beta1ClusterPausePlanType +const ( + DEDICATEDV1BETA1CLUSTERPAUSEPLANTYPE_NORMAL Dedicatedv1beta1ClusterPausePlanType = "NORMAL" + DEDICATEDV1BETA1CLUSTERPAUSEPLANTYPE_DEPRECATE Dedicatedv1beta1ClusterPausePlanType = "DEPRECATE" +) + +// All allowed values of Dedicatedv1beta1ClusterPausePlanType enum +var AllowedDedicatedv1beta1ClusterPausePlanTypeEnumValues = []Dedicatedv1beta1ClusterPausePlanType{ + "NORMAL", + "DEPRECATE", +} + +func (v *Dedicatedv1beta1ClusterPausePlanType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := Dedicatedv1beta1ClusterPausePlanType(value) + for _, existing := range AllowedDedicatedv1beta1ClusterPausePlanTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Dedicatedv1beta1ClusterPausePlanType", value) +} + +// NewDedicatedv1beta1ClusterPausePlanTypeFromValue returns a pointer to a valid Dedicatedv1beta1ClusterPausePlanType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDedicatedv1beta1ClusterPausePlanTypeFromValue(v string) (*Dedicatedv1beta1ClusterPausePlanType, error) { + ev := Dedicatedv1beta1ClusterPausePlanType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Dedicatedv1beta1ClusterPausePlanType: valid values are %v", v, AllowedDedicatedv1beta1ClusterPausePlanTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Dedicatedv1beta1ClusterPausePlanType) IsValid() bool { + for _, existing := range AllowedDedicatedv1beta1ClusterPausePlanTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to dedicatedv1beta1ClusterPausePlanType value +func (v Dedicatedv1beta1ClusterPausePlanType) Ptr() *Dedicatedv1beta1ClusterPausePlanType { + return &v +} + +type NullableDedicatedv1beta1ClusterPausePlanType struct { + value *Dedicatedv1beta1ClusterPausePlanType + isSet bool +} + +func (v NullableDedicatedv1beta1ClusterPausePlanType) Get() *Dedicatedv1beta1ClusterPausePlanType { + return v.value +} + +func (v *NullableDedicatedv1beta1ClusterPausePlanType) Set(val *Dedicatedv1beta1ClusterPausePlanType) { + v.value = val + v.isSet = true +} + +func (v NullableDedicatedv1beta1ClusterPausePlanType) IsSet() bool { + return v.isSet +} + +func (v *NullableDedicatedv1beta1ClusterPausePlanType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDedicatedv1beta1ClusterPausePlanType(val *Dedicatedv1beta1ClusterPausePlanType) *NullableDedicatedv1beta1ClusterPausePlanType { + return &NullableDedicatedv1beta1ClusterPausePlanType{value: val, isSet: true} +} + +func (v NullableDedicatedv1beta1ClusterPausePlanType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDedicatedv1beta1ClusterPausePlanType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_component_type.go b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_component_type.go new file mode 100644 index 00000000..1bd925ef --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_component_type.go @@ -0,0 +1,116 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// Dedicatedv1beta1ComponentType the model 'Dedicatedv1beta1ComponentType' +type Dedicatedv1beta1ComponentType string + +// List of dedicatedv1beta1ComponentType +const ( + DEDICATEDV1BETA1COMPONENTTYPE_TIKV Dedicatedv1beta1ComponentType = "TIKV" + DEDICATEDV1BETA1COMPONENTTYPE_TIDB Dedicatedv1beta1ComponentType = "TIDB" + DEDICATEDV1BETA1COMPONENTTYPE_TIFLASH Dedicatedv1beta1ComponentType = "TIFLASH" + DEDICATEDV1BETA1COMPONENTTYPE_PD Dedicatedv1beta1ComponentType = "PD" + DEDICATEDV1BETA1COMPONENTTYPE_TIPROXY Dedicatedv1beta1ComponentType = "TIPROXY" +) + +// All allowed values of Dedicatedv1beta1ComponentType enum +var AllowedDedicatedv1beta1ComponentTypeEnumValues = []Dedicatedv1beta1ComponentType{ + "TIKV", + "TIDB", + "TIFLASH", + "PD", + "TIPROXY", +} + +func (v *Dedicatedv1beta1ComponentType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := Dedicatedv1beta1ComponentType(value) + for _, existing := range AllowedDedicatedv1beta1ComponentTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Dedicatedv1beta1ComponentType", value) +} + +// NewDedicatedv1beta1ComponentTypeFromValue returns a pointer to a valid Dedicatedv1beta1ComponentType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDedicatedv1beta1ComponentTypeFromValue(v string) (*Dedicatedv1beta1ComponentType, error) { + ev := Dedicatedv1beta1ComponentType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Dedicatedv1beta1ComponentType: valid values are %v", v, AllowedDedicatedv1beta1ComponentTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Dedicatedv1beta1ComponentType) IsValid() bool { + for _, existing := range AllowedDedicatedv1beta1ComponentTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to dedicatedv1beta1ComponentType value +func (v Dedicatedv1beta1ComponentType) Ptr() *Dedicatedv1beta1ComponentType { + return &v +} + +type NullableDedicatedv1beta1ComponentType struct { + value *Dedicatedv1beta1ComponentType + isSet bool +} + +func (v NullableDedicatedv1beta1ComponentType) Get() *Dedicatedv1beta1ComponentType { + return v.value +} + +func (v *NullableDedicatedv1beta1ComponentType) Set(val *Dedicatedv1beta1ComponentType) { + v.value = val + v.isSet = true +} + +func (v NullableDedicatedv1beta1ComponentType) IsSet() bool { + return v.isSet +} + +func (v *NullableDedicatedv1beta1ComponentType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDedicatedv1beta1ComponentType(val *Dedicatedv1beta1ComponentType) *NullableDedicatedv1beta1ComponentType { + return &NullableDedicatedv1beta1ComponentType{value: val, isSet: true} +} + +func (v NullableDedicatedv1beta1ComponentType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDedicatedv1beta1ComponentType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_list_tidb_node_groups_response.go b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_list_tidb_node_groups_response.go new file mode 100644 index 00000000..ec7d777d --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_list_tidb_node_groups_response.go @@ -0,0 +1,229 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the Dedicatedv1beta1ListTidbNodeGroupsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Dedicatedv1beta1ListTidbNodeGroupsResponse{} + +// Dedicatedv1beta1ListTidbNodeGroupsResponse struct for Dedicatedv1beta1ListTidbNodeGroupsResponse +type Dedicatedv1beta1ListTidbNodeGroupsResponse struct { + TidbNodeGroups []Dedicatedv1beta1TidbNodeGroup `json:"tidbNodeGroups,omitempty"` + // The total number of TiDB groups that matched the query. + TotalSize *int32 `json:"totalSize,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. + NextPageToken *string `json:"nextPageToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Dedicatedv1beta1ListTidbNodeGroupsResponse Dedicatedv1beta1ListTidbNodeGroupsResponse + +// NewDedicatedv1beta1ListTidbNodeGroupsResponse instantiates a new Dedicatedv1beta1ListTidbNodeGroupsResponse 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 NewDedicatedv1beta1ListTidbNodeGroupsResponse() *Dedicatedv1beta1ListTidbNodeGroupsResponse { + this := Dedicatedv1beta1ListTidbNodeGroupsResponse{} + return &this +} + +// NewDedicatedv1beta1ListTidbNodeGroupsResponseWithDefaults instantiates a new Dedicatedv1beta1ListTidbNodeGroupsResponse 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 NewDedicatedv1beta1ListTidbNodeGroupsResponseWithDefaults() *Dedicatedv1beta1ListTidbNodeGroupsResponse { + this := Dedicatedv1beta1ListTidbNodeGroupsResponse{} + return &this +} + +// GetTidbNodeGroups returns the TidbNodeGroups field value if set, zero value otherwise. +func (o *Dedicatedv1beta1ListTidbNodeGroupsResponse) GetTidbNodeGroups() []Dedicatedv1beta1TidbNodeGroup { + if o == nil || IsNil(o.TidbNodeGroups) { + var ret []Dedicatedv1beta1TidbNodeGroup + return ret + } + return o.TidbNodeGroups +} + +// GetTidbNodeGroupsOk returns a tuple with the TidbNodeGroups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1ListTidbNodeGroupsResponse) GetTidbNodeGroupsOk() ([]Dedicatedv1beta1TidbNodeGroup, bool) { + if o == nil || IsNil(o.TidbNodeGroups) { + return nil, false + } + return o.TidbNodeGroups, true +} + +// HasTidbNodeGroups returns a boolean if a field has been set. +func (o *Dedicatedv1beta1ListTidbNodeGroupsResponse) HasTidbNodeGroups() bool { + if o != nil && !IsNil(o.TidbNodeGroups) { + return true + } + + return false +} + +// SetTidbNodeGroups gets a reference to the given []Dedicatedv1beta1TidbNodeGroup and assigns it to the TidbNodeGroups field. +func (o *Dedicatedv1beta1ListTidbNodeGroupsResponse) SetTidbNodeGroups(v []Dedicatedv1beta1TidbNodeGroup) { + o.TidbNodeGroups = v +} + +// GetTotalSize returns the TotalSize field value if set, zero value otherwise. +func (o *Dedicatedv1beta1ListTidbNodeGroupsResponse) GetTotalSize() int32 { + if o == nil || IsNil(o.TotalSize) { + var ret int32 + return ret + } + return *o.TotalSize +} + +// GetTotalSizeOk returns a tuple with the TotalSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1ListTidbNodeGroupsResponse) GetTotalSizeOk() (*int32, bool) { + if o == nil || IsNil(o.TotalSize) { + return nil, false + } + return o.TotalSize, true +} + +// HasTotalSize returns a boolean if a field has been set. +func (o *Dedicatedv1beta1ListTidbNodeGroupsResponse) HasTotalSize() bool { + if o != nil && !IsNil(o.TotalSize) { + return true + } + + return false +} + +// SetTotalSize gets a reference to the given int32 and assigns it to the TotalSize field. +func (o *Dedicatedv1beta1ListTidbNodeGroupsResponse) SetTotalSize(v int32) { + o.TotalSize = &v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *Dedicatedv1beta1ListTidbNodeGroupsResponse) GetNextPageToken() string { + if o == nil || IsNil(o.NextPageToken) { + var ret string + return ret + } + return *o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1ListTidbNodeGroupsResponse) GetNextPageTokenOk() (*string, bool) { + if o == nil || IsNil(o.NextPageToken) { + return nil, false + } + return o.NextPageToken, true +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *Dedicatedv1beta1ListTidbNodeGroupsResponse) HasNextPageToken() bool { + if o != nil && !IsNil(o.NextPageToken) { + return true + } + + return false +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *Dedicatedv1beta1ListTidbNodeGroupsResponse) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o Dedicatedv1beta1ListTidbNodeGroupsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Dedicatedv1beta1ListTidbNodeGroupsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.TidbNodeGroups) { + toSerialize["tidbNodeGroups"] = o.TidbNodeGroups + } + if !IsNil(o.TotalSize) { + toSerialize["totalSize"] = o.TotalSize + } + if !IsNil(o.NextPageToken) { + toSerialize["nextPageToken"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Dedicatedv1beta1ListTidbNodeGroupsResponse) UnmarshalJSON(data []byte) (err error) { + varDedicatedv1beta1ListTidbNodeGroupsResponse := _Dedicatedv1beta1ListTidbNodeGroupsResponse{} + + err = json.Unmarshal(data, &varDedicatedv1beta1ListTidbNodeGroupsResponse) + + if err != nil { + return err + } + + *o = Dedicatedv1beta1ListTidbNodeGroupsResponse(varDedicatedv1beta1ListTidbNodeGroupsResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "tidbNodeGroups") + delete(additionalProperties, "totalSize") + delete(additionalProperties, "nextPageToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDedicatedv1beta1ListTidbNodeGroupsResponse struct { + value *Dedicatedv1beta1ListTidbNodeGroupsResponse + isSet bool +} + +func (v NullableDedicatedv1beta1ListTidbNodeGroupsResponse) Get() *Dedicatedv1beta1ListTidbNodeGroupsResponse { + return v.value +} + +func (v *NullableDedicatedv1beta1ListTidbNodeGroupsResponse) Set(val *Dedicatedv1beta1ListTidbNodeGroupsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDedicatedv1beta1ListTidbNodeGroupsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDedicatedv1beta1ListTidbNodeGroupsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDedicatedv1beta1ListTidbNodeGroupsResponse(val *Dedicatedv1beta1ListTidbNodeGroupsResponse) *NullableDedicatedv1beta1ListTidbNodeGroupsResponse { + return &NullableDedicatedv1beta1ListTidbNodeGroupsResponse{value: val, isSet: true} +} + +func (v NullableDedicatedv1beta1ListTidbNodeGroupsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDedicatedv1beta1ListTidbNodeGroupsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_list_vpc_peerings_response.go b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_list_vpc_peerings_response.go new file mode 100644 index 00000000..03727e72 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_list_vpc_peerings_response.go @@ -0,0 +1,229 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the Dedicatedv1beta1ListVpcPeeringsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Dedicatedv1beta1ListVpcPeeringsResponse{} + +// Dedicatedv1beta1ListVpcPeeringsResponse struct for Dedicatedv1beta1ListVpcPeeringsResponse +type Dedicatedv1beta1ListVpcPeeringsResponse struct { + VpcPeerings []Dedicatedv1beta1VpcPeering `json:"vpcPeerings,omitempty"` + // The total number of VPC peerings that matched the query. + TotalSize *int32 `json:"totalSize,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. + NextPageToken *string `json:"nextPageToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Dedicatedv1beta1ListVpcPeeringsResponse Dedicatedv1beta1ListVpcPeeringsResponse + +// NewDedicatedv1beta1ListVpcPeeringsResponse instantiates a new Dedicatedv1beta1ListVpcPeeringsResponse 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 NewDedicatedv1beta1ListVpcPeeringsResponse() *Dedicatedv1beta1ListVpcPeeringsResponse { + this := Dedicatedv1beta1ListVpcPeeringsResponse{} + return &this +} + +// NewDedicatedv1beta1ListVpcPeeringsResponseWithDefaults instantiates a new Dedicatedv1beta1ListVpcPeeringsResponse 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 NewDedicatedv1beta1ListVpcPeeringsResponseWithDefaults() *Dedicatedv1beta1ListVpcPeeringsResponse { + this := Dedicatedv1beta1ListVpcPeeringsResponse{} + return &this +} + +// GetVpcPeerings returns the VpcPeerings field value if set, zero value otherwise. +func (o *Dedicatedv1beta1ListVpcPeeringsResponse) GetVpcPeerings() []Dedicatedv1beta1VpcPeering { + if o == nil || IsNil(o.VpcPeerings) { + var ret []Dedicatedv1beta1VpcPeering + return ret + } + return o.VpcPeerings +} + +// GetVpcPeeringsOk returns a tuple with the VpcPeerings field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1ListVpcPeeringsResponse) GetVpcPeeringsOk() ([]Dedicatedv1beta1VpcPeering, bool) { + if o == nil || IsNil(o.VpcPeerings) { + return nil, false + } + return o.VpcPeerings, true +} + +// HasVpcPeerings returns a boolean if a field has been set. +func (o *Dedicatedv1beta1ListVpcPeeringsResponse) HasVpcPeerings() bool { + if o != nil && !IsNil(o.VpcPeerings) { + return true + } + + return false +} + +// SetVpcPeerings gets a reference to the given []Dedicatedv1beta1VpcPeering and assigns it to the VpcPeerings field. +func (o *Dedicatedv1beta1ListVpcPeeringsResponse) SetVpcPeerings(v []Dedicatedv1beta1VpcPeering) { + o.VpcPeerings = v +} + +// GetTotalSize returns the TotalSize field value if set, zero value otherwise. +func (o *Dedicatedv1beta1ListVpcPeeringsResponse) GetTotalSize() int32 { + if o == nil || IsNil(o.TotalSize) { + var ret int32 + return ret + } + return *o.TotalSize +} + +// GetTotalSizeOk returns a tuple with the TotalSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1ListVpcPeeringsResponse) GetTotalSizeOk() (*int32, bool) { + if o == nil || IsNil(o.TotalSize) { + return nil, false + } + return o.TotalSize, true +} + +// HasTotalSize returns a boolean if a field has been set. +func (o *Dedicatedv1beta1ListVpcPeeringsResponse) HasTotalSize() bool { + if o != nil && !IsNil(o.TotalSize) { + return true + } + + return false +} + +// SetTotalSize gets a reference to the given int32 and assigns it to the TotalSize field. +func (o *Dedicatedv1beta1ListVpcPeeringsResponse) SetTotalSize(v int32) { + o.TotalSize = &v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *Dedicatedv1beta1ListVpcPeeringsResponse) GetNextPageToken() string { + if o == nil || IsNil(o.NextPageToken) { + var ret string + return ret + } + return *o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1ListVpcPeeringsResponse) GetNextPageTokenOk() (*string, bool) { + if o == nil || IsNil(o.NextPageToken) { + return nil, false + } + return o.NextPageToken, true +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *Dedicatedv1beta1ListVpcPeeringsResponse) HasNextPageToken() bool { + if o != nil && !IsNil(o.NextPageToken) { + return true + } + + return false +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *Dedicatedv1beta1ListVpcPeeringsResponse) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o Dedicatedv1beta1ListVpcPeeringsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Dedicatedv1beta1ListVpcPeeringsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.VpcPeerings) { + toSerialize["vpcPeerings"] = o.VpcPeerings + } + if !IsNil(o.TotalSize) { + toSerialize["totalSize"] = o.TotalSize + } + if !IsNil(o.NextPageToken) { + toSerialize["nextPageToken"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Dedicatedv1beta1ListVpcPeeringsResponse) UnmarshalJSON(data []byte) (err error) { + varDedicatedv1beta1ListVpcPeeringsResponse := _Dedicatedv1beta1ListVpcPeeringsResponse{} + + err = json.Unmarshal(data, &varDedicatedv1beta1ListVpcPeeringsResponse) + + if err != nil { + return err + } + + *o = Dedicatedv1beta1ListVpcPeeringsResponse(varDedicatedv1beta1ListVpcPeeringsResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "vpcPeerings") + delete(additionalProperties, "totalSize") + delete(additionalProperties, "nextPageToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDedicatedv1beta1ListVpcPeeringsResponse struct { + value *Dedicatedv1beta1ListVpcPeeringsResponse + isSet bool +} + +func (v NullableDedicatedv1beta1ListVpcPeeringsResponse) Get() *Dedicatedv1beta1ListVpcPeeringsResponse { + return v.value +} + +func (v *NullableDedicatedv1beta1ListVpcPeeringsResponse) Set(val *Dedicatedv1beta1ListVpcPeeringsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDedicatedv1beta1ListVpcPeeringsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDedicatedv1beta1ListVpcPeeringsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDedicatedv1beta1ListVpcPeeringsResponse(val *Dedicatedv1beta1ListVpcPeeringsResponse) *NullableDedicatedv1beta1ListVpcPeeringsResponse { + return &NullableDedicatedv1beta1ListVpcPeeringsResponse{value: val, isSet: true} +} + +func (v NullableDedicatedv1beta1ListVpcPeeringsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDedicatedv1beta1ListVpcPeeringsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_maintenance_window.go b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_maintenance_window.go new file mode 100644 index 00000000..08350059 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_maintenance_window.go @@ -0,0 +1,405 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the Dedicatedv1beta1MaintenanceWindow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Dedicatedv1beta1MaintenanceWindow{} + +// Dedicatedv1beta1MaintenanceWindow MaintenanceWindow is a singleton resource that represents the maintenance window under a project. +type Dedicatedv1beta1MaintenanceWindow struct { + Name *string `json:"name,omitempty"` + MaintenanceWindowId *string `json:"maintenanceWindowId,omitempty"` + ProjectId string `json:"projectId"` + // 0-6, 0 is Sunday. + WeekDay int32 `json:"weekDay"` + // 0-23 in UTC. + DayHour int32 `json:"dayHour"` + // 0-59 in UTC. + HourMinute int32 `json:"hourMinute"` + NextMaintenanceDate *time.Time `json:"nextMaintenanceDate,omitempty"` + UnchangedMaintenanceTasks []V1beta1MaintenanceTask `json:"unchangedMaintenanceTasks,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Dedicatedv1beta1MaintenanceWindow Dedicatedv1beta1MaintenanceWindow + +// NewDedicatedv1beta1MaintenanceWindow instantiates a new Dedicatedv1beta1MaintenanceWindow 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 NewDedicatedv1beta1MaintenanceWindow(projectId string, weekDay int32, dayHour int32, hourMinute int32) *Dedicatedv1beta1MaintenanceWindow { + this := Dedicatedv1beta1MaintenanceWindow{} + this.ProjectId = projectId + this.WeekDay = weekDay + this.DayHour = dayHour + this.HourMinute = hourMinute + return &this +} + +// NewDedicatedv1beta1MaintenanceWindowWithDefaults instantiates a new Dedicatedv1beta1MaintenanceWindow 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 NewDedicatedv1beta1MaintenanceWindowWithDefaults() *Dedicatedv1beta1MaintenanceWindow { + this := Dedicatedv1beta1MaintenanceWindow{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Dedicatedv1beta1MaintenanceWindow) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1MaintenanceWindow) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Dedicatedv1beta1MaintenanceWindow) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Dedicatedv1beta1MaintenanceWindow) SetName(v string) { + o.Name = &v +} + +// GetMaintenanceWindowId returns the MaintenanceWindowId field value if set, zero value otherwise. +func (o *Dedicatedv1beta1MaintenanceWindow) GetMaintenanceWindowId() string { + if o == nil || IsNil(o.MaintenanceWindowId) { + var ret string + return ret + } + return *o.MaintenanceWindowId +} + +// GetMaintenanceWindowIdOk returns a tuple with the MaintenanceWindowId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1MaintenanceWindow) GetMaintenanceWindowIdOk() (*string, bool) { + if o == nil || IsNil(o.MaintenanceWindowId) { + return nil, false + } + return o.MaintenanceWindowId, true +} + +// HasMaintenanceWindowId returns a boolean if a field has been set. +func (o *Dedicatedv1beta1MaintenanceWindow) HasMaintenanceWindowId() bool { + if o != nil && !IsNil(o.MaintenanceWindowId) { + return true + } + + return false +} + +// SetMaintenanceWindowId gets a reference to the given string and assigns it to the MaintenanceWindowId field. +func (o *Dedicatedv1beta1MaintenanceWindow) SetMaintenanceWindowId(v string) { + o.MaintenanceWindowId = &v +} + +// GetProjectId returns the ProjectId field value +func (o *Dedicatedv1beta1MaintenanceWindow) GetProjectId() string { + if o == nil { + var ret string + return ret + } + + return o.ProjectId +} + +// GetProjectIdOk returns a tuple with the ProjectId field value +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1MaintenanceWindow) GetProjectIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ProjectId, true +} + +// SetProjectId sets field value +func (o *Dedicatedv1beta1MaintenanceWindow) SetProjectId(v string) { + o.ProjectId = v +} + +// GetWeekDay returns the WeekDay field value +func (o *Dedicatedv1beta1MaintenanceWindow) GetWeekDay() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.WeekDay +} + +// GetWeekDayOk returns a tuple with the WeekDay field value +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1MaintenanceWindow) GetWeekDayOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.WeekDay, true +} + +// SetWeekDay sets field value +func (o *Dedicatedv1beta1MaintenanceWindow) SetWeekDay(v int32) { + o.WeekDay = v +} + +// GetDayHour returns the DayHour field value +func (o *Dedicatedv1beta1MaintenanceWindow) GetDayHour() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.DayHour +} + +// GetDayHourOk returns a tuple with the DayHour field value +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1MaintenanceWindow) GetDayHourOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.DayHour, true +} + +// SetDayHour sets field value +func (o *Dedicatedv1beta1MaintenanceWindow) SetDayHour(v int32) { + o.DayHour = v +} + +// GetHourMinute returns the HourMinute field value +func (o *Dedicatedv1beta1MaintenanceWindow) GetHourMinute() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.HourMinute +} + +// GetHourMinuteOk returns a tuple with the HourMinute field value +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1MaintenanceWindow) GetHourMinuteOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.HourMinute, true +} + +// SetHourMinute sets field value +func (o *Dedicatedv1beta1MaintenanceWindow) SetHourMinute(v int32) { + o.HourMinute = v +} + +// GetNextMaintenanceDate returns the NextMaintenanceDate field value if set, zero value otherwise. +func (o *Dedicatedv1beta1MaintenanceWindow) GetNextMaintenanceDate() time.Time { + if o == nil || IsNil(o.NextMaintenanceDate) { + var ret time.Time + return ret + } + return *o.NextMaintenanceDate +} + +// GetNextMaintenanceDateOk returns a tuple with the NextMaintenanceDate field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1MaintenanceWindow) GetNextMaintenanceDateOk() (*time.Time, bool) { + if o == nil || IsNil(o.NextMaintenanceDate) { + return nil, false + } + return o.NextMaintenanceDate, true +} + +// HasNextMaintenanceDate returns a boolean if a field has been set. +func (o *Dedicatedv1beta1MaintenanceWindow) HasNextMaintenanceDate() bool { + if o != nil && !IsNil(o.NextMaintenanceDate) { + return true + } + + return false +} + +// SetNextMaintenanceDate gets a reference to the given time.Time and assigns it to the NextMaintenanceDate field. +func (o *Dedicatedv1beta1MaintenanceWindow) SetNextMaintenanceDate(v time.Time) { + o.NextMaintenanceDate = &v +} + +// GetUnchangedMaintenanceTasks returns the UnchangedMaintenanceTasks field value if set, zero value otherwise. +func (o *Dedicatedv1beta1MaintenanceWindow) GetUnchangedMaintenanceTasks() []V1beta1MaintenanceTask { + if o == nil || IsNil(o.UnchangedMaintenanceTasks) { + var ret []V1beta1MaintenanceTask + return ret + } + return o.UnchangedMaintenanceTasks +} + +// GetUnchangedMaintenanceTasksOk returns a tuple with the UnchangedMaintenanceTasks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1MaintenanceWindow) GetUnchangedMaintenanceTasksOk() ([]V1beta1MaintenanceTask, bool) { + if o == nil || IsNil(o.UnchangedMaintenanceTasks) { + return nil, false + } + return o.UnchangedMaintenanceTasks, true +} + +// HasUnchangedMaintenanceTasks returns a boolean if a field has been set. +func (o *Dedicatedv1beta1MaintenanceWindow) HasUnchangedMaintenanceTasks() bool { + if o != nil && !IsNil(o.UnchangedMaintenanceTasks) { + return true + } + + return false +} + +// SetUnchangedMaintenanceTasks gets a reference to the given []V1beta1MaintenanceTask and assigns it to the UnchangedMaintenanceTasks field. +func (o *Dedicatedv1beta1MaintenanceWindow) SetUnchangedMaintenanceTasks(v []V1beta1MaintenanceTask) { + o.UnchangedMaintenanceTasks = v +} + +func (o Dedicatedv1beta1MaintenanceWindow) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Dedicatedv1beta1MaintenanceWindow) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.MaintenanceWindowId) { + toSerialize["maintenanceWindowId"] = o.MaintenanceWindowId + } + toSerialize["projectId"] = o.ProjectId + toSerialize["weekDay"] = o.WeekDay + toSerialize["dayHour"] = o.DayHour + toSerialize["hourMinute"] = o.HourMinute + if !IsNil(o.NextMaintenanceDate) { + toSerialize["nextMaintenanceDate"] = o.NextMaintenanceDate + } + if !IsNil(o.UnchangedMaintenanceTasks) { + toSerialize["unchangedMaintenanceTasks"] = o.UnchangedMaintenanceTasks + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Dedicatedv1beta1MaintenanceWindow) 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{ + "projectId", + "weekDay", + "dayHour", + "hourMinute", + } + + 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) + } + } + + varDedicatedv1beta1MaintenanceWindow := _Dedicatedv1beta1MaintenanceWindow{} + + err = json.Unmarshal(data, &varDedicatedv1beta1MaintenanceWindow) + + if err != nil { + return err + } + + *o = Dedicatedv1beta1MaintenanceWindow(varDedicatedv1beta1MaintenanceWindow) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "maintenanceWindowId") + delete(additionalProperties, "projectId") + delete(additionalProperties, "weekDay") + delete(additionalProperties, "dayHour") + delete(additionalProperties, "hourMinute") + delete(additionalProperties, "nextMaintenanceDate") + delete(additionalProperties, "unchangedMaintenanceTasks") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDedicatedv1beta1MaintenanceWindow struct { + value *Dedicatedv1beta1MaintenanceWindow + isSet bool +} + +func (v NullableDedicatedv1beta1MaintenanceWindow) Get() *Dedicatedv1beta1MaintenanceWindow { + return v.value +} + +func (v *NullableDedicatedv1beta1MaintenanceWindow) Set(val *Dedicatedv1beta1MaintenanceWindow) { + v.value = val + v.isSet = true +} + +func (v NullableDedicatedv1beta1MaintenanceWindow) IsSet() bool { + return v.isSet +} + +func (v *NullableDedicatedv1beta1MaintenanceWindow) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDedicatedv1beta1MaintenanceWindow(val *Dedicatedv1beta1MaintenanceWindow) *NullableDedicatedv1beta1MaintenanceWindow { + return &NullableDedicatedv1beta1MaintenanceWindow{value: val, isSet: true} +} + +func (v NullableDedicatedv1beta1MaintenanceWindow) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDedicatedv1beta1MaintenanceWindow) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_node_spec.go b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_node_spec.go new file mode 100644 index 00000000..747f9499 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_node_spec.go @@ -0,0 +1,560 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the Dedicatedv1beta1NodeSpec type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Dedicatedv1beta1NodeSpec{} + +// Dedicatedv1beta1NodeSpec struct for Dedicatedv1beta1NodeSpec +type Dedicatedv1beta1NodeSpec struct { + Name *string `json:"name,omitempty"` + RegionId *string `json:"regionId,omitempty"` + ComponentType *Dedicatedv1beta1ComponentType `json:"componentType,omitempty"` + NodeSpecKey *string `json:"nodeSpecKey,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + VCpu *int32 `json:"vCpu,omitempty"` + MemorySizeGi *int32 `json:"memorySizeGi,omitempty"` + DefaultStorageSizeGi *int32 `json:"defaultStorageSizeGi,omitempty"` + MaxStorageSizeGi *int32 `json:"maxStorageSizeGi,omitempty"` + MinStorageSizeGi *int32 `json:"minStorageSizeGi,omitempty"` + DefaultNodeCount *int32 `json:"defaultNodeCount,omitempty"` + StorageTypes []ClusterStorageNodeSettingStorageType `json:"storageTypes,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Dedicatedv1beta1NodeSpec Dedicatedv1beta1NodeSpec + +// NewDedicatedv1beta1NodeSpec instantiates a new Dedicatedv1beta1NodeSpec 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 NewDedicatedv1beta1NodeSpec() *Dedicatedv1beta1NodeSpec { + this := Dedicatedv1beta1NodeSpec{} + return &this +} + +// NewDedicatedv1beta1NodeSpecWithDefaults instantiates a new Dedicatedv1beta1NodeSpec 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 NewDedicatedv1beta1NodeSpecWithDefaults() *Dedicatedv1beta1NodeSpec { + this := Dedicatedv1beta1NodeSpec{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Dedicatedv1beta1NodeSpec) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1NodeSpec) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Dedicatedv1beta1NodeSpec) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Dedicatedv1beta1NodeSpec) SetName(v string) { + o.Name = &v +} + +// GetRegionId returns the RegionId field value if set, zero value otherwise. +func (o *Dedicatedv1beta1NodeSpec) GetRegionId() string { + if o == nil || IsNil(o.RegionId) { + var ret string + return ret + } + return *o.RegionId +} + +// GetRegionIdOk returns a tuple with the RegionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1NodeSpec) GetRegionIdOk() (*string, bool) { + if o == nil || IsNil(o.RegionId) { + return nil, false + } + return o.RegionId, true +} + +// HasRegionId returns a boolean if a field has been set. +func (o *Dedicatedv1beta1NodeSpec) HasRegionId() bool { + if o != nil && !IsNil(o.RegionId) { + return true + } + + return false +} + +// SetRegionId gets a reference to the given string and assigns it to the RegionId field. +func (o *Dedicatedv1beta1NodeSpec) SetRegionId(v string) { + o.RegionId = &v +} + +// GetComponentType returns the ComponentType field value if set, zero value otherwise. +func (o *Dedicatedv1beta1NodeSpec) GetComponentType() Dedicatedv1beta1ComponentType { + if o == nil || IsNil(o.ComponentType) { + var ret Dedicatedv1beta1ComponentType + return ret + } + return *o.ComponentType +} + +// GetComponentTypeOk returns a tuple with the ComponentType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1NodeSpec) GetComponentTypeOk() (*Dedicatedv1beta1ComponentType, bool) { + if o == nil || IsNil(o.ComponentType) { + return nil, false + } + return o.ComponentType, true +} + +// HasComponentType returns a boolean if a field has been set. +func (o *Dedicatedv1beta1NodeSpec) HasComponentType() bool { + if o != nil && !IsNil(o.ComponentType) { + return true + } + + return false +} + +// SetComponentType gets a reference to the given Dedicatedv1beta1ComponentType and assigns it to the ComponentType field. +func (o *Dedicatedv1beta1NodeSpec) SetComponentType(v Dedicatedv1beta1ComponentType) { + o.ComponentType = &v +} + +// GetNodeSpecKey returns the NodeSpecKey field value if set, zero value otherwise. +func (o *Dedicatedv1beta1NodeSpec) GetNodeSpecKey() string { + if o == nil || IsNil(o.NodeSpecKey) { + var ret string + return ret + } + return *o.NodeSpecKey +} + +// GetNodeSpecKeyOk returns a tuple with the NodeSpecKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1NodeSpec) GetNodeSpecKeyOk() (*string, bool) { + if o == nil || IsNil(o.NodeSpecKey) { + return nil, false + } + return o.NodeSpecKey, true +} + +// HasNodeSpecKey returns a boolean if a field has been set. +func (o *Dedicatedv1beta1NodeSpec) HasNodeSpecKey() bool { + if o != nil && !IsNil(o.NodeSpecKey) { + return true + } + + return false +} + +// SetNodeSpecKey gets a reference to the given string and assigns it to the NodeSpecKey field. +func (o *Dedicatedv1beta1NodeSpec) SetNodeSpecKey(v string) { + o.NodeSpecKey = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *Dedicatedv1beta1NodeSpec) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1NodeSpec) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *Dedicatedv1beta1NodeSpec) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *Dedicatedv1beta1NodeSpec) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetVCpu returns the VCpu field value if set, zero value otherwise. +func (o *Dedicatedv1beta1NodeSpec) GetVCpu() int32 { + if o == nil || IsNil(o.VCpu) { + var ret int32 + return ret + } + return *o.VCpu +} + +// GetVCpuOk returns a tuple with the VCpu field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1NodeSpec) GetVCpuOk() (*int32, bool) { + if o == nil || IsNil(o.VCpu) { + return nil, false + } + return o.VCpu, true +} + +// HasVCpu returns a boolean if a field has been set. +func (o *Dedicatedv1beta1NodeSpec) HasVCpu() bool { + if o != nil && !IsNil(o.VCpu) { + return true + } + + return false +} + +// SetVCpu gets a reference to the given int32 and assigns it to the VCpu field. +func (o *Dedicatedv1beta1NodeSpec) SetVCpu(v int32) { + o.VCpu = &v +} + +// GetMemorySizeGi returns the MemorySizeGi field value if set, zero value otherwise. +func (o *Dedicatedv1beta1NodeSpec) GetMemorySizeGi() int32 { + if o == nil || IsNil(o.MemorySizeGi) { + var ret int32 + return ret + } + return *o.MemorySizeGi +} + +// GetMemorySizeGiOk returns a tuple with the MemorySizeGi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1NodeSpec) GetMemorySizeGiOk() (*int32, bool) { + if o == nil || IsNil(o.MemorySizeGi) { + return nil, false + } + return o.MemorySizeGi, true +} + +// HasMemorySizeGi returns a boolean if a field has been set. +func (o *Dedicatedv1beta1NodeSpec) HasMemorySizeGi() bool { + if o != nil && !IsNil(o.MemorySizeGi) { + return true + } + + return false +} + +// SetMemorySizeGi gets a reference to the given int32 and assigns it to the MemorySizeGi field. +func (o *Dedicatedv1beta1NodeSpec) SetMemorySizeGi(v int32) { + o.MemorySizeGi = &v +} + +// GetDefaultStorageSizeGi returns the DefaultStorageSizeGi field value if set, zero value otherwise. +func (o *Dedicatedv1beta1NodeSpec) GetDefaultStorageSizeGi() int32 { + if o == nil || IsNil(o.DefaultStorageSizeGi) { + var ret int32 + return ret + } + return *o.DefaultStorageSizeGi +} + +// GetDefaultStorageSizeGiOk returns a tuple with the DefaultStorageSizeGi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1NodeSpec) GetDefaultStorageSizeGiOk() (*int32, bool) { + if o == nil || IsNil(o.DefaultStorageSizeGi) { + return nil, false + } + return o.DefaultStorageSizeGi, true +} + +// HasDefaultStorageSizeGi returns a boolean if a field has been set. +func (o *Dedicatedv1beta1NodeSpec) HasDefaultStorageSizeGi() bool { + if o != nil && !IsNil(o.DefaultStorageSizeGi) { + return true + } + + return false +} + +// SetDefaultStorageSizeGi gets a reference to the given int32 and assigns it to the DefaultStorageSizeGi field. +func (o *Dedicatedv1beta1NodeSpec) SetDefaultStorageSizeGi(v int32) { + o.DefaultStorageSizeGi = &v +} + +// GetMaxStorageSizeGi returns the MaxStorageSizeGi field value if set, zero value otherwise. +func (o *Dedicatedv1beta1NodeSpec) GetMaxStorageSizeGi() int32 { + if o == nil || IsNil(o.MaxStorageSizeGi) { + var ret int32 + return ret + } + return *o.MaxStorageSizeGi +} + +// GetMaxStorageSizeGiOk returns a tuple with the MaxStorageSizeGi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1NodeSpec) GetMaxStorageSizeGiOk() (*int32, bool) { + if o == nil || IsNil(o.MaxStorageSizeGi) { + return nil, false + } + return o.MaxStorageSizeGi, true +} + +// HasMaxStorageSizeGi returns a boolean if a field has been set. +func (o *Dedicatedv1beta1NodeSpec) HasMaxStorageSizeGi() bool { + if o != nil && !IsNil(o.MaxStorageSizeGi) { + return true + } + + return false +} + +// SetMaxStorageSizeGi gets a reference to the given int32 and assigns it to the MaxStorageSizeGi field. +func (o *Dedicatedv1beta1NodeSpec) SetMaxStorageSizeGi(v int32) { + o.MaxStorageSizeGi = &v +} + +// GetMinStorageSizeGi returns the MinStorageSizeGi field value if set, zero value otherwise. +func (o *Dedicatedv1beta1NodeSpec) GetMinStorageSizeGi() int32 { + if o == nil || IsNil(o.MinStorageSizeGi) { + var ret int32 + return ret + } + return *o.MinStorageSizeGi +} + +// GetMinStorageSizeGiOk returns a tuple with the MinStorageSizeGi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1NodeSpec) GetMinStorageSizeGiOk() (*int32, bool) { + if o == nil || IsNil(o.MinStorageSizeGi) { + return nil, false + } + return o.MinStorageSizeGi, true +} + +// HasMinStorageSizeGi returns a boolean if a field has been set. +func (o *Dedicatedv1beta1NodeSpec) HasMinStorageSizeGi() bool { + if o != nil && !IsNil(o.MinStorageSizeGi) { + return true + } + + return false +} + +// SetMinStorageSizeGi gets a reference to the given int32 and assigns it to the MinStorageSizeGi field. +func (o *Dedicatedv1beta1NodeSpec) SetMinStorageSizeGi(v int32) { + o.MinStorageSizeGi = &v +} + +// GetDefaultNodeCount returns the DefaultNodeCount field value if set, zero value otherwise. +func (o *Dedicatedv1beta1NodeSpec) GetDefaultNodeCount() int32 { + if o == nil || IsNil(o.DefaultNodeCount) { + var ret int32 + return ret + } + return *o.DefaultNodeCount +} + +// GetDefaultNodeCountOk returns a tuple with the DefaultNodeCount field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1NodeSpec) GetDefaultNodeCountOk() (*int32, bool) { + if o == nil || IsNil(o.DefaultNodeCount) { + return nil, false + } + return o.DefaultNodeCount, true +} + +// HasDefaultNodeCount returns a boolean if a field has been set. +func (o *Dedicatedv1beta1NodeSpec) HasDefaultNodeCount() bool { + if o != nil && !IsNil(o.DefaultNodeCount) { + return true + } + + return false +} + +// SetDefaultNodeCount gets a reference to the given int32 and assigns it to the DefaultNodeCount field. +func (o *Dedicatedv1beta1NodeSpec) SetDefaultNodeCount(v int32) { + o.DefaultNodeCount = &v +} + +// GetStorageTypes returns the StorageTypes field value if set, zero value otherwise. +func (o *Dedicatedv1beta1NodeSpec) GetStorageTypes() []ClusterStorageNodeSettingStorageType { + if o == nil || IsNil(o.StorageTypes) { + var ret []ClusterStorageNodeSettingStorageType + return ret + } + return o.StorageTypes +} + +// GetStorageTypesOk returns a tuple with the StorageTypes field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1NodeSpec) GetStorageTypesOk() ([]ClusterStorageNodeSettingStorageType, bool) { + if o == nil || IsNil(o.StorageTypes) { + return nil, false + } + return o.StorageTypes, true +} + +// HasStorageTypes returns a boolean if a field has been set. +func (o *Dedicatedv1beta1NodeSpec) HasStorageTypes() bool { + if o != nil && !IsNil(o.StorageTypes) { + return true + } + + return false +} + +// SetStorageTypes gets a reference to the given []ClusterStorageNodeSettingStorageType and assigns it to the StorageTypes field. +func (o *Dedicatedv1beta1NodeSpec) SetStorageTypes(v []ClusterStorageNodeSettingStorageType) { + o.StorageTypes = v +} + +func (o Dedicatedv1beta1NodeSpec) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Dedicatedv1beta1NodeSpec) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.RegionId) { + toSerialize["regionId"] = o.RegionId + } + if !IsNil(o.ComponentType) { + toSerialize["componentType"] = o.ComponentType + } + if !IsNil(o.NodeSpecKey) { + toSerialize["nodeSpecKey"] = o.NodeSpecKey + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + if !IsNil(o.VCpu) { + toSerialize["vCpu"] = o.VCpu + } + if !IsNil(o.MemorySizeGi) { + toSerialize["memorySizeGi"] = o.MemorySizeGi + } + if !IsNil(o.DefaultStorageSizeGi) { + toSerialize["defaultStorageSizeGi"] = o.DefaultStorageSizeGi + } + if !IsNil(o.MaxStorageSizeGi) { + toSerialize["maxStorageSizeGi"] = o.MaxStorageSizeGi + } + if !IsNil(o.MinStorageSizeGi) { + toSerialize["minStorageSizeGi"] = o.MinStorageSizeGi + } + if !IsNil(o.DefaultNodeCount) { + toSerialize["defaultNodeCount"] = o.DefaultNodeCount + } + if !IsNil(o.StorageTypes) { + toSerialize["storageTypes"] = o.StorageTypes + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Dedicatedv1beta1NodeSpec) UnmarshalJSON(data []byte) (err error) { + varDedicatedv1beta1NodeSpec := _Dedicatedv1beta1NodeSpec{} + + err = json.Unmarshal(data, &varDedicatedv1beta1NodeSpec) + + if err != nil { + return err + } + + *o = Dedicatedv1beta1NodeSpec(varDedicatedv1beta1NodeSpec) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "regionId") + delete(additionalProperties, "componentType") + delete(additionalProperties, "nodeSpecKey") + delete(additionalProperties, "displayName") + delete(additionalProperties, "vCpu") + delete(additionalProperties, "memorySizeGi") + delete(additionalProperties, "defaultStorageSizeGi") + delete(additionalProperties, "maxStorageSizeGi") + delete(additionalProperties, "minStorageSizeGi") + delete(additionalProperties, "defaultNodeCount") + delete(additionalProperties, "storageTypes") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDedicatedv1beta1NodeSpec struct { + value *Dedicatedv1beta1NodeSpec + isSet bool +} + +func (v NullableDedicatedv1beta1NodeSpec) Get() *Dedicatedv1beta1NodeSpec { + return v.value +} + +func (v *NullableDedicatedv1beta1NodeSpec) Set(val *Dedicatedv1beta1NodeSpec) { + v.value = val + v.isSet = true +} + +func (v NullableDedicatedv1beta1NodeSpec) IsSet() bool { + return v.isSet +} + +func (v *NullableDedicatedv1beta1NodeSpec) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDedicatedv1beta1NodeSpec(val *Dedicatedv1beta1NodeSpec) *NullableDedicatedv1beta1NodeSpec { + return &NullableDedicatedv1beta1NodeSpec{value: val, isSet: true} +} + +func (v NullableDedicatedv1beta1NodeSpec) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDedicatedv1beta1NodeSpec) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_pause_cluster_response.go b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_pause_cluster_response.go new file mode 100644 index 00000000..8160d9e4 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_pause_cluster_response.go @@ -0,0 +1,166 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the Dedicatedv1beta1PauseClusterResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Dedicatedv1beta1PauseClusterResponse{} + +// Dedicatedv1beta1PauseClusterResponse struct for Dedicatedv1beta1PauseClusterResponse +type Dedicatedv1beta1PauseClusterResponse struct { + Cluster TidbCloudOpenApidedicatedv1beta1Cluster `json:"cluster"` + AdditionalProperties map[string]interface{} +} + +type _Dedicatedv1beta1PauseClusterResponse Dedicatedv1beta1PauseClusterResponse + +// NewDedicatedv1beta1PauseClusterResponse instantiates a new Dedicatedv1beta1PauseClusterResponse 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 NewDedicatedv1beta1PauseClusterResponse(cluster TidbCloudOpenApidedicatedv1beta1Cluster) *Dedicatedv1beta1PauseClusterResponse { + this := Dedicatedv1beta1PauseClusterResponse{} + this.Cluster = cluster + return &this +} + +// NewDedicatedv1beta1PauseClusterResponseWithDefaults instantiates a new Dedicatedv1beta1PauseClusterResponse 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 NewDedicatedv1beta1PauseClusterResponseWithDefaults() *Dedicatedv1beta1PauseClusterResponse { + this := Dedicatedv1beta1PauseClusterResponse{} + return &this +} + +// GetCluster returns the Cluster field value +func (o *Dedicatedv1beta1PauseClusterResponse) GetCluster() TidbCloudOpenApidedicatedv1beta1Cluster { + if o == nil { + var ret TidbCloudOpenApidedicatedv1beta1Cluster + 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 *Dedicatedv1beta1PauseClusterResponse) GetClusterOk() (*TidbCloudOpenApidedicatedv1beta1Cluster, bool) { + if o == nil { + return nil, false + } + return &o.Cluster, true +} + +// SetCluster sets field value +func (o *Dedicatedv1beta1PauseClusterResponse) SetCluster(v TidbCloudOpenApidedicatedv1beta1Cluster) { + o.Cluster = v +} + +func (o Dedicatedv1beta1PauseClusterResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Dedicatedv1beta1PauseClusterResponse) 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 *Dedicatedv1beta1PauseClusterResponse) 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) + } + } + + varDedicatedv1beta1PauseClusterResponse := _Dedicatedv1beta1PauseClusterResponse{} + + err = json.Unmarshal(data, &varDedicatedv1beta1PauseClusterResponse) + + if err != nil { + return err + } + + *o = Dedicatedv1beta1PauseClusterResponse(varDedicatedv1beta1PauseClusterResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "cluster") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDedicatedv1beta1PauseClusterResponse struct { + value *Dedicatedv1beta1PauseClusterResponse + isSet bool +} + +func (v NullableDedicatedv1beta1PauseClusterResponse) Get() *Dedicatedv1beta1PauseClusterResponse { + return v.value +} + +func (v *NullableDedicatedv1beta1PauseClusterResponse) Set(val *Dedicatedv1beta1PauseClusterResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDedicatedv1beta1PauseClusterResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDedicatedv1beta1PauseClusterResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDedicatedv1beta1PauseClusterResponse(val *Dedicatedv1beta1PauseClusterResponse) *NullableDedicatedv1beta1PauseClusterResponse { + return &NullableDedicatedv1beta1PauseClusterResponse{value: val, isSet: true} +} + +func (v NullableDedicatedv1beta1PauseClusterResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDedicatedv1beta1PauseClusterResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_private_link_service.go b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_private_link_service.go new file mode 100644 index 00000000..a3c86c78 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_private_link_service.go @@ -0,0 +1,452 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the Dedicatedv1beta1PrivateLinkService type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Dedicatedv1beta1PrivateLinkService{} + +// Dedicatedv1beta1PrivateLinkService struct for Dedicatedv1beta1PrivateLinkService +type Dedicatedv1beta1PrivateLinkService struct { + Name *string `json:"name,omitempty"` + TidbNodeGroupId *string `json:"tidbNodeGroupId,omitempty"` + // For AWS, it's the service name of the Private Link Service. For GCP, it's the resource name of the service attachment. For Azure, it's service resource ID of the Private Link Service. + ServiceName *string `json:"serviceName,omitempty"` + // For AWS, it's the fully qualified domain name (FQDN) shared for all private endpoints, despite which VPC the endpoint located in. For GCP, it's the zone name (suffix of FQDN) shared for all private endpoints located in a single VPC network. The format of FQDN is `.`. For Azure, it's the zone name shared across public internet. The format of FQDN is `-.`. + ServiceDnsName *string `json:"serviceDnsName,omitempty"` + // Only available for AWS. Same as the `AvailabilityZones` field in response body of `github.com/aws/aws-sdk-go-v2/service/ec2.DescribeVpcEndpointServices` method. + AvailableZones []string `json:"availableZones,omitempty"` + State *V1beta1PrivateLinkServiceState `json:"state,omitempty"` + RegionId *string `json:"regionId,omitempty"` + RegionDisplayName *string `json:"regionDisplayName,omitempty"` + CloudProvider *V1beta1RegionCloudProvider `json:"cloudProvider,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Dedicatedv1beta1PrivateLinkService Dedicatedv1beta1PrivateLinkService + +// NewDedicatedv1beta1PrivateLinkService instantiates a new Dedicatedv1beta1PrivateLinkService 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 NewDedicatedv1beta1PrivateLinkService() *Dedicatedv1beta1PrivateLinkService { + this := Dedicatedv1beta1PrivateLinkService{} + return &this +} + +// NewDedicatedv1beta1PrivateLinkServiceWithDefaults instantiates a new Dedicatedv1beta1PrivateLinkService 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 NewDedicatedv1beta1PrivateLinkServiceWithDefaults() *Dedicatedv1beta1PrivateLinkService { + this := Dedicatedv1beta1PrivateLinkService{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Dedicatedv1beta1PrivateLinkService) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1PrivateLinkService) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Dedicatedv1beta1PrivateLinkService) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Dedicatedv1beta1PrivateLinkService) SetName(v string) { + o.Name = &v +} + +// GetTidbNodeGroupId returns the TidbNodeGroupId field value if set, zero value otherwise. +func (o *Dedicatedv1beta1PrivateLinkService) GetTidbNodeGroupId() string { + if o == nil || IsNil(o.TidbNodeGroupId) { + var ret string + return ret + } + return *o.TidbNodeGroupId +} + +// GetTidbNodeGroupIdOk returns a tuple with the TidbNodeGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1PrivateLinkService) GetTidbNodeGroupIdOk() (*string, bool) { + if o == nil || IsNil(o.TidbNodeGroupId) { + return nil, false + } + return o.TidbNodeGroupId, true +} + +// HasTidbNodeGroupId returns a boolean if a field has been set. +func (o *Dedicatedv1beta1PrivateLinkService) HasTidbNodeGroupId() bool { + if o != nil && !IsNil(o.TidbNodeGroupId) { + return true + } + + return false +} + +// SetTidbNodeGroupId gets a reference to the given string and assigns it to the TidbNodeGroupId field. +func (o *Dedicatedv1beta1PrivateLinkService) SetTidbNodeGroupId(v string) { + o.TidbNodeGroupId = &v +} + +// GetServiceName returns the ServiceName field value if set, zero value otherwise. +func (o *Dedicatedv1beta1PrivateLinkService) GetServiceName() string { + if o == nil || IsNil(o.ServiceName) { + var ret string + return ret + } + return *o.ServiceName +} + +// GetServiceNameOk returns a tuple with the ServiceName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1PrivateLinkService) GetServiceNameOk() (*string, bool) { + if o == nil || IsNil(o.ServiceName) { + return nil, false + } + return o.ServiceName, true +} + +// HasServiceName returns a boolean if a field has been set. +func (o *Dedicatedv1beta1PrivateLinkService) HasServiceName() bool { + if o != nil && !IsNil(o.ServiceName) { + return true + } + + return false +} + +// SetServiceName gets a reference to the given string and assigns it to the ServiceName field. +func (o *Dedicatedv1beta1PrivateLinkService) SetServiceName(v string) { + o.ServiceName = &v +} + +// GetServiceDnsName returns the ServiceDnsName field value if set, zero value otherwise. +func (o *Dedicatedv1beta1PrivateLinkService) GetServiceDnsName() string { + if o == nil || IsNil(o.ServiceDnsName) { + var ret string + return ret + } + return *o.ServiceDnsName +} + +// GetServiceDnsNameOk returns a tuple with the ServiceDnsName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1PrivateLinkService) GetServiceDnsNameOk() (*string, bool) { + if o == nil || IsNil(o.ServiceDnsName) { + return nil, false + } + return o.ServiceDnsName, true +} + +// HasServiceDnsName returns a boolean if a field has been set. +func (o *Dedicatedv1beta1PrivateLinkService) HasServiceDnsName() bool { + if o != nil && !IsNil(o.ServiceDnsName) { + return true + } + + return false +} + +// SetServiceDnsName gets a reference to the given string and assigns it to the ServiceDnsName field. +func (o *Dedicatedv1beta1PrivateLinkService) SetServiceDnsName(v string) { + o.ServiceDnsName = &v +} + +// GetAvailableZones returns the AvailableZones field value if set, zero value otherwise. +func (o *Dedicatedv1beta1PrivateLinkService) GetAvailableZones() []string { + if o == nil || IsNil(o.AvailableZones) { + var ret []string + return ret + } + return o.AvailableZones +} + +// GetAvailableZonesOk returns a tuple with the AvailableZones field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1PrivateLinkService) GetAvailableZonesOk() ([]string, bool) { + if o == nil || IsNil(o.AvailableZones) { + return nil, false + } + return o.AvailableZones, true +} + +// HasAvailableZones returns a boolean if a field has been set. +func (o *Dedicatedv1beta1PrivateLinkService) HasAvailableZones() bool { + if o != nil && !IsNil(o.AvailableZones) { + return true + } + + return false +} + +// SetAvailableZones gets a reference to the given []string and assigns it to the AvailableZones field. +func (o *Dedicatedv1beta1PrivateLinkService) SetAvailableZones(v []string) { + o.AvailableZones = v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *Dedicatedv1beta1PrivateLinkService) GetState() V1beta1PrivateLinkServiceState { + if o == nil || IsNil(o.State) { + var ret V1beta1PrivateLinkServiceState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1PrivateLinkService) GetStateOk() (*V1beta1PrivateLinkServiceState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *Dedicatedv1beta1PrivateLinkService) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given V1beta1PrivateLinkServiceState and assigns it to the State field. +func (o *Dedicatedv1beta1PrivateLinkService) SetState(v V1beta1PrivateLinkServiceState) { + o.State = &v +} + +// GetRegionId returns the RegionId field value if set, zero value otherwise. +func (o *Dedicatedv1beta1PrivateLinkService) GetRegionId() string { + if o == nil || IsNil(o.RegionId) { + var ret string + return ret + } + return *o.RegionId +} + +// GetRegionIdOk returns a tuple with the RegionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1PrivateLinkService) GetRegionIdOk() (*string, bool) { + if o == nil || IsNil(o.RegionId) { + return nil, false + } + return o.RegionId, true +} + +// HasRegionId returns a boolean if a field has been set. +func (o *Dedicatedv1beta1PrivateLinkService) HasRegionId() bool { + if o != nil && !IsNil(o.RegionId) { + return true + } + + return false +} + +// SetRegionId gets a reference to the given string and assigns it to the RegionId field. +func (o *Dedicatedv1beta1PrivateLinkService) SetRegionId(v string) { + o.RegionId = &v +} + +// GetRegionDisplayName returns the RegionDisplayName field value if set, zero value otherwise. +func (o *Dedicatedv1beta1PrivateLinkService) GetRegionDisplayName() string { + if o == nil || IsNil(o.RegionDisplayName) { + var ret string + return ret + } + return *o.RegionDisplayName +} + +// GetRegionDisplayNameOk returns a tuple with the RegionDisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1PrivateLinkService) GetRegionDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.RegionDisplayName) { + return nil, false + } + return o.RegionDisplayName, true +} + +// HasRegionDisplayName returns a boolean if a field has been set. +func (o *Dedicatedv1beta1PrivateLinkService) HasRegionDisplayName() bool { + if o != nil && !IsNil(o.RegionDisplayName) { + return true + } + + return false +} + +// SetRegionDisplayName gets a reference to the given string and assigns it to the RegionDisplayName field. +func (o *Dedicatedv1beta1PrivateLinkService) SetRegionDisplayName(v string) { + o.RegionDisplayName = &v +} + +// GetCloudProvider returns the CloudProvider field value if set, zero value otherwise. +func (o *Dedicatedv1beta1PrivateLinkService) GetCloudProvider() V1beta1RegionCloudProvider { + if o == nil || IsNil(o.CloudProvider) { + var ret V1beta1RegionCloudProvider + return ret + } + return *o.CloudProvider +} + +// GetCloudProviderOk returns a tuple with the CloudProvider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1PrivateLinkService) GetCloudProviderOk() (*V1beta1RegionCloudProvider, bool) { + if o == nil || IsNil(o.CloudProvider) { + return nil, false + } + return o.CloudProvider, true +} + +// HasCloudProvider returns a boolean if a field has been set. +func (o *Dedicatedv1beta1PrivateLinkService) HasCloudProvider() bool { + if o != nil && !IsNil(o.CloudProvider) { + return true + } + + return false +} + +// SetCloudProvider gets a reference to the given V1beta1RegionCloudProvider and assigns it to the CloudProvider field. +func (o *Dedicatedv1beta1PrivateLinkService) SetCloudProvider(v V1beta1RegionCloudProvider) { + o.CloudProvider = &v +} + +func (o Dedicatedv1beta1PrivateLinkService) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Dedicatedv1beta1PrivateLinkService) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.TidbNodeGroupId) { + toSerialize["tidbNodeGroupId"] = o.TidbNodeGroupId + } + if !IsNil(o.ServiceName) { + toSerialize["serviceName"] = o.ServiceName + } + if !IsNil(o.ServiceDnsName) { + toSerialize["serviceDnsName"] = o.ServiceDnsName + } + if !IsNil(o.AvailableZones) { + toSerialize["availableZones"] = o.AvailableZones + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.RegionId) { + toSerialize["regionId"] = o.RegionId + } + if !IsNil(o.RegionDisplayName) { + toSerialize["regionDisplayName"] = o.RegionDisplayName + } + if !IsNil(o.CloudProvider) { + toSerialize["cloudProvider"] = o.CloudProvider + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Dedicatedv1beta1PrivateLinkService) UnmarshalJSON(data []byte) (err error) { + varDedicatedv1beta1PrivateLinkService := _Dedicatedv1beta1PrivateLinkService{} + + err = json.Unmarshal(data, &varDedicatedv1beta1PrivateLinkService) + + if err != nil { + return err + } + + *o = Dedicatedv1beta1PrivateLinkService(varDedicatedv1beta1PrivateLinkService) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "tidbNodeGroupId") + delete(additionalProperties, "serviceName") + delete(additionalProperties, "serviceDnsName") + delete(additionalProperties, "availableZones") + delete(additionalProperties, "state") + delete(additionalProperties, "regionId") + delete(additionalProperties, "regionDisplayName") + delete(additionalProperties, "cloudProvider") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDedicatedv1beta1PrivateLinkService struct { + value *Dedicatedv1beta1PrivateLinkService + isSet bool +} + +func (v NullableDedicatedv1beta1PrivateLinkService) Get() *Dedicatedv1beta1PrivateLinkService { + return v.value +} + +func (v *NullableDedicatedv1beta1PrivateLinkService) Set(val *Dedicatedv1beta1PrivateLinkService) { + v.value = val + v.isSet = true +} + +func (v NullableDedicatedv1beta1PrivateLinkService) IsSet() bool { + return v.isSet +} + +func (v *NullableDedicatedv1beta1PrivateLinkService) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDedicatedv1beta1PrivateLinkService(val *Dedicatedv1beta1PrivateLinkService) *NullableDedicatedv1beta1PrivateLinkService { + return &NullableDedicatedv1beta1PrivateLinkService{value: val, isSet: true} +} + +func (v NullableDedicatedv1beta1PrivateLinkService) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDedicatedv1beta1PrivateLinkService) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_resume_cluster_response.go b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_resume_cluster_response.go new file mode 100644 index 00000000..33cf0b83 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_resume_cluster_response.go @@ -0,0 +1,166 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the Dedicatedv1beta1ResumeClusterResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Dedicatedv1beta1ResumeClusterResponse{} + +// Dedicatedv1beta1ResumeClusterResponse struct for Dedicatedv1beta1ResumeClusterResponse +type Dedicatedv1beta1ResumeClusterResponse struct { + Cluster TidbCloudOpenApidedicatedv1beta1Cluster `json:"cluster"` + AdditionalProperties map[string]interface{} +} + +type _Dedicatedv1beta1ResumeClusterResponse Dedicatedv1beta1ResumeClusterResponse + +// NewDedicatedv1beta1ResumeClusterResponse instantiates a new Dedicatedv1beta1ResumeClusterResponse 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 NewDedicatedv1beta1ResumeClusterResponse(cluster TidbCloudOpenApidedicatedv1beta1Cluster) *Dedicatedv1beta1ResumeClusterResponse { + this := Dedicatedv1beta1ResumeClusterResponse{} + this.Cluster = cluster + return &this +} + +// NewDedicatedv1beta1ResumeClusterResponseWithDefaults instantiates a new Dedicatedv1beta1ResumeClusterResponse 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 NewDedicatedv1beta1ResumeClusterResponseWithDefaults() *Dedicatedv1beta1ResumeClusterResponse { + this := Dedicatedv1beta1ResumeClusterResponse{} + return &this +} + +// GetCluster returns the Cluster field value +func (o *Dedicatedv1beta1ResumeClusterResponse) GetCluster() TidbCloudOpenApidedicatedv1beta1Cluster { + if o == nil { + var ret TidbCloudOpenApidedicatedv1beta1Cluster + 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 *Dedicatedv1beta1ResumeClusterResponse) GetClusterOk() (*TidbCloudOpenApidedicatedv1beta1Cluster, bool) { + if o == nil { + return nil, false + } + return &o.Cluster, true +} + +// SetCluster sets field value +func (o *Dedicatedv1beta1ResumeClusterResponse) SetCluster(v TidbCloudOpenApidedicatedv1beta1Cluster) { + o.Cluster = v +} + +func (o Dedicatedv1beta1ResumeClusterResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Dedicatedv1beta1ResumeClusterResponse) 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 *Dedicatedv1beta1ResumeClusterResponse) 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) + } + } + + varDedicatedv1beta1ResumeClusterResponse := _Dedicatedv1beta1ResumeClusterResponse{} + + err = json.Unmarshal(data, &varDedicatedv1beta1ResumeClusterResponse) + + if err != nil { + return err + } + + *o = Dedicatedv1beta1ResumeClusterResponse(varDedicatedv1beta1ResumeClusterResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "cluster") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDedicatedv1beta1ResumeClusterResponse struct { + value *Dedicatedv1beta1ResumeClusterResponse + isSet bool +} + +func (v NullableDedicatedv1beta1ResumeClusterResponse) Get() *Dedicatedv1beta1ResumeClusterResponse { + return v.value +} + +func (v *NullableDedicatedv1beta1ResumeClusterResponse) Set(val *Dedicatedv1beta1ResumeClusterResponse) { + v.value = val + v.isSet = true +} + +func (v NullableDedicatedv1beta1ResumeClusterResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableDedicatedv1beta1ResumeClusterResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDedicatedv1beta1ResumeClusterResponse(val *Dedicatedv1beta1ResumeClusterResponse) *NullableDedicatedv1beta1ResumeClusterResponse { + return &NullableDedicatedv1beta1ResumeClusterResponse{value: val, isSet: true} +} + +func (v NullableDedicatedv1beta1ResumeClusterResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDedicatedv1beta1ResumeClusterResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_tidb_node_group.go b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_tidb_node_group.go new file mode 100644 index 00000000..16e92763 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_tidb_node_group.go @@ -0,0 +1,540 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the Dedicatedv1beta1TidbNodeGroup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Dedicatedv1beta1TidbNodeGroup{} + +// Dedicatedv1beta1TidbNodeGroup struct for Dedicatedv1beta1TidbNodeGroup +type Dedicatedv1beta1TidbNodeGroup struct { + Name *string `json:"name,omitempty"` + // The unique ID of the TiDB group. + TidbNodeGroupId *string `json:"tidbNodeGroupId,omitempty"` + // The cluster ID of the TiDB group. Optional when creating cluster with the default TiDB group. Required when creating non-default TiDB group. + ClusterId *string `json:"clusterId,omitempty"` + // The display name of the TiDB group. + DisplayName *string `json:"displayName,omitempty"` + // The number of TiDB nodes in the TiDB group. + NodeCount int32 `json:"nodeCount"` + Endpoints []Dedicatedv1beta1TidbNodeGroupEndpoint `json:"endpoints,omitempty"` + NodeSpecKey *string `json:"nodeSpecKey,omitempty"` + NodeSpecDisplayName *string `json:"nodeSpecDisplayName,omitempty"` + IsDefaultGroup *bool `json:"isDefaultGroup,omitempty"` + State *Dedicatedv1beta1TidbNodeGroupState `json:"state,omitempty"` + NodeChangingProgress *ClusterNodeChangingProgress `json:"nodeChangingProgress,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Dedicatedv1beta1TidbNodeGroup Dedicatedv1beta1TidbNodeGroup + +// NewDedicatedv1beta1TidbNodeGroup instantiates a new Dedicatedv1beta1TidbNodeGroup 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 NewDedicatedv1beta1TidbNodeGroup(nodeCount int32) *Dedicatedv1beta1TidbNodeGroup { + this := Dedicatedv1beta1TidbNodeGroup{} + this.NodeCount = nodeCount + return &this +} + +// NewDedicatedv1beta1TidbNodeGroupWithDefaults instantiates a new Dedicatedv1beta1TidbNodeGroup 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 NewDedicatedv1beta1TidbNodeGroupWithDefaults() *Dedicatedv1beta1TidbNodeGroup { + this := Dedicatedv1beta1TidbNodeGroup{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Dedicatedv1beta1TidbNodeGroup) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1TidbNodeGroup) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Dedicatedv1beta1TidbNodeGroup) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Dedicatedv1beta1TidbNodeGroup) SetName(v string) { + o.Name = &v +} + +// GetTidbNodeGroupId returns the TidbNodeGroupId field value if set, zero value otherwise. +func (o *Dedicatedv1beta1TidbNodeGroup) GetTidbNodeGroupId() string { + if o == nil || IsNil(o.TidbNodeGroupId) { + var ret string + return ret + } + return *o.TidbNodeGroupId +} + +// GetTidbNodeGroupIdOk returns a tuple with the TidbNodeGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1TidbNodeGroup) GetTidbNodeGroupIdOk() (*string, bool) { + if o == nil || IsNil(o.TidbNodeGroupId) { + return nil, false + } + return o.TidbNodeGroupId, true +} + +// HasTidbNodeGroupId returns a boolean if a field has been set. +func (o *Dedicatedv1beta1TidbNodeGroup) HasTidbNodeGroupId() bool { + if o != nil && !IsNil(o.TidbNodeGroupId) { + return true + } + + return false +} + +// SetTidbNodeGroupId gets a reference to the given string and assigns it to the TidbNodeGroupId field. +func (o *Dedicatedv1beta1TidbNodeGroup) SetTidbNodeGroupId(v string) { + o.TidbNodeGroupId = &v +} + +// GetClusterId returns the ClusterId field value if set, zero value otherwise. +func (o *Dedicatedv1beta1TidbNodeGroup) GetClusterId() string { + if o == nil || IsNil(o.ClusterId) { + var ret string + return ret + } + return *o.ClusterId +} + +// GetClusterIdOk returns a tuple with the ClusterId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1TidbNodeGroup) GetClusterIdOk() (*string, bool) { + if o == nil || IsNil(o.ClusterId) { + return nil, false + } + return o.ClusterId, true +} + +// HasClusterId returns a boolean if a field has been set. +func (o *Dedicatedv1beta1TidbNodeGroup) HasClusterId() bool { + if o != nil && !IsNil(o.ClusterId) { + return true + } + + return false +} + +// SetClusterId gets a reference to the given string and assigns it to the ClusterId field. +func (o *Dedicatedv1beta1TidbNodeGroup) SetClusterId(v string) { + o.ClusterId = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *Dedicatedv1beta1TidbNodeGroup) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1TidbNodeGroup) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *Dedicatedv1beta1TidbNodeGroup) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *Dedicatedv1beta1TidbNodeGroup) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetNodeCount returns the NodeCount field value +func (o *Dedicatedv1beta1TidbNodeGroup) GetNodeCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NodeCount +} + +// GetNodeCountOk returns a tuple with the NodeCount field value +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1TidbNodeGroup) GetNodeCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NodeCount, true +} + +// SetNodeCount sets field value +func (o *Dedicatedv1beta1TidbNodeGroup) SetNodeCount(v int32) { + o.NodeCount = v +} + +// GetEndpoints returns the Endpoints field value if set, zero value otherwise. +func (o *Dedicatedv1beta1TidbNodeGroup) GetEndpoints() []Dedicatedv1beta1TidbNodeGroupEndpoint { + if o == nil || IsNil(o.Endpoints) { + var ret []Dedicatedv1beta1TidbNodeGroupEndpoint + 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 *Dedicatedv1beta1TidbNodeGroup) GetEndpointsOk() ([]Dedicatedv1beta1TidbNodeGroupEndpoint, 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 *Dedicatedv1beta1TidbNodeGroup) HasEndpoints() bool { + if o != nil && !IsNil(o.Endpoints) { + return true + } + + return false +} + +// SetEndpoints gets a reference to the given []Dedicatedv1beta1TidbNodeGroupEndpoint and assigns it to the Endpoints field. +func (o *Dedicatedv1beta1TidbNodeGroup) SetEndpoints(v []Dedicatedv1beta1TidbNodeGroupEndpoint) { + o.Endpoints = v +} + +// GetNodeSpecKey returns the NodeSpecKey field value if set, zero value otherwise. +func (o *Dedicatedv1beta1TidbNodeGroup) GetNodeSpecKey() string { + if o == nil || IsNil(o.NodeSpecKey) { + var ret string + return ret + } + return *o.NodeSpecKey +} + +// GetNodeSpecKeyOk returns a tuple with the NodeSpecKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1TidbNodeGroup) GetNodeSpecKeyOk() (*string, bool) { + if o == nil || IsNil(o.NodeSpecKey) { + return nil, false + } + return o.NodeSpecKey, true +} + +// HasNodeSpecKey returns a boolean if a field has been set. +func (o *Dedicatedv1beta1TidbNodeGroup) HasNodeSpecKey() bool { + if o != nil && !IsNil(o.NodeSpecKey) { + return true + } + + return false +} + +// SetNodeSpecKey gets a reference to the given string and assigns it to the NodeSpecKey field. +func (o *Dedicatedv1beta1TidbNodeGroup) SetNodeSpecKey(v string) { + o.NodeSpecKey = &v +} + +// GetNodeSpecDisplayName returns the NodeSpecDisplayName field value if set, zero value otherwise. +func (o *Dedicatedv1beta1TidbNodeGroup) GetNodeSpecDisplayName() string { + if o == nil || IsNil(o.NodeSpecDisplayName) { + var ret string + return ret + } + return *o.NodeSpecDisplayName +} + +// GetNodeSpecDisplayNameOk returns a tuple with the NodeSpecDisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1TidbNodeGroup) GetNodeSpecDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.NodeSpecDisplayName) { + return nil, false + } + return o.NodeSpecDisplayName, true +} + +// HasNodeSpecDisplayName returns a boolean if a field has been set. +func (o *Dedicatedv1beta1TidbNodeGroup) HasNodeSpecDisplayName() bool { + if o != nil && !IsNil(o.NodeSpecDisplayName) { + return true + } + + return false +} + +// SetNodeSpecDisplayName gets a reference to the given string and assigns it to the NodeSpecDisplayName field. +func (o *Dedicatedv1beta1TidbNodeGroup) SetNodeSpecDisplayName(v string) { + o.NodeSpecDisplayName = &v +} + +// GetIsDefaultGroup returns the IsDefaultGroup field value if set, zero value otherwise. +func (o *Dedicatedv1beta1TidbNodeGroup) GetIsDefaultGroup() bool { + if o == nil || IsNil(o.IsDefaultGroup) { + var ret bool + return ret + } + return *o.IsDefaultGroup +} + +// GetIsDefaultGroupOk returns a tuple with the IsDefaultGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1TidbNodeGroup) GetIsDefaultGroupOk() (*bool, bool) { + if o == nil || IsNil(o.IsDefaultGroup) { + return nil, false + } + return o.IsDefaultGroup, true +} + +// HasIsDefaultGroup returns a boolean if a field has been set. +func (o *Dedicatedv1beta1TidbNodeGroup) HasIsDefaultGroup() bool { + if o != nil && !IsNil(o.IsDefaultGroup) { + return true + } + + return false +} + +// SetIsDefaultGroup gets a reference to the given bool and assigns it to the IsDefaultGroup field. +func (o *Dedicatedv1beta1TidbNodeGroup) SetIsDefaultGroup(v bool) { + o.IsDefaultGroup = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *Dedicatedv1beta1TidbNodeGroup) GetState() Dedicatedv1beta1TidbNodeGroupState { + if o == nil || IsNil(o.State) { + var ret Dedicatedv1beta1TidbNodeGroupState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1TidbNodeGroup) GetStateOk() (*Dedicatedv1beta1TidbNodeGroupState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *Dedicatedv1beta1TidbNodeGroup) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given Dedicatedv1beta1TidbNodeGroupState and assigns it to the State field. +func (o *Dedicatedv1beta1TidbNodeGroup) SetState(v Dedicatedv1beta1TidbNodeGroupState) { + o.State = &v +} + +// GetNodeChangingProgress returns the NodeChangingProgress field value if set, zero value otherwise. +func (o *Dedicatedv1beta1TidbNodeGroup) GetNodeChangingProgress() ClusterNodeChangingProgress { + if o == nil || IsNil(o.NodeChangingProgress) { + var ret ClusterNodeChangingProgress + return ret + } + return *o.NodeChangingProgress +} + +// GetNodeChangingProgressOk returns a tuple with the NodeChangingProgress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1TidbNodeGroup) GetNodeChangingProgressOk() (*ClusterNodeChangingProgress, bool) { + if o == nil || IsNil(o.NodeChangingProgress) { + return nil, false + } + return o.NodeChangingProgress, true +} + +// HasNodeChangingProgress returns a boolean if a field has been set. +func (o *Dedicatedv1beta1TidbNodeGroup) HasNodeChangingProgress() bool { + if o != nil && !IsNil(o.NodeChangingProgress) { + return true + } + + return false +} + +// SetNodeChangingProgress gets a reference to the given ClusterNodeChangingProgress and assigns it to the NodeChangingProgress field. +func (o *Dedicatedv1beta1TidbNodeGroup) SetNodeChangingProgress(v ClusterNodeChangingProgress) { + o.NodeChangingProgress = &v +} + +func (o Dedicatedv1beta1TidbNodeGroup) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Dedicatedv1beta1TidbNodeGroup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.TidbNodeGroupId) { + toSerialize["tidbNodeGroupId"] = o.TidbNodeGroupId + } + if !IsNil(o.ClusterId) { + toSerialize["clusterId"] = o.ClusterId + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + toSerialize["nodeCount"] = o.NodeCount + if !IsNil(o.Endpoints) { + toSerialize["endpoints"] = o.Endpoints + } + if !IsNil(o.NodeSpecKey) { + toSerialize["nodeSpecKey"] = o.NodeSpecKey + } + if !IsNil(o.NodeSpecDisplayName) { + toSerialize["nodeSpecDisplayName"] = o.NodeSpecDisplayName + } + if !IsNil(o.IsDefaultGroup) { + toSerialize["isDefaultGroup"] = o.IsDefaultGroup + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.NodeChangingProgress) { + toSerialize["nodeChangingProgress"] = o.NodeChangingProgress + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Dedicatedv1beta1TidbNodeGroup) 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{ + "nodeCount", + } + + 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) + } + } + + varDedicatedv1beta1TidbNodeGroup := _Dedicatedv1beta1TidbNodeGroup{} + + err = json.Unmarshal(data, &varDedicatedv1beta1TidbNodeGroup) + + if err != nil { + return err + } + + *o = Dedicatedv1beta1TidbNodeGroup(varDedicatedv1beta1TidbNodeGroup) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "tidbNodeGroupId") + delete(additionalProperties, "clusterId") + delete(additionalProperties, "displayName") + delete(additionalProperties, "nodeCount") + delete(additionalProperties, "endpoints") + delete(additionalProperties, "nodeSpecKey") + delete(additionalProperties, "nodeSpecDisplayName") + delete(additionalProperties, "isDefaultGroup") + delete(additionalProperties, "state") + delete(additionalProperties, "nodeChangingProgress") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDedicatedv1beta1TidbNodeGroup struct { + value *Dedicatedv1beta1TidbNodeGroup + isSet bool +} + +func (v NullableDedicatedv1beta1TidbNodeGroup) Get() *Dedicatedv1beta1TidbNodeGroup { + return v.value +} + +func (v *NullableDedicatedv1beta1TidbNodeGroup) Set(val *Dedicatedv1beta1TidbNodeGroup) { + v.value = val + v.isSet = true +} + +func (v NullableDedicatedv1beta1TidbNodeGroup) IsSet() bool { + return v.isSet +} + +func (v *NullableDedicatedv1beta1TidbNodeGroup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDedicatedv1beta1TidbNodeGroup(val *Dedicatedv1beta1TidbNodeGroup) *NullableDedicatedv1beta1TidbNodeGroup { + return &NullableDedicatedv1beta1TidbNodeGroup{value: val, isSet: true} +} + +func (v NullableDedicatedv1beta1TidbNodeGroup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDedicatedv1beta1TidbNodeGroup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_tidb_node_group_endpoint.go b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_tidb_node_group_endpoint.go new file mode 100644 index 00000000..c9727274 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_tidb_node_group_endpoint.go @@ -0,0 +1,228 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the Dedicatedv1beta1TidbNodeGroupEndpoint type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Dedicatedv1beta1TidbNodeGroupEndpoint{} + +// Dedicatedv1beta1TidbNodeGroupEndpoint struct for Dedicatedv1beta1TidbNodeGroupEndpoint +type Dedicatedv1beta1TidbNodeGroupEndpoint struct { + // When endpoint's type is `PRIVATE_ENDPOINT`, the `host` field behave differently across cloud providers: For AWS clusters, the `host` field is available right after the private link service is ready. For GCP and Azure clusters, the `host` field is available after the user creates a `PrivateEndpointConnection`. + Host *string `json:"host,omitempty"` + Port *int32 `json:"port,omitempty"` + ConnectionType *EndpointConnectionType `json:"connectionType,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Dedicatedv1beta1TidbNodeGroupEndpoint Dedicatedv1beta1TidbNodeGroupEndpoint + +// NewDedicatedv1beta1TidbNodeGroupEndpoint instantiates a new Dedicatedv1beta1TidbNodeGroupEndpoint 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 NewDedicatedv1beta1TidbNodeGroupEndpoint() *Dedicatedv1beta1TidbNodeGroupEndpoint { + this := Dedicatedv1beta1TidbNodeGroupEndpoint{} + return &this +} + +// NewDedicatedv1beta1TidbNodeGroupEndpointWithDefaults instantiates a new Dedicatedv1beta1TidbNodeGroupEndpoint 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 NewDedicatedv1beta1TidbNodeGroupEndpointWithDefaults() *Dedicatedv1beta1TidbNodeGroupEndpoint { + this := Dedicatedv1beta1TidbNodeGroupEndpoint{} + return &this +} + +// GetHost returns the Host field value if set, zero value otherwise. +func (o *Dedicatedv1beta1TidbNodeGroupEndpoint) GetHost() string { + if o == nil || IsNil(o.Host) { + var ret string + return ret + } + return *o.Host +} + +// GetHostOk returns a tuple with the Host field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1TidbNodeGroupEndpoint) GetHostOk() (*string, bool) { + if o == nil || IsNil(o.Host) { + return nil, false + } + return o.Host, true +} + +// HasHost returns a boolean if a field has been set. +func (o *Dedicatedv1beta1TidbNodeGroupEndpoint) HasHost() bool { + if o != nil && !IsNil(o.Host) { + return true + } + + return false +} + +// SetHost gets a reference to the given string and assigns it to the Host field. +func (o *Dedicatedv1beta1TidbNodeGroupEndpoint) SetHost(v string) { + o.Host = &v +} + +// GetPort returns the Port field value if set, zero value otherwise. +func (o *Dedicatedv1beta1TidbNodeGroupEndpoint) GetPort() int32 { + if o == nil || IsNil(o.Port) { + var ret int32 + return ret + } + return *o.Port +} + +// GetPortOk returns a tuple with the Port field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1TidbNodeGroupEndpoint) GetPortOk() (*int32, bool) { + if o == nil || IsNil(o.Port) { + return nil, false + } + return o.Port, true +} + +// HasPort returns a boolean if a field has been set. +func (o *Dedicatedv1beta1TidbNodeGroupEndpoint) HasPort() bool { + if o != nil && !IsNil(o.Port) { + return true + } + + return false +} + +// SetPort gets a reference to the given int32 and assigns it to the Port field. +func (o *Dedicatedv1beta1TidbNodeGroupEndpoint) SetPort(v int32) { + o.Port = &v +} + +// GetConnectionType returns the ConnectionType field value if set, zero value otherwise. +func (o *Dedicatedv1beta1TidbNodeGroupEndpoint) GetConnectionType() EndpointConnectionType { + if o == nil || IsNil(o.ConnectionType) { + var ret EndpointConnectionType + return ret + } + return *o.ConnectionType +} + +// GetConnectionTypeOk returns a tuple with the ConnectionType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1TidbNodeGroupEndpoint) GetConnectionTypeOk() (*EndpointConnectionType, bool) { + if o == nil || IsNil(o.ConnectionType) { + return nil, false + } + return o.ConnectionType, true +} + +// HasConnectionType returns a boolean if a field has been set. +func (o *Dedicatedv1beta1TidbNodeGroupEndpoint) HasConnectionType() bool { + if o != nil && !IsNil(o.ConnectionType) { + return true + } + + return false +} + +// SetConnectionType gets a reference to the given EndpointConnectionType and assigns it to the ConnectionType field. +func (o *Dedicatedv1beta1TidbNodeGroupEndpoint) SetConnectionType(v EndpointConnectionType) { + o.ConnectionType = &v +} + +func (o Dedicatedv1beta1TidbNodeGroupEndpoint) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Dedicatedv1beta1TidbNodeGroupEndpoint) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Host) { + toSerialize["host"] = o.Host + } + if !IsNil(o.Port) { + toSerialize["port"] = o.Port + } + if !IsNil(o.ConnectionType) { + toSerialize["connectionType"] = o.ConnectionType + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Dedicatedv1beta1TidbNodeGroupEndpoint) UnmarshalJSON(data []byte) (err error) { + varDedicatedv1beta1TidbNodeGroupEndpoint := _Dedicatedv1beta1TidbNodeGroupEndpoint{} + + err = json.Unmarshal(data, &varDedicatedv1beta1TidbNodeGroupEndpoint) + + if err != nil { + return err + } + + *o = Dedicatedv1beta1TidbNodeGroupEndpoint(varDedicatedv1beta1TidbNodeGroupEndpoint) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "host") + delete(additionalProperties, "port") + delete(additionalProperties, "connectionType") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDedicatedv1beta1TidbNodeGroupEndpoint struct { + value *Dedicatedv1beta1TidbNodeGroupEndpoint + isSet bool +} + +func (v NullableDedicatedv1beta1TidbNodeGroupEndpoint) Get() *Dedicatedv1beta1TidbNodeGroupEndpoint { + return v.value +} + +func (v *NullableDedicatedv1beta1TidbNodeGroupEndpoint) Set(val *Dedicatedv1beta1TidbNodeGroupEndpoint) { + v.value = val + v.isSet = true +} + +func (v NullableDedicatedv1beta1TidbNodeGroupEndpoint) IsSet() bool { + return v.isSet +} + +func (v *NullableDedicatedv1beta1TidbNodeGroupEndpoint) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDedicatedv1beta1TidbNodeGroupEndpoint(val *Dedicatedv1beta1TidbNodeGroupEndpoint) *NullableDedicatedv1beta1TidbNodeGroupEndpoint { + return &NullableDedicatedv1beta1TidbNodeGroupEndpoint{value: val, isSet: true} +} + +func (v NullableDedicatedv1beta1TidbNodeGroupEndpoint) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDedicatedv1beta1TidbNodeGroupEndpoint) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_tidb_node_group_state.go b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_tidb_node_group_state.go new file mode 100644 index 00000000..ed3b23b8 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_tidb_node_group_state.go @@ -0,0 +1,112 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// Dedicatedv1beta1TidbNodeGroupState - ACTIVE: All nodes are ready. - MODIFYING: When TiDB group is modifying. - PAUSED: When cluster is paused. +type Dedicatedv1beta1TidbNodeGroupState string + +// List of dedicatedv1beta1TidbNodeGroupState +const ( + DEDICATEDV1BETA1TIDBNODEGROUPSTATE_ACTIVE Dedicatedv1beta1TidbNodeGroupState = "ACTIVE" + DEDICATEDV1BETA1TIDBNODEGROUPSTATE_MODIFYING Dedicatedv1beta1TidbNodeGroupState = "MODIFYING" + DEDICATEDV1BETA1TIDBNODEGROUPSTATE_PAUSED Dedicatedv1beta1TidbNodeGroupState = "PAUSED" +) + +// All allowed values of Dedicatedv1beta1TidbNodeGroupState enum +var AllowedDedicatedv1beta1TidbNodeGroupStateEnumValues = []Dedicatedv1beta1TidbNodeGroupState{ + "ACTIVE", + "MODIFYING", + "PAUSED", +} + +func (v *Dedicatedv1beta1TidbNodeGroupState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := Dedicatedv1beta1TidbNodeGroupState(value) + for _, existing := range AllowedDedicatedv1beta1TidbNodeGroupStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Dedicatedv1beta1TidbNodeGroupState", value) +} + +// NewDedicatedv1beta1TidbNodeGroupStateFromValue returns a pointer to a valid Dedicatedv1beta1TidbNodeGroupState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDedicatedv1beta1TidbNodeGroupStateFromValue(v string) (*Dedicatedv1beta1TidbNodeGroupState, error) { + ev := Dedicatedv1beta1TidbNodeGroupState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Dedicatedv1beta1TidbNodeGroupState: valid values are %v", v, AllowedDedicatedv1beta1TidbNodeGroupStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Dedicatedv1beta1TidbNodeGroupState) IsValid() bool { + for _, existing := range AllowedDedicatedv1beta1TidbNodeGroupStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to dedicatedv1beta1TidbNodeGroupState value +func (v Dedicatedv1beta1TidbNodeGroupState) Ptr() *Dedicatedv1beta1TidbNodeGroupState { + return &v +} + +type NullableDedicatedv1beta1TidbNodeGroupState struct { + value *Dedicatedv1beta1TidbNodeGroupState + isSet bool +} + +func (v NullableDedicatedv1beta1TidbNodeGroupState) Get() *Dedicatedv1beta1TidbNodeGroupState { + return v.value +} + +func (v *NullableDedicatedv1beta1TidbNodeGroupState) Set(val *Dedicatedv1beta1TidbNodeGroupState) { + v.value = val + v.isSet = true +} + +func (v NullableDedicatedv1beta1TidbNodeGroupState) IsSet() bool { + return v.isSet +} + +func (v *NullableDedicatedv1beta1TidbNodeGroupState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDedicatedv1beta1TidbNodeGroupState(val *Dedicatedv1beta1TidbNodeGroupState) *NullableDedicatedv1beta1TidbNodeGroupState { + return &NullableDedicatedv1beta1TidbNodeGroupState{value: val, isSet: true} +} + +func (v NullableDedicatedv1beta1TidbNodeGroupState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDedicatedv1beta1TidbNodeGroupState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_vpc_peering.go b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_vpc_peering.go new file mode 100644 index 00000000..32199e73 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_vpc_peering.go @@ -0,0 +1,641 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the Dedicatedv1beta1VpcPeering type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &Dedicatedv1beta1VpcPeering{} + +// Dedicatedv1beta1VpcPeering struct for Dedicatedv1beta1VpcPeering +type Dedicatedv1beta1VpcPeering struct { + Name *string `json:"name,omitempty"` + VpcPeeringId *string `json:"vpcPeeringId,omitempty"` + // The labels of the vpc peering. It always contains the `project_id` label. + Labels *map[string]string `json:"labels,omitempty"` + TidbCloudRegionId string `json:"tidbCloudRegionId"` + // Format: {cloud_provider}-{region_code} For AWS, it's required. For GCP, it's optional. Since GCP does not require region_id when creating VPC peering. + CustomerRegionId *string `json:"customerRegionId,omitempty"` + // In AWS, it is the account ID. In GCP, it is the project name. + CustomerAccountId string `json:"customerAccountId"` + // In AWS, it is the VPC ID. In GCP, it is the network name. + CustomerVpcId string `json:"customerVpcId"` + CustomerVpcCidr string `json:"customerVpcCidr"` + TidbCloudCloudProvider *V1beta1RegionCloudProvider `json:"tidbCloudCloudProvider,omitempty"` + // In AWS, it is the account ID. In GCP, it is the project name. + TidbCloudAccountId *string `json:"tidbCloudAccountId,omitempty"` + // In AWS, it is the VPC ID. In GCP, it is the network name. + TidbCloudVpcId *string `json:"tidbCloudVpcId,omitempty"` + TidbCloudVpcCidr *string `json:"tidbCloudVpcCidr,omitempty"` + State *Dedicatedv1beta1VpcPeeringState `json:"state,omitempty"` + // Only for AWS vpc peerings. + AwsVpcPeeringConnectionId NullableString `json:"awsVpcPeeringConnectionId,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _Dedicatedv1beta1VpcPeering Dedicatedv1beta1VpcPeering + +// NewDedicatedv1beta1VpcPeering instantiates a new Dedicatedv1beta1VpcPeering 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 NewDedicatedv1beta1VpcPeering(tidbCloudRegionId string, customerAccountId string, customerVpcId string, customerVpcCidr string) *Dedicatedv1beta1VpcPeering { + this := Dedicatedv1beta1VpcPeering{} + this.TidbCloudRegionId = tidbCloudRegionId + this.CustomerAccountId = customerAccountId + this.CustomerVpcId = customerVpcId + this.CustomerVpcCidr = customerVpcCidr + return &this +} + +// NewDedicatedv1beta1VpcPeeringWithDefaults instantiates a new Dedicatedv1beta1VpcPeering 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 NewDedicatedv1beta1VpcPeeringWithDefaults() *Dedicatedv1beta1VpcPeering { + this := Dedicatedv1beta1VpcPeering{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *Dedicatedv1beta1VpcPeering) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1VpcPeering) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *Dedicatedv1beta1VpcPeering) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *Dedicatedv1beta1VpcPeering) SetName(v string) { + o.Name = &v +} + +// GetVpcPeeringId returns the VpcPeeringId field value if set, zero value otherwise. +func (o *Dedicatedv1beta1VpcPeering) GetVpcPeeringId() string { + if o == nil || IsNil(o.VpcPeeringId) { + var ret string + return ret + } + return *o.VpcPeeringId +} + +// GetVpcPeeringIdOk returns a tuple with the VpcPeeringId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1VpcPeering) GetVpcPeeringIdOk() (*string, bool) { + if o == nil || IsNil(o.VpcPeeringId) { + return nil, false + } + return o.VpcPeeringId, true +} + +// HasVpcPeeringId returns a boolean if a field has been set. +func (o *Dedicatedv1beta1VpcPeering) HasVpcPeeringId() bool { + if o != nil && !IsNil(o.VpcPeeringId) { + return true + } + + return false +} + +// SetVpcPeeringId gets a reference to the given string and assigns it to the VpcPeeringId field. +func (o *Dedicatedv1beta1VpcPeering) SetVpcPeeringId(v string) { + o.VpcPeeringId = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *Dedicatedv1beta1VpcPeering) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1VpcPeering) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *Dedicatedv1beta1VpcPeering) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *Dedicatedv1beta1VpcPeering) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetTidbCloudRegionId returns the TidbCloudRegionId field value +func (o *Dedicatedv1beta1VpcPeering) GetTidbCloudRegionId() string { + if o == nil { + var ret string + return ret + } + + return o.TidbCloudRegionId +} + +// GetTidbCloudRegionIdOk returns a tuple with the TidbCloudRegionId field value +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1VpcPeering) GetTidbCloudRegionIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TidbCloudRegionId, true +} + +// SetTidbCloudRegionId sets field value +func (o *Dedicatedv1beta1VpcPeering) SetTidbCloudRegionId(v string) { + o.TidbCloudRegionId = v +} + +// GetCustomerRegionId returns the CustomerRegionId field value if set, zero value otherwise. +func (o *Dedicatedv1beta1VpcPeering) GetCustomerRegionId() string { + if o == nil || IsNil(o.CustomerRegionId) { + var ret string + return ret + } + return *o.CustomerRegionId +} + +// GetCustomerRegionIdOk returns a tuple with the CustomerRegionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1VpcPeering) GetCustomerRegionIdOk() (*string, bool) { + if o == nil || IsNil(o.CustomerRegionId) { + return nil, false + } + return o.CustomerRegionId, true +} + +// HasCustomerRegionId returns a boolean if a field has been set. +func (o *Dedicatedv1beta1VpcPeering) HasCustomerRegionId() bool { + if o != nil && !IsNil(o.CustomerRegionId) { + return true + } + + return false +} + +// SetCustomerRegionId gets a reference to the given string and assigns it to the CustomerRegionId field. +func (o *Dedicatedv1beta1VpcPeering) SetCustomerRegionId(v string) { + o.CustomerRegionId = &v +} + +// GetCustomerAccountId returns the CustomerAccountId field value +func (o *Dedicatedv1beta1VpcPeering) GetCustomerAccountId() string { + if o == nil { + var ret string + return ret + } + + return o.CustomerAccountId +} + +// GetCustomerAccountIdOk returns a tuple with the CustomerAccountId field value +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1VpcPeering) GetCustomerAccountIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CustomerAccountId, true +} + +// SetCustomerAccountId sets field value +func (o *Dedicatedv1beta1VpcPeering) SetCustomerAccountId(v string) { + o.CustomerAccountId = v +} + +// GetCustomerVpcId returns the CustomerVpcId field value +func (o *Dedicatedv1beta1VpcPeering) GetCustomerVpcId() string { + if o == nil { + var ret string + return ret + } + + return o.CustomerVpcId +} + +// GetCustomerVpcIdOk returns a tuple with the CustomerVpcId field value +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1VpcPeering) GetCustomerVpcIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CustomerVpcId, true +} + +// SetCustomerVpcId sets field value +func (o *Dedicatedv1beta1VpcPeering) SetCustomerVpcId(v string) { + o.CustomerVpcId = v +} + +// GetCustomerVpcCidr returns the CustomerVpcCidr field value +func (o *Dedicatedv1beta1VpcPeering) GetCustomerVpcCidr() string { + if o == nil { + var ret string + return ret + } + + return o.CustomerVpcCidr +} + +// GetCustomerVpcCidrOk returns a tuple with the CustomerVpcCidr field value +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1VpcPeering) GetCustomerVpcCidrOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CustomerVpcCidr, true +} + +// SetCustomerVpcCidr sets field value +func (o *Dedicatedv1beta1VpcPeering) SetCustomerVpcCidr(v string) { + o.CustomerVpcCidr = v +} + +// GetTidbCloudCloudProvider returns the TidbCloudCloudProvider field value if set, zero value otherwise. +func (o *Dedicatedv1beta1VpcPeering) GetTidbCloudCloudProvider() V1beta1RegionCloudProvider { + if o == nil || IsNil(o.TidbCloudCloudProvider) { + var ret V1beta1RegionCloudProvider + return ret + } + return *o.TidbCloudCloudProvider +} + +// GetTidbCloudCloudProviderOk returns a tuple with the TidbCloudCloudProvider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1VpcPeering) GetTidbCloudCloudProviderOk() (*V1beta1RegionCloudProvider, bool) { + if o == nil || IsNil(o.TidbCloudCloudProvider) { + return nil, false + } + return o.TidbCloudCloudProvider, true +} + +// HasTidbCloudCloudProvider returns a boolean if a field has been set. +func (o *Dedicatedv1beta1VpcPeering) HasTidbCloudCloudProvider() bool { + if o != nil && !IsNil(o.TidbCloudCloudProvider) { + return true + } + + return false +} + +// SetTidbCloudCloudProvider gets a reference to the given V1beta1RegionCloudProvider and assigns it to the TidbCloudCloudProvider field. +func (o *Dedicatedv1beta1VpcPeering) SetTidbCloudCloudProvider(v V1beta1RegionCloudProvider) { + o.TidbCloudCloudProvider = &v +} + +// GetTidbCloudAccountId returns the TidbCloudAccountId field value if set, zero value otherwise. +func (o *Dedicatedv1beta1VpcPeering) GetTidbCloudAccountId() string { + if o == nil || IsNil(o.TidbCloudAccountId) { + var ret string + return ret + } + return *o.TidbCloudAccountId +} + +// GetTidbCloudAccountIdOk returns a tuple with the TidbCloudAccountId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1VpcPeering) GetTidbCloudAccountIdOk() (*string, bool) { + if o == nil || IsNil(o.TidbCloudAccountId) { + return nil, false + } + return o.TidbCloudAccountId, true +} + +// HasTidbCloudAccountId returns a boolean if a field has been set. +func (o *Dedicatedv1beta1VpcPeering) HasTidbCloudAccountId() bool { + if o != nil && !IsNil(o.TidbCloudAccountId) { + return true + } + + return false +} + +// SetTidbCloudAccountId gets a reference to the given string and assigns it to the TidbCloudAccountId field. +func (o *Dedicatedv1beta1VpcPeering) SetTidbCloudAccountId(v string) { + o.TidbCloudAccountId = &v +} + +// GetTidbCloudVpcId returns the TidbCloudVpcId field value if set, zero value otherwise. +func (o *Dedicatedv1beta1VpcPeering) GetTidbCloudVpcId() string { + if o == nil || IsNil(o.TidbCloudVpcId) { + var ret string + return ret + } + return *o.TidbCloudVpcId +} + +// GetTidbCloudVpcIdOk returns a tuple with the TidbCloudVpcId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1VpcPeering) GetTidbCloudVpcIdOk() (*string, bool) { + if o == nil || IsNil(o.TidbCloudVpcId) { + return nil, false + } + return o.TidbCloudVpcId, true +} + +// HasTidbCloudVpcId returns a boolean if a field has been set. +func (o *Dedicatedv1beta1VpcPeering) HasTidbCloudVpcId() bool { + if o != nil && !IsNil(o.TidbCloudVpcId) { + return true + } + + return false +} + +// SetTidbCloudVpcId gets a reference to the given string and assigns it to the TidbCloudVpcId field. +func (o *Dedicatedv1beta1VpcPeering) SetTidbCloudVpcId(v string) { + o.TidbCloudVpcId = &v +} + +// GetTidbCloudVpcCidr returns the TidbCloudVpcCidr field value if set, zero value otherwise. +func (o *Dedicatedv1beta1VpcPeering) GetTidbCloudVpcCidr() string { + if o == nil || IsNil(o.TidbCloudVpcCidr) { + var ret string + return ret + } + return *o.TidbCloudVpcCidr +} + +// GetTidbCloudVpcCidrOk returns a tuple with the TidbCloudVpcCidr field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1VpcPeering) GetTidbCloudVpcCidrOk() (*string, bool) { + if o == nil || IsNil(o.TidbCloudVpcCidr) { + return nil, false + } + return o.TidbCloudVpcCidr, true +} + +// HasTidbCloudVpcCidr returns a boolean if a field has been set. +func (o *Dedicatedv1beta1VpcPeering) HasTidbCloudVpcCidr() bool { + if o != nil && !IsNil(o.TidbCloudVpcCidr) { + return true + } + + return false +} + +// SetTidbCloudVpcCidr gets a reference to the given string and assigns it to the TidbCloudVpcCidr field. +func (o *Dedicatedv1beta1VpcPeering) SetTidbCloudVpcCidr(v string) { + o.TidbCloudVpcCidr = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *Dedicatedv1beta1VpcPeering) GetState() Dedicatedv1beta1VpcPeeringState { + if o == nil || IsNil(o.State) { + var ret Dedicatedv1beta1VpcPeeringState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *Dedicatedv1beta1VpcPeering) GetStateOk() (*Dedicatedv1beta1VpcPeeringState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *Dedicatedv1beta1VpcPeering) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given Dedicatedv1beta1VpcPeeringState and assigns it to the State field. +func (o *Dedicatedv1beta1VpcPeering) SetState(v Dedicatedv1beta1VpcPeeringState) { + o.State = &v +} + +// GetAwsVpcPeeringConnectionId returns the AwsVpcPeeringConnectionId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *Dedicatedv1beta1VpcPeering) GetAwsVpcPeeringConnectionId() string { + if o == nil || IsNil(o.AwsVpcPeeringConnectionId.Get()) { + var ret string + return ret + } + return *o.AwsVpcPeeringConnectionId.Get() +} + +// GetAwsVpcPeeringConnectionIdOk returns a tuple with the AwsVpcPeeringConnectionId field value if set, nil otherwise +// 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 *Dedicatedv1beta1VpcPeering) GetAwsVpcPeeringConnectionIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.AwsVpcPeeringConnectionId.Get(), o.AwsVpcPeeringConnectionId.IsSet() +} + +// HasAwsVpcPeeringConnectionId returns a boolean if a field has been set. +func (o *Dedicatedv1beta1VpcPeering) HasAwsVpcPeeringConnectionId() bool { + if o != nil && o.AwsVpcPeeringConnectionId.IsSet() { + return true + } + + return false +} + +// SetAwsVpcPeeringConnectionId gets a reference to the given NullableString and assigns it to the AwsVpcPeeringConnectionId field. +func (o *Dedicatedv1beta1VpcPeering) SetAwsVpcPeeringConnectionId(v string) { + o.AwsVpcPeeringConnectionId.Set(&v) +} + +// SetAwsVpcPeeringConnectionIdNil sets the value for AwsVpcPeeringConnectionId to be an explicit nil +func (o *Dedicatedv1beta1VpcPeering) SetAwsVpcPeeringConnectionIdNil() { + o.AwsVpcPeeringConnectionId.Set(nil) +} + +// UnsetAwsVpcPeeringConnectionId ensures that no value is present for AwsVpcPeeringConnectionId, not even an explicit nil +func (o *Dedicatedv1beta1VpcPeering) UnsetAwsVpcPeeringConnectionId() { + o.AwsVpcPeeringConnectionId.Unset() +} + +func (o Dedicatedv1beta1VpcPeering) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o Dedicatedv1beta1VpcPeering) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.VpcPeeringId) { + toSerialize["vpcPeeringId"] = o.VpcPeeringId + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["tidbCloudRegionId"] = o.TidbCloudRegionId + if !IsNil(o.CustomerRegionId) { + toSerialize["customerRegionId"] = o.CustomerRegionId + } + toSerialize["customerAccountId"] = o.CustomerAccountId + toSerialize["customerVpcId"] = o.CustomerVpcId + toSerialize["customerVpcCidr"] = o.CustomerVpcCidr + if !IsNil(o.TidbCloudCloudProvider) { + toSerialize["tidbCloudCloudProvider"] = o.TidbCloudCloudProvider + } + if !IsNil(o.TidbCloudAccountId) { + toSerialize["tidbCloudAccountId"] = o.TidbCloudAccountId + } + if !IsNil(o.TidbCloudVpcId) { + toSerialize["tidbCloudVpcId"] = o.TidbCloudVpcId + } + if !IsNil(o.TidbCloudVpcCidr) { + toSerialize["tidbCloudVpcCidr"] = o.TidbCloudVpcCidr + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if o.AwsVpcPeeringConnectionId.IsSet() { + toSerialize["awsVpcPeeringConnectionId"] = o.AwsVpcPeeringConnectionId.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *Dedicatedv1beta1VpcPeering) 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{ + "tidbCloudRegionId", + "customerAccountId", + "customerVpcId", + "customerVpcCidr", + } + + 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) + } + } + + varDedicatedv1beta1VpcPeering := _Dedicatedv1beta1VpcPeering{} + + err = json.Unmarshal(data, &varDedicatedv1beta1VpcPeering) + + if err != nil { + return err + } + + *o = Dedicatedv1beta1VpcPeering(varDedicatedv1beta1VpcPeering) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "vpcPeeringId") + delete(additionalProperties, "labels") + delete(additionalProperties, "tidbCloudRegionId") + delete(additionalProperties, "customerRegionId") + delete(additionalProperties, "customerAccountId") + delete(additionalProperties, "customerVpcId") + delete(additionalProperties, "customerVpcCidr") + delete(additionalProperties, "tidbCloudCloudProvider") + delete(additionalProperties, "tidbCloudAccountId") + delete(additionalProperties, "tidbCloudVpcId") + delete(additionalProperties, "tidbCloudVpcCidr") + delete(additionalProperties, "state") + delete(additionalProperties, "awsVpcPeeringConnectionId") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableDedicatedv1beta1VpcPeering struct { + value *Dedicatedv1beta1VpcPeering + isSet bool +} + +func (v NullableDedicatedv1beta1VpcPeering) Get() *Dedicatedv1beta1VpcPeering { + return v.value +} + +func (v *NullableDedicatedv1beta1VpcPeering) Set(val *Dedicatedv1beta1VpcPeering) { + v.value = val + v.isSet = true +} + +func (v NullableDedicatedv1beta1VpcPeering) IsSet() bool { + return v.isSet +} + +func (v *NullableDedicatedv1beta1VpcPeering) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDedicatedv1beta1VpcPeering(val *Dedicatedv1beta1VpcPeering) *NullableDedicatedv1beta1VpcPeering { + return &NullableDedicatedv1beta1VpcPeering{value: val, isSet: true} +} + +func (v NullableDedicatedv1beta1VpcPeering) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDedicatedv1beta1VpcPeering) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_vpc_peering_state.go b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_vpc_peering_state.go new file mode 100644 index 00000000..30354804 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_dedicatedv1beta1_vpc_peering_state.go @@ -0,0 +1,112 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// Dedicatedv1beta1VpcPeeringState the model 'Dedicatedv1beta1VpcPeeringState' +type Dedicatedv1beta1VpcPeeringState string + +// List of dedicatedv1beta1VpcPeeringState +const ( + DEDICATEDV1BETA1VPCPEERINGSTATE_PENDING Dedicatedv1beta1VpcPeeringState = "PENDING" + DEDICATEDV1BETA1VPCPEERINGSTATE_FAILED Dedicatedv1beta1VpcPeeringState = "FAILED" + DEDICATEDV1BETA1VPCPEERINGSTATE_ACTIVE Dedicatedv1beta1VpcPeeringState = "ACTIVE" +) + +// All allowed values of Dedicatedv1beta1VpcPeeringState enum +var AllowedDedicatedv1beta1VpcPeeringStateEnumValues = []Dedicatedv1beta1VpcPeeringState{ + "PENDING", + "FAILED", + "ACTIVE", +} + +func (v *Dedicatedv1beta1VpcPeeringState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := Dedicatedv1beta1VpcPeeringState(value) + for _, existing := range AllowedDedicatedv1beta1VpcPeeringStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid Dedicatedv1beta1VpcPeeringState", value) +} + +// NewDedicatedv1beta1VpcPeeringStateFromValue returns a pointer to a valid Dedicatedv1beta1VpcPeeringState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewDedicatedv1beta1VpcPeeringStateFromValue(v string) (*Dedicatedv1beta1VpcPeeringState, error) { + ev := Dedicatedv1beta1VpcPeeringState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for Dedicatedv1beta1VpcPeeringState: valid values are %v", v, AllowedDedicatedv1beta1VpcPeeringStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v Dedicatedv1beta1VpcPeeringState) IsValid() bool { + for _, existing := range AllowedDedicatedv1beta1VpcPeeringStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to dedicatedv1beta1VpcPeeringState value +func (v Dedicatedv1beta1VpcPeeringState) Ptr() *Dedicatedv1beta1VpcPeeringState { + return &v +} + +type NullableDedicatedv1beta1VpcPeeringState struct { + value *Dedicatedv1beta1VpcPeeringState + isSet bool +} + +func (v NullableDedicatedv1beta1VpcPeeringState) Get() *Dedicatedv1beta1VpcPeeringState { + return v.value +} + +func (v *NullableDedicatedv1beta1VpcPeeringState) Set(val *Dedicatedv1beta1VpcPeeringState) { + v.value = val + v.isSet = true +} + +func (v NullableDedicatedv1beta1VpcPeeringState) IsSet() bool { + return v.isSet +} + +func (v *NullableDedicatedv1beta1VpcPeeringState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableDedicatedv1beta1VpcPeeringState(val *Dedicatedv1beta1VpcPeeringState) *NullableDedicatedv1beta1VpcPeeringState { + return &NullableDedicatedv1beta1VpcPeeringState{value: val, isSet: true} +} + +func (v NullableDedicatedv1beta1VpcPeeringState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableDedicatedv1beta1VpcPeeringState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_endpoint_connection_type.go b/pkg/tidbcloud/v1beta1/dedicated/model_endpoint_connection_type.go new file mode 100644 index 00000000..c6bb02a9 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_endpoint_connection_type.go @@ -0,0 +1,112 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// EndpointConnectionType - PUBLIC: The endpoint is a public endpoint. - VPC_PEERING: The endpoint is a VPC peering endpoint. - PRIVATE_ENDPOINT: The endpoint is a private link endpoint. +type EndpointConnectionType string + +// List of EndpointConnectionType +const ( + ENDPOINTCONNECTIONTYPE_PUBLIC EndpointConnectionType = "PUBLIC" + ENDPOINTCONNECTIONTYPE_VPC_PEERING EndpointConnectionType = "VPC_PEERING" + ENDPOINTCONNECTIONTYPE_PRIVATE_ENDPOINT EndpointConnectionType = "PRIVATE_ENDPOINT" +) + +// All allowed values of EndpointConnectionType enum +var AllowedEndpointConnectionTypeEnumValues = []EndpointConnectionType{ + "PUBLIC", + "VPC_PEERING", + "PRIVATE_ENDPOINT", +} + +func (v *EndpointConnectionType) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := EndpointConnectionType(value) + for _, existing := range AllowedEndpointConnectionTypeEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid EndpointConnectionType", value) +} + +// NewEndpointConnectionTypeFromValue returns a pointer to a valid EndpointConnectionType +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewEndpointConnectionTypeFromValue(v string) (*EndpointConnectionType, error) { + ev := EndpointConnectionType(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for EndpointConnectionType: valid values are %v", v, AllowedEndpointConnectionTypeEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v EndpointConnectionType) IsValid() bool { + for _, existing := range AllowedEndpointConnectionTypeEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to EndpointConnectionType value +func (v EndpointConnectionType) Ptr() *EndpointConnectionType { + return &v +} + +type NullableEndpointConnectionType struct { + value *EndpointConnectionType + isSet bool +} + +func (v NullableEndpointConnectionType) Get() *EndpointConnectionType { + return v.value +} + +func (v *NullableEndpointConnectionType) Set(val *EndpointConnectionType) { + v.value = val + v.isSet = true +} + +func (v NullableEndpointConnectionType) IsSet() bool { + return v.isSet +} + +func (v *NullableEndpointConnectionType) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableEndpointConnectionType(val *EndpointConnectionType) *NullableEndpointConnectionType { + return &NullableEndpointConnectionType{value: val, isSet: true} +} + +func (v NullableEndpointConnectionType) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableEndpointConnectionType) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_googlerpc_status.go b/pkg/tidbcloud/v1beta1/dedicated/model_googlerpc_status.go new file mode 100644 index 00000000..38d4cff9 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_googlerpc_status.go @@ -0,0 +1,230 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the GooglerpcStatus type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &GooglerpcStatus{} + +// GooglerpcStatus The `Status` type defines a logical error model that is suitable for different programming environments, including REST APIs and RPC APIs. It is used by [gRPC](https://github.com/grpc). Each `Status` message contains three pieces of data: error code, error message, and error details. You can find out more about this error model and how to work with it in the [API Design Guide](https://cloud.google.com/apis/design/errors). +type GooglerpcStatus struct { + // The status code, which should be an enum value of [google.rpc.Code][google.rpc.Code]. + Code *int32 `json:"code,omitempty"` + // A developer-facing error message, which should be in English. Any user-facing error message should be localized and sent in the [google.rpc.Status.details][google.rpc.Status.details] field, or localized by the client. + Message *string `json:"message,omitempty"` + // A list of messages that carry the error details. There is a common set of message types for APIs to use. + Details []ProtobufAny `json:"details,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _GooglerpcStatus GooglerpcStatus + +// NewGooglerpcStatus instantiates a new GooglerpcStatus 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 NewGooglerpcStatus() *GooglerpcStatus { + this := GooglerpcStatus{} + return &this +} + +// NewGooglerpcStatusWithDefaults instantiates a new GooglerpcStatus 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 NewGooglerpcStatusWithDefaults() *GooglerpcStatus { + this := GooglerpcStatus{} + return &this +} + +// GetCode returns the Code field value if set, zero value otherwise. +func (o *GooglerpcStatus) GetCode() int32 { + if o == nil || IsNil(o.Code) { + var ret int32 + return ret + } + return *o.Code +} + +// GetCodeOk returns a tuple with the Code field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GooglerpcStatus) GetCodeOk() (*int32, bool) { + if o == nil || IsNil(o.Code) { + return nil, false + } + return o.Code, true +} + +// HasCode returns a boolean if a field has been set. +func (o *GooglerpcStatus) HasCode() bool { + if o != nil && !IsNil(o.Code) { + return true + } + + return false +} + +// SetCode gets a reference to the given int32 and assigns it to the Code field. +func (o *GooglerpcStatus) SetCode(v int32) { + o.Code = &v +} + +// GetMessage returns the Message field value if set, zero value otherwise. +func (o *GooglerpcStatus) GetMessage() string { + if o == nil || IsNil(o.Message) { + var ret string + return ret + } + return *o.Message +} + +// GetMessageOk returns a tuple with the Message field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GooglerpcStatus) GetMessageOk() (*string, bool) { + if o == nil || IsNil(o.Message) { + return nil, false + } + return o.Message, true +} + +// HasMessage returns a boolean if a field has been set. +func (o *GooglerpcStatus) HasMessage() bool { + if o != nil && !IsNil(o.Message) { + return true + } + + return false +} + +// SetMessage gets a reference to the given string and assigns it to the Message field. +func (o *GooglerpcStatus) SetMessage(v string) { + o.Message = &v +} + +// GetDetails returns the Details field value if set, zero value otherwise. +func (o *GooglerpcStatus) GetDetails() []ProtobufAny { + if o == nil || IsNil(o.Details) { + var ret []ProtobufAny + return ret + } + return o.Details +} + +// GetDetailsOk returns a tuple with the Details field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *GooglerpcStatus) GetDetailsOk() ([]ProtobufAny, bool) { + if o == nil || IsNil(o.Details) { + return nil, false + } + return o.Details, true +} + +// HasDetails returns a boolean if a field has been set. +func (o *GooglerpcStatus) HasDetails() bool { + if o != nil && !IsNil(o.Details) { + return true + } + + return false +} + +// SetDetails gets a reference to the given []ProtobufAny and assigns it to the Details field. +func (o *GooglerpcStatus) SetDetails(v []ProtobufAny) { + o.Details = v +} + +func (o GooglerpcStatus) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o GooglerpcStatus) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Code) { + toSerialize["code"] = o.Code + } + if !IsNil(o.Message) { + toSerialize["message"] = o.Message + } + if !IsNil(o.Details) { + toSerialize["details"] = o.Details + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *GooglerpcStatus) UnmarshalJSON(data []byte) (err error) { + varGooglerpcStatus := _GooglerpcStatus{} + + err = json.Unmarshal(data, &varGooglerpcStatus) + + if err != nil { + return err + } + + *o = GooglerpcStatus(varGooglerpcStatus) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "code") + delete(additionalProperties, "message") + delete(additionalProperties, "details") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableGooglerpcStatus struct { + value *GooglerpcStatus + isSet bool +} + +func (v NullableGooglerpcStatus) Get() *GooglerpcStatus { + return v.value +} + +func (v *NullableGooglerpcStatus) Set(val *GooglerpcStatus) { + v.value = val + v.isSet = true +} + +func (v NullableGooglerpcStatus) IsSet() bool { + return v.isSet +} + +func (v *NullableGooglerpcStatus) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableGooglerpcStatus(val *GooglerpcStatus) *NullableGooglerpcStatus { + return &NullableGooglerpcStatus{value: val, isSet: true} +} + +func (v NullableGooglerpcStatus) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableGooglerpcStatus) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_maintenance_service_update_maintenance_window_request.go b/pkg/tidbcloud/v1beta1/dedicated/model_maintenance_service_update_maintenance_window_request.go new file mode 100644 index 00000000..9e6c2572 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_maintenance_service_update_maintenance_window_request.go @@ -0,0 +1,227 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the MaintenanceServiceUpdateMaintenanceWindowRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &MaintenanceServiceUpdateMaintenanceWindowRequest{} + +// MaintenanceServiceUpdateMaintenanceWindowRequest struct for MaintenanceServiceUpdateMaintenanceWindowRequest +type MaintenanceServiceUpdateMaintenanceWindowRequest struct { + WeekDay *int32 `json:"weekDay,omitempty"` + DayHour *int32 `json:"dayHour,omitempty"` + HourMinute *int32 `json:"hourMinute,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _MaintenanceServiceUpdateMaintenanceWindowRequest MaintenanceServiceUpdateMaintenanceWindowRequest + +// NewMaintenanceServiceUpdateMaintenanceWindowRequest instantiates a new MaintenanceServiceUpdateMaintenanceWindowRequest 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 NewMaintenanceServiceUpdateMaintenanceWindowRequest() *MaintenanceServiceUpdateMaintenanceWindowRequest { + this := MaintenanceServiceUpdateMaintenanceWindowRequest{} + return &this +} + +// NewMaintenanceServiceUpdateMaintenanceWindowRequestWithDefaults instantiates a new MaintenanceServiceUpdateMaintenanceWindowRequest 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 NewMaintenanceServiceUpdateMaintenanceWindowRequestWithDefaults() *MaintenanceServiceUpdateMaintenanceWindowRequest { + this := MaintenanceServiceUpdateMaintenanceWindowRequest{} + return &this +} + +// GetWeekDay returns the WeekDay field value if set, zero value otherwise. +func (o *MaintenanceServiceUpdateMaintenanceWindowRequest) GetWeekDay() int32 { + if o == nil || IsNil(o.WeekDay) { + var ret int32 + return ret + } + return *o.WeekDay +} + +// GetWeekDayOk returns a tuple with the WeekDay field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MaintenanceServiceUpdateMaintenanceWindowRequest) GetWeekDayOk() (*int32, bool) { + if o == nil || IsNil(o.WeekDay) { + return nil, false + } + return o.WeekDay, true +} + +// HasWeekDay returns a boolean if a field has been set. +func (o *MaintenanceServiceUpdateMaintenanceWindowRequest) HasWeekDay() bool { + if o != nil && !IsNil(o.WeekDay) { + return true + } + + return false +} + +// SetWeekDay gets a reference to the given int32 and assigns it to the WeekDay field. +func (o *MaintenanceServiceUpdateMaintenanceWindowRequest) SetWeekDay(v int32) { + o.WeekDay = &v +} + +// GetDayHour returns the DayHour field value if set, zero value otherwise. +func (o *MaintenanceServiceUpdateMaintenanceWindowRequest) GetDayHour() int32 { + if o == nil || IsNil(o.DayHour) { + var ret int32 + return ret + } + return *o.DayHour +} + +// GetDayHourOk returns a tuple with the DayHour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MaintenanceServiceUpdateMaintenanceWindowRequest) GetDayHourOk() (*int32, bool) { + if o == nil || IsNil(o.DayHour) { + return nil, false + } + return o.DayHour, true +} + +// HasDayHour returns a boolean if a field has been set. +func (o *MaintenanceServiceUpdateMaintenanceWindowRequest) HasDayHour() bool { + if o != nil && !IsNil(o.DayHour) { + return true + } + + return false +} + +// SetDayHour gets a reference to the given int32 and assigns it to the DayHour field. +func (o *MaintenanceServiceUpdateMaintenanceWindowRequest) SetDayHour(v int32) { + o.DayHour = &v +} + +// GetHourMinute returns the HourMinute field value if set, zero value otherwise. +func (o *MaintenanceServiceUpdateMaintenanceWindowRequest) GetHourMinute() int32 { + if o == nil || IsNil(o.HourMinute) { + var ret int32 + return ret + } + return *o.HourMinute +} + +// GetHourMinuteOk returns a tuple with the HourMinute field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *MaintenanceServiceUpdateMaintenanceWindowRequest) GetHourMinuteOk() (*int32, bool) { + if o == nil || IsNil(o.HourMinute) { + return nil, false + } + return o.HourMinute, true +} + +// HasHourMinute returns a boolean if a field has been set. +func (o *MaintenanceServiceUpdateMaintenanceWindowRequest) HasHourMinute() bool { + if o != nil && !IsNil(o.HourMinute) { + return true + } + + return false +} + +// SetHourMinute gets a reference to the given int32 and assigns it to the HourMinute field. +func (o *MaintenanceServiceUpdateMaintenanceWindowRequest) SetHourMinute(v int32) { + o.HourMinute = &v +} + +func (o MaintenanceServiceUpdateMaintenanceWindowRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o MaintenanceServiceUpdateMaintenanceWindowRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.WeekDay) { + toSerialize["weekDay"] = o.WeekDay + } + if !IsNil(o.DayHour) { + toSerialize["dayHour"] = o.DayHour + } + if !IsNil(o.HourMinute) { + toSerialize["hourMinute"] = o.HourMinute + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *MaintenanceServiceUpdateMaintenanceWindowRequest) UnmarshalJSON(data []byte) (err error) { + varMaintenanceServiceUpdateMaintenanceWindowRequest := _MaintenanceServiceUpdateMaintenanceWindowRequest{} + + err = json.Unmarshal(data, &varMaintenanceServiceUpdateMaintenanceWindowRequest) + + if err != nil { + return err + } + + *o = MaintenanceServiceUpdateMaintenanceWindowRequest(varMaintenanceServiceUpdateMaintenanceWindowRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "weekDay") + delete(additionalProperties, "dayHour") + delete(additionalProperties, "hourMinute") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableMaintenanceServiceUpdateMaintenanceWindowRequest struct { + value *MaintenanceServiceUpdateMaintenanceWindowRequest + isSet bool +} + +func (v NullableMaintenanceServiceUpdateMaintenanceWindowRequest) Get() *MaintenanceServiceUpdateMaintenanceWindowRequest { + return v.value +} + +func (v *NullableMaintenanceServiceUpdateMaintenanceWindowRequest) Set(val *MaintenanceServiceUpdateMaintenanceWindowRequest) { + v.value = val + v.isSet = true +} + +func (v NullableMaintenanceServiceUpdateMaintenanceWindowRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableMaintenanceServiceUpdateMaintenanceWindowRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableMaintenanceServiceUpdateMaintenanceWindowRequest(val *MaintenanceServiceUpdateMaintenanceWindowRequest) *NullableMaintenanceServiceUpdateMaintenanceWindowRequest { + return &NullableMaintenanceServiceUpdateMaintenanceWindowRequest{value: val, isSet: true} +} + +func (v NullableMaintenanceServiceUpdateMaintenanceWindowRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableMaintenanceServiceUpdateMaintenanceWindowRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_private_endpoint_connection_endpoint_state.go b/pkg/tidbcloud/v1beta1/dedicated/model_private_endpoint_connection_endpoint_state.go new file mode 100644 index 00000000..7ea88606 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_private_endpoint_connection_endpoint_state.go @@ -0,0 +1,116 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// PrivateEndpointConnectionEndpointState - PENDING: Customer has posted to TiDB cloud API, but endpoint connection has not been accepted **asynchronously** by TiDB Cloud. - DISCOVERED: Customer has created the endpoint in their vpc, but has not posted to TiDB Cloud API. +type PrivateEndpointConnectionEndpointState string + +// List of PrivateEndpointConnectionEndpointState +const ( + PRIVATEENDPOINTCONNECTIONENDPOINTSTATE_PENDING PrivateEndpointConnectionEndpointState = "PENDING" + PRIVATEENDPOINTCONNECTIONENDPOINTSTATE_ACTIVE PrivateEndpointConnectionEndpointState = "ACTIVE" + PRIVATEENDPOINTCONNECTIONENDPOINTSTATE_DELETING PrivateEndpointConnectionEndpointState = "DELETING" + PRIVATEENDPOINTCONNECTIONENDPOINTSTATE_FAILED PrivateEndpointConnectionEndpointState = "FAILED" + PRIVATEENDPOINTCONNECTIONENDPOINTSTATE_DISCOVERED PrivateEndpointConnectionEndpointState = "DISCOVERED" +) + +// All allowed values of PrivateEndpointConnectionEndpointState enum +var AllowedPrivateEndpointConnectionEndpointStateEnumValues = []PrivateEndpointConnectionEndpointState{ + "PENDING", + "ACTIVE", + "DELETING", + "FAILED", + "DISCOVERED", +} + +func (v *PrivateEndpointConnectionEndpointState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := PrivateEndpointConnectionEndpointState(value) + for _, existing := range AllowedPrivateEndpointConnectionEndpointStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid PrivateEndpointConnectionEndpointState", value) +} + +// NewPrivateEndpointConnectionEndpointStateFromValue returns a pointer to a valid PrivateEndpointConnectionEndpointState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPrivateEndpointConnectionEndpointStateFromValue(v string) (*PrivateEndpointConnectionEndpointState, error) { + ev := PrivateEndpointConnectionEndpointState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for PrivateEndpointConnectionEndpointState: valid values are %v", v, AllowedPrivateEndpointConnectionEndpointStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v PrivateEndpointConnectionEndpointState) IsValid() bool { + for _, existing := range AllowedPrivateEndpointConnectionEndpointStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to PrivateEndpointConnectionEndpointState value +func (v PrivateEndpointConnectionEndpointState) Ptr() *PrivateEndpointConnectionEndpointState { + return &v +} + +type NullablePrivateEndpointConnectionEndpointState struct { + value *PrivateEndpointConnectionEndpointState + isSet bool +} + +func (v NullablePrivateEndpointConnectionEndpointState) Get() *PrivateEndpointConnectionEndpointState { + return v.value +} + +func (v *NullablePrivateEndpointConnectionEndpointState) Set(val *PrivateEndpointConnectionEndpointState) { + v.value = val + v.isSet = true +} + +func (v NullablePrivateEndpointConnectionEndpointState) IsSet() bool { + return v.isSet +} + +func (v *NullablePrivateEndpointConnectionEndpointState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePrivateEndpointConnectionEndpointState(val *PrivateEndpointConnectionEndpointState) *NullablePrivateEndpointConnectionEndpointState { + return &NullablePrivateEndpointConnectionEndpointState{value: val, isSet: true} +} + +func (v NullablePrivateEndpointConnectionEndpointState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePrivateEndpointConnectionEndpointState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_private_endpoint_connection_service_create_private_endpoint_connection_request.go b/pkg/tidbcloud/v1beta1/dedicated/model_private_endpoint_connection_service_create_private_endpoint_connection_request.go new file mode 100644 index 00000000..24d6b5d7 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_private_endpoint_connection_service_create_private_endpoint_connection_request.go @@ -0,0 +1,821 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest{} + +// PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest struct for PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest +type PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest struct { + Name *string `json:"name,omitempty"` + PrivateEndpointConnectionId *string `json:"privateEndpointConnectionId,omitempty"` + ClusterId *string `json:"clusterId,omitempty"` + ClusterDisplayName *string `json:"clusterDisplayName,omitempty"` + // The labels of private link connection. It always contains the `project_id` label. + Labels *map[string]string `json:"labels,omitempty"` + // The endpoint ID of the private link connection. For AWS, it's VPC endpoint ID. For GCP, it's private service connect endpoint ID. For Azure, it's private endpoint resource ID. + EndpointId string `json:"endpointId"` + // The private IP address of the private endpoint in the user's vNet. TiDB Cloud will setup a public DNS record for this private IP address. So the user can use DNS address to connect to the cluster. Only available for Azure clusters. + PrivateIpAddress NullableString `json:"privateIpAddress,omitempty"` + EndpointState *PrivateEndpointConnectionEndpointState `json:"endpointState,omitempty"` + Massage *string `json:"massage,omitempty"` + RegionId *string `json:"regionId,omitempty"` + RegionDisplayName *string `json:"regionDisplayName,omitempty"` + CloudProvider *V1beta1RegionCloudProvider `json:"cloudProvider,omitempty"` + PrivateLinkServiceName *string `json:"privateLinkServiceName,omitempty"` + PrivateLinkServiceState *V1beta1PrivateLinkServiceState `json:"privateLinkServiceState,omitempty"` + TidbNodeGroupDisplayName *string `json:"tidbNodeGroupDisplayName,omitempty"` + // Only for GCP private service connections. It's GCP project name. + AccountId NullableString `json:"accountId,omitempty"` + Host *string `json:"host,omitempty"` + Port *int32 `json:"port,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest + +// NewPrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest instantiates a new PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest 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 NewPrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest(endpointId string) *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest { + this := PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest{} + this.EndpointId = endpointId + return &this +} + +// NewPrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequestWithDefaults instantiates a new PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest 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 NewPrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequestWithDefaults() *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest { + this := PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetName(v string) { + o.Name = &v +} + +// GetPrivateEndpointConnectionId returns the PrivateEndpointConnectionId field value if set, zero value otherwise. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetPrivateEndpointConnectionId() string { + if o == nil || IsNil(o.PrivateEndpointConnectionId) { + var ret string + return ret + } + return *o.PrivateEndpointConnectionId +} + +// GetPrivateEndpointConnectionIdOk returns a tuple with the PrivateEndpointConnectionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetPrivateEndpointConnectionIdOk() (*string, bool) { + if o == nil || IsNil(o.PrivateEndpointConnectionId) { + return nil, false + } + return o.PrivateEndpointConnectionId, true +} + +// HasPrivateEndpointConnectionId returns a boolean if a field has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) HasPrivateEndpointConnectionId() bool { + if o != nil && !IsNil(o.PrivateEndpointConnectionId) { + return true + } + + return false +} + +// SetPrivateEndpointConnectionId gets a reference to the given string and assigns it to the PrivateEndpointConnectionId field. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetPrivateEndpointConnectionId(v string) { + o.PrivateEndpointConnectionId = &v +} + +// GetClusterId returns the ClusterId field value if set, zero value otherwise. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetClusterId() string { + if o == nil || IsNil(o.ClusterId) { + var ret string + return ret + } + return *o.ClusterId +} + +// GetClusterIdOk returns a tuple with the ClusterId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetClusterIdOk() (*string, bool) { + if o == nil || IsNil(o.ClusterId) { + return nil, false + } + return o.ClusterId, true +} + +// HasClusterId returns a boolean if a field has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) HasClusterId() bool { + if o != nil && !IsNil(o.ClusterId) { + return true + } + + return false +} + +// SetClusterId gets a reference to the given string and assigns it to the ClusterId field. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetClusterId(v string) { + o.ClusterId = &v +} + +// GetClusterDisplayName returns the ClusterDisplayName field value if set, zero value otherwise. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetClusterDisplayName() string { + if o == nil || IsNil(o.ClusterDisplayName) { + var ret string + return ret + } + return *o.ClusterDisplayName +} + +// GetClusterDisplayNameOk returns a tuple with the ClusterDisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetClusterDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.ClusterDisplayName) { + return nil, false + } + return o.ClusterDisplayName, true +} + +// HasClusterDisplayName returns a boolean if a field has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) HasClusterDisplayName() bool { + if o != nil && !IsNil(o.ClusterDisplayName) { + return true + } + + return false +} + +// SetClusterDisplayName gets a reference to the given string and assigns it to the ClusterDisplayName field. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetClusterDisplayName(v string) { + o.ClusterDisplayName = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetEndpointId returns the EndpointId field value +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetEndpointId() string { + if o == nil { + var ret string + return ret + } + + return o.EndpointId +} + +// GetEndpointIdOk returns a tuple with the EndpointId field value +// and a boolean to check if the value has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetEndpointIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.EndpointId, true +} + +// SetEndpointId sets field value +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetEndpointId(v string) { + o.EndpointId = v +} + +// GetPrivateIpAddress returns the PrivateIpAddress field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetPrivateIpAddress() string { + if o == nil || IsNil(o.PrivateIpAddress.Get()) { + var ret string + return ret + } + return *o.PrivateIpAddress.Get() +} + +// GetPrivateIpAddressOk returns a tuple with the PrivateIpAddress field value if set, nil otherwise +// 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 *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetPrivateIpAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.PrivateIpAddress.Get(), o.PrivateIpAddress.IsSet() +} + +// HasPrivateIpAddress returns a boolean if a field has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) HasPrivateIpAddress() bool { + if o != nil && o.PrivateIpAddress.IsSet() { + return true + } + + return false +} + +// SetPrivateIpAddress gets a reference to the given NullableString and assigns it to the PrivateIpAddress field. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetPrivateIpAddress(v string) { + o.PrivateIpAddress.Set(&v) +} + +// SetPrivateIpAddressNil sets the value for PrivateIpAddress to be an explicit nil +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetPrivateIpAddressNil() { + o.PrivateIpAddress.Set(nil) +} + +// UnsetPrivateIpAddress ensures that no value is present for PrivateIpAddress, not even an explicit nil +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) UnsetPrivateIpAddress() { + o.PrivateIpAddress.Unset() +} + +// GetEndpointState returns the EndpointState field value if set, zero value otherwise. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetEndpointState() PrivateEndpointConnectionEndpointState { + if o == nil || IsNil(o.EndpointState) { + var ret PrivateEndpointConnectionEndpointState + return ret + } + return *o.EndpointState +} + +// GetEndpointStateOk returns a tuple with the EndpointState field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetEndpointStateOk() (*PrivateEndpointConnectionEndpointState, bool) { + if o == nil || IsNil(o.EndpointState) { + return nil, false + } + return o.EndpointState, true +} + +// HasEndpointState returns a boolean if a field has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) HasEndpointState() bool { + if o != nil && !IsNil(o.EndpointState) { + return true + } + + return false +} + +// SetEndpointState gets a reference to the given PrivateEndpointConnectionEndpointState and assigns it to the EndpointState field. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetEndpointState(v PrivateEndpointConnectionEndpointState) { + o.EndpointState = &v +} + +// GetMassage returns the Massage field value if set, zero value otherwise. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetMassage() string { + if o == nil || IsNil(o.Massage) { + var ret string + return ret + } + return *o.Massage +} + +// GetMassageOk returns a tuple with the Massage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetMassageOk() (*string, bool) { + if o == nil || IsNil(o.Massage) { + return nil, false + } + return o.Massage, true +} + +// HasMassage returns a boolean if a field has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) HasMassage() bool { + if o != nil && !IsNil(o.Massage) { + return true + } + + return false +} + +// SetMassage gets a reference to the given string and assigns it to the Massage field. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetMassage(v string) { + o.Massage = &v +} + +// GetRegionId returns the RegionId field value if set, zero value otherwise. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetRegionId() string { + if o == nil || IsNil(o.RegionId) { + var ret string + return ret + } + return *o.RegionId +} + +// GetRegionIdOk returns a tuple with the RegionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetRegionIdOk() (*string, bool) { + if o == nil || IsNil(o.RegionId) { + return nil, false + } + return o.RegionId, true +} + +// HasRegionId returns a boolean if a field has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) HasRegionId() bool { + if o != nil && !IsNil(o.RegionId) { + return true + } + + return false +} + +// SetRegionId gets a reference to the given string and assigns it to the RegionId field. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetRegionId(v string) { + o.RegionId = &v +} + +// GetRegionDisplayName returns the RegionDisplayName field value if set, zero value otherwise. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetRegionDisplayName() string { + if o == nil || IsNil(o.RegionDisplayName) { + var ret string + return ret + } + return *o.RegionDisplayName +} + +// GetRegionDisplayNameOk returns a tuple with the RegionDisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetRegionDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.RegionDisplayName) { + return nil, false + } + return o.RegionDisplayName, true +} + +// HasRegionDisplayName returns a boolean if a field has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) HasRegionDisplayName() bool { + if o != nil && !IsNil(o.RegionDisplayName) { + return true + } + + return false +} + +// SetRegionDisplayName gets a reference to the given string and assigns it to the RegionDisplayName field. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetRegionDisplayName(v string) { + o.RegionDisplayName = &v +} + +// GetCloudProvider returns the CloudProvider field value if set, zero value otherwise. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetCloudProvider() V1beta1RegionCloudProvider { + if o == nil || IsNil(o.CloudProvider) { + var ret V1beta1RegionCloudProvider + return ret + } + return *o.CloudProvider +} + +// GetCloudProviderOk returns a tuple with the CloudProvider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetCloudProviderOk() (*V1beta1RegionCloudProvider, bool) { + if o == nil || IsNil(o.CloudProvider) { + return nil, false + } + return o.CloudProvider, true +} + +// HasCloudProvider returns a boolean if a field has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) HasCloudProvider() bool { + if o != nil && !IsNil(o.CloudProvider) { + return true + } + + return false +} + +// SetCloudProvider gets a reference to the given V1beta1RegionCloudProvider and assigns it to the CloudProvider field. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetCloudProvider(v V1beta1RegionCloudProvider) { + o.CloudProvider = &v +} + +// GetPrivateLinkServiceName returns the PrivateLinkServiceName field value if set, zero value otherwise. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetPrivateLinkServiceName() string { + if o == nil || IsNil(o.PrivateLinkServiceName) { + var ret string + return ret + } + return *o.PrivateLinkServiceName +} + +// GetPrivateLinkServiceNameOk returns a tuple with the PrivateLinkServiceName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetPrivateLinkServiceNameOk() (*string, bool) { + if o == nil || IsNil(o.PrivateLinkServiceName) { + return nil, false + } + return o.PrivateLinkServiceName, true +} + +// HasPrivateLinkServiceName returns a boolean if a field has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) HasPrivateLinkServiceName() bool { + if o != nil && !IsNil(o.PrivateLinkServiceName) { + return true + } + + return false +} + +// SetPrivateLinkServiceName gets a reference to the given string and assigns it to the PrivateLinkServiceName field. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetPrivateLinkServiceName(v string) { + o.PrivateLinkServiceName = &v +} + +// GetPrivateLinkServiceState returns the PrivateLinkServiceState field value if set, zero value otherwise. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetPrivateLinkServiceState() V1beta1PrivateLinkServiceState { + if o == nil || IsNil(o.PrivateLinkServiceState) { + var ret V1beta1PrivateLinkServiceState + return ret + } + return *o.PrivateLinkServiceState +} + +// GetPrivateLinkServiceStateOk returns a tuple with the PrivateLinkServiceState field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetPrivateLinkServiceStateOk() (*V1beta1PrivateLinkServiceState, bool) { + if o == nil || IsNil(o.PrivateLinkServiceState) { + return nil, false + } + return o.PrivateLinkServiceState, true +} + +// HasPrivateLinkServiceState returns a boolean if a field has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) HasPrivateLinkServiceState() bool { + if o != nil && !IsNil(o.PrivateLinkServiceState) { + return true + } + + return false +} + +// SetPrivateLinkServiceState gets a reference to the given V1beta1PrivateLinkServiceState and assigns it to the PrivateLinkServiceState field. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetPrivateLinkServiceState(v V1beta1PrivateLinkServiceState) { + o.PrivateLinkServiceState = &v +} + +// GetTidbNodeGroupDisplayName returns the TidbNodeGroupDisplayName field value if set, zero value otherwise. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetTidbNodeGroupDisplayName() string { + if o == nil || IsNil(o.TidbNodeGroupDisplayName) { + var ret string + return ret + } + return *o.TidbNodeGroupDisplayName +} + +// GetTidbNodeGroupDisplayNameOk returns a tuple with the TidbNodeGroupDisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetTidbNodeGroupDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.TidbNodeGroupDisplayName) { + return nil, false + } + return o.TidbNodeGroupDisplayName, true +} + +// HasTidbNodeGroupDisplayName returns a boolean if a field has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) HasTidbNodeGroupDisplayName() bool { + if o != nil && !IsNil(o.TidbNodeGroupDisplayName) { + return true + } + + return false +} + +// SetTidbNodeGroupDisplayName gets a reference to the given string and assigns it to the TidbNodeGroupDisplayName field. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetTidbNodeGroupDisplayName(v string) { + o.TidbNodeGroupDisplayName = &v +} + +// GetAccountId returns the AccountId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetAccountId() string { + if o == nil || IsNil(o.AccountId.Get()) { + var ret string + return ret + } + return *o.AccountId.Get() +} + +// GetAccountIdOk returns a tuple with the AccountId field value if set, nil otherwise +// 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 *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetAccountIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.AccountId.Get(), o.AccountId.IsSet() +} + +// HasAccountId returns a boolean if a field has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) HasAccountId() bool { + if o != nil && o.AccountId.IsSet() { + return true + } + + return false +} + +// SetAccountId gets a reference to the given NullableString and assigns it to the AccountId field. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetAccountId(v string) { + o.AccountId.Set(&v) +} + +// SetAccountIdNil sets the value for AccountId to be an explicit nil +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetAccountIdNil() { + o.AccountId.Set(nil) +} + +// UnsetAccountId ensures that no value is present for AccountId, not even an explicit nil +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) UnsetAccountId() { + o.AccountId.Unset() +} + +// GetHost returns the Host field value if set, zero value otherwise. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetHost() string { + if o == nil || IsNil(o.Host) { + var ret string + return ret + } + return *o.Host +} + +// GetHostOk returns a tuple with the Host field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetHostOk() (*string, bool) { + if o == nil || IsNil(o.Host) { + return nil, false + } + return o.Host, true +} + +// HasHost returns a boolean if a field has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) HasHost() bool { + if o != nil && !IsNil(o.Host) { + return true + } + + return false +} + +// SetHost gets a reference to the given string and assigns it to the Host field. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetHost(v string) { + o.Host = &v +} + +// GetPort returns the Port field value if set, zero value otherwise. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetPort() int32 { + if o == nil || IsNil(o.Port) { + var ret int32 + return ret + } + return *o.Port +} + +// GetPortOk returns a tuple with the Port field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) GetPortOk() (*int32, bool) { + if o == nil || IsNil(o.Port) { + return nil, false + } + return o.Port, true +} + +// HasPort returns a boolean if a field has been set. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) HasPort() bool { + if o != nil && !IsNil(o.Port) { + return true + } + + return false +} + +// SetPort gets a reference to the given int32 and assigns it to the Port field. +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) SetPort(v int32) { + o.Port = &v +} + +func (o PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.PrivateEndpointConnectionId) { + toSerialize["privateEndpointConnectionId"] = o.PrivateEndpointConnectionId + } + if !IsNil(o.ClusterId) { + toSerialize["clusterId"] = o.ClusterId + } + if !IsNil(o.ClusterDisplayName) { + toSerialize["clusterDisplayName"] = o.ClusterDisplayName + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["endpointId"] = o.EndpointId + if o.PrivateIpAddress.IsSet() { + toSerialize["privateIpAddress"] = o.PrivateIpAddress.Get() + } + if !IsNil(o.EndpointState) { + toSerialize["endpointState"] = o.EndpointState + } + if !IsNil(o.Massage) { + toSerialize["massage"] = o.Massage + } + if !IsNil(o.RegionId) { + toSerialize["regionId"] = o.RegionId + } + if !IsNil(o.RegionDisplayName) { + toSerialize["regionDisplayName"] = o.RegionDisplayName + } + if !IsNil(o.CloudProvider) { + toSerialize["cloudProvider"] = o.CloudProvider + } + if !IsNil(o.PrivateLinkServiceName) { + toSerialize["privateLinkServiceName"] = o.PrivateLinkServiceName + } + if !IsNil(o.PrivateLinkServiceState) { + toSerialize["privateLinkServiceState"] = o.PrivateLinkServiceState + } + if !IsNil(o.TidbNodeGroupDisplayName) { + toSerialize["tidbNodeGroupDisplayName"] = o.TidbNodeGroupDisplayName + } + if o.AccountId.IsSet() { + toSerialize["accountId"] = o.AccountId.Get() + } + if !IsNil(o.Host) { + toSerialize["host"] = o.Host + } + if !IsNil(o.Port) { + toSerialize["port"] = o.Port + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) 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{ + "endpointId", + } + + 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) + } + } + + varPrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest := _PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest{} + + err = json.Unmarshal(data, &varPrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) + + if err != nil { + return err + } + + *o = PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest(varPrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "privateEndpointConnectionId") + delete(additionalProperties, "clusterId") + delete(additionalProperties, "clusterDisplayName") + delete(additionalProperties, "labels") + delete(additionalProperties, "endpointId") + delete(additionalProperties, "privateIpAddress") + delete(additionalProperties, "endpointState") + delete(additionalProperties, "massage") + delete(additionalProperties, "regionId") + delete(additionalProperties, "regionDisplayName") + delete(additionalProperties, "cloudProvider") + delete(additionalProperties, "privateLinkServiceName") + delete(additionalProperties, "privateLinkServiceState") + delete(additionalProperties, "tidbNodeGroupDisplayName") + delete(additionalProperties, "accountId") + delete(additionalProperties, "host") + delete(additionalProperties, "port") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest struct { + value *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest + isSet bool +} + +func (v NullablePrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) Get() *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest { + return v.value +} + +func (v *NullablePrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) Set(val *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) { + v.value = val + v.isSet = true +} + +func (v NullablePrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) IsSet() bool { + return v.isSet +} + +func (v *NullablePrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest(val *PrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) *NullablePrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest { + return &NullablePrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest{value: val, isSet: true} +} + +func (v NullablePrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePrivateEndpointConnectionServiceCreatePrivateEndpointConnectionRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_private_endpoint_connection_service_list_private_endpoint_connections_cloud_provider_parameter.go b/pkg/tidbcloud/v1beta1/dedicated/model_private_endpoint_connection_service_list_private_endpoint_connections_cloud_provider_parameter.go new file mode 100644 index 00000000..c2993d36 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_private_endpoint_connection_service_list_private_endpoint_connections_cloud_provider_parameter.go @@ -0,0 +1,112 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter the model 'PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter' +type PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter string + +// List of PrivateEndpointConnectionService_ListPrivateEndpointConnections_cloudProvider_parameter +const ( + PRIVATEENDPOINTCONNECTIONSERVICELISTPRIVATEENDPOINTCONNECTIONSCLOUDPROVIDERPARAMETER_AWS PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter = "aws" + PRIVATEENDPOINTCONNECTIONSERVICELISTPRIVATEENDPOINTCONNECTIONSCLOUDPROVIDERPARAMETER_GCP PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter = "gcp" + PRIVATEENDPOINTCONNECTIONSERVICELISTPRIVATEENDPOINTCONNECTIONSCLOUDPROVIDERPARAMETER_AZURE PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter = "azure" +) + +// All allowed values of PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter enum +var AllowedPrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameterEnumValues = []PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter{ + "aws", + "gcp", + "azure", +} + +func (v *PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter(value) + for _, existing := range AllowedPrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameterEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter", value) +} + +// NewPrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameterFromValue returns a pointer to a valid PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewPrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameterFromValue(v string) (*PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter, error) { + ev := PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter: valid values are %v", v, AllowedPrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameterEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter) IsValid() bool { + for _, existing := range AllowedPrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameterEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to PrivateEndpointConnectionService_ListPrivateEndpointConnections_cloudProvider_parameter value +func (v PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter) Ptr() *PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter { + return &v +} + +type NullablePrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter struct { + value *PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter + isSet bool +} + +func (v NullablePrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter) Get() *PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter { + return v.value +} + +func (v *NullablePrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter) Set(val *PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter) { + v.value = val + v.isSet = true +} + +func (v NullablePrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter) IsSet() bool { + return v.isSet +} + +func (v *NullablePrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter(val *PrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter) *NullablePrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter { + return &NullablePrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter{value: val, isSet: true} +} + +func (v NullablePrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePrivateEndpointConnectionServiceListPrivateEndpointConnectionsCloudProviderParameter) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_protobuf_any.go b/pkg/tidbcloud/v1beta1/dedicated/model_protobuf_any.go new file mode 100644 index 00000000..27544e8e --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_protobuf_any.go @@ -0,0 +1,154 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the ProtobufAny type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ProtobufAny{} + +// ProtobufAny `Any` contains an arbitrary serialized protocol buffer message along with a URL that describes the type of the serialized message. Protobuf library provides support to pack/unpack Any values in the form of utility functions or additional generated methods of the Any type. Example 1: Pack and unpack a message in C++. Foo foo = ...; Any any; any.PackFrom(foo); ... if (any.UnpackTo(&foo)) { ... } Example 2: Pack and unpack a message in Java. Foo foo = ...; Any any = Any.pack(foo); ... if (any.is(Foo.class)) { foo = any.unpack(Foo.class); } // or ... if (any.isSameTypeAs(Foo.getDefaultInstance())) { foo = any.unpack(Foo.getDefaultInstance()); } Example 3: Pack and unpack a message in Python. foo = Foo(...) any = Any() any.Pack(foo) ... if any.Is(Foo.DESCRIPTOR): any.Unpack(foo) ... Example 4: Pack and unpack a message in Go foo := &pb.Foo{...} any, err := anypb.New(foo) if err != nil { ... } ... foo := &pb.Foo{} if err := any.UnmarshalTo(foo); err != nil { ... } The pack methods provided by protobuf library will by default use 'type.googleapis.com/full.type.name' as the type URL and the unpack methods only use the fully qualified type name after the last '/' in the type URL, for example \"foo.bar.com/x/y.z\" will yield type name \"y.z\". JSON ==== The JSON representation of an `Any` value uses the regular representation of the deserialized, embedded message, with an additional field `@type` which contains the type URL. Example: package google.profile; message Person { string first_name = 1; string last_name = 2; } { \"@type\": \"type.googleapis.com/google.profile.Person\", \"firstName\": , \"lastName\": } If the embedded message type is well-known and has a custom JSON representation, that representation will be embedded adding a field `value` which holds the custom JSON in addition to the `@type` field. Example (for message [google.protobuf.Duration][]): { \"@type\": \"type.googleapis.com/google.protobuf.Duration\", \"value\": \"1.212s\" } +type ProtobufAny struct { + // A URL/resource name that uniquely identifies the type of the serialized protocol buffer message. This string must contain at least one \"/\" character. The last segment of the URL's path must represent the fully qualified name of the type (as in `path/google.protobuf.Duration`). The name should be in a canonical form (e.g., leading \".\" is not accepted). In practice, teams usually precompile into the binary all types that they expect it to use in the context of Any. However, for URLs which use the scheme `http`, `https`, or no scheme, one can optionally set up a type server that maps type URLs to message definitions as follows: * If no scheme is provided, `https` is assumed. * An HTTP GET on the URL must yield a [google.protobuf.Type][] value in binary format, or produce an error. * Applications are allowed to cache lookup results based on the URL, or have them precompiled into a binary to avoid any lookup. Therefore, binary compatibility needs to be preserved on changes to types. (Use versioned type names to manage breaking changes.) Note: this functionality is not currently available in the official protobuf release, and it is not used for type URLs beginning with type.googleapis.com. As of May 2023, there are no widely used type server implementations and no plans to implement one. Schemes other than `http`, `https` (or the empty scheme) might be used with implementation specific semantics. + Type *string `json:"@type,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ProtobufAny ProtobufAny + +// NewProtobufAny instantiates a new ProtobufAny 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 NewProtobufAny() *ProtobufAny { + this := ProtobufAny{} + return &this +} + +// NewProtobufAnyWithDefaults instantiates a new ProtobufAny 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 NewProtobufAnyWithDefaults() *ProtobufAny { + this := ProtobufAny{} + return &this +} + +// GetType returns the Type field value if set, zero value otherwise. +func (o *ProtobufAny) GetType() string { + if o == nil || IsNil(o.Type) { + var ret string + return ret + } + return *o.Type +} + +// GetTypeOk returns a tuple with the Type field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ProtobufAny) GetTypeOk() (*string, bool) { + if o == nil || IsNil(o.Type) { + return nil, false + } + return o.Type, true +} + +// HasType returns a boolean if a field has been set. +func (o *ProtobufAny) HasType() bool { + if o != nil && !IsNil(o.Type) { + return true + } + + return false +} + +// SetType gets a reference to the given string and assigns it to the Type field. +func (o *ProtobufAny) SetType(v string) { + o.Type = &v +} + +func (o ProtobufAny) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ProtobufAny) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Type) { + toSerialize["@type"] = o.Type + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ProtobufAny) UnmarshalJSON(data []byte) (err error) { + varProtobufAny := _ProtobufAny{} + + err = json.Unmarshal(data, &varProtobufAny) + + if err != nil { + return err + } + + *o = ProtobufAny(varProtobufAny) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "@type") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableProtobufAny struct { + value *ProtobufAny + isSet bool +} + +func (v NullableProtobufAny) Get() *ProtobufAny { + return v.value +} + +func (v *NullableProtobufAny) Set(val *ProtobufAny) { + v.value = val + v.isSet = true +} + +func (v NullableProtobufAny) IsSet() bool { + return v.isSet +} + +func (v *NullableProtobufAny) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableProtobufAny(val *ProtobufAny) *NullableProtobufAny { + return &NullableProtobufAny{value: val, isSet: true} +} + +func (v NullableProtobufAny) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableProtobufAny) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_public_endpoint_setting_ip_access_list.go b/pkg/tidbcloud/v1beta1/dedicated/model_public_endpoint_setting_ip_access_list.go new file mode 100644 index 00000000..1ab84fdd --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_public_endpoint_setting_ip_access_list.go @@ -0,0 +1,203 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the PublicEndpointSettingIpAccessList type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &PublicEndpointSettingIpAccessList{} + +// PublicEndpointSettingIpAccessList struct for PublicEndpointSettingIpAccessList +type PublicEndpointSettingIpAccessList struct { + CidrNotation string `json:"cidrNotation"` + Description *string `json:"description,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _PublicEndpointSettingIpAccessList PublicEndpointSettingIpAccessList + +// NewPublicEndpointSettingIpAccessList instantiates a new PublicEndpointSettingIpAccessList 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 NewPublicEndpointSettingIpAccessList(cidrNotation string) *PublicEndpointSettingIpAccessList { + this := PublicEndpointSettingIpAccessList{} + this.CidrNotation = cidrNotation + return &this +} + +// NewPublicEndpointSettingIpAccessListWithDefaults instantiates a new PublicEndpointSettingIpAccessList 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 NewPublicEndpointSettingIpAccessListWithDefaults() *PublicEndpointSettingIpAccessList { + this := PublicEndpointSettingIpAccessList{} + return &this +} + +// GetCidrNotation returns the CidrNotation field value +func (o *PublicEndpointSettingIpAccessList) GetCidrNotation() string { + if o == nil { + var ret string + return ret + } + + return o.CidrNotation +} + +// GetCidrNotationOk returns a tuple with the CidrNotation field value +// and a boolean to check if the value has been set. +func (o *PublicEndpointSettingIpAccessList) GetCidrNotationOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.CidrNotation, true +} + +// SetCidrNotation sets field value +func (o *PublicEndpointSettingIpAccessList) SetCidrNotation(v string) { + o.CidrNotation = v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *PublicEndpointSettingIpAccessList) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *PublicEndpointSettingIpAccessList) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *PublicEndpointSettingIpAccessList) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *PublicEndpointSettingIpAccessList) SetDescription(v string) { + o.Description = &v +} + +func (o PublicEndpointSettingIpAccessList) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o PublicEndpointSettingIpAccessList) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["cidrNotation"] = o.CidrNotation + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *PublicEndpointSettingIpAccessList) 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{ + "cidrNotation", + } + + 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) + } + } + + varPublicEndpointSettingIpAccessList := _PublicEndpointSettingIpAccessList{} + + err = json.Unmarshal(data, &varPublicEndpointSettingIpAccessList) + + if err != nil { + return err + } + + *o = PublicEndpointSettingIpAccessList(varPublicEndpointSettingIpAccessList) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "cidrNotation") + delete(additionalProperties, "description") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullablePublicEndpointSettingIpAccessList struct { + value *PublicEndpointSettingIpAccessList + isSet bool +} + +func (v NullablePublicEndpointSettingIpAccessList) Get() *PublicEndpointSettingIpAccessList { + return v.value +} + +func (v *NullablePublicEndpointSettingIpAccessList) Set(val *PublicEndpointSettingIpAccessList) { + v.value = val + v.isSet = true +} + +func (v NullablePublicEndpointSettingIpAccessList) IsSet() bool { + return v.isSet +} + +func (v *NullablePublicEndpointSettingIpAccessList) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullablePublicEndpointSettingIpAccessList(val *PublicEndpointSettingIpAccessList) *NullablePublicEndpointSettingIpAccessList { + return &NullablePublicEndpointSettingIpAccessList{value: val, isSet: true} +} + +func (v NullablePublicEndpointSettingIpAccessList) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullablePublicEndpointSettingIpAccessList) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_show_node_quota_response_component_quota.go b/pkg/tidbcloud/v1beta1/dedicated/model_show_node_quota_response_component_quota.go new file mode 100644 index 00000000..be84a3c3 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_show_node_quota_response_component_quota.go @@ -0,0 +1,190 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the ShowNodeQuotaResponseComponentQuota type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &ShowNodeQuotaResponseComponentQuota{} + +// ShowNodeQuotaResponseComponentQuota struct for ShowNodeQuotaResponseComponentQuota +type ShowNodeQuotaResponseComponentQuota struct { + ComponentType *Dedicatedv1beta1ComponentType `json:"componentType,omitempty"` + Quota *int32 `json:"quota,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _ShowNodeQuotaResponseComponentQuota ShowNodeQuotaResponseComponentQuota + +// NewShowNodeQuotaResponseComponentQuota instantiates a new ShowNodeQuotaResponseComponentQuota 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 NewShowNodeQuotaResponseComponentQuota() *ShowNodeQuotaResponseComponentQuota { + this := ShowNodeQuotaResponseComponentQuota{} + return &this +} + +// NewShowNodeQuotaResponseComponentQuotaWithDefaults instantiates a new ShowNodeQuotaResponseComponentQuota 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 NewShowNodeQuotaResponseComponentQuotaWithDefaults() *ShowNodeQuotaResponseComponentQuota { + this := ShowNodeQuotaResponseComponentQuota{} + return &this +} + +// GetComponentType returns the ComponentType field value if set, zero value otherwise. +func (o *ShowNodeQuotaResponseComponentQuota) GetComponentType() Dedicatedv1beta1ComponentType { + if o == nil || IsNil(o.ComponentType) { + var ret Dedicatedv1beta1ComponentType + return ret + } + return *o.ComponentType +} + +// GetComponentTypeOk returns a tuple with the ComponentType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ShowNodeQuotaResponseComponentQuota) GetComponentTypeOk() (*Dedicatedv1beta1ComponentType, bool) { + if o == nil || IsNil(o.ComponentType) { + return nil, false + } + return o.ComponentType, true +} + +// HasComponentType returns a boolean if a field has been set. +func (o *ShowNodeQuotaResponseComponentQuota) HasComponentType() bool { + if o != nil && !IsNil(o.ComponentType) { + return true + } + + return false +} + +// SetComponentType gets a reference to the given Dedicatedv1beta1ComponentType and assigns it to the ComponentType field. +func (o *ShowNodeQuotaResponseComponentQuota) SetComponentType(v Dedicatedv1beta1ComponentType) { + o.ComponentType = &v +} + +// GetQuota returns the Quota field value if set, zero value otherwise. +func (o *ShowNodeQuotaResponseComponentQuota) GetQuota() int32 { + if o == nil || IsNil(o.Quota) { + var ret int32 + return ret + } + return *o.Quota +} + +// GetQuotaOk returns a tuple with the Quota field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *ShowNodeQuotaResponseComponentQuota) GetQuotaOk() (*int32, bool) { + if o == nil || IsNil(o.Quota) { + return nil, false + } + return o.Quota, true +} + +// HasQuota returns a boolean if a field has been set. +func (o *ShowNodeQuotaResponseComponentQuota) HasQuota() bool { + if o != nil && !IsNil(o.Quota) { + return true + } + + return false +} + +// SetQuota gets a reference to the given int32 and assigns it to the Quota field. +func (o *ShowNodeQuotaResponseComponentQuota) SetQuota(v int32) { + o.Quota = &v +} + +func (o ShowNodeQuotaResponseComponentQuota) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o ShowNodeQuotaResponseComponentQuota) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ComponentType) { + toSerialize["componentType"] = o.ComponentType + } + if !IsNil(o.Quota) { + toSerialize["quota"] = o.Quota + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *ShowNodeQuotaResponseComponentQuota) UnmarshalJSON(data []byte) (err error) { + varShowNodeQuotaResponseComponentQuota := _ShowNodeQuotaResponseComponentQuota{} + + err = json.Unmarshal(data, &varShowNodeQuotaResponseComponentQuota) + + if err != nil { + return err + } + + *o = ShowNodeQuotaResponseComponentQuota(varShowNodeQuotaResponseComponentQuota) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "componentType") + delete(additionalProperties, "quota") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableShowNodeQuotaResponseComponentQuota struct { + value *ShowNodeQuotaResponseComponentQuota + isSet bool +} + +func (v NullableShowNodeQuotaResponseComponentQuota) Get() *ShowNodeQuotaResponseComponentQuota { + return v.value +} + +func (v *NullableShowNodeQuotaResponseComponentQuota) Set(val *ShowNodeQuotaResponseComponentQuota) { + v.value = val + v.isSet = true +} + +func (v NullableShowNodeQuotaResponseComponentQuota) IsSet() bool { + return v.isSet +} + +func (v *NullableShowNodeQuotaResponseComponentQuota) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableShowNodeQuotaResponseComponentQuota(val *ShowNodeQuotaResponseComponentQuota) *NullableShowNodeQuotaResponseComponentQuota { + return &NullableShowNodeQuotaResponseComponentQuota{value: val, isSet: true} +} + +func (v NullableShowNodeQuotaResponseComponentQuota) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableShowNodeQuotaResponseComponentQuota) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_tidb_cloud_open_apidedicatedv1beta1_cluster.go b/pkg/tidbcloud/v1beta1/dedicated/model_tidb_cloud_open_apidedicatedv1beta1_cluster.go new file mode 100644 index 00000000..e6ee0dda --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_tidb_cloud_open_apidedicatedv1beta1_cluster.go @@ -0,0 +1,812 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" + "time" +) + +// checks if the TidbCloudOpenApidedicatedv1beta1Cluster type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TidbCloudOpenApidedicatedv1beta1Cluster{} + +// TidbCloudOpenApidedicatedv1beta1Cluster Cluster represents a dedicated TiDB cluster. +type TidbCloudOpenApidedicatedv1beta1Cluster struct { + Name *string `json:"name,omitempty"` + // The unique ID of the cluster. + ClusterId *string `json:"clusterId,omitempty"` + // The display name of the cluster. + DisplayName string `json:"displayName" validate:"regexp=^[A-Za-z0-9][-A-Za-z0-9]{2,62}[A-Za-z0-9]$"` + RegionId string `json:"regionId"` + // The labels of the cluster. If there is no \"project_id\" in labels, resource should be in the default project of the creator's organization. + Labels *map[string]string `json:"labels,omitempty"` + TidbNodeSetting V1beta1ClusterTidbNodeSetting `json:"tidbNodeSetting"` + TikvNodeSetting V1beta1ClusterStorageNodeSetting `json:"tikvNodeSetting"` + TiflashNodeSetting *V1beta1ClusterStorageNodeSetting `json:"tiflashNodeSetting,omitempty"` + // The port of the cluster. This port applies to all network endpoints of the cluster. + Port int32 `json:"port"` + RootPassword *string `json:"rootPassword,omitempty" validate:"regexp=^.{8,64}$"` + // The current state of the cluster. + State *Commonv1beta1ClusterState `json:"state,omitempty"` + // The TiDB version of the cluster. + Version *string `json:"version,omitempty"` + // The email address or public api key of the creator of the cluster. + CreatedBy *string `json:"createdBy,omitempty"` + // Timestamp when the cluster was created. + CreateTime *time.Time `json:"createTime,omitempty"` + // Timestamp when the cluster was last updated. + UpdateTime *time.Time `json:"updateTime,omitempty"` + // Pause plan of the cluster. + PausePlan *Dedicatedv1beta1ClusterPausePlan `json:"pausePlan,omitempty"` + RegionDisplayName *string `json:"regionDisplayName,omitempty"` + CloudProvider *V1beta1RegionCloudProvider `json:"cloudProvider,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. + Annotations *map[string]string `json:"annotations,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _TidbCloudOpenApidedicatedv1beta1Cluster TidbCloudOpenApidedicatedv1beta1Cluster + +// NewTidbCloudOpenApidedicatedv1beta1Cluster instantiates a new TidbCloudOpenApidedicatedv1beta1Cluster 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 NewTidbCloudOpenApidedicatedv1beta1Cluster(displayName string, regionId string, tidbNodeSetting V1beta1ClusterTidbNodeSetting, tikvNodeSetting V1beta1ClusterStorageNodeSetting, port int32) *TidbCloudOpenApidedicatedv1beta1Cluster { + this := TidbCloudOpenApidedicatedv1beta1Cluster{} + this.DisplayName = displayName + this.RegionId = regionId + this.TidbNodeSetting = tidbNodeSetting + this.TikvNodeSetting = tikvNodeSetting + this.Port = port + return &this +} + +// NewTidbCloudOpenApidedicatedv1beta1ClusterWithDefaults instantiates a new TidbCloudOpenApidedicatedv1beta1Cluster 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 NewTidbCloudOpenApidedicatedv1beta1ClusterWithDefaults() *TidbCloudOpenApidedicatedv1beta1Cluster { + this := TidbCloudOpenApidedicatedv1beta1Cluster{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) SetName(v string) { + o.Name = &v +} + +// GetClusterId returns the ClusterId field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetClusterId() string { + if o == nil || IsNil(o.ClusterId) { + var ret string + return ret + } + return *o.ClusterId +} + +// GetClusterIdOk returns a tuple with the ClusterId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetClusterIdOk() (*string, bool) { + if o == nil || IsNil(o.ClusterId) { + return nil, false + } + return o.ClusterId, true +} + +// HasClusterId returns a boolean if a field has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) HasClusterId() bool { + if o != nil && !IsNil(o.ClusterId) { + return true + } + + return false +} + +// SetClusterId gets a reference to the given string and assigns it to the ClusterId field. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) SetClusterId(v string) { + o.ClusterId = &v +} + +// GetDisplayName returns the DisplayName field value +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetDisplayName() string { + if o == nil { + var ret string + return ret + } + + return o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.DisplayName, true +} + +// SetDisplayName sets field value +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) SetDisplayName(v string) { + o.DisplayName = v +} + +// GetRegionId returns the RegionId field value +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetRegionId() string { + if o == nil { + var ret string + return ret + } + + return o.RegionId +} + +// GetRegionIdOk returns a tuple with the RegionId field value +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetRegionIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RegionId, true +} + +// SetRegionId sets field value +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) SetRegionId(v string) { + o.RegionId = v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetTidbNodeSetting returns the TidbNodeSetting field value +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetTidbNodeSetting() V1beta1ClusterTidbNodeSetting { + if o == nil { + var ret V1beta1ClusterTidbNodeSetting + return ret + } + + return o.TidbNodeSetting +} + +// GetTidbNodeSettingOk returns a tuple with the TidbNodeSetting field value +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetTidbNodeSettingOk() (*V1beta1ClusterTidbNodeSetting, bool) { + if o == nil { + return nil, false + } + return &o.TidbNodeSetting, true +} + +// SetTidbNodeSetting sets field value +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) SetTidbNodeSetting(v V1beta1ClusterTidbNodeSetting) { + o.TidbNodeSetting = v +} + +// GetTikvNodeSetting returns the TikvNodeSetting field value +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetTikvNodeSetting() V1beta1ClusterStorageNodeSetting { + if o == nil { + var ret V1beta1ClusterStorageNodeSetting + return ret + } + + return o.TikvNodeSetting +} + +// GetTikvNodeSettingOk returns a tuple with the TikvNodeSetting field value +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetTikvNodeSettingOk() (*V1beta1ClusterStorageNodeSetting, bool) { + if o == nil { + return nil, false + } + return &o.TikvNodeSetting, true +} + +// SetTikvNodeSetting sets field value +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) SetTikvNodeSetting(v V1beta1ClusterStorageNodeSetting) { + o.TikvNodeSetting = v +} + +// GetTiflashNodeSetting returns the TiflashNodeSetting field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetTiflashNodeSetting() V1beta1ClusterStorageNodeSetting { + if o == nil || IsNil(o.TiflashNodeSetting) { + var ret V1beta1ClusterStorageNodeSetting + return ret + } + return *o.TiflashNodeSetting +} + +// GetTiflashNodeSettingOk returns a tuple with the TiflashNodeSetting field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetTiflashNodeSettingOk() (*V1beta1ClusterStorageNodeSetting, bool) { + if o == nil || IsNil(o.TiflashNodeSetting) { + return nil, false + } + return o.TiflashNodeSetting, true +} + +// HasTiflashNodeSetting returns a boolean if a field has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) HasTiflashNodeSetting() bool { + if o != nil && !IsNil(o.TiflashNodeSetting) { + return true + } + + return false +} + +// SetTiflashNodeSetting gets a reference to the given V1beta1ClusterStorageNodeSetting and assigns it to the TiflashNodeSetting field. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) SetTiflashNodeSetting(v V1beta1ClusterStorageNodeSetting) { + o.TiflashNodeSetting = &v +} + +// GetPort returns the Port field value +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetPort() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.Port +} + +// GetPortOk returns a tuple with the Port field value +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetPortOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.Port, true +} + +// SetPort sets field value +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) SetPort(v int32) { + o.Port = v +} + +// GetRootPassword returns the RootPassword field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) 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 *TidbCloudOpenApidedicatedv1beta1Cluster) 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 *TidbCloudOpenApidedicatedv1beta1Cluster) 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 *TidbCloudOpenApidedicatedv1beta1Cluster) SetRootPassword(v string) { + o.RootPassword = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetState() Commonv1beta1ClusterState { + if o == nil || IsNil(o.State) { + var ret Commonv1beta1ClusterState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetStateOk() (*Commonv1beta1ClusterState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given Commonv1beta1ClusterState and assigns it to the State field. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) SetState(v Commonv1beta1ClusterState) { + o.State = &v +} + +// GetVersion returns the Version field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetVersion() string { + if o == nil || IsNil(o.Version) { + var ret string + return ret + } + return *o.Version +} + +// GetVersionOk returns a tuple with the Version field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetVersionOk() (*string, bool) { + if o == nil || IsNil(o.Version) { + return nil, false + } + return o.Version, true +} + +// HasVersion returns a boolean if a field has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) HasVersion() bool { + if o != nil && !IsNil(o.Version) { + return true + } + + return false +} + +// SetVersion gets a reference to the given string and assigns it to the Version field. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) SetVersion(v string) { + o.Version = &v +} + +// GetCreatedBy returns the CreatedBy field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetCreatedBy() string { + if o == nil || IsNil(o.CreatedBy) { + var ret string + return ret + } + return *o.CreatedBy +} + +// GetCreatedByOk returns a tuple with the CreatedBy field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetCreatedByOk() (*string, bool) { + if o == nil || IsNil(o.CreatedBy) { + return nil, false + } + return o.CreatedBy, true +} + +// HasCreatedBy returns a boolean if a field has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) HasCreatedBy() bool { + if o != nil && !IsNil(o.CreatedBy) { + return true + } + + return false +} + +// SetCreatedBy gets a reference to the given string and assigns it to the CreatedBy field. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) SetCreatedBy(v string) { + o.CreatedBy = &v +} + +// GetCreateTime returns the CreateTime field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetCreateTime() time.Time { + if o == nil || IsNil(o.CreateTime) { + var ret time.Time + return ret + } + return *o.CreateTime +} + +// GetCreateTimeOk returns a tuple with the CreateTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetCreateTimeOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreateTime) { + return nil, false + } + return o.CreateTime, true +} + +// HasCreateTime returns a boolean if a field has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) HasCreateTime() bool { + if o != nil && !IsNil(o.CreateTime) { + return true + } + + return false +} + +// SetCreateTime gets a reference to the given time.Time and assigns it to the CreateTime field. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) SetCreateTime(v time.Time) { + o.CreateTime = &v +} + +// GetUpdateTime returns the UpdateTime field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetUpdateTime() time.Time { + if o == nil || IsNil(o.UpdateTime) { + var ret time.Time + return ret + } + return *o.UpdateTime +} + +// GetUpdateTimeOk returns a tuple with the UpdateTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetUpdateTimeOk() (*time.Time, bool) { + if o == nil || IsNil(o.UpdateTime) { + return nil, false + } + return o.UpdateTime, true +} + +// HasUpdateTime returns a boolean if a field has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) HasUpdateTime() bool { + if o != nil && !IsNil(o.UpdateTime) { + return true + } + + return false +} + +// SetUpdateTime gets a reference to the given time.Time and assigns it to the UpdateTime field. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) SetUpdateTime(v time.Time) { + o.UpdateTime = &v +} + +// GetPausePlan returns the PausePlan field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetPausePlan() Dedicatedv1beta1ClusterPausePlan { + if o == nil || IsNil(o.PausePlan) { + var ret Dedicatedv1beta1ClusterPausePlan + return ret + } + return *o.PausePlan +} + +// GetPausePlanOk returns a tuple with the PausePlan field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetPausePlanOk() (*Dedicatedv1beta1ClusterPausePlan, bool) { + if o == nil || IsNil(o.PausePlan) { + return nil, false + } + return o.PausePlan, true +} + +// HasPausePlan returns a boolean if a field has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) HasPausePlan() bool { + if o != nil && !IsNil(o.PausePlan) { + return true + } + + return false +} + +// SetPausePlan gets a reference to the given Dedicatedv1beta1ClusterPausePlan and assigns it to the PausePlan field. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) SetPausePlan(v Dedicatedv1beta1ClusterPausePlan) { + o.PausePlan = &v +} + +// GetRegionDisplayName returns the RegionDisplayName field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetRegionDisplayName() string { + if o == nil || IsNil(o.RegionDisplayName) { + var ret string + return ret + } + return *o.RegionDisplayName +} + +// GetRegionDisplayNameOk returns a tuple with the RegionDisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetRegionDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.RegionDisplayName) { + return nil, false + } + return o.RegionDisplayName, true +} + +// HasRegionDisplayName returns a boolean if a field has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) HasRegionDisplayName() bool { + if o != nil && !IsNil(o.RegionDisplayName) { + return true + } + + return false +} + +// SetRegionDisplayName gets a reference to the given string and assigns it to the RegionDisplayName field. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) SetRegionDisplayName(v string) { + o.RegionDisplayName = &v +} + +// GetCloudProvider returns the CloudProvider field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetCloudProvider() V1beta1RegionCloudProvider { + if o == nil || IsNil(o.CloudProvider) { + var ret V1beta1RegionCloudProvider + return ret + } + return *o.CloudProvider +} + +// GetCloudProviderOk returns a tuple with the CloudProvider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetCloudProviderOk() (*V1beta1RegionCloudProvider, bool) { + if o == nil || IsNil(o.CloudProvider) { + return nil, false + } + return o.CloudProvider, true +} + +// HasCloudProvider returns a boolean if a field has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) HasCloudProvider() bool { + if o != nil && !IsNil(o.CloudProvider) { + return true + } + + return false +} + +// SetCloudProvider gets a reference to the given V1beta1RegionCloudProvider and assigns it to the CloudProvider field. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) SetCloudProvider(v V1beta1RegionCloudProvider) { + o.CloudProvider = &v +} + +// GetAnnotations returns the Annotations field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetAnnotations() map[string]string { + if o == nil || IsNil(o.Annotations) { + var ret map[string]string + return ret + } + return *o.Annotations +} + +// GetAnnotationsOk returns a tuple with the Annotations field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) GetAnnotationsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Annotations) { + return nil, false + } + return o.Annotations, true +} + +// HasAnnotations returns a boolean if a field has been set. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) HasAnnotations() bool { + if o != nil && !IsNil(o.Annotations) { + return true + } + + return false +} + +// SetAnnotations gets a reference to the given map[string]string and assigns it to the Annotations field. +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) SetAnnotations(v map[string]string) { + o.Annotations = &v +} + +func (o TidbCloudOpenApidedicatedv1beta1Cluster) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TidbCloudOpenApidedicatedv1beta1Cluster) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.ClusterId) { + toSerialize["clusterId"] = o.ClusterId + } + toSerialize["displayName"] = o.DisplayName + toSerialize["regionId"] = o.RegionId + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["tidbNodeSetting"] = o.TidbNodeSetting + toSerialize["tikvNodeSetting"] = o.TikvNodeSetting + if !IsNil(o.TiflashNodeSetting) { + toSerialize["tiflashNodeSetting"] = o.TiflashNodeSetting + } + toSerialize["port"] = o.Port + if !IsNil(o.RootPassword) { + toSerialize["rootPassword"] = o.RootPassword + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.Version) { + toSerialize["version"] = o.Version + } + if !IsNil(o.CreatedBy) { + toSerialize["createdBy"] = o.CreatedBy + } + if !IsNil(o.CreateTime) { + toSerialize["createTime"] = o.CreateTime + } + if !IsNil(o.UpdateTime) { + toSerialize["updateTime"] = o.UpdateTime + } + if !IsNil(o.PausePlan) { + toSerialize["pausePlan"] = o.PausePlan + } + if !IsNil(o.RegionDisplayName) { + toSerialize["regionDisplayName"] = o.RegionDisplayName + } + if !IsNil(o.CloudProvider) { + toSerialize["cloudProvider"] = o.CloudProvider + } + if !IsNil(o.Annotations) { + toSerialize["annotations"] = o.Annotations + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *TidbCloudOpenApidedicatedv1beta1Cluster) 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{ + "displayName", + "regionId", + "tidbNodeSetting", + "tikvNodeSetting", + "port", + } + + 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) + } + } + + varTidbCloudOpenApidedicatedv1beta1Cluster := _TidbCloudOpenApidedicatedv1beta1Cluster{} + + err = json.Unmarshal(data, &varTidbCloudOpenApidedicatedv1beta1Cluster) + + if err != nil { + return err + } + + *o = TidbCloudOpenApidedicatedv1beta1Cluster(varTidbCloudOpenApidedicatedv1beta1Cluster) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "clusterId") + delete(additionalProperties, "displayName") + delete(additionalProperties, "regionId") + delete(additionalProperties, "labels") + delete(additionalProperties, "tidbNodeSetting") + delete(additionalProperties, "tikvNodeSetting") + delete(additionalProperties, "tiflashNodeSetting") + delete(additionalProperties, "port") + delete(additionalProperties, "rootPassword") + delete(additionalProperties, "state") + delete(additionalProperties, "version") + delete(additionalProperties, "createdBy") + delete(additionalProperties, "createTime") + delete(additionalProperties, "updateTime") + delete(additionalProperties, "pausePlan") + delete(additionalProperties, "regionDisplayName") + delete(additionalProperties, "cloudProvider") + delete(additionalProperties, "annotations") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTidbCloudOpenApidedicatedv1beta1Cluster struct { + value *TidbCloudOpenApidedicatedv1beta1Cluster + isSet bool +} + +func (v NullableTidbCloudOpenApidedicatedv1beta1Cluster) Get() *TidbCloudOpenApidedicatedv1beta1Cluster { + return v.value +} + +func (v *NullableTidbCloudOpenApidedicatedv1beta1Cluster) Set(val *TidbCloudOpenApidedicatedv1beta1Cluster) { + v.value = val + v.isSet = true +} + +func (v NullableTidbCloudOpenApidedicatedv1beta1Cluster) IsSet() bool { + return v.isSet +} + +func (v *NullableTidbCloudOpenApidedicatedv1beta1Cluster) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTidbCloudOpenApidedicatedv1beta1Cluster(val *TidbCloudOpenApidedicatedv1beta1Cluster) *NullableTidbCloudOpenApidedicatedv1beta1Cluster { + return &NullableTidbCloudOpenApidedicatedv1beta1Cluster{value: val, isSet: true} +} + +func (v NullableTidbCloudOpenApidedicatedv1beta1Cluster) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTidbCloudOpenApidedicatedv1beta1Cluster) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_tidb_cloud_open_apidedicatedv1beta1_list_clusters_response.go b/pkg/tidbcloud/v1beta1/dedicated/model_tidb_cloud_open_apidedicatedv1beta1_list_clusters_response.go new file mode 100644 index 00000000..26a284b3 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_tidb_cloud_open_apidedicatedv1beta1_list_clusters_response.go @@ -0,0 +1,229 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the TidbCloudOpenApidedicatedv1beta1ListClustersResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TidbCloudOpenApidedicatedv1beta1ListClustersResponse{} + +// TidbCloudOpenApidedicatedv1beta1ListClustersResponse struct for TidbCloudOpenApidedicatedv1beta1ListClustersResponse +type TidbCloudOpenApidedicatedv1beta1ListClustersResponse struct { + Clusters []TidbCloudOpenApidedicatedv1beta1Cluster `json:"clusters,omitempty"` + // The total number of clusters that matched the query. + TotalSize *int32 `json:"totalSize,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. + NextPageToken *string `json:"nextPageToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _TidbCloudOpenApidedicatedv1beta1ListClustersResponse TidbCloudOpenApidedicatedv1beta1ListClustersResponse + +// NewTidbCloudOpenApidedicatedv1beta1ListClustersResponse instantiates a new TidbCloudOpenApidedicatedv1beta1ListClustersResponse 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 NewTidbCloudOpenApidedicatedv1beta1ListClustersResponse() *TidbCloudOpenApidedicatedv1beta1ListClustersResponse { + this := TidbCloudOpenApidedicatedv1beta1ListClustersResponse{} + return &this +} + +// NewTidbCloudOpenApidedicatedv1beta1ListClustersResponseWithDefaults instantiates a new TidbCloudOpenApidedicatedv1beta1ListClustersResponse 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 NewTidbCloudOpenApidedicatedv1beta1ListClustersResponseWithDefaults() *TidbCloudOpenApidedicatedv1beta1ListClustersResponse { + this := TidbCloudOpenApidedicatedv1beta1ListClustersResponse{} + return &this +} + +// GetClusters returns the Clusters field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1ListClustersResponse) GetClusters() []TidbCloudOpenApidedicatedv1beta1Cluster { + if o == nil || IsNil(o.Clusters) { + var ret []TidbCloudOpenApidedicatedv1beta1Cluster + 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 *TidbCloudOpenApidedicatedv1beta1ListClustersResponse) GetClustersOk() ([]TidbCloudOpenApidedicatedv1beta1Cluster, 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 *TidbCloudOpenApidedicatedv1beta1ListClustersResponse) HasClusters() bool { + if o != nil && !IsNil(o.Clusters) { + return true + } + + return false +} + +// SetClusters gets a reference to the given []TidbCloudOpenApidedicatedv1beta1Cluster and assigns it to the Clusters field. +func (o *TidbCloudOpenApidedicatedv1beta1ListClustersResponse) SetClusters(v []TidbCloudOpenApidedicatedv1beta1Cluster) { + o.Clusters = v +} + +// GetTotalSize returns the TotalSize field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1ListClustersResponse) GetTotalSize() int32 { + if o == nil || IsNil(o.TotalSize) { + var ret int32 + return ret + } + return *o.TotalSize +} + +// GetTotalSizeOk returns a tuple with the TotalSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1ListClustersResponse) GetTotalSizeOk() (*int32, bool) { + if o == nil || IsNil(o.TotalSize) { + return nil, false + } + return o.TotalSize, true +} + +// HasTotalSize returns a boolean if a field has been set. +func (o *TidbCloudOpenApidedicatedv1beta1ListClustersResponse) HasTotalSize() bool { + if o != nil && !IsNil(o.TotalSize) { + return true + } + + return false +} + +// SetTotalSize gets a reference to the given int32 and assigns it to the TotalSize field. +func (o *TidbCloudOpenApidedicatedv1beta1ListClustersResponse) SetTotalSize(v int32) { + o.TotalSize = &v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1ListClustersResponse) GetNextPageToken() string { + if o == nil || IsNil(o.NextPageToken) { + var ret string + return ret + } + return *o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1ListClustersResponse) GetNextPageTokenOk() (*string, bool) { + if o == nil || IsNil(o.NextPageToken) { + return nil, false + } + return o.NextPageToken, true +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *TidbCloudOpenApidedicatedv1beta1ListClustersResponse) HasNextPageToken() bool { + if o != nil && !IsNil(o.NextPageToken) { + return true + } + + return false +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *TidbCloudOpenApidedicatedv1beta1ListClustersResponse) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o TidbCloudOpenApidedicatedv1beta1ListClustersResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TidbCloudOpenApidedicatedv1beta1ListClustersResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Clusters) { + toSerialize["clusters"] = o.Clusters + } + if !IsNil(o.TotalSize) { + toSerialize["totalSize"] = o.TotalSize + } + if !IsNil(o.NextPageToken) { + toSerialize["nextPageToken"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *TidbCloudOpenApidedicatedv1beta1ListClustersResponse) UnmarshalJSON(data []byte) (err error) { + varTidbCloudOpenApidedicatedv1beta1ListClustersResponse := _TidbCloudOpenApidedicatedv1beta1ListClustersResponse{} + + err = json.Unmarshal(data, &varTidbCloudOpenApidedicatedv1beta1ListClustersResponse) + + if err != nil { + return err + } + + *o = TidbCloudOpenApidedicatedv1beta1ListClustersResponse(varTidbCloudOpenApidedicatedv1beta1ListClustersResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "clusters") + delete(additionalProperties, "totalSize") + delete(additionalProperties, "nextPageToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTidbCloudOpenApidedicatedv1beta1ListClustersResponse struct { + value *TidbCloudOpenApidedicatedv1beta1ListClustersResponse + isSet bool +} + +func (v NullableTidbCloudOpenApidedicatedv1beta1ListClustersResponse) Get() *TidbCloudOpenApidedicatedv1beta1ListClustersResponse { + return v.value +} + +func (v *NullableTidbCloudOpenApidedicatedv1beta1ListClustersResponse) Set(val *TidbCloudOpenApidedicatedv1beta1ListClustersResponse) { + v.value = val + v.isSet = true +} + +func (v NullableTidbCloudOpenApidedicatedv1beta1ListClustersResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableTidbCloudOpenApidedicatedv1beta1ListClustersResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTidbCloudOpenApidedicatedv1beta1ListClustersResponse(val *TidbCloudOpenApidedicatedv1beta1ListClustersResponse) *NullableTidbCloudOpenApidedicatedv1beta1ListClustersResponse { + return &NullableTidbCloudOpenApidedicatedv1beta1ListClustersResponse{value: val, isSet: true} +} + +func (v NullableTidbCloudOpenApidedicatedv1beta1ListClustersResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTidbCloudOpenApidedicatedv1beta1ListClustersResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_tidb_cloud_open_apidedicatedv1beta1_list_regions_response.go b/pkg/tidbcloud/v1beta1/dedicated/model_tidb_cloud_open_apidedicatedv1beta1_list_regions_response.go new file mode 100644 index 00000000..45fc476c --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_tidb_cloud_open_apidedicatedv1beta1_list_regions_response.go @@ -0,0 +1,229 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the TidbCloudOpenApidedicatedv1beta1ListRegionsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TidbCloudOpenApidedicatedv1beta1ListRegionsResponse{} + +// TidbCloudOpenApidedicatedv1beta1ListRegionsResponse struct for TidbCloudOpenApidedicatedv1beta1ListRegionsResponse +type TidbCloudOpenApidedicatedv1beta1ListRegionsResponse struct { + Regions []Commonv1beta1Region `json:"regions,omitempty"` + // The total number of regions that matched the query. + TotalSize *int32 `json:"totalSize,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. + NextPageToken *string `json:"nextPageToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _TidbCloudOpenApidedicatedv1beta1ListRegionsResponse TidbCloudOpenApidedicatedv1beta1ListRegionsResponse + +// NewTidbCloudOpenApidedicatedv1beta1ListRegionsResponse instantiates a new TidbCloudOpenApidedicatedv1beta1ListRegionsResponse 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 NewTidbCloudOpenApidedicatedv1beta1ListRegionsResponse() *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse { + this := TidbCloudOpenApidedicatedv1beta1ListRegionsResponse{} + return &this +} + +// NewTidbCloudOpenApidedicatedv1beta1ListRegionsResponseWithDefaults instantiates a new TidbCloudOpenApidedicatedv1beta1ListRegionsResponse 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 NewTidbCloudOpenApidedicatedv1beta1ListRegionsResponseWithDefaults() *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse { + this := TidbCloudOpenApidedicatedv1beta1ListRegionsResponse{} + return &this +} + +// GetRegions returns the Regions field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse) GetRegions() []Commonv1beta1Region { + if o == nil || IsNil(o.Regions) { + var ret []Commonv1beta1Region + return ret + } + return o.Regions +} + +// GetRegionsOk returns a tuple with the Regions field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse) GetRegionsOk() ([]Commonv1beta1Region, bool) { + if o == nil || IsNil(o.Regions) { + return nil, false + } + return o.Regions, true +} + +// HasRegions returns a boolean if a field has been set. +func (o *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse) HasRegions() bool { + if o != nil && !IsNil(o.Regions) { + return true + } + + return false +} + +// SetRegions gets a reference to the given []Commonv1beta1Region and assigns it to the Regions field. +func (o *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse) SetRegions(v []Commonv1beta1Region) { + o.Regions = v +} + +// GetTotalSize returns the TotalSize field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse) GetTotalSize() int32 { + if o == nil || IsNil(o.TotalSize) { + var ret int32 + return ret + } + return *o.TotalSize +} + +// GetTotalSizeOk returns a tuple with the TotalSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse) GetTotalSizeOk() (*int32, bool) { + if o == nil || IsNil(o.TotalSize) { + return nil, false + } + return o.TotalSize, true +} + +// HasTotalSize returns a boolean if a field has been set. +func (o *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse) HasTotalSize() bool { + if o != nil && !IsNil(o.TotalSize) { + return true + } + + return false +} + +// SetTotalSize gets a reference to the given int32 and assigns it to the TotalSize field. +func (o *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse) SetTotalSize(v int32) { + o.TotalSize = &v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse) GetNextPageToken() string { + if o == nil || IsNil(o.NextPageToken) { + var ret string + return ret + } + return *o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse) GetNextPageTokenOk() (*string, bool) { + if o == nil || IsNil(o.NextPageToken) { + return nil, false + } + return o.NextPageToken, true +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse) HasNextPageToken() bool { + if o != nil && !IsNil(o.NextPageToken) { + return true + } + + return false +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o TidbCloudOpenApidedicatedv1beta1ListRegionsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TidbCloudOpenApidedicatedv1beta1ListRegionsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Regions) { + toSerialize["regions"] = o.Regions + } + if !IsNil(o.TotalSize) { + toSerialize["totalSize"] = o.TotalSize + } + if !IsNil(o.NextPageToken) { + toSerialize["nextPageToken"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse) UnmarshalJSON(data []byte) (err error) { + varTidbCloudOpenApidedicatedv1beta1ListRegionsResponse := _TidbCloudOpenApidedicatedv1beta1ListRegionsResponse{} + + err = json.Unmarshal(data, &varTidbCloudOpenApidedicatedv1beta1ListRegionsResponse) + + if err != nil { + return err + } + + *o = TidbCloudOpenApidedicatedv1beta1ListRegionsResponse(varTidbCloudOpenApidedicatedv1beta1ListRegionsResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "regions") + delete(additionalProperties, "totalSize") + delete(additionalProperties, "nextPageToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTidbCloudOpenApidedicatedv1beta1ListRegionsResponse struct { + value *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse + isSet bool +} + +func (v NullableTidbCloudOpenApidedicatedv1beta1ListRegionsResponse) Get() *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse { + return v.value +} + +func (v *NullableTidbCloudOpenApidedicatedv1beta1ListRegionsResponse) Set(val *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableTidbCloudOpenApidedicatedv1beta1ListRegionsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableTidbCloudOpenApidedicatedv1beta1ListRegionsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTidbCloudOpenApidedicatedv1beta1ListRegionsResponse(val *TidbCloudOpenApidedicatedv1beta1ListRegionsResponse) *NullableTidbCloudOpenApidedicatedv1beta1ListRegionsResponse { + return &NullableTidbCloudOpenApidedicatedv1beta1ListRegionsResponse{value: val, isSet: true} +} + +func (v NullableTidbCloudOpenApidedicatedv1beta1ListRegionsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTidbCloudOpenApidedicatedv1beta1ListRegionsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_tidb_node_group_service_create_tidb_node_group_request.go b/pkg/tidbcloud/v1beta1/dedicated/model_tidb_node_group_service_create_tidb_node_group_request.go new file mode 100644 index 00000000..a52ce060 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_tidb_node_group_service_create_tidb_node_group_request.go @@ -0,0 +1,502 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the TidbNodeGroupServiceCreateTidbNodeGroupRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TidbNodeGroupServiceCreateTidbNodeGroupRequest{} + +// TidbNodeGroupServiceCreateTidbNodeGroupRequest struct for TidbNodeGroupServiceCreateTidbNodeGroupRequest +type TidbNodeGroupServiceCreateTidbNodeGroupRequest struct { + Name *string `json:"name,omitempty"` + // The unique ID of the TiDB group. + TidbNodeGroupId *string `json:"tidbNodeGroupId,omitempty"` + // The display name of the TiDB group. + DisplayName *string `json:"displayName,omitempty"` + // The number of TiDB nodes in the TiDB group. + NodeCount int32 `json:"nodeCount"` + Endpoints []Dedicatedv1beta1TidbNodeGroupEndpoint `json:"endpoints,omitempty"` + NodeSpecKey *string `json:"nodeSpecKey,omitempty"` + NodeSpecDisplayName *string `json:"nodeSpecDisplayName,omitempty"` + IsDefaultGroup *bool `json:"isDefaultGroup,omitempty"` + State *Dedicatedv1beta1TidbNodeGroupState `json:"state,omitempty"` + NodeChangingProgress *ClusterNodeChangingProgress `json:"nodeChangingProgress,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _TidbNodeGroupServiceCreateTidbNodeGroupRequest TidbNodeGroupServiceCreateTidbNodeGroupRequest + +// NewTidbNodeGroupServiceCreateTidbNodeGroupRequest instantiates a new TidbNodeGroupServiceCreateTidbNodeGroupRequest 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 NewTidbNodeGroupServiceCreateTidbNodeGroupRequest(nodeCount int32) *TidbNodeGroupServiceCreateTidbNodeGroupRequest { + this := TidbNodeGroupServiceCreateTidbNodeGroupRequest{} + this.NodeCount = nodeCount + return &this +} + +// NewTidbNodeGroupServiceCreateTidbNodeGroupRequestWithDefaults instantiates a new TidbNodeGroupServiceCreateTidbNodeGroupRequest 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 NewTidbNodeGroupServiceCreateTidbNodeGroupRequestWithDefaults() *TidbNodeGroupServiceCreateTidbNodeGroupRequest { + this := TidbNodeGroupServiceCreateTidbNodeGroupRequest{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) SetName(v string) { + o.Name = &v +} + +// GetTidbNodeGroupId returns the TidbNodeGroupId field value if set, zero value otherwise. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetTidbNodeGroupId() string { + if o == nil || IsNil(o.TidbNodeGroupId) { + var ret string + return ret + } + return *o.TidbNodeGroupId +} + +// GetTidbNodeGroupIdOk returns a tuple with the TidbNodeGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetTidbNodeGroupIdOk() (*string, bool) { + if o == nil || IsNil(o.TidbNodeGroupId) { + return nil, false + } + return o.TidbNodeGroupId, true +} + +// HasTidbNodeGroupId returns a boolean if a field has been set. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) HasTidbNodeGroupId() bool { + if o != nil && !IsNil(o.TidbNodeGroupId) { + return true + } + + return false +} + +// SetTidbNodeGroupId gets a reference to the given string and assigns it to the TidbNodeGroupId field. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) SetTidbNodeGroupId(v string) { + o.TidbNodeGroupId = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetNodeCount returns the NodeCount field value +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetNodeCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NodeCount +} + +// GetNodeCountOk returns a tuple with the NodeCount field value +// and a boolean to check if the value has been set. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetNodeCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NodeCount, true +} + +// SetNodeCount sets field value +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) SetNodeCount(v int32) { + o.NodeCount = v +} + +// GetEndpoints returns the Endpoints field value if set, zero value otherwise. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetEndpoints() []Dedicatedv1beta1TidbNodeGroupEndpoint { + if o == nil || IsNil(o.Endpoints) { + var ret []Dedicatedv1beta1TidbNodeGroupEndpoint + 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 *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetEndpointsOk() ([]Dedicatedv1beta1TidbNodeGroupEndpoint, 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 *TidbNodeGroupServiceCreateTidbNodeGroupRequest) HasEndpoints() bool { + if o != nil && !IsNil(o.Endpoints) { + return true + } + + return false +} + +// SetEndpoints gets a reference to the given []Dedicatedv1beta1TidbNodeGroupEndpoint and assigns it to the Endpoints field. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) SetEndpoints(v []Dedicatedv1beta1TidbNodeGroupEndpoint) { + o.Endpoints = v +} + +// GetNodeSpecKey returns the NodeSpecKey field value if set, zero value otherwise. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetNodeSpecKey() string { + if o == nil || IsNil(o.NodeSpecKey) { + var ret string + return ret + } + return *o.NodeSpecKey +} + +// GetNodeSpecKeyOk returns a tuple with the NodeSpecKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetNodeSpecKeyOk() (*string, bool) { + if o == nil || IsNil(o.NodeSpecKey) { + return nil, false + } + return o.NodeSpecKey, true +} + +// HasNodeSpecKey returns a boolean if a field has been set. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) HasNodeSpecKey() bool { + if o != nil && !IsNil(o.NodeSpecKey) { + return true + } + + return false +} + +// SetNodeSpecKey gets a reference to the given string and assigns it to the NodeSpecKey field. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) SetNodeSpecKey(v string) { + o.NodeSpecKey = &v +} + +// GetNodeSpecDisplayName returns the NodeSpecDisplayName field value if set, zero value otherwise. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetNodeSpecDisplayName() string { + if o == nil || IsNil(o.NodeSpecDisplayName) { + var ret string + return ret + } + return *o.NodeSpecDisplayName +} + +// GetNodeSpecDisplayNameOk returns a tuple with the NodeSpecDisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetNodeSpecDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.NodeSpecDisplayName) { + return nil, false + } + return o.NodeSpecDisplayName, true +} + +// HasNodeSpecDisplayName returns a boolean if a field has been set. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) HasNodeSpecDisplayName() bool { + if o != nil && !IsNil(o.NodeSpecDisplayName) { + return true + } + + return false +} + +// SetNodeSpecDisplayName gets a reference to the given string and assigns it to the NodeSpecDisplayName field. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) SetNodeSpecDisplayName(v string) { + o.NodeSpecDisplayName = &v +} + +// GetIsDefaultGroup returns the IsDefaultGroup field value if set, zero value otherwise. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetIsDefaultGroup() bool { + if o == nil || IsNil(o.IsDefaultGroup) { + var ret bool + return ret + } + return *o.IsDefaultGroup +} + +// GetIsDefaultGroupOk returns a tuple with the IsDefaultGroup field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetIsDefaultGroupOk() (*bool, bool) { + if o == nil || IsNil(o.IsDefaultGroup) { + return nil, false + } + return o.IsDefaultGroup, true +} + +// HasIsDefaultGroup returns a boolean if a field has been set. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) HasIsDefaultGroup() bool { + if o != nil && !IsNil(o.IsDefaultGroup) { + return true + } + + return false +} + +// SetIsDefaultGroup gets a reference to the given bool and assigns it to the IsDefaultGroup field. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) SetIsDefaultGroup(v bool) { + o.IsDefaultGroup = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetState() Dedicatedv1beta1TidbNodeGroupState { + if o == nil || IsNil(o.State) { + var ret Dedicatedv1beta1TidbNodeGroupState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetStateOk() (*Dedicatedv1beta1TidbNodeGroupState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given Dedicatedv1beta1TidbNodeGroupState and assigns it to the State field. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) SetState(v Dedicatedv1beta1TidbNodeGroupState) { + o.State = &v +} + +// GetNodeChangingProgress returns the NodeChangingProgress field value if set, zero value otherwise. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetNodeChangingProgress() ClusterNodeChangingProgress { + if o == nil || IsNil(o.NodeChangingProgress) { + var ret ClusterNodeChangingProgress + return ret + } + return *o.NodeChangingProgress +} + +// GetNodeChangingProgressOk returns a tuple with the NodeChangingProgress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) GetNodeChangingProgressOk() (*ClusterNodeChangingProgress, bool) { + if o == nil || IsNil(o.NodeChangingProgress) { + return nil, false + } + return o.NodeChangingProgress, true +} + +// HasNodeChangingProgress returns a boolean if a field has been set. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) HasNodeChangingProgress() bool { + if o != nil && !IsNil(o.NodeChangingProgress) { + return true + } + + return false +} + +// SetNodeChangingProgress gets a reference to the given ClusterNodeChangingProgress and assigns it to the NodeChangingProgress field. +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) SetNodeChangingProgress(v ClusterNodeChangingProgress) { + o.NodeChangingProgress = &v +} + +func (o TidbNodeGroupServiceCreateTidbNodeGroupRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TidbNodeGroupServiceCreateTidbNodeGroupRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.TidbNodeGroupId) { + toSerialize["tidbNodeGroupId"] = o.TidbNodeGroupId + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + toSerialize["nodeCount"] = o.NodeCount + if !IsNil(o.Endpoints) { + toSerialize["endpoints"] = o.Endpoints + } + if !IsNil(o.NodeSpecKey) { + toSerialize["nodeSpecKey"] = o.NodeSpecKey + } + if !IsNil(o.NodeSpecDisplayName) { + toSerialize["nodeSpecDisplayName"] = o.NodeSpecDisplayName + } + if !IsNil(o.IsDefaultGroup) { + toSerialize["isDefaultGroup"] = o.IsDefaultGroup + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.NodeChangingProgress) { + toSerialize["nodeChangingProgress"] = o.NodeChangingProgress + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *TidbNodeGroupServiceCreateTidbNodeGroupRequest) 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{ + "nodeCount", + } + + 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) + } + } + + varTidbNodeGroupServiceCreateTidbNodeGroupRequest := _TidbNodeGroupServiceCreateTidbNodeGroupRequest{} + + err = json.Unmarshal(data, &varTidbNodeGroupServiceCreateTidbNodeGroupRequest) + + if err != nil { + return err + } + + *o = TidbNodeGroupServiceCreateTidbNodeGroupRequest(varTidbNodeGroupServiceCreateTidbNodeGroupRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "tidbNodeGroupId") + delete(additionalProperties, "displayName") + delete(additionalProperties, "nodeCount") + delete(additionalProperties, "endpoints") + delete(additionalProperties, "nodeSpecKey") + delete(additionalProperties, "nodeSpecDisplayName") + delete(additionalProperties, "isDefaultGroup") + delete(additionalProperties, "state") + delete(additionalProperties, "nodeChangingProgress") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTidbNodeGroupServiceCreateTidbNodeGroupRequest struct { + value *TidbNodeGroupServiceCreateTidbNodeGroupRequest + isSet bool +} + +func (v NullableTidbNodeGroupServiceCreateTidbNodeGroupRequest) Get() *TidbNodeGroupServiceCreateTidbNodeGroupRequest { + return v.value +} + +func (v *NullableTidbNodeGroupServiceCreateTidbNodeGroupRequest) Set(val *TidbNodeGroupServiceCreateTidbNodeGroupRequest) { + v.value = val + v.isSet = true +} + +func (v NullableTidbNodeGroupServiceCreateTidbNodeGroupRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableTidbNodeGroupServiceCreateTidbNodeGroupRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTidbNodeGroupServiceCreateTidbNodeGroupRequest(val *TidbNodeGroupServiceCreateTidbNodeGroupRequest) *NullableTidbNodeGroupServiceCreateTidbNodeGroupRequest { + return &NullableTidbNodeGroupServiceCreateTidbNodeGroupRequest{value: val, isSet: true} +} + +func (v NullableTidbNodeGroupServiceCreateTidbNodeGroupRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTidbNodeGroupServiceCreateTidbNodeGroupRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_tidb_node_group_service_update_public_endpoint_setting_request.go b/pkg/tidbcloud/v1beta1/dedicated/model_tidb_node_group_service_update_public_endpoint_setting_request.go new file mode 100644 index 00000000..e0f62664 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_tidb_node_group_service_update_public_endpoint_setting_request.go @@ -0,0 +1,238 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the TidbNodeGroupServiceUpdatePublicEndpointSettingRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TidbNodeGroupServiceUpdatePublicEndpointSettingRequest{} + +// TidbNodeGroupServiceUpdatePublicEndpointSettingRequest struct for TidbNodeGroupServiceUpdatePublicEndpointSettingRequest +type TidbNodeGroupServiceUpdatePublicEndpointSettingRequest struct { + Name *string `json:"name,omitempty"` + Enabled NullableBool `json:"enabled,omitempty"` + IpAccessList []PublicEndpointSettingIpAccessList `json:"ipAccessList,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _TidbNodeGroupServiceUpdatePublicEndpointSettingRequest TidbNodeGroupServiceUpdatePublicEndpointSettingRequest + +// NewTidbNodeGroupServiceUpdatePublicEndpointSettingRequest instantiates a new TidbNodeGroupServiceUpdatePublicEndpointSettingRequest 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 NewTidbNodeGroupServiceUpdatePublicEndpointSettingRequest() *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest { + this := TidbNodeGroupServiceUpdatePublicEndpointSettingRequest{} + return &this +} + +// NewTidbNodeGroupServiceUpdatePublicEndpointSettingRequestWithDefaults instantiates a new TidbNodeGroupServiceUpdatePublicEndpointSettingRequest 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 NewTidbNodeGroupServiceUpdatePublicEndpointSettingRequestWithDefaults() *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest { + this := TidbNodeGroupServiceUpdatePublicEndpointSettingRequest{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) SetName(v string) { + o.Name = &v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) GetEnabled() bool { + if o == nil || IsNil(o.Enabled.Get()) { + var ret bool + return ret + } + return *o.Enabled.Get() +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// 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 *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) GetEnabledOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.Enabled.Get(), o.Enabled.IsSet() +} + +// HasEnabled returns a boolean if a field has been set. +func (o *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) HasEnabled() bool { + if o != nil && o.Enabled.IsSet() { + return true + } + + return false +} + +// SetEnabled gets a reference to the given NullableBool and assigns it to the Enabled field. +func (o *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) SetEnabled(v bool) { + o.Enabled.Set(&v) +} + +// SetEnabledNil sets the value for Enabled to be an explicit nil +func (o *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) SetEnabledNil() { + o.Enabled.Set(nil) +} + +// UnsetEnabled ensures that no value is present for Enabled, not even an explicit nil +func (o *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) UnsetEnabled() { + o.Enabled.Unset() +} + +// GetIpAccessList returns the IpAccessList field value if set, zero value otherwise. +func (o *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) GetIpAccessList() []PublicEndpointSettingIpAccessList { + if o == nil || IsNil(o.IpAccessList) { + var ret []PublicEndpointSettingIpAccessList + return ret + } + return o.IpAccessList +} + +// GetIpAccessListOk returns a tuple with the IpAccessList field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) GetIpAccessListOk() ([]PublicEndpointSettingIpAccessList, bool) { + if o == nil || IsNil(o.IpAccessList) { + return nil, false + } + return o.IpAccessList, true +} + +// HasIpAccessList returns a boolean if a field has been set. +func (o *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) HasIpAccessList() bool { + if o != nil && !IsNil(o.IpAccessList) { + return true + } + + return false +} + +// SetIpAccessList gets a reference to the given []PublicEndpointSettingIpAccessList and assigns it to the IpAccessList field. +func (o *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) SetIpAccessList(v []PublicEndpointSettingIpAccessList) { + o.IpAccessList = v +} + +func (o TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if o.Enabled.IsSet() { + toSerialize["enabled"] = o.Enabled.Get() + } + if !IsNil(o.IpAccessList) { + toSerialize["ipAccessList"] = o.IpAccessList + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) UnmarshalJSON(data []byte) (err error) { + varTidbNodeGroupServiceUpdatePublicEndpointSettingRequest := _TidbNodeGroupServiceUpdatePublicEndpointSettingRequest{} + + err = json.Unmarshal(data, &varTidbNodeGroupServiceUpdatePublicEndpointSettingRequest) + + if err != nil { + return err + } + + *o = TidbNodeGroupServiceUpdatePublicEndpointSettingRequest(varTidbNodeGroupServiceUpdatePublicEndpointSettingRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "enabled") + delete(additionalProperties, "ipAccessList") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTidbNodeGroupServiceUpdatePublicEndpointSettingRequest struct { + value *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest + isSet bool +} + +func (v NullableTidbNodeGroupServiceUpdatePublicEndpointSettingRequest) Get() *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest { + return v.value +} + +func (v *NullableTidbNodeGroupServiceUpdatePublicEndpointSettingRequest) Set(val *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) { + v.value = val + v.isSet = true +} + +func (v NullableTidbNodeGroupServiceUpdatePublicEndpointSettingRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableTidbNodeGroupServiceUpdatePublicEndpointSettingRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTidbNodeGroupServiceUpdatePublicEndpointSettingRequest(val *TidbNodeGroupServiceUpdatePublicEndpointSettingRequest) *NullableTidbNodeGroupServiceUpdatePublicEndpointSettingRequest { + return &NullableTidbNodeGroupServiceUpdatePublicEndpointSettingRequest{value: val, isSet: true} +} + +func (v NullableTidbNodeGroupServiceUpdatePublicEndpointSettingRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTidbNodeGroupServiceUpdatePublicEndpointSettingRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_tidb_node_group_service_update_tidb_node_group_request.go b/pkg/tidbcloud/v1beta1/dedicated/model_tidb_node_group_service_update_tidb_node_group_request.go new file mode 100644 index 00000000..b499e141 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_tidb_node_group_service_update_tidb_node_group_request.go @@ -0,0 +1,201 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the TidbNodeGroupServiceUpdateTidbNodeGroupRequest type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &TidbNodeGroupServiceUpdateTidbNodeGroupRequest{} + +// TidbNodeGroupServiceUpdateTidbNodeGroupRequest struct for TidbNodeGroupServiceUpdateTidbNodeGroupRequest +type TidbNodeGroupServiceUpdateTidbNodeGroupRequest struct { + DisplayName *string `json:"displayName,omitempty"` + NodeCount NullableInt32 `json:"nodeCount,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _TidbNodeGroupServiceUpdateTidbNodeGroupRequest TidbNodeGroupServiceUpdateTidbNodeGroupRequest + +// NewTidbNodeGroupServiceUpdateTidbNodeGroupRequest instantiates a new TidbNodeGroupServiceUpdateTidbNodeGroupRequest 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 NewTidbNodeGroupServiceUpdateTidbNodeGroupRequest() *TidbNodeGroupServiceUpdateTidbNodeGroupRequest { + this := TidbNodeGroupServiceUpdateTidbNodeGroupRequest{} + return &this +} + +// NewTidbNodeGroupServiceUpdateTidbNodeGroupRequestWithDefaults instantiates a new TidbNodeGroupServiceUpdateTidbNodeGroupRequest 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 NewTidbNodeGroupServiceUpdateTidbNodeGroupRequestWithDefaults() *TidbNodeGroupServiceUpdateTidbNodeGroupRequest { + this := TidbNodeGroupServiceUpdateTidbNodeGroupRequest{} + return &this +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *TidbNodeGroupServiceUpdateTidbNodeGroupRequest) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *TidbNodeGroupServiceUpdateTidbNodeGroupRequest) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *TidbNodeGroupServiceUpdateTidbNodeGroupRequest) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *TidbNodeGroupServiceUpdateTidbNodeGroupRequest) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetNodeCount returns the NodeCount field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *TidbNodeGroupServiceUpdateTidbNodeGroupRequest) GetNodeCount() int32 { + if o == nil || IsNil(o.NodeCount.Get()) { + var ret int32 + return ret + } + return *o.NodeCount.Get() +} + +// GetNodeCountOk returns a tuple with the NodeCount field value if set, nil otherwise +// 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 *TidbNodeGroupServiceUpdateTidbNodeGroupRequest) GetNodeCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.NodeCount.Get(), o.NodeCount.IsSet() +} + +// HasNodeCount returns a boolean if a field has been set. +func (o *TidbNodeGroupServiceUpdateTidbNodeGroupRequest) HasNodeCount() bool { + if o != nil && o.NodeCount.IsSet() { + return true + } + + return false +} + +// SetNodeCount gets a reference to the given NullableInt32 and assigns it to the NodeCount field. +func (o *TidbNodeGroupServiceUpdateTidbNodeGroupRequest) SetNodeCount(v int32) { + o.NodeCount.Set(&v) +} + +// SetNodeCountNil sets the value for NodeCount to be an explicit nil +func (o *TidbNodeGroupServiceUpdateTidbNodeGroupRequest) SetNodeCountNil() { + o.NodeCount.Set(nil) +} + +// UnsetNodeCount ensures that no value is present for NodeCount, not even an explicit nil +func (o *TidbNodeGroupServiceUpdateTidbNodeGroupRequest) UnsetNodeCount() { + o.NodeCount.Unset() +} + +func (o TidbNodeGroupServiceUpdateTidbNodeGroupRequest) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o TidbNodeGroupServiceUpdateTidbNodeGroupRequest) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + if o.NodeCount.IsSet() { + toSerialize["nodeCount"] = o.NodeCount.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *TidbNodeGroupServiceUpdateTidbNodeGroupRequest) UnmarshalJSON(data []byte) (err error) { + varTidbNodeGroupServiceUpdateTidbNodeGroupRequest := _TidbNodeGroupServiceUpdateTidbNodeGroupRequest{} + + err = json.Unmarshal(data, &varTidbNodeGroupServiceUpdateTidbNodeGroupRequest) + + if err != nil { + return err + } + + *o = TidbNodeGroupServiceUpdateTidbNodeGroupRequest(varTidbNodeGroupServiceUpdateTidbNodeGroupRequest) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "displayName") + delete(additionalProperties, "nodeCount") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableTidbNodeGroupServiceUpdateTidbNodeGroupRequest struct { + value *TidbNodeGroupServiceUpdateTidbNodeGroupRequest + isSet bool +} + +func (v NullableTidbNodeGroupServiceUpdateTidbNodeGroupRequest) Get() *TidbNodeGroupServiceUpdateTidbNodeGroupRequest { + return v.value +} + +func (v *NullableTidbNodeGroupServiceUpdateTidbNodeGroupRequest) Set(val *TidbNodeGroupServiceUpdateTidbNodeGroupRequest) { + v.value = val + v.isSet = true +} + +func (v NullableTidbNodeGroupServiceUpdateTidbNodeGroupRequest) IsSet() bool { + return v.isSet +} + +func (v *NullableTidbNodeGroupServiceUpdateTidbNodeGroupRequest) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTidbNodeGroupServiceUpdateTidbNodeGroupRequest(val *TidbNodeGroupServiceUpdateTidbNodeGroupRequest) *NullableTidbNodeGroupServiceUpdateTidbNodeGroupRequest { + return &NullableTidbNodeGroupServiceUpdateTidbNodeGroupRequest{value: val, isSet: true} +} + +func (v NullableTidbNodeGroupServiceUpdateTidbNodeGroupRequest) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTidbNodeGroupServiceUpdateTidbNodeGroupRequest) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_update_cluster_request_tidb_node_setting_tidb_node_group.go b/pkg/tidbcloud/v1beta1/dedicated/model_update_cluster_request_tidb_node_setting_tidb_node_group.go new file mode 100644 index 00000000..e575791a --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_update_cluster_request_tidb_node_setting_tidb_node_group.go @@ -0,0 +1,201 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the UpdateClusterRequestTidbNodeSettingTidbNodeGroup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &UpdateClusterRequestTidbNodeSettingTidbNodeGroup{} + +// UpdateClusterRequestTidbNodeSettingTidbNodeGroup struct for UpdateClusterRequestTidbNodeSettingTidbNodeGroup +type UpdateClusterRequestTidbNodeSettingTidbNodeGroup struct { + TidbNodeGroupId *string `json:"tidbNodeGroupId,omitempty"` + NodeCount NullableInt32 `json:"nodeCount,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _UpdateClusterRequestTidbNodeSettingTidbNodeGroup UpdateClusterRequestTidbNodeSettingTidbNodeGroup + +// NewUpdateClusterRequestTidbNodeSettingTidbNodeGroup instantiates a new UpdateClusterRequestTidbNodeSettingTidbNodeGroup 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 NewUpdateClusterRequestTidbNodeSettingTidbNodeGroup() *UpdateClusterRequestTidbNodeSettingTidbNodeGroup { + this := UpdateClusterRequestTidbNodeSettingTidbNodeGroup{} + return &this +} + +// NewUpdateClusterRequestTidbNodeSettingTidbNodeGroupWithDefaults instantiates a new UpdateClusterRequestTidbNodeSettingTidbNodeGroup 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 NewUpdateClusterRequestTidbNodeSettingTidbNodeGroupWithDefaults() *UpdateClusterRequestTidbNodeSettingTidbNodeGroup { + this := UpdateClusterRequestTidbNodeSettingTidbNodeGroup{} + return &this +} + +// GetTidbNodeGroupId returns the TidbNodeGroupId field value if set, zero value otherwise. +func (o *UpdateClusterRequestTidbNodeSettingTidbNodeGroup) GetTidbNodeGroupId() string { + if o == nil || IsNil(o.TidbNodeGroupId) { + var ret string + return ret + } + return *o.TidbNodeGroupId +} + +// GetTidbNodeGroupIdOk returns a tuple with the TidbNodeGroupId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *UpdateClusterRequestTidbNodeSettingTidbNodeGroup) GetTidbNodeGroupIdOk() (*string, bool) { + if o == nil || IsNil(o.TidbNodeGroupId) { + return nil, false + } + return o.TidbNodeGroupId, true +} + +// HasTidbNodeGroupId returns a boolean if a field has been set. +func (o *UpdateClusterRequestTidbNodeSettingTidbNodeGroup) HasTidbNodeGroupId() bool { + if o != nil && !IsNil(o.TidbNodeGroupId) { + return true + } + + return false +} + +// SetTidbNodeGroupId gets a reference to the given string and assigns it to the TidbNodeGroupId field. +func (o *UpdateClusterRequestTidbNodeSettingTidbNodeGroup) SetTidbNodeGroupId(v string) { + o.TidbNodeGroupId = &v +} + +// GetNodeCount returns the NodeCount field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *UpdateClusterRequestTidbNodeSettingTidbNodeGroup) GetNodeCount() int32 { + if o == nil || IsNil(o.NodeCount.Get()) { + var ret int32 + return ret + } + return *o.NodeCount.Get() +} + +// GetNodeCountOk returns a tuple with the NodeCount field value if set, nil otherwise +// 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 *UpdateClusterRequestTidbNodeSettingTidbNodeGroup) GetNodeCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.NodeCount.Get(), o.NodeCount.IsSet() +} + +// HasNodeCount returns a boolean if a field has been set. +func (o *UpdateClusterRequestTidbNodeSettingTidbNodeGroup) HasNodeCount() bool { + if o != nil && o.NodeCount.IsSet() { + return true + } + + return false +} + +// SetNodeCount gets a reference to the given NullableInt32 and assigns it to the NodeCount field. +func (o *UpdateClusterRequestTidbNodeSettingTidbNodeGroup) SetNodeCount(v int32) { + o.NodeCount.Set(&v) +} + +// SetNodeCountNil sets the value for NodeCount to be an explicit nil +func (o *UpdateClusterRequestTidbNodeSettingTidbNodeGroup) SetNodeCountNil() { + o.NodeCount.Set(nil) +} + +// UnsetNodeCount ensures that no value is present for NodeCount, not even an explicit nil +func (o *UpdateClusterRequestTidbNodeSettingTidbNodeGroup) UnsetNodeCount() { + o.NodeCount.Unset() +} + +func (o UpdateClusterRequestTidbNodeSettingTidbNodeGroup) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o UpdateClusterRequestTidbNodeSettingTidbNodeGroup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.TidbNodeGroupId) { + toSerialize["tidbNodeGroupId"] = o.TidbNodeGroupId + } + if o.NodeCount.IsSet() { + toSerialize["nodeCount"] = o.NodeCount.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *UpdateClusterRequestTidbNodeSettingTidbNodeGroup) UnmarshalJSON(data []byte) (err error) { + varUpdateClusterRequestTidbNodeSettingTidbNodeGroup := _UpdateClusterRequestTidbNodeSettingTidbNodeGroup{} + + err = json.Unmarshal(data, &varUpdateClusterRequestTidbNodeSettingTidbNodeGroup) + + if err != nil { + return err + } + + *o = UpdateClusterRequestTidbNodeSettingTidbNodeGroup(varUpdateClusterRequestTidbNodeSettingTidbNodeGroup) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "tidbNodeGroupId") + delete(additionalProperties, "nodeCount") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableUpdateClusterRequestTidbNodeSettingTidbNodeGroup struct { + value *UpdateClusterRequestTidbNodeSettingTidbNodeGroup + isSet bool +} + +func (v NullableUpdateClusterRequestTidbNodeSettingTidbNodeGroup) Get() *UpdateClusterRequestTidbNodeSettingTidbNodeGroup { + return v.value +} + +func (v *NullableUpdateClusterRequestTidbNodeSettingTidbNodeGroup) Set(val *UpdateClusterRequestTidbNodeSettingTidbNodeGroup) { + v.value = val + v.isSet = true +} + +func (v NullableUpdateClusterRequestTidbNodeSettingTidbNodeGroup) IsSet() bool { + return v.isSet +} + +func (v *NullableUpdateClusterRequestTidbNodeSettingTidbNodeGroup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableUpdateClusterRequestTidbNodeSettingTidbNodeGroup(val *UpdateClusterRequestTidbNodeSettingTidbNodeGroup) *NullableUpdateClusterRequestTidbNodeSettingTidbNodeGroup { + return &NullableUpdateClusterRequestTidbNodeSettingTidbNodeGroup{value: val, isSet: true} +} + +func (v NullableUpdateClusterRequestTidbNodeSettingTidbNodeGroup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableUpdateClusterRequestTidbNodeSettingTidbNodeGroup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_audit_log_filter_rule.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_audit_log_filter_rule.go new file mode 100644 index 00000000..439b92be --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_audit_log_filter_rule.go @@ -0,0 +1,388 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the V1beta1AuditLogFilterRule type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1AuditLogFilterRule{} + +// V1beta1AuditLogFilterRule struct for V1beta1AuditLogFilterRule +type V1beta1AuditLogFilterRule struct { + Name *string `json:"name,omitempty"` + AuditLogFilterRuleId *string `json:"auditLogFilterRuleId,omitempty"` + ClusterId string `json:"clusterId"` + UserExpr *string `json:"userExpr,omitempty"` + DbExpr *string `json:"dbExpr,omitempty"` + TableExpr *string `json:"tableExpr,omitempty"` + AccessTypeList []string `json:"accessTypeList,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1AuditLogFilterRule V1beta1AuditLogFilterRule + +// NewV1beta1AuditLogFilterRule instantiates a new V1beta1AuditLogFilterRule 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 NewV1beta1AuditLogFilterRule(clusterId string) *V1beta1AuditLogFilterRule { + this := V1beta1AuditLogFilterRule{} + this.ClusterId = clusterId + return &this +} + +// NewV1beta1AuditLogFilterRuleWithDefaults instantiates a new V1beta1AuditLogFilterRule 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 NewV1beta1AuditLogFilterRuleWithDefaults() *V1beta1AuditLogFilterRule { + this := V1beta1AuditLogFilterRule{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *V1beta1AuditLogFilterRule) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1AuditLogFilterRule) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *V1beta1AuditLogFilterRule) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *V1beta1AuditLogFilterRule) SetName(v string) { + o.Name = &v +} + +// GetAuditLogFilterRuleId returns the AuditLogFilterRuleId field value if set, zero value otherwise. +func (o *V1beta1AuditLogFilterRule) GetAuditLogFilterRuleId() string { + if o == nil || IsNil(o.AuditLogFilterRuleId) { + var ret string + return ret + } + return *o.AuditLogFilterRuleId +} + +// GetAuditLogFilterRuleIdOk returns a tuple with the AuditLogFilterRuleId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1AuditLogFilterRule) GetAuditLogFilterRuleIdOk() (*string, bool) { + if o == nil || IsNil(o.AuditLogFilterRuleId) { + return nil, false + } + return o.AuditLogFilterRuleId, true +} + +// HasAuditLogFilterRuleId returns a boolean if a field has been set. +func (o *V1beta1AuditLogFilterRule) HasAuditLogFilterRuleId() bool { + if o != nil && !IsNil(o.AuditLogFilterRuleId) { + return true + } + + return false +} + +// SetAuditLogFilterRuleId gets a reference to the given string and assigns it to the AuditLogFilterRuleId field. +func (o *V1beta1AuditLogFilterRule) SetAuditLogFilterRuleId(v string) { + o.AuditLogFilterRuleId = &v +} + +// GetClusterId returns the ClusterId field value +func (o *V1beta1AuditLogFilterRule) GetClusterId() string { + if o == nil { + var ret string + return ret + } + + return o.ClusterId +} + +// GetClusterIdOk returns a tuple with the ClusterId field value +// and a boolean to check if the value has been set. +func (o *V1beta1AuditLogFilterRule) GetClusterIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClusterId, true +} + +// SetClusterId sets field value +func (o *V1beta1AuditLogFilterRule) SetClusterId(v string) { + o.ClusterId = v +} + +// GetUserExpr returns the UserExpr field value if set, zero value otherwise. +func (o *V1beta1AuditLogFilterRule) GetUserExpr() string { + if o == nil || IsNil(o.UserExpr) { + var ret string + return ret + } + return *o.UserExpr +} + +// GetUserExprOk returns a tuple with the UserExpr field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1AuditLogFilterRule) GetUserExprOk() (*string, bool) { + if o == nil || IsNil(o.UserExpr) { + return nil, false + } + return o.UserExpr, true +} + +// HasUserExpr returns a boolean if a field has been set. +func (o *V1beta1AuditLogFilterRule) HasUserExpr() bool { + if o != nil && !IsNil(o.UserExpr) { + return true + } + + return false +} + +// SetUserExpr gets a reference to the given string and assigns it to the UserExpr field. +func (o *V1beta1AuditLogFilterRule) SetUserExpr(v string) { + o.UserExpr = &v +} + +// GetDbExpr returns the DbExpr field value if set, zero value otherwise. +func (o *V1beta1AuditLogFilterRule) GetDbExpr() string { + if o == nil || IsNil(o.DbExpr) { + var ret string + return ret + } + return *o.DbExpr +} + +// GetDbExprOk returns a tuple with the DbExpr field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1AuditLogFilterRule) GetDbExprOk() (*string, bool) { + if o == nil || IsNil(o.DbExpr) { + return nil, false + } + return o.DbExpr, true +} + +// HasDbExpr returns a boolean if a field has been set. +func (o *V1beta1AuditLogFilterRule) HasDbExpr() bool { + if o != nil && !IsNil(o.DbExpr) { + return true + } + + return false +} + +// SetDbExpr gets a reference to the given string and assigns it to the DbExpr field. +func (o *V1beta1AuditLogFilterRule) SetDbExpr(v string) { + o.DbExpr = &v +} + +// GetTableExpr returns the TableExpr field value if set, zero value otherwise. +func (o *V1beta1AuditLogFilterRule) GetTableExpr() string { + if o == nil || IsNil(o.TableExpr) { + var ret string + return ret + } + return *o.TableExpr +} + +// GetTableExprOk returns a tuple with the TableExpr field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1AuditLogFilterRule) GetTableExprOk() (*string, bool) { + if o == nil || IsNil(o.TableExpr) { + return nil, false + } + return o.TableExpr, true +} + +// HasTableExpr returns a boolean if a field has been set. +func (o *V1beta1AuditLogFilterRule) HasTableExpr() bool { + if o != nil && !IsNil(o.TableExpr) { + return true + } + + return false +} + +// SetTableExpr gets a reference to the given string and assigns it to the TableExpr field. +func (o *V1beta1AuditLogFilterRule) SetTableExpr(v string) { + o.TableExpr = &v +} + +// GetAccessTypeList returns the AccessTypeList field value if set, zero value otherwise. +func (o *V1beta1AuditLogFilterRule) GetAccessTypeList() []string { + if o == nil || IsNil(o.AccessTypeList) { + var ret []string + return ret + } + return o.AccessTypeList +} + +// GetAccessTypeListOk returns a tuple with the AccessTypeList field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1AuditLogFilterRule) GetAccessTypeListOk() ([]string, bool) { + if o == nil || IsNil(o.AccessTypeList) { + return nil, false + } + return o.AccessTypeList, true +} + +// HasAccessTypeList returns a boolean if a field has been set. +func (o *V1beta1AuditLogFilterRule) HasAccessTypeList() bool { + if o != nil && !IsNil(o.AccessTypeList) { + return true + } + + return false +} + +// SetAccessTypeList gets a reference to the given []string and assigns it to the AccessTypeList field. +func (o *V1beta1AuditLogFilterRule) SetAccessTypeList(v []string) { + o.AccessTypeList = v +} + +func (o V1beta1AuditLogFilterRule) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1AuditLogFilterRule) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.AuditLogFilterRuleId) { + toSerialize["auditLogFilterRuleId"] = o.AuditLogFilterRuleId + } + toSerialize["clusterId"] = o.ClusterId + if !IsNil(o.UserExpr) { + toSerialize["userExpr"] = o.UserExpr + } + if !IsNil(o.DbExpr) { + toSerialize["dbExpr"] = o.DbExpr + } + if !IsNil(o.TableExpr) { + toSerialize["tableExpr"] = o.TableExpr + } + if !IsNil(o.AccessTypeList) { + toSerialize["accessTypeList"] = o.AccessTypeList + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1AuditLogFilterRule) 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{ + "clusterId", + } + + 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) + } + } + + varV1beta1AuditLogFilterRule := _V1beta1AuditLogFilterRule{} + + err = json.Unmarshal(data, &varV1beta1AuditLogFilterRule) + + if err != nil { + return err + } + + *o = V1beta1AuditLogFilterRule(varV1beta1AuditLogFilterRule) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "auditLogFilterRuleId") + delete(additionalProperties, "clusterId") + delete(additionalProperties, "userExpr") + delete(additionalProperties, "dbExpr") + delete(additionalProperties, "tableExpr") + delete(additionalProperties, "accessTypeList") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1AuditLogFilterRule struct { + value *V1beta1AuditLogFilterRule + isSet bool +} + +func (v NullableV1beta1AuditLogFilterRule) Get() *V1beta1AuditLogFilterRule { + return v.value +} + +func (v *NullableV1beta1AuditLogFilterRule) Set(val *V1beta1AuditLogFilterRule) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1AuditLogFilterRule) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1AuditLogFilterRule) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1AuditLogFilterRule(val *V1beta1AuditLogFilterRule) *NullableV1beta1AuditLogFilterRule { + return &NullableV1beta1AuditLogFilterRule{value: val, isSet: true} +} + +func (v NullableV1beta1AuditLogFilterRule) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1AuditLogFilterRule) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_cluster_storage_node_setting.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_cluster_storage_node_setting.go new file mode 100644 index 00000000..3b887022 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_cluster_storage_node_setting.go @@ -0,0 +1,327 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the V1beta1ClusterStorageNodeSetting type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1ClusterStorageNodeSetting{} + +// V1beta1ClusterStorageNodeSetting struct for V1beta1ClusterStorageNodeSetting +type V1beta1ClusterStorageNodeSetting struct { + NodeCount int32 `json:"nodeCount"` + NodeSpecKey string `json:"nodeSpecKey"` + StorageSizeGi int32 `json:"storageSizeGi"` + StorageType ClusterStorageNodeSettingStorageType `json:"storageType"` + NodeSpecDisplayName *string `json:"nodeSpecDisplayName,omitempty"` + NodeChangingProgress *ClusterNodeChangingProgress `json:"nodeChangingProgress,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1ClusterStorageNodeSetting V1beta1ClusterStorageNodeSetting + +// NewV1beta1ClusterStorageNodeSetting instantiates a new V1beta1ClusterStorageNodeSetting 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 NewV1beta1ClusterStorageNodeSetting(nodeCount int32, nodeSpecKey string, storageSizeGi int32, storageType ClusterStorageNodeSettingStorageType) *V1beta1ClusterStorageNodeSetting { + this := V1beta1ClusterStorageNodeSetting{} + this.NodeCount = nodeCount + this.NodeSpecKey = nodeSpecKey + this.StorageSizeGi = storageSizeGi + this.StorageType = storageType + return &this +} + +// NewV1beta1ClusterStorageNodeSettingWithDefaults instantiates a new V1beta1ClusterStorageNodeSetting 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 NewV1beta1ClusterStorageNodeSettingWithDefaults() *V1beta1ClusterStorageNodeSetting { + this := V1beta1ClusterStorageNodeSetting{} + return &this +} + +// GetNodeCount returns the NodeCount field value +func (o *V1beta1ClusterStorageNodeSetting) GetNodeCount() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.NodeCount +} + +// GetNodeCountOk returns a tuple with the NodeCount field value +// and a boolean to check if the value has been set. +func (o *V1beta1ClusterStorageNodeSetting) GetNodeCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.NodeCount, true +} + +// SetNodeCount sets field value +func (o *V1beta1ClusterStorageNodeSetting) SetNodeCount(v int32) { + o.NodeCount = v +} + +// GetNodeSpecKey returns the NodeSpecKey field value +func (o *V1beta1ClusterStorageNodeSetting) GetNodeSpecKey() string { + if o == nil { + var ret string + return ret + } + + return o.NodeSpecKey +} + +// GetNodeSpecKeyOk returns a tuple with the NodeSpecKey field value +// and a boolean to check if the value has been set. +func (o *V1beta1ClusterStorageNodeSetting) GetNodeSpecKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NodeSpecKey, true +} + +// SetNodeSpecKey sets field value +func (o *V1beta1ClusterStorageNodeSetting) SetNodeSpecKey(v string) { + o.NodeSpecKey = v +} + +// GetStorageSizeGi returns the StorageSizeGi field value +func (o *V1beta1ClusterStorageNodeSetting) GetStorageSizeGi() int32 { + if o == nil { + var ret int32 + return ret + } + + return o.StorageSizeGi +} + +// GetStorageSizeGiOk returns a tuple with the StorageSizeGi field value +// and a boolean to check if the value has been set. +func (o *V1beta1ClusterStorageNodeSetting) GetStorageSizeGiOk() (*int32, bool) { + if o == nil { + return nil, false + } + return &o.StorageSizeGi, true +} + +// SetStorageSizeGi sets field value +func (o *V1beta1ClusterStorageNodeSetting) SetStorageSizeGi(v int32) { + o.StorageSizeGi = v +} + +// GetStorageType returns the StorageType field value +func (o *V1beta1ClusterStorageNodeSetting) GetStorageType() ClusterStorageNodeSettingStorageType { + if o == nil { + var ret ClusterStorageNodeSettingStorageType + return ret + } + + return o.StorageType +} + +// GetStorageTypeOk returns a tuple with the StorageType field value +// and a boolean to check if the value has been set. +func (o *V1beta1ClusterStorageNodeSetting) GetStorageTypeOk() (*ClusterStorageNodeSettingStorageType, bool) { + if o == nil { + return nil, false + } + return &o.StorageType, true +} + +// SetStorageType sets field value +func (o *V1beta1ClusterStorageNodeSetting) SetStorageType(v ClusterStorageNodeSettingStorageType) { + o.StorageType = v +} + +// GetNodeSpecDisplayName returns the NodeSpecDisplayName field value if set, zero value otherwise. +func (o *V1beta1ClusterStorageNodeSetting) GetNodeSpecDisplayName() string { + if o == nil || IsNil(o.NodeSpecDisplayName) { + var ret string + return ret + } + return *o.NodeSpecDisplayName +} + +// GetNodeSpecDisplayNameOk returns a tuple with the NodeSpecDisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ClusterStorageNodeSetting) GetNodeSpecDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.NodeSpecDisplayName) { + return nil, false + } + return o.NodeSpecDisplayName, true +} + +// HasNodeSpecDisplayName returns a boolean if a field has been set. +func (o *V1beta1ClusterStorageNodeSetting) HasNodeSpecDisplayName() bool { + if o != nil && !IsNil(o.NodeSpecDisplayName) { + return true + } + + return false +} + +// SetNodeSpecDisplayName gets a reference to the given string and assigns it to the NodeSpecDisplayName field. +func (o *V1beta1ClusterStorageNodeSetting) SetNodeSpecDisplayName(v string) { + o.NodeSpecDisplayName = &v +} + +// GetNodeChangingProgress returns the NodeChangingProgress field value if set, zero value otherwise. +func (o *V1beta1ClusterStorageNodeSetting) GetNodeChangingProgress() ClusterNodeChangingProgress { + if o == nil || IsNil(o.NodeChangingProgress) { + var ret ClusterNodeChangingProgress + return ret + } + return *o.NodeChangingProgress +} + +// GetNodeChangingProgressOk returns a tuple with the NodeChangingProgress field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ClusterStorageNodeSetting) GetNodeChangingProgressOk() (*ClusterNodeChangingProgress, bool) { + if o == nil || IsNil(o.NodeChangingProgress) { + return nil, false + } + return o.NodeChangingProgress, true +} + +// HasNodeChangingProgress returns a boolean if a field has been set. +func (o *V1beta1ClusterStorageNodeSetting) HasNodeChangingProgress() bool { + if o != nil && !IsNil(o.NodeChangingProgress) { + return true + } + + return false +} + +// SetNodeChangingProgress gets a reference to the given ClusterNodeChangingProgress and assigns it to the NodeChangingProgress field. +func (o *V1beta1ClusterStorageNodeSetting) SetNodeChangingProgress(v ClusterNodeChangingProgress) { + o.NodeChangingProgress = &v +} + +func (o V1beta1ClusterStorageNodeSetting) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1ClusterStorageNodeSetting) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["nodeCount"] = o.NodeCount + toSerialize["nodeSpecKey"] = o.NodeSpecKey + toSerialize["storageSizeGi"] = o.StorageSizeGi + toSerialize["storageType"] = o.StorageType + if !IsNil(o.NodeSpecDisplayName) { + toSerialize["nodeSpecDisplayName"] = o.NodeSpecDisplayName + } + if !IsNil(o.NodeChangingProgress) { + toSerialize["nodeChangingProgress"] = o.NodeChangingProgress + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1ClusterStorageNodeSetting) 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{ + "nodeCount", + "nodeSpecKey", + "storageSizeGi", + "storageType", + } + + 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) + } + } + + varV1beta1ClusterStorageNodeSetting := _V1beta1ClusterStorageNodeSetting{} + + err = json.Unmarshal(data, &varV1beta1ClusterStorageNodeSetting) + + if err != nil { + return err + } + + *o = V1beta1ClusterStorageNodeSetting(varV1beta1ClusterStorageNodeSetting) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "nodeCount") + delete(additionalProperties, "nodeSpecKey") + delete(additionalProperties, "storageSizeGi") + delete(additionalProperties, "storageType") + delete(additionalProperties, "nodeSpecDisplayName") + delete(additionalProperties, "nodeChangingProgress") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1ClusterStorageNodeSetting struct { + value *V1beta1ClusterStorageNodeSetting + isSet bool +} + +func (v NullableV1beta1ClusterStorageNodeSetting) Get() *V1beta1ClusterStorageNodeSetting { + return v.value +} + +func (v *NullableV1beta1ClusterStorageNodeSetting) Set(val *V1beta1ClusterStorageNodeSetting) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1ClusterStorageNodeSetting) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1ClusterStorageNodeSetting) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1ClusterStorageNodeSetting(val *V1beta1ClusterStorageNodeSetting) *NullableV1beta1ClusterStorageNodeSetting { + return &NullableV1beta1ClusterStorageNodeSetting{value: val, isSet: true} +} + +func (v NullableV1beta1ClusterStorageNodeSetting) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1ClusterStorageNodeSetting) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_cluster_tidb_node_setting.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_cluster_tidb_node_setting.go new file mode 100644 index 00000000..05a61b02 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_cluster_tidb_node_setting.go @@ -0,0 +1,233 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the V1beta1ClusterTidbNodeSetting type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1ClusterTidbNodeSetting{} + +// V1beta1ClusterTidbNodeSetting struct for V1beta1ClusterTidbNodeSetting +type V1beta1ClusterTidbNodeSetting struct { + NodeSpecKey string `json:"nodeSpecKey"` + // When creating a cluster, the length of the `tidb_node_groups` should be 1 and the `node_count` field of `TidbNodeGroup` should be set. + TidbNodeGroups []Dedicatedv1beta1TidbNodeGroup `json:"tidbNodeGroups"` + NodeSpecDisplayName *string `json:"nodeSpecDisplayName,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1ClusterTidbNodeSetting V1beta1ClusterTidbNodeSetting + +// NewV1beta1ClusterTidbNodeSetting instantiates a new V1beta1ClusterTidbNodeSetting 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 NewV1beta1ClusterTidbNodeSetting(nodeSpecKey string, tidbNodeGroups []Dedicatedv1beta1TidbNodeGroup) *V1beta1ClusterTidbNodeSetting { + this := V1beta1ClusterTidbNodeSetting{} + this.NodeSpecKey = nodeSpecKey + this.TidbNodeGroups = tidbNodeGroups + return &this +} + +// NewV1beta1ClusterTidbNodeSettingWithDefaults instantiates a new V1beta1ClusterTidbNodeSetting 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 NewV1beta1ClusterTidbNodeSettingWithDefaults() *V1beta1ClusterTidbNodeSetting { + this := V1beta1ClusterTidbNodeSetting{} + return &this +} + +// GetNodeSpecKey returns the NodeSpecKey field value +func (o *V1beta1ClusterTidbNodeSetting) GetNodeSpecKey() string { + if o == nil { + var ret string + return ret + } + + return o.NodeSpecKey +} + +// GetNodeSpecKeyOk returns a tuple with the NodeSpecKey field value +// and a boolean to check if the value has been set. +func (o *V1beta1ClusterTidbNodeSetting) GetNodeSpecKeyOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.NodeSpecKey, true +} + +// SetNodeSpecKey sets field value +func (o *V1beta1ClusterTidbNodeSetting) SetNodeSpecKey(v string) { + o.NodeSpecKey = v +} + +// GetTidbNodeGroups returns the TidbNodeGroups field value +func (o *V1beta1ClusterTidbNodeSetting) GetTidbNodeGroups() []Dedicatedv1beta1TidbNodeGroup { + if o == nil { + var ret []Dedicatedv1beta1TidbNodeGroup + return ret + } + + return o.TidbNodeGroups +} + +// GetTidbNodeGroupsOk returns a tuple with the TidbNodeGroups field value +// and a boolean to check if the value has been set. +func (o *V1beta1ClusterTidbNodeSetting) GetTidbNodeGroupsOk() ([]Dedicatedv1beta1TidbNodeGroup, bool) { + if o == nil { + return nil, false + } + return o.TidbNodeGroups, true +} + +// SetTidbNodeGroups sets field value +func (o *V1beta1ClusterTidbNodeSetting) SetTidbNodeGroups(v []Dedicatedv1beta1TidbNodeGroup) { + o.TidbNodeGroups = v +} + +// GetNodeSpecDisplayName returns the NodeSpecDisplayName field value if set, zero value otherwise. +func (o *V1beta1ClusterTidbNodeSetting) GetNodeSpecDisplayName() string { + if o == nil || IsNil(o.NodeSpecDisplayName) { + var ret string + return ret + } + return *o.NodeSpecDisplayName +} + +// GetNodeSpecDisplayNameOk returns a tuple with the NodeSpecDisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ClusterTidbNodeSetting) GetNodeSpecDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.NodeSpecDisplayName) { + return nil, false + } + return o.NodeSpecDisplayName, true +} + +// HasNodeSpecDisplayName returns a boolean if a field has been set. +func (o *V1beta1ClusterTidbNodeSetting) HasNodeSpecDisplayName() bool { + if o != nil && !IsNil(o.NodeSpecDisplayName) { + return true + } + + return false +} + +// SetNodeSpecDisplayName gets a reference to the given string and assigns it to the NodeSpecDisplayName field. +func (o *V1beta1ClusterTidbNodeSetting) SetNodeSpecDisplayName(v string) { + o.NodeSpecDisplayName = &v +} + +func (o V1beta1ClusterTidbNodeSetting) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1ClusterTidbNodeSetting) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["nodeSpecKey"] = o.NodeSpecKey + toSerialize["tidbNodeGroups"] = o.TidbNodeGroups + if !IsNil(o.NodeSpecDisplayName) { + toSerialize["nodeSpecDisplayName"] = o.NodeSpecDisplayName + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1ClusterTidbNodeSetting) 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{ + "nodeSpecKey", + "tidbNodeGroups", + } + + 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) + } + } + + varV1beta1ClusterTidbNodeSetting := _V1beta1ClusterTidbNodeSetting{} + + err = json.Unmarshal(data, &varV1beta1ClusterTidbNodeSetting) + + if err != nil { + return err + } + + *o = V1beta1ClusterTidbNodeSetting(varV1beta1ClusterTidbNodeSetting) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "nodeSpecKey") + delete(additionalProperties, "tidbNodeGroups") + delete(additionalProperties, "nodeSpecDisplayName") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1ClusterTidbNodeSetting struct { + value *V1beta1ClusterTidbNodeSetting + isSet bool +} + +func (v NullableV1beta1ClusterTidbNodeSetting) Get() *V1beta1ClusterTidbNodeSetting { + return v.value +} + +func (v *NullableV1beta1ClusterTidbNodeSetting) Set(val *V1beta1ClusterTidbNodeSetting) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1ClusterTidbNodeSetting) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1ClusterTidbNodeSetting) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1ClusterTidbNodeSetting(val *V1beta1ClusterTidbNodeSetting) *NullableV1beta1ClusterTidbNodeSetting { + return &NullableV1beta1ClusterTidbNodeSetting{value: val, isSet: true} +} + +func (v NullableV1beta1ClusterTidbNodeSetting) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1ClusterTidbNodeSetting) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_audit_log_filter_rules_response.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_audit_log_filter_rules_response.go new file mode 100644 index 00000000..0496c95a --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_audit_log_filter_rules_response.go @@ -0,0 +1,227 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the V1beta1ListAuditLogFilterRulesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1ListAuditLogFilterRulesResponse{} + +// V1beta1ListAuditLogFilterRulesResponse struct for V1beta1ListAuditLogFilterRulesResponse +type V1beta1ListAuditLogFilterRulesResponse struct { + AuditLogFilterRules []V1beta1AuditLogFilterRule `json:"auditLogFilterRules,omitempty"` + TotalSize *int32 `json:"totalSize,omitempty"` + NextPageToken *string `json:"nextPageToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1ListAuditLogFilterRulesResponse V1beta1ListAuditLogFilterRulesResponse + +// NewV1beta1ListAuditLogFilterRulesResponse instantiates a new V1beta1ListAuditLogFilterRulesResponse 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 NewV1beta1ListAuditLogFilterRulesResponse() *V1beta1ListAuditLogFilterRulesResponse { + this := V1beta1ListAuditLogFilterRulesResponse{} + return &this +} + +// NewV1beta1ListAuditLogFilterRulesResponseWithDefaults instantiates a new V1beta1ListAuditLogFilterRulesResponse 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 NewV1beta1ListAuditLogFilterRulesResponseWithDefaults() *V1beta1ListAuditLogFilterRulesResponse { + this := V1beta1ListAuditLogFilterRulesResponse{} + return &this +} + +// GetAuditLogFilterRules returns the AuditLogFilterRules field value if set, zero value otherwise. +func (o *V1beta1ListAuditLogFilterRulesResponse) GetAuditLogFilterRules() []V1beta1AuditLogFilterRule { + if o == nil || IsNil(o.AuditLogFilterRules) { + var ret []V1beta1AuditLogFilterRule + return ret + } + return o.AuditLogFilterRules +} + +// GetAuditLogFilterRulesOk returns a tuple with the AuditLogFilterRules field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListAuditLogFilterRulesResponse) GetAuditLogFilterRulesOk() ([]V1beta1AuditLogFilterRule, bool) { + if o == nil || IsNil(o.AuditLogFilterRules) { + return nil, false + } + return o.AuditLogFilterRules, true +} + +// HasAuditLogFilterRules returns a boolean if a field has been set. +func (o *V1beta1ListAuditLogFilterRulesResponse) HasAuditLogFilterRules() bool { + if o != nil && !IsNil(o.AuditLogFilterRules) { + return true + } + + return false +} + +// SetAuditLogFilterRules gets a reference to the given []V1beta1AuditLogFilterRule and assigns it to the AuditLogFilterRules field. +func (o *V1beta1ListAuditLogFilterRulesResponse) SetAuditLogFilterRules(v []V1beta1AuditLogFilterRule) { + o.AuditLogFilterRules = v +} + +// GetTotalSize returns the TotalSize field value if set, zero value otherwise. +func (o *V1beta1ListAuditLogFilterRulesResponse) GetTotalSize() int32 { + if o == nil || IsNil(o.TotalSize) { + var ret int32 + return ret + } + return *o.TotalSize +} + +// GetTotalSizeOk returns a tuple with the TotalSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListAuditLogFilterRulesResponse) GetTotalSizeOk() (*int32, bool) { + if o == nil || IsNil(o.TotalSize) { + return nil, false + } + return o.TotalSize, true +} + +// HasTotalSize returns a boolean if a field has been set. +func (o *V1beta1ListAuditLogFilterRulesResponse) HasTotalSize() bool { + if o != nil && !IsNil(o.TotalSize) { + return true + } + + return false +} + +// SetTotalSize gets a reference to the given int32 and assigns it to the TotalSize field. +func (o *V1beta1ListAuditLogFilterRulesResponse) SetTotalSize(v int32) { + o.TotalSize = &v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *V1beta1ListAuditLogFilterRulesResponse) GetNextPageToken() string { + if o == nil || IsNil(o.NextPageToken) { + var ret string + return ret + } + return *o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListAuditLogFilterRulesResponse) GetNextPageTokenOk() (*string, bool) { + if o == nil || IsNil(o.NextPageToken) { + return nil, false + } + return o.NextPageToken, true +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *V1beta1ListAuditLogFilterRulesResponse) HasNextPageToken() bool { + if o != nil && !IsNil(o.NextPageToken) { + return true + } + + return false +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *V1beta1ListAuditLogFilterRulesResponse) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o V1beta1ListAuditLogFilterRulesResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1ListAuditLogFilterRulesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.AuditLogFilterRules) { + toSerialize["auditLogFilterRules"] = o.AuditLogFilterRules + } + if !IsNil(o.TotalSize) { + toSerialize["totalSize"] = o.TotalSize + } + if !IsNil(o.NextPageToken) { + toSerialize["nextPageToken"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1ListAuditLogFilterRulesResponse) UnmarshalJSON(data []byte) (err error) { + varV1beta1ListAuditLogFilterRulesResponse := _V1beta1ListAuditLogFilterRulesResponse{} + + err = json.Unmarshal(data, &varV1beta1ListAuditLogFilterRulesResponse) + + if err != nil { + return err + } + + *o = V1beta1ListAuditLogFilterRulesResponse(varV1beta1ListAuditLogFilterRulesResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "auditLogFilterRules") + delete(additionalProperties, "totalSize") + delete(additionalProperties, "nextPageToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1ListAuditLogFilterRulesResponse struct { + value *V1beta1ListAuditLogFilterRulesResponse + isSet bool +} + +func (v NullableV1beta1ListAuditLogFilterRulesResponse) Get() *V1beta1ListAuditLogFilterRulesResponse { + return v.value +} + +func (v *NullableV1beta1ListAuditLogFilterRulesResponse) Set(val *V1beta1ListAuditLogFilterRulesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1ListAuditLogFilterRulesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1ListAuditLogFilterRulesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1ListAuditLogFilterRulesResponse(val *V1beta1ListAuditLogFilterRulesResponse) *NullableV1beta1ListAuditLogFilterRulesResponse { + return &NullableV1beta1ListAuditLogFilterRulesResponse{value: val, isSet: true} +} + +func (v NullableV1beta1ListAuditLogFilterRulesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1ListAuditLogFilterRulesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_maintenance_tasks_response.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_maintenance_tasks_response.go new file mode 100644 index 00000000..9b2d6d7d --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_maintenance_tasks_response.go @@ -0,0 +1,229 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the V1beta1ListMaintenanceTasksResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1ListMaintenanceTasksResponse{} + +// V1beta1ListMaintenanceTasksResponse struct for V1beta1ListMaintenanceTasksResponse +type V1beta1ListMaintenanceTasksResponse struct { + MaintenanceTasks []V1beta1MaintenanceTask `json:"maintenanceTasks,omitempty"` + // The total number of maintenance tasks that matched the query. + TotalSize *int32 `json:"totalSize,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. + NextPageToken *string `json:"nextPageToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1ListMaintenanceTasksResponse V1beta1ListMaintenanceTasksResponse + +// NewV1beta1ListMaintenanceTasksResponse instantiates a new V1beta1ListMaintenanceTasksResponse 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 NewV1beta1ListMaintenanceTasksResponse() *V1beta1ListMaintenanceTasksResponse { + this := V1beta1ListMaintenanceTasksResponse{} + return &this +} + +// NewV1beta1ListMaintenanceTasksResponseWithDefaults instantiates a new V1beta1ListMaintenanceTasksResponse 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 NewV1beta1ListMaintenanceTasksResponseWithDefaults() *V1beta1ListMaintenanceTasksResponse { + this := V1beta1ListMaintenanceTasksResponse{} + return &this +} + +// GetMaintenanceTasks returns the MaintenanceTasks field value if set, zero value otherwise. +func (o *V1beta1ListMaintenanceTasksResponse) GetMaintenanceTasks() []V1beta1MaintenanceTask { + if o == nil || IsNil(o.MaintenanceTasks) { + var ret []V1beta1MaintenanceTask + return ret + } + return o.MaintenanceTasks +} + +// GetMaintenanceTasksOk returns a tuple with the MaintenanceTasks field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListMaintenanceTasksResponse) GetMaintenanceTasksOk() ([]V1beta1MaintenanceTask, bool) { + if o == nil || IsNil(o.MaintenanceTasks) { + return nil, false + } + return o.MaintenanceTasks, true +} + +// HasMaintenanceTasks returns a boolean if a field has been set. +func (o *V1beta1ListMaintenanceTasksResponse) HasMaintenanceTasks() bool { + if o != nil && !IsNil(o.MaintenanceTasks) { + return true + } + + return false +} + +// SetMaintenanceTasks gets a reference to the given []V1beta1MaintenanceTask and assigns it to the MaintenanceTasks field. +func (o *V1beta1ListMaintenanceTasksResponse) SetMaintenanceTasks(v []V1beta1MaintenanceTask) { + o.MaintenanceTasks = v +} + +// GetTotalSize returns the TotalSize field value if set, zero value otherwise. +func (o *V1beta1ListMaintenanceTasksResponse) GetTotalSize() int32 { + if o == nil || IsNil(o.TotalSize) { + var ret int32 + return ret + } + return *o.TotalSize +} + +// GetTotalSizeOk returns a tuple with the TotalSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListMaintenanceTasksResponse) GetTotalSizeOk() (*int32, bool) { + if o == nil || IsNil(o.TotalSize) { + return nil, false + } + return o.TotalSize, true +} + +// HasTotalSize returns a boolean if a field has been set. +func (o *V1beta1ListMaintenanceTasksResponse) HasTotalSize() bool { + if o != nil && !IsNil(o.TotalSize) { + return true + } + + return false +} + +// SetTotalSize gets a reference to the given int32 and assigns it to the TotalSize field. +func (o *V1beta1ListMaintenanceTasksResponse) SetTotalSize(v int32) { + o.TotalSize = &v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *V1beta1ListMaintenanceTasksResponse) GetNextPageToken() string { + if o == nil || IsNil(o.NextPageToken) { + var ret string + return ret + } + return *o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListMaintenanceTasksResponse) GetNextPageTokenOk() (*string, bool) { + if o == nil || IsNil(o.NextPageToken) { + return nil, false + } + return o.NextPageToken, true +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *V1beta1ListMaintenanceTasksResponse) HasNextPageToken() bool { + if o != nil && !IsNil(o.NextPageToken) { + return true + } + + return false +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *V1beta1ListMaintenanceTasksResponse) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o V1beta1ListMaintenanceTasksResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1ListMaintenanceTasksResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.MaintenanceTasks) { + toSerialize["maintenanceTasks"] = o.MaintenanceTasks + } + if !IsNil(o.TotalSize) { + toSerialize["totalSize"] = o.TotalSize + } + if !IsNil(o.NextPageToken) { + toSerialize["nextPageToken"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1ListMaintenanceTasksResponse) UnmarshalJSON(data []byte) (err error) { + varV1beta1ListMaintenanceTasksResponse := _V1beta1ListMaintenanceTasksResponse{} + + err = json.Unmarshal(data, &varV1beta1ListMaintenanceTasksResponse) + + if err != nil { + return err + } + + *o = V1beta1ListMaintenanceTasksResponse(varV1beta1ListMaintenanceTasksResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "maintenanceTasks") + delete(additionalProperties, "totalSize") + delete(additionalProperties, "nextPageToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1ListMaintenanceTasksResponse struct { + value *V1beta1ListMaintenanceTasksResponse + isSet bool +} + +func (v NullableV1beta1ListMaintenanceTasksResponse) Get() *V1beta1ListMaintenanceTasksResponse { + return v.value +} + +func (v *NullableV1beta1ListMaintenanceTasksResponse) Set(val *V1beta1ListMaintenanceTasksResponse) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1ListMaintenanceTasksResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1ListMaintenanceTasksResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1ListMaintenanceTasksResponse(val *V1beta1ListMaintenanceTasksResponse) *NullableV1beta1ListMaintenanceTasksResponse { + return &NullableV1beta1ListMaintenanceTasksResponse{value: val, isSet: true} +} + +func (v NullableV1beta1ListMaintenanceTasksResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1ListMaintenanceTasksResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_maintenance_windows_response.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_maintenance_windows_response.go new file mode 100644 index 00000000..ceaf865c --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_maintenance_windows_response.go @@ -0,0 +1,229 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the V1beta1ListMaintenanceWindowsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1ListMaintenanceWindowsResponse{} + +// V1beta1ListMaintenanceWindowsResponse struct for V1beta1ListMaintenanceWindowsResponse +type V1beta1ListMaintenanceWindowsResponse struct { + MaintenanceWindows []Dedicatedv1beta1MaintenanceWindow `json:"maintenanceWindows,omitempty"` + // The total number of maintenance windows that matched the query. + TotalSize *int32 `json:"totalSize,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. + NextPageToken *string `json:"nextPageToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1ListMaintenanceWindowsResponse V1beta1ListMaintenanceWindowsResponse + +// NewV1beta1ListMaintenanceWindowsResponse instantiates a new V1beta1ListMaintenanceWindowsResponse 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 NewV1beta1ListMaintenanceWindowsResponse() *V1beta1ListMaintenanceWindowsResponse { + this := V1beta1ListMaintenanceWindowsResponse{} + return &this +} + +// NewV1beta1ListMaintenanceWindowsResponseWithDefaults instantiates a new V1beta1ListMaintenanceWindowsResponse 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 NewV1beta1ListMaintenanceWindowsResponseWithDefaults() *V1beta1ListMaintenanceWindowsResponse { + this := V1beta1ListMaintenanceWindowsResponse{} + return &this +} + +// GetMaintenanceWindows returns the MaintenanceWindows field value if set, zero value otherwise. +func (o *V1beta1ListMaintenanceWindowsResponse) GetMaintenanceWindows() []Dedicatedv1beta1MaintenanceWindow { + if o == nil || IsNil(o.MaintenanceWindows) { + var ret []Dedicatedv1beta1MaintenanceWindow + return ret + } + return o.MaintenanceWindows +} + +// GetMaintenanceWindowsOk returns a tuple with the MaintenanceWindows field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListMaintenanceWindowsResponse) GetMaintenanceWindowsOk() ([]Dedicatedv1beta1MaintenanceWindow, bool) { + if o == nil || IsNil(o.MaintenanceWindows) { + return nil, false + } + return o.MaintenanceWindows, true +} + +// HasMaintenanceWindows returns a boolean if a field has been set. +func (o *V1beta1ListMaintenanceWindowsResponse) HasMaintenanceWindows() bool { + if o != nil && !IsNil(o.MaintenanceWindows) { + return true + } + + return false +} + +// SetMaintenanceWindows gets a reference to the given []Dedicatedv1beta1MaintenanceWindow and assigns it to the MaintenanceWindows field. +func (o *V1beta1ListMaintenanceWindowsResponse) SetMaintenanceWindows(v []Dedicatedv1beta1MaintenanceWindow) { + o.MaintenanceWindows = v +} + +// GetTotalSize returns the TotalSize field value if set, zero value otherwise. +func (o *V1beta1ListMaintenanceWindowsResponse) GetTotalSize() int32 { + if o == nil || IsNil(o.TotalSize) { + var ret int32 + return ret + } + return *o.TotalSize +} + +// GetTotalSizeOk returns a tuple with the TotalSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListMaintenanceWindowsResponse) GetTotalSizeOk() (*int32, bool) { + if o == nil || IsNil(o.TotalSize) { + return nil, false + } + return o.TotalSize, true +} + +// HasTotalSize returns a boolean if a field has been set. +func (o *V1beta1ListMaintenanceWindowsResponse) HasTotalSize() bool { + if o != nil && !IsNil(o.TotalSize) { + return true + } + + return false +} + +// SetTotalSize gets a reference to the given int32 and assigns it to the TotalSize field. +func (o *V1beta1ListMaintenanceWindowsResponse) SetTotalSize(v int32) { + o.TotalSize = &v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *V1beta1ListMaintenanceWindowsResponse) GetNextPageToken() string { + if o == nil || IsNil(o.NextPageToken) { + var ret string + return ret + } + return *o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListMaintenanceWindowsResponse) GetNextPageTokenOk() (*string, bool) { + if o == nil || IsNil(o.NextPageToken) { + return nil, false + } + return o.NextPageToken, true +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *V1beta1ListMaintenanceWindowsResponse) HasNextPageToken() bool { + if o != nil && !IsNil(o.NextPageToken) { + return true + } + + return false +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *V1beta1ListMaintenanceWindowsResponse) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o V1beta1ListMaintenanceWindowsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1ListMaintenanceWindowsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.MaintenanceWindows) { + toSerialize["maintenanceWindows"] = o.MaintenanceWindows + } + if !IsNil(o.TotalSize) { + toSerialize["totalSize"] = o.TotalSize + } + if !IsNil(o.NextPageToken) { + toSerialize["nextPageToken"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1ListMaintenanceWindowsResponse) UnmarshalJSON(data []byte) (err error) { + varV1beta1ListMaintenanceWindowsResponse := _V1beta1ListMaintenanceWindowsResponse{} + + err = json.Unmarshal(data, &varV1beta1ListMaintenanceWindowsResponse) + + if err != nil { + return err + } + + *o = V1beta1ListMaintenanceWindowsResponse(varV1beta1ListMaintenanceWindowsResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "maintenanceWindows") + delete(additionalProperties, "totalSize") + delete(additionalProperties, "nextPageToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1ListMaintenanceWindowsResponse struct { + value *V1beta1ListMaintenanceWindowsResponse + isSet bool +} + +func (v NullableV1beta1ListMaintenanceWindowsResponse) Get() *V1beta1ListMaintenanceWindowsResponse { + return v.value +} + +func (v *NullableV1beta1ListMaintenanceWindowsResponse) Set(val *V1beta1ListMaintenanceWindowsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1ListMaintenanceWindowsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1ListMaintenanceWindowsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1ListMaintenanceWindowsResponse(val *V1beta1ListMaintenanceWindowsResponse) *NullableV1beta1ListMaintenanceWindowsResponse { + return &NullableV1beta1ListMaintenanceWindowsResponse{value: val, isSet: true} +} + +func (v NullableV1beta1ListMaintenanceWindowsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1ListMaintenanceWindowsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_network_containers_response.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_network_containers_response.go new file mode 100644 index 00000000..d7782d25 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_network_containers_response.go @@ -0,0 +1,229 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the V1beta1ListNetworkContainersResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1ListNetworkContainersResponse{} + +// V1beta1ListNetworkContainersResponse struct for V1beta1ListNetworkContainersResponse +type V1beta1ListNetworkContainersResponse struct { + NetworkContainers []V1beta1NetworkContainer `json:"networkContainers,omitempty"` + // The total number of network containers that matched the query. + TotalSize *int32 `json:"totalSize,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. + NextPageToken *string `json:"nextPageToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1ListNetworkContainersResponse V1beta1ListNetworkContainersResponse + +// NewV1beta1ListNetworkContainersResponse instantiates a new V1beta1ListNetworkContainersResponse 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 NewV1beta1ListNetworkContainersResponse() *V1beta1ListNetworkContainersResponse { + this := V1beta1ListNetworkContainersResponse{} + return &this +} + +// NewV1beta1ListNetworkContainersResponseWithDefaults instantiates a new V1beta1ListNetworkContainersResponse 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 NewV1beta1ListNetworkContainersResponseWithDefaults() *V1beta1ListNetworkContainersResponse { + this := V1beta1ListNetworkContainersResponse{} + return &this +} + +// GetNetworkContainers returns the NetworkContainers field value if set, zero value otherwise. +func (o *V1beta1ListNetworkContainersResponse) GetNetworkContainers() []V1beta1NetworkContainer { + if o == nil || IsNil(o.NetworkContainers) { + var ret []V1beta1NetworkContainer + return ret + } + return o.NetworkContainers +} + +// GetNetworkContainersOk returns a tuple with the NetworkContainers field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListNetworkContainersResponse) GetNetworkContainersOk() ([]V1beta1NetworkContainer, bool) { + if o == nil || IsNil(o.NetworkContainers) { + return nil, false + } + return o.NetworkContainers, true +} + +// HasNetworkContainers returns a boolean if a field has been set. +func (o *V1beta1ListNetworkContainersResponse) HasNetworkContainers() bool { + if o != nil && !IsNil(o.NetworkContainers) { + return true + } + + return false +} + +// SetNetworkContainers gets a reference to the given []V1beta1NetworkContainer and assigns it to the NetworkContainers field. +func (o *V1beta1ListNetworkContainersResponse) SetNetworkContainers(v []V1beta1NetworkContainer) { + o.NetworkContainers = v +} + +// GetTotalSize returns the TotalSize field value if set, zero value otherwise. +func (o *V1beta1ListNetworkContainersResponse) GetTotalSize() int32 { + if o == nil || IsNil(o.TotalSize) { + var ret int32 + return ret + } + return *o.TotalSize +} + +// GetTotalSizeOk returns a tuple with the TotalSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListNetworkContainersResponse) GetTotalSizeOk() (*int32, bool) { + if o == nil || IsNil(o.TotalSize) { + return nil, false + } + return o.TotalSize, true +} + +// HasTotalSize returns a boolean if a field has been set. +func (o *V1beta1ListNetworkContainersResponse) HasTotalSize() bool { + if o != nil && !IsNil(o.TotalSize) { + return true + } + + return false +} + +// SetTotalSize gets a reference to the given int32 and assigns it to the TotalSize field. +func (o *V1beta1ListNetworkContainersResponse) SetTotalSize(v int32) { + o.TotalSize = &v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *V1beta1ListNetworkContainersResponse) GetNextPageToken() string { + if o == nil || IsNil(o.NextPageToken) { + var ret string + return ret + } + return *o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListNetworkContainersResponse) GetNextPageTokenOk() (*string, bool) { + if o == nil || IsNil(o.NextPageToken) { + return nil, false + } + return o.NextPageToken, true +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *V1beta1ListNetworkContainersResponse) HasNextPageToken() bool { + if o != nil && !IsNil(o.NextPageToken) { + return true + } + + return false +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *V1beta1ListNetworkContainersResponse) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o V1beta1ListNetworkContainersResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1ListNetworkContainersResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.NetworkContainers) { + toSerialize["networkContainers"] = o.NetworkContainers + } + if !IsNil(o.TotalSize) { + toSerialize["totalSize"] = o.TotalSize + } + if !IsNil(o.NextPageToken) { + toSerialize["nextPageToken"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1ListNetworkContainersResponse) UnmarshalJSON(data []byte) (err error) { + varV1beta1ListNetworkContainersResponse := _V1beta1ListNetworkContainersResponse{} + + err = json.Unmarshal(data, &varV1beta1ListNetworkContainersResponse) + + if err != nil { + return err + } + + *o = V1beta1ListNetworkContainersResponse(varV1beta1ListNetworkContainersResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "networkContainers") + delete(additionalProperties, "totalSize") + delete(additionalProperties, "nextPageToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1ListNetworkContainersResponse struct { + value *V1beta1ListNetworkContainersResponse + isSet bool +} + +func (v NullableV1beta1ListNetworkContainersResponse) Get() *V1beta1ListNetworkContainersResponse { + return v.value +} + +func (v *NullableV1beta1ListNetworkContainersResponse) Set(val *V1beta1ListNetworkContainersResponse) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1ListNetworkContainersResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1ListNetworkContainersResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1ListNetworkContainersResponse(val *V1beta1ListNetworkContainersResponse) *NullableV1beta1ListNetworkContainersResponse { + return &NullableV1beta1ListNetworkContainersResponse{value: val, isSet: true} +} + +func (v NullableV1beta1ListNetworkContainersResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1ListNetworkContainersResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_node_instances_response.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_node_instances_response.go new file mode 100644 index 00000000..b02c19f1 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_node_instances_response.go @@ -0,0 +1,229 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the V1beta1ListNodeInstancesResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1ListNodeInstancesResponse{} + +// V1beta1ListNodeInstancesResponse struct for V1beta1ListNodeInstancesResponse +type V1beta1ListNodeInstancesResponse struct { + NodeInstances []V1beta1NodeInstance `json:"nodeInstances,omitempty"` + // The total number of node instances that matched the query. + TotalSize *int32 `json:"totalSize,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. + NextPageToken *string `json:"nextPageToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1ListNodeInstancesResponse V1beta1ListNodeInstancesResponse + +// NewV1beta1ListNodeInstancesResponse instantiates a new V1beta1ListNodeInstancesResponse 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 NewV1beta1ListNodeInstancesResponse() *V1beta1ListNodeInstancesResponse { + this := V1beta1ListNodeInstancesResponse{} + return &this +} + +// NewV1beta1ListNodeInstancesResponseWithDefaults instantiates a new V1beta1ListNodeInstancesResponse 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 NewV1beta1ListNodeInstancesResponseWithDefaults() *V1beta1ListNodeInstancesResponse { + this := V1beta1ListNodeInstancesResponse{} + return &this +} + +// GetNodeInstances returns the NodeInstances field value if set, zero value otherwise. +func (o *V1beta1ListNodeInstancesResponse) GetNodeInstances() []V1beta1NodeInstance { + if o == nil || IsNil(o.NodeInstances) { + var ret []V1beta1NodeInstance + return ret + } + return o.NodeInstances +} + +// GetNodeInstancesOk returns a tuple with the NodeInstances field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListNodeInstancesResponse) GetNodeInstancesOk() ([]V1beta1NodeInstance, bool) { + if o == nil || IsNil(o.NodeInstances) { + return nil, false + } + return o.NodeInstances, true +} + +// HasNodeInstances returns a boolean if a field has been set. +func (o *V1beta1ListNodeInstancesResponse) HasNodeInstances() bool { + if o != nil && !IsNil(o.NodeInstances) { + return true + } + + return false +} + +// SetNodeInstances gets a reference to the given []V1beta1NodeInstance and assigns it to the NodeInstances field. +func (o *V1beta1ListNodeInstancesResponse) SetNodeInstances(v []V1beta1NodeInstance) { + o.NodeInstances = v +} + +// GetTotalSize returns the TotalSize field value if set, zero value otherwise. +func (o *V1beta1ListNodeInstancesResponse) GetTotalSize() int32 { + if o == nil || IsNil(o.TotalSize) { + var ret int32 + return ret + } + return *o.TotalSize +} + +// GetTotalSizeOk returns a tuple with the TotalSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListNodeInstancesResponse) GetTotalSizeOk() (*int32, bool) { + if o == nil || IsNil(o.TotalSize) { + return nil, false + } + return o.TotalSize, true +} + +// HasTotalSize returns a boolean if a field has been set. +func (o *V1beta1ListNodeInstancesResponse) HasTotalSize() bool { + if o != nil && !IsNil(o.TotalSize) { + return true + } + + return false +} + +// SetTotalSize gets a reference to the given int32 and assigns it to the TotalSize field. +func (o *V1beta1ListNodeInstancesResponse) SetTotalSize(v int32) { + o.TotalSize = &v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *V1beta1ListNodeInstancesResponse) GetNextPageToken() string { + if o == nil || IsNil(o.NextPageToken) { + var ret string + return ret + } + return *o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListNodeInstancesResponse) GetNextPageTokenOk() (*string, bool) { + if o == nil || IsNil(o.NextPageToken) { + return nil, false + } + return o.NextPageToken, true +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *V1beta1ListNodeInstancesResponse) HasNextPageToken() bool { + if o != nil && !IsNil(o.NextPageToken) { + return true + } + + return false +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *V1beta1ListNodeInstancesResponse) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o V1beta1ListNodeInstancesResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1ListNodeInstancesResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.NodeInstances) { + toSerialize["nodeInstances"] = o.NodeInstances + } + if !IsNil(o.TotalSize) { + toSerialize["totalSize"] = o.TotalSize + } + if !IsNil(o.NextPageToken) { + toSerialize["nextPageToken"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1ListNodeInstancesResponse) UnmarshalJSON(data []byte) (err error) { + varV1beta1ListNodeInstancesResponse := _V1beta1ListNodeInstancesResponse{} + + err = json.Unmarshal(data, &varV1beta1ListNodeInstancesResponse) + + if err != nil { + return err + } + + *o = V1beta1ListNodeInstancesResponse(varV1beta1ListNodeInstancesResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "nodeInstances") + delete(additionalProperties, "totalSize") + delete(additionalProperties, "nextPageToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1ListNodeInstancesResponse struct { + value *V1beta1ListNodeInstancesResponse + isSet bool +} + +func (v NullableV1beta1ListNodeInstancesResponse) Get() *V1beta1ListNodeInstancesResponse { + return v.value +} + +func (v *NullableV1beta1ListNodeInstancesResponse) Set(val *V1beta1ListNodeInstancesResponse) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1ListNodeInstancesResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1ListNodeInstancesResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1ListNodeInstancesResponse(val *V1beta1ListNodeInstancesResponse) *NullableV1beta1ListNodeInstancesResponse { + return &NullableV1beta1ListNodeInstancesResponse{value: val, isSet: true} +} + +func (v NullableV1beta1ListNodeInstancesResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1ListNodeInstancesResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_node_specs_response.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_node_specs_response.go new file mode 100644 index 00000000..1b358d3a --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_node_specs_response.go @@ -0,0 +1,229 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the V1beta1ListNodeSpecsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1ListNodeSpecsResponse{} + +// V1beta1ListNodeSpecsResponse struct for V1beta1ListNodeSpecsResponse +type V1beta1ListNodeSpecsResponse struct { + NodeSpecs []Dedicatedv1beta1NodeSpec `json:"nodeSpecs,omitempty"` + // The total number of node specs that matched the query. + TotalSize *int32 `json:"totalSize,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. + NextPageToken *string `json:"nextPageToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1ListNodeSpecsResponse V1beta1ListNodeSpecsResponse + +// NewV1beta1ListNodeSpecsResponse instantiates a new V1beta1ListNodeSpecsResponse 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 NewV1beta1ListNodeSpecsResponse() *V1beta1ListNodeSpecsResponse { + this := V1beta1ListNodeSpecsResponse{} + return &this +} + +// NewV1beta1ListNodeSpecsResponseWithDefaults instantiates a new V1beta1ListNodeSpecsResponse 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 NewV1beta1ListNodeSpecsResponseWithDefaults() *V1beta1ListNodeSpecsResponse { + this := V1beta1ListNodeSpecsResponse{} + return &this +} + +// GetNodeSpecs returns the NodeSpecs field value if set, zero value otherwise. +func (o *V1beta1ListNodeSpecsResponse) GetNodeSpecs() []Dedicatedv1beta1NodeSpec { + if o == nil || IsNil(o.NodeSpecs) { + var ret []Dedicatedv1beta1NodeSpec + return ret + } + return o.NodeSpecs +} + +// GetNodeSpecsOk returns a tuple with the NodeSpecs field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListNodeSpecsResponse) GetNodeSpecsOk() ([]Dedicatedv1beta1NodeSpec, bool) { + if o == nil || IsNil(o.NodeSpecs) { + return nil, false + } + return o.NodeSpecs, true +} + +// HasNodeSpecs returns a boolean if a field has been set. +func (o *V1beta1ListNodeSpecsResponse) HasNodeSpecs() bool { + if o != nil && !IsNil(o.NodeSpecs) { + return true + } + + return false +} + +// SetNodeSpecs gets a reference to the given []Dedicatedv1beta1NodeSpec and assigns it to the NodeSpecs field. +func (o *V1beta1ListNodeSpecsResponse) SetNodeSpecs(v []Dedicatedv1beta1NodeSpec) { + o.NodeSpecs = v +} + +// GetTotalSize returns the TotalSize field value if set, zero value otherwise. +func (o *V1beta1ListNodeSpecsResponse) GetTotalSize() int32 { + if o == nil || IsNil(o.TotalSize) { + var ret int32 + return ret + } + return *o.TotalSize +} + +// GetTotalSizeOk returns a tuple with the TotalSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListNodeSpecsResponse) GetTotalSizeOk() (*int32, bool) { + if o == nil || IsNil(o.TotalSize) { + return nil, false + } + return o.TotalSize, true +} + +// HasTotalSize returns a boolean if a field has been set. +func (o *V1beta1ListNodeSpecsResponse) HasTotalSize() bool { + if o != nil && !IsNil(o.TotalSize) { + return true + } + + return false +} + +// SetTotalSize gets a reference to the given int32 and assigns it to the TotalSize field. +func (o *V1beta1ListNodeSpecsResponse) SetTotalSize(v int32) { + o.TotalSize = &v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *V1beta1ListNodeSpecsResponse) GetNextPageToken() string { + if o == nil || IsNil(o.NextPageToken) { + var ret string + return ret + } + return *o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListNodeSpecsResponse) GetNextPageTokenOk() (*string, bool) { + if o == nil || IsNil(o.NextPageToken) { + return nil, false + } + return o.NextPageToken, true +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *V1beta1ListNodeSpecsResponse) HasNextPageToken() bool { + if o != nil && !IsNil(o.NextPageToken) { + return true + } + + return false +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *V1beta1ListNodeSpecsResponse) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o V1beta1ListNodeSpecsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1ListNodeSpecsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.NodeSpecs) { + toSerialize["nodeSpecs"] = o.NodeSpecs + } + if !IsNil(o.TotalSize) { + toSerialize["totalSize"] = o.TotalSize + } + if !IsNil(o.NextPageToken) { + toSerialize["nextPageToken"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1ListNodeSpecsResponse) UnmarshalJSON(data []byte) (err error) { + varV1beta1ListNodeSpecsResponse := _V1beta1ListNodeSpecsResponse{} + + err = json.Unmarshal(data, &varV1beta1ListNodeSpecsResponse) + + if err != nil { + return err + } + + *o = V1beta1ListNodeSpecsResponse(varV1beta1ListNodeSpecsResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "nodeSpecs") + delete(additionalProperties, "totalSize") + delete(additionalProperties, "nextPageToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1ListNodeSpecsResponse struct { + value *V1beta1ListNodeSpecsResponse + isSet bool +} + +func (v NullableV1beta1ListNodeSpecsResponse) Get() *V1beta1ListNodeSpecsResponse { + return v.value +} + +func (v *NullableV1beta1ListNodeSpecsResponse) Set(val *V1beta1ListNodeSpecsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1ListNodeSpecsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1ListNodeSpecsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1ListNodeSpecsResponse(val *V1beta1ListNodeSpecsResponse) *NullableV1beta1ListNodeSpecsResponse { + return &NullableV1beta1ListNodeSpecsResponse{value: val, isSet: true} +} + +func (v NullableV1beta1ListNodeSpecsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1ListNodeSpecsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_private_endpoint_connections_response.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_private_endpoint_connections_response.go new file mode 100644 index 00000000..83264b49 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_list_private_endpoint_connections_response.go @@ -0,0 +1,229 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the V1beta1ListPrivateEndpointConnectionsResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1ListPrivateEndpointConnectionsResponse{} + +// V1beta1ListPrivateEndpointConnectionsResponse struct for V1beta1ListPrivateEndpointConnectionsResponse +type V1beta1ListPrivateEndpointConnectionsResponse struct { + PrivateEndpointConnections []V1beta1PrivateEndpointConnection `json:"privateEndpointConnections,omitempty"` + // The total number of private link connections that matched the query. + TotalSize *int32 `json:"totalSize,omitempty"` + // A token, which can be sent as `page_token` to retrieve the next page. If this field is omitted, there are no subsequent pages. + NextPageToken *string `json:"nextPageToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1ListPrivateEndpointConnectionsResponse V1beta1ListPrivateEndpointConnectionsResponse + +// NewV1beta1ListPrivateEndpointConnectionsResponse instantiates a new V1beta1ListPrivateEndpointConnectionsResponse 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 NewV1beta1ListPrivateEndpointConnectionsResponse() *V1beta1ListPrivateEndpointConnectionsResponse { + this := V1beta1ListPrivateEndpointConnectionsResponse{} + return &this +} + +// NewV1beta1ListPrivateEndpointConnectionsResponseWithDefaults instantiates a new V1beta1ListPrivateEndpointConnectionsResponse 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 NewV1beta1ListPrivateEndpointConnectionsResponseWithDefaults() *V1beta1ListPrivateEndpointConnectionsResponse { + this := V1beta1ListPrivateEndpointConnectionsResponse{} + return &this +} + +// GetPrivateEndpointConnections returns the PrivateEndpointConnections field value if set, zero value otherwise. +func (o *V1beta1ListPrivateEndpointConnectionsResponse) GetPrivateEndpointConnections() []V1beta1PrivateEndpointConnection { + if o == nil || IsNil(o.PrivateEndpointConnections) { + var ret []V1beta1PrivateEndpointConnection + return ret + } + return o.PrivateEndpointConnections +} + +// GetPrivateEndpointConnectionsOk returns a tuple with the PrivateEndpointConnections field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListPrivateEndpointConnectionsResponse) GetPrivateEndpointConnectionsOk() ([]V1beta1PrivateEndpointConnection, bool) { + if o == nil || IsNil(o.PrivateEndpointConnections) { + return nil, false + } + return o.PrivateEndpointConnections, true +} + +// HasPrivateEndpointConnections returns a boolean if a field has been set. +func (o *V1beta1ListPrivateEndpointConnectionsResponse) HasPrivateEndpointConnections() bool { + if o != nil && !IsNil(o.PrivateEndpointConnections) { + return true + } + + return false +} + +// SetPrivateEndpointConnections gets a reference to the given []V1beta1PrivateEndpointConnection and assigns it to the PrivateEndpointConnections field. +func (o *V1beta1ListPrivateEndpointConnectionsResponse) SetPrivateEndpointConnections(v []V1beta1PrivateEndpointConnection) { + o.PrivateEndpointConnections = v +} + +// GetTotalSize returns the TotalSize field value if set, zero value otherwise. +func (o *V1beta1ListPrivateEndpointConnectionsResponse) GetTotalSize() int32 { + if o == nil || IsNil(o.TotalSize) { + var ret int32 + return ret + } + return *o.TotalSize +} + +// GetTotalSizeOk returns a tuple with the TotalSize field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListPrivateEndpointConnectionsResponse) GetTotalSizeOk() (*int32, bool) { + if o == nil || IsNil(o.TotalSize) { + return nil, false + } + return o.TotalSize, true +} + +// HasTotalSize returns a boolean if a field has been set. +func (o *V1beta1ListPrivateEndpointConnectionsResponse) HasTotalSize() bool { + if o != nil && !IsNil(o.TotalSize) { + return true + } + + return false +} + +// SetTotalSize gets a reference to the given int32 and assigns it to the TotalSize field. +func (o *V1beta1ListPrivateEndpointConnectionsResponse) SetTotalSize(v int32) { + o.TotalSize = &v +} + +// GetNextPageToken returns the NextPageToken field value if set, zero value otherwise. +func (o *V1beta1ListPrivateEndpointConnectionsResponse) GetNextPageToken() string { + if o == nil || IsNil(o.NextPageToken) { + var ret string + return ret + } + return *o.NextPageToken +} + +// GetNextPageTokenOk returns a tuple with the NextPageToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ListPrivateEndpointConnectionsResponse) GetNextPageTokenOk() (*string, bool) { + if o == nil || IsNil(o.NextPageToken) { + return nil, false + } + return o.NextPageToken, true +} + +// HasNextPageToken returns a boolean if a field has been set. +func (o *V1beta1ListPrivateEndpointConnectionsResponse) HasNextPageToken() bool { + if o != nil && !IsNil(o.NextPageToken) { + return true + } + + return false +} + +// SetNextPageToken gets a reference to the given string and assigns it to the NextPageToken field. +func (o *V1beta1ListPrivateEndpointConnectionsResponse) SetNextPageToken(v string) { + o.NextPageToken = &v +} + +func (o V1beta1ListPrivateEndpointConnectionsResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1ListPrivateEndpointConnectionsResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.PrivateEndpointConnections) { + toSerialize["privateEndpointConnections"] = o.PrivateEndpointConnections + } + if !IsNil(o.TotalSize) { + toSerialize["totalSize"] = o.TotalSize + } + if !IsNil(o.NextPageToken) { + toSerialize["nextPageToken"] = o.NextPageToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1ListPrivateEndpointConnectionsResponse) UnmarshalJSON(data []byte) (err error) { + varV1beta1ListPrivateEndpointConnectionsResponse := _V1beta1ListPrivateEndpointConnectionsResponse{} + + err = json.Unmarshal(data, &varV1beta1ListPrivateEndpointConnectionsResponse) + + if err != nil { + return err + } + + *o = V1beta1ListPrivateEndpointConnectionsResponse(varV1beta1ListPrivateEndpointConnectionsResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "privateEndpointConnections") + delete(additionalProperties, "totalSize") + delete(additionalProperties, "nextPageToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1ListPrivateEndpointConnectionsResponse struct { + value *V1beta1ListPrivateEndpointConnectionsResponse + isSet bool +} + +func (v NullableV1beta1ListPrivateEndpointConnectionsResponse) Get() *V1beta1ListPrivateEndpointConnectionsResponse { + return v.value +} + +func (v *NullableV1beta1ListPrivateEndpointConnectionsResponse) Set(val *V1beta1ListPrivateEndpointConnectionsResponse) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1ListPrivateEndpointConnectionsResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1ListPrivateEndpointConnectionsResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1ListPrivateEndpointConnectionsResponse(val *V1beta1ListPrivateEndpointConnectionsResponse) *NullableV1beta1ListPrivateEndpointConnectionsResponse { + return &NullableV1beta1ListPrivateEndpointConnectionsResponse{value: val, isSet: true} +} + +func (v NullableV1beta1ListPrivateEndpointConnectionsResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1ListPrivateEndpointConnectionsResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_maintenance_task.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_maintenance_task.go new file mode 100644 index 00000000..a1999afd --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_maintenance_task.go @@ -0,0 +1,416 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "time" +) + +// checks if the V1beta1MaintenanceTask type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1MaintenanceTask{} + +// V1beta1MaintenanceTask struct for V1beta1MaintenanceTask +type V1beta1MaintenanceTask struct { + Name *string `json:"name,omitempty"` + MaintenanceTaskId *string `json:"maintenanceTaskId,omitempty"` + ProjectId *string `json:"projectId,omitempty"` + Description *string `json:"description,omitempty"` + State *V1beta1MaintenanceTaskState `json:"state,omitempty"` + // Timestamp when the task was created. + CreateTime *time.Time `json:"createTime,omitempty"` + // Timestamp when the task run. + ScheduledApplyTime *time.Time `json:"scheduledApplyTime,omitempty"` + // Timestamp when the task will be expired. + Deadline *time.Time `json:"deadline,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1MaintenanceTask V1beta1MaintenanceTask + +// NewV1beta1MaintenanceTask instantiates a new V1beta1MaintenanceTask 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 NewV1beta1MaintenanceTask() *V1beta1MaintenanceTask { + this := V1beta1MaintenanceTask{} + return &this +} + +// NewV1beta1MaintenanceTaskWithDefaults instantiates a new V1beta1MaintenanceTask 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 NewV1beta1MaintenanceTaskWithDefaults() *V1beta1MaintenanceTask { + this := V1beta1MaintenanceTask{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *V1beta1MaintenanceTask) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1MaintenanceTask) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *V1beta1MaintenanceTask) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *V1beta1MaintenanceTask) SetName(v string) { + o.Name = &v +} + +// GetMaintenanceTaskId returns the MaintenanceTaskId field value if set, zero value otherwise. +func (o *V1beta1MaintenanceTask) GetMaintenanceTaskId() string { + if o == nil || IsNil(o.MaintenanceTaskId) { + var ret string + return ret + } + return *o.MaintenanceTaskId +} + +// GetMaintenanceTaskIdOk returns a tuple with the MaintenanceTaskId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1MaintenanceTask) GetMaintenanceTaskIdOk() (*string, bool) { + if o == nil || IsNil(o.MaintenanceTaskId) { + return nil, false + } + return o.MaintenanceTaskId, true +} + +// HasMaintenanceTaskId returns a boolean if a field has been set. +func (o *V1beta1MaintenanceTask) HasMaintenanceTaskId() bool { + if o != nil && !IsNil(o.MaintenanceTaskId) { + return true + } + + return false +} + +// SetMaintenanceTaskId gets a reference to the given string and assigns it to the MaintenanceTaskId field. +func (o *V1beta1MaintenanceTask) SetMaintenanceTaskId(v string) { + o.MaintenanceTaskId = &v +} + +// GetProjectId returns the ProjectId field value if set, zero value otherwise. +func (o *V1beta1MaintenanceTask) GetProjectId() string { + if o == nil || IsNil(o.ProjectId) { + var ret string + return ret + } + return *o.ProjectId +} + +// GetProjectIdOk returns a tuple with the ProjectId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1MaintenanceTask) GetProjectIdOk() (*string, bool) { + if o == nil || IsNil(o.ProjectId) { + return nil, false + } + return o.ProjectId, true +} + +// HasProjectId returns a boolean if a field has been set. +func (o *V1beta1MaintenanceTask) HasProjectId() bool { + if o != nil && !IsNil(o.ProjectId) { + return true + } + + return false +} + +// SetProjectId gets a reference to the given string and assigns it to the ProjectId field. +func (o *V1beta1MaintenanceTask) SetProjectId(v string) { + o.ProjectId = &v +} + +// GetDescription returns the Description field value if set, zero value otherwise. +func (o *V1beta1MaintenanceTask) GetDescription() string { + if o == nil || IsNil(o.Description) { + var ret string + return ret + } + return *o.Description +} + +// GetDescriptionOk returns a tuple with the Description field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1MaintenanceTask) GetDescriptionOk() (*string, bool) { + if o == nil || IsNil(o.Description) { + return nil, false + } + return o.Description, true +} + +// HasDescription returns a boolean if a field has been set. +func (o *V1beta1MaintenanceTask) HasDescription() bool { + if o != nil && !IsNil(o.Description) { + return true + } + + return false +} + +// SetDescription gets a reference to the given string and assigns it to the Description field. +func (o *V1beta1MaintenanceTask) SetDescription(v string) { + o.Description = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *V1beta1MaintenanceTask) GetState() V1beta1MaintenanceTaskState { + if o == nil || IsNil(o.State) { + var ret V1beta1MaintenanceTaskState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1MaintenanceTask) GetStateOk() (*V1beta1MaintenanceTaskState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *V1beta1MaintenanceTask) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given V1beta1MaintenanceTaskState and assigns it to the State field. +func (o *V1beta1MaintenanceTask) SetState(v V1beta1MaintenanceTaskState) { + o.State = &v +} + +// GetCreateTime returns the CreateTime field value if set, zero value otherwise. +func (o *V1beta1MaintenanceTask) GetCreateTime() time.Time { + if o == nil || IsNil(o.CreateTime) { + var ret time.Time + return ret + } + return *o.CreateTime +} + +// GetCreateTimeOk returns a tuple with the CreateTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1MaintenanceTask) GetCreateTimeOk() (*time.Time, bool) { + if o == nil || IsNil(o.CreateTime) { + return nil, false + } + return o.CreateTime, true +} + +// HasCreateTime returns a boolean if a field has been set. +func (o *V1beta1MaintenanceTask) HasCreateTime() bool { + if o != nil && !IsNil(o.CreateTime) { + return true + } + + return false +} + +// SetCreateTime gets a reference to the given time.Time and assigns it to the CreateTime field. +func (o *V1beta1MaintenanceTask) SetCreateTime(v time.Time) { + o.CreateTime = &v +} + +// GetScheduledApplyTime returns the ScheduledApplyTime field value if set, zero value otherwise. +func (o *V1beta1MaintenanceTask) GetScheduledApplyTime() time.Time { + if o == nil || IsNil(o.ScheduledApplyTime) { + var ret time.Time + return ret + } + return *o.ScheduledApplyTime +} + +// GetScheduledApplyTimeOk returns a tuple with the ScheduledApplyTime field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1MaintenanceTask) GetScheduledApplyTimeOk() (*time.Time, bool) { + if o == nil || IsNil(o.ScheduledApplyTime) { + return nil, false + } + return o.ScheduledApplyTime, true +} + +// HasScheduledApplyTime returns a boolean if a field has been set. +func (o *V1beta1MaintenanceTask) HasScheduledApplyTime() bool { + if o != nil && !IsNil(o.ScheduledApplyTime) { + return true + } + + return false +} + +// SetScheduledApplyTime gets a reference to the given time.Time and assigns it to the ScheduledApplyTime field. +func (o *V1beta1MaintenanceTask) SetScheduledApplyTime(v time.Time) { + o.ScheduledApplyTime = &v +} + +// GetDeadline returns the Deadline field value if set, zero value otherwise. +func (o *V1beta1MaintenanceTask) GetDeadline() time.Time { + if o == nil || IsNil(o.Deadline) { + var ret time.Time + return ret + } + return *o.Deadline +} + +// GetDeadlineOk returns a tuple with the Deadline field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1MaintenanceTask) GetDeadlineOk() (*time.Time, bool) { + if o == nil || IsNil(o.Deadline) { + return nil, false + } + return o.Deadline, true +} + +// HasDeadline returns a boolean if a field has been set. +func (o *V1beta1MaintenanceTask) HasDeadline() bool { + if o != nil && !IsNil(o.Deadline) { + return true + } + + return false +} + +// SetDeadline gets a reference to the given time.Time and assigns it to the Deadline field. +func (o *V1beta1MaintenanceTask) SetDeadline(v time.Time) { + o.Deadline = &v +} + +func (o V1beta1MaintenanceTask) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1MaintenanceTask) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.MaintenanceTaskId) { + toSerialize["maintenanceTaskId"] = o.MaintenanceTaskId + } + if !IsNil(o.ProjectId) { + toSerialize["projectId"] = o.ProjectId + } + if !IsNil(o.Description) { + toSerialize["description"] = o.Description + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.CreateTime) { + toSerialize["createTime"] = o.CreateTime + } + if !IsNil(o.ScheduledApplyTime) { + toSerialize["scheduledApplyTime"] = o.ScheduledApplyTime + } + if !IsNil(o.Deadline) { + toSerialize["deadline"] = o.Deadline + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1MaintenanceTask) UnmarshalJSON(data []byte) (err error) { + varV1beta1MaintenanceTask := _V1beta1MaintenanceTask{} + + err = json.Unmarshal(data, &varV1beta1MaintenanceTask) + + if err != nil { + return err + } + + *o = V1beta1MaintenanceTask(varV1beta1MaintenanceTask) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "maintenanceTaskId") + delete(additionalProperties, "projectId") + delete(additionalProperties, "description") + delete(additionalProperties, "state") + delete(additionalProperties, "createTime") + delete(additionalProperties, "scheduledApplyTime") + delete(additionalProperties, "deadline") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1MaintenanceTask struct { + value *V1beta1MaintenanceTask + isSet bool +} + +func (v NullableV1beta1MaintenanceTask) Get() *V1beta1MaintenanceTask { + return v.value +} + +func (v *NullableV1beta1MaintenanceTask) Set(val *V1beta1MaintenanceTask) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1MaintenanceTask) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1MaintenanceTask) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1MaintenanceTask(val *V1beta1MaintenanceTask) *NullableV1beta1MaintenanceTask { + return &NullableV1beta1MaintenanceTask{value: val, isSet: true} +} + +func (v NullableV1beta1MaintenanceTask) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1MaintenanceTask) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_maintenance_task_state.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_maintenance_task_state.go new file mode 100644 index 00000000..cea55ffb --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_maintenance_task_state.go @@ -0,0 +1,112 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// V1beta1MaintenanceTaskState the model 'V1beta1MaintenanceTaskState' +type V1beta1MaintenanceTaskState string + +// List of v1beta1MaintenanceTaskState +const ( + V1BETA1MAINTENANCETASKSTATE_PENDING V1beta1MaintenanceTaskState = "PENDING" + V1BETA1MAINTENANCETASKSTATE_RUNNING V1beta1MaintenanceTaskState = "RUNNING" + V1BETA1MAINTENANCETASKSTATE_DONE V1beta1MaintenanceTaskState = "DONE" +) + +// All allowed values of V1beta1MaintenanceTaskState enum +var AllowedV1beta1MaintenanceTaskStateEnumValues = []V1beta1MaintenanceTaskState{ + "PENDING", + "RUNNING", + "DONE", +} + +func (v *V1beta1MaintenanceTaskState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := V1beta1MaintenanceTaskState(value) + for _, existing := range AllowedV1beta1MaintenanceTaskStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid V1beta1MaintenanceTaskState", value) +} + +// NewV1beta1MaintenanceTaskStateFromValue returns a pointer to a valid V1beta1MaintenanceTaskState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewV1beta1MaintenanceTaskStateFromValue(v string) (*V1beta1MaintenanceTaskState, error) { + ev := V1beta1MaintenanceTaskState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for V1beta1MaintenanceTaskState: valid values are %v", v, AllowedV1beta1MaintenanceTaskStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v V1beta1MaintenanceTaskState) IsValid() bool { + for _, existing := range AllowedV1beta1MaintenanceTaskStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to v1beta1MaintenanceTaskState value +func (v V1beta1MaintenanceTaskState) Ptr() *V1beta1MaintenanceTaskState { + return &v +} + +type NullableV1beta1MaintenanceTaskState struct { + value *V1beta1MaintenanceTaskState + isSet bool +} + +func (v NullableV1beta1MaintenanceTaskState) Get() *V1beta1MaintenanceTaskState { + return v.value +} + +func (v *NullableV1beta1MaintenanceTaskState) Set(val *V1beta1MaintenanceTaskState) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1MaintenanceTaskState) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1MaintenanceTaskState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1MaintenanceTaskState(val *V1beta1MaintenanceTaskState) *NullableV1beta1MaintenanceTaskState { + return &NullableV1beta1MaintenanceTaskState{value: val, isSet: true} +} + +func (v NullableV1beta1MaintenanceTaskState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1MaintenanceTaskState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_network_container.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_network_container.go new file mode 100644 index 00000000..b23ac511 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_network_container.go @@ -0,0 +1,465 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the V1beta1NetworkContainer type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1NetworkContainer{} + +// V1beta1NetworkContainer struct for V1beta1NetworkContainer +type V1beta1NetworkContainer struct { + Name *string `json:"name,omitempty"` + NetworkContainerId *string `json:"networkContainerId,omitempty"` + // The labels of the cluster. If there is no \"project_id\" in labels, resource should be in the default project of the creator's organization. + Labels *map[string]string `json:"labels,omitempty"` + RegionId string `json:"regionId"` + // If not set, the default cidr of the region will be used. + CidrNotion *string `json:"cidrNotion,omitempty"` + CloudProvider *V1beta1RegionCloudProvider `json:"cloudProvider,omitempty"` + State *V1beta1NetworkContainerState `json:"state,omitempty"` + RegionDisplayName *string `json:"regionDisplayName,omitempty"` + // For AWS, it is the vpc id. For GCP, it is the network name. For Azure, it is the vnet name. + VpcId *string `json:"vpcId,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1NetworkContainer V1beta1NetworkContainer + +// NewV1beta1NetworkContainer instantiates a new V1beta1NetworkContainer 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 NewV1beta1NetworkContainer(regionId string) *V1beta1NetworkContainer { + this := V1beta1NetworkContainer{} + this.RegionId = regionId + return &this +} + +// NewV1beta1NetworkContainerWithDefaults instantiates a new V1beta1NetworkContainer 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 NewV1beta1NetworkContainerWithDefaults() *V1beta1NetworkContainer { + this := V1beta1NetworkContainer{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *V1beta1NetworkContainer) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1NetworkContainer) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *V1beta1NetworkContainer) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *V1beta1NetworkContainer) SetName(v string) { + o.Name = &v +} + +// GetNetworkContainerId returns the NetworkContainerId field value if set, zero value otherwise. +func (o *V1beta1NetworkContainer) GetNetworkContainerId() string { + if o == nil || IsNil(o.NetworkContainerId) { + var ret string + return ret + } + return *o.NetworkContainerId +} + +// GetNetworkContainerIdOk returns a tuple with the NetworkContainerId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1NetworkContainer) GetNetworkContainerIdOk() (*string, bool) { + if o == nil || IsNil(o.NetworkContainerId) { + return nil, false + } + return o.NetworkContainerId, true +} + +// HasNetworkContainerId returns a boolean if a field has been set. +func (o *V1beta1NetworkContainer) HasNetworkContainerId() bool { + if o != nil && !IsNil(o.NetworkContainerId) { + return true + } + + return false +} + +// SetNetworkContainerId gets a reference to the given string and assigns it to the NetworkContainerId field. +func (o *V1beta1NetworkContainer) SetNetworkContainerId(v string) { + o.NetworkContainerId = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *V1beta1NetworkContainer) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1NetworkContainer) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *V1beta1NetworkContainer) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *V1beta1NetworkContainer) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetRegionId returns the RegionId field value +func (o *V1beta1NetworkContainer) GetRegionId() string { + if o == nil { + var ret string + return ret + } + + return o.RegionId +} + +// GetRegionIdOk returns a tuple with the RegionId field value +// and a boolean to check if the value has been set. +func (o *V1beta1NetworkContainer) GetRegionIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.RegionId, true +} + +// SetRegionId sets field value +func (o *V1beta1NetworkContainer) SetRegionId(v string) { + o.RegionId = v +} + +// GetCidrNotion returns the CidrNotion field value if set, zero value otherwise. +func (o *V1beta1NetworkContainer) GetCidrNotion() string { + if o == nil || IsNil(o.CidrNotion) { + var ret string + return ret + } + return *o.CidrNotion +} + +// GetCidrNotionOk returns a tuple with the CidrNotion field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1NetworkContainer) GetCidrNotionOk() (*string, bool) { + if o == nil || IsNil(o.CidrNotion) { + return nil, false + } + return o.CidrNotion, true +} + +// HasCidrNotion returns a boolean if a field has been set. +func (o *V1beta1NetworkContainer) HasCidrNotion() bool { + if o != nil && !IsNil(o.CidrNotion) { + return true + } + + return false +} + +// SetCidrNotion gets a reference to the given string and assigns it to the CidrNotion field. +func (o *V1beta1NetworkContainer) SetCidrNotion(v string) { + o.CidrNotion = &v +} + +// GetCloudProvider returns the CloudProvider field value if set, zero value otherwise. +func (o *V1beta1NetworkContainer) GetCloudProvider() V1beta1RegionCloudProvider { + if o == nil || IsNil(o.CloudProvider) { + var ret V1beta1RegionCloudProvider + return ret + } + return *o.CloudProvider +} + +// GetCloudProviderOk returns a tuple with the CloudProvider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1NetworkContainer) GetCloudProviderOk() (*V1beta1RegionCloudProvider, bool) { + if o == nil || IsNil(o.CloudProvider) { + return nil, false + } + return o.CloudProvider, true +} + +// HasCloudProvider returns a boolean if a field has been set. +func (o *V1beta1NetworkContainer) HasCloudProvider() bool { + if o != nil && !IsNil(o.CloudProvider) { + return true + } + + return false +} + +// SetCloudProvider gets a reference to the given V1beta1RegionCloudProvider and assigns it to the CloudProvider field. +func (o *V1beta1NetworkContainer) SetCloudProvider(v V1beta1RegionCloudProvider) { + o.CloudProvider = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *V1beta1NetworkContainer) GetState() V1beta1NetworkContainerState { + if o == nil || IsNil(o.State) { + var ret V1beta1NetworkContainerState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1NetworkContainer) GetStateOk() (*V1beta1NetworkContainerState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *V1beta1NetworkContainer) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given V1beta1NetworkContainerState and assigns it to the State field. +func (o *V1beta1NetworkContainer) SetState(v V1beta1NetworkContainerState) { + o.State = &v +} + +// GetRegionDisplayName returns the RegionDisplayName field value if set, zero value otherwise. +func (o *V1beta1NetworkContainer) GetRegionDisplayName() string { + if o == nil || IsNil(o.RegionDisplayName) { + var ret string + return ret + } + return *o.RegionDisplayName +} + +// GetRegionDisplayNameOk returns a tuple with the RegionDisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1NetworkContainer) GetRegionDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.RegionDisplayName) { + return nil, false + } + return o.RegionDisplayName, true +} + +// HasRegionDisplayName returns a boolean if a field has been set. +func (o *V1beta1NetworkContainer) HasRegionDisplayName() bool { + if o != nil && !IsNil(o.RegionDisplayName) { + return true + } + + return false +} + +// SetRegionDisplayName gets a reference to the given string and assigns it to the RegionDisplayName field. +func (o *V1beta1NetworkContainer) SetRegionDisplayName(v string) { + o.RegionDisplayName = &v +} + +// GetVpcId returns the VpcId field value if set, zero value otherwise. +func (o *V1beta1NetworkContainer) GetVpcId() string { + if o == nil || IsNil(o.VpcId) { + var ret string + return ret + } + return *o.VpcId +} + +// GetVpcIdOk returns a tuple with the VpcId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1NetworkContainer) GetVpcIdOk() (*string, bool) { + if o == nil || IsNil(o.VpcId) { + return nil, false + } + return o.VpcId, true +} + +// HasVpcId returns a boolean if a field has been set. +func (o *V1beta1NetworkContainer) HasVpcId() bool { + if o != nil && !IsNil(o.VpcId) { + return true + } + + return false +} + +// SetVpcId gets a reference to the given string and assigns it to the VpcId field. +func (o *V1beta1NetworkContainer) SetVpcId(v string) { + o.VpcId = &v +} + +func (o V1beta1NetworkContainer) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1NetworkContainer) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.NetworkContainerId) { + toSerialize["networkContainerId"] = o.NetworkContainerId + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["regionId"] = o.RegionId + if !IsNil(o.CidrNotion) { + toSerialize["cidrNotion"] = o.CidrNotion + } + if !IsNil(o.CloudProvider) { + toSerialize["cloudProvider"] = o.CloudProvider + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.RegionDisplayName) { + toSerialize["regionDisplayName"] = o.RegionDisplayName + } + if !IsNil(o.VpcId) { + toSerialize["vpcId"] = o.VpcId + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1NetworkContainer) 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{ + "regionId", + } + + 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) + } + } + + varV1beta1NetworkContainer := _V1beta1NetworkContainer{} + + err = json.Unmarshal(data, &varV1beta1NetworkContainer) + + if err != nil { + return err + } + + *o = V1beta1NetworkContainer(varV1beta1NetworkContainer) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "networkContainerId") + delete(additionalProperties, "labels") + delete(additionalProperties, "regionId") + delete(additionalProperties, "cidrNotion") + delete(additionalProperties, "cloudProvider") + delete(additionalProperties, "state") + delete(additionalProperties, "regionDisplayName") + delete(additionalProperties, "vpcId") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1NetworkContainer struct { + value *V1beta1NetworkContainer + isSet bool +} + +func (v NullableV1beta1NetworkContainer) Get() *V1beta1NetworkContainer { + return v.value +} + +func (v *NullableV1beta1NetworkContainer) Set(val *V1beta1NetworkContainer) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1NetworkContainer) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1NetworkContainer) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1NetworkContainer(val *V1beta1NetworkContainer) *NullableV1beta1NetworkContainer { + return &NullableV1beta1NetworkContainer{value: val, isSet: true} +} + +func (v NullableV1beta1NetworkContainer) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1NetworkContainer) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_network_container_state.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_network_container_state.go new file mode 100644 index 00000000..3c4fcfa6 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_network_container_state.go @@ -0,0 +1,110 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// V1beta1NetworkContainerState the model 'V1beta1NetworkContainerState' +type V1beta1NetworkContainerState string + +// List of v1beta1NetworkContainerState +const ( + V1BETA1NETWORKCONTAINERSTATE_ACTIVE V1beta1NetworkContainerState = "ACTIVE" + V1BETA1NETWORKCONTAINERSTATE_INACTIVE V1beta1NetworkContainerState = "INACTIVE" +) + +// All allowed values of V1beta1NetworkContainerState enum +var AllowedV1beta1NetworkContainerStateEnumValues = []V1beta1NetworkContainerState{ + "ACTIVE", + "INACTIVE", +} + +func (v *V1beta1NetworkContainerState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := V1beta1NetworkContainerState(value) + for _, existing := range AllowedV1beta1NetworkContainerStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid V1beta1NetworkContainerState", value) +} + +// NewV1beta1NetworkContainerStateFromValue returns a pointer to a valid V1beta1NetworkContainerState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewV1beta1NetworkContainerStateFromValue(v string) (*V1beta1NetworkContainerState, error) { + ev := V1beta1NetworkContainerState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for V1beta1NetworkContainerState: valid values are %v", v, AllowedV1beta1NetworkContainerStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v V1beta1NetworkContainerState) IsValid() bool { + for _, existing := range AllowedV1beta1NetworkContainerStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to v1beta1NetworkContainerState value +func (v V1beta1NetworkContainerState) Ptr() *V1beta1NetworkContainerState { + return &v +} + +type NullableV1beta1NetworkContainerState struct { + value *V1beta1NetworkContainerState + isSet bool +} + +func (v NullableV1beta1NetworkContainerState) Get() *V1beta1NetworkContainerState { + return v.value +} + +func (v *NullableV1beta1NetworkContainerState) Set(val *V1beta1NetworkContainerState) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1NetworkContainerState) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1NetworkContainerState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1NetworkContainerState(val *V1beta1NetworkContainerState) *NullableV1beta1NetworkContainerState { + return &NullableV1beta1NetworkContainerState{value: val, isSet: true} +} + +func (v NullableV1beta1NetworkContainerState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1NetworkContainerState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_node_instance.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_node_instance.go new file mode 100644 index 00000000..fc5ffd2e --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_node_instance.go @@ -0,0 +1,598 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the V1beta1NodeInstance type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1NodeInstance{} + +// V1beta1NodeInstance struct for V1beta1NodeInstance +type V1beta1NodeInstance struct { + Name *string `json:"name,omitempty"` + ClusterId *string `json:"clusterId,omitempty"` + InstanceId *string `json:"instanceId,omitempty"` + ComponentType *Dedicatedv1beta1ComponentType `json:"componentType,omitempty"` + // the state of the instance, e.g. \"Available\". + State *V1beta1NodeInstanceState `json:"state,omitempty"` + // the cpu size of the instance, e.g. 2. + VCpu *int32 `json:"vCpu,omitempty"` + // the memory size of the instance, e.g. 8. + MemorySizeGi *int32 `json:"memorySizeGi,omitempty"` + // the availability zone of the instance, e.g. \"us-west1-a\". + AvailabilityZone *string `json:"availabilityZone,omitempty"` + // the storage size of the instance, e.g. 100. + StorageSizeGi *int32 `json:"storageSizeGi,omitempty"` + TidbNodeGroupId NullableString `json:"tidbNodeGroupId,omitempty"` + TidbNodeGroupDisplayName NullableString `json:"tidbNodeGroupDisplayName,omitempty"` + IsDefaultTidbNodeGroup NullableBool `json:"isDefaultTidbNodeGroup,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1NodeInstance V1beta1NodeInstance + +// NewV1beta1NodeInstance instantiates a new V1beta1NodeInstance 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 NewV1beta1NodeInstance() *V1beta1NodeInstance { + this := V1beta1NodeInstance{} + return &this +} + +// NewV1beta1NodeInstanceWithDefaults instantiates a new V1beta1NodeInstance 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 NewV1beta1NodeInstanceWithDefaults() *V1beta1NodeInstance { + this := V1beta1NodeInstance{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *V1beta1NodeInstance) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1NodeInstance) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *V1beta1NodeInstance) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *V1beta1NodeInstance) SetName(v string) { + o.Name = &v +} + +// GetClusterId returns the ClusterId field value if set, zero value otherwise. +func (o *V1beta1NodeInstance) GetClusterId() string { + if o == nil || IsNil(o.ClusterId) { + var ret string + return ret + } + return *o.ClusterId +} + +// GetClusterIdOk returns a tuple with the ClusterId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1NodeInstance) GetClusterIdOk() (*string, bool) { + if o == nil || IsNil(o.ClusterId) { + return nil, false + } + return o.ClusterId, true +} + +// HasClusterId returns a boolean if a field has been set. +func (o *V1beta1NodeInstance) HasClusterId() bool { + if o != nil && !IsNil(o.ClusterId) { + return true + } + + return false +} + +// SetClusterId gets a reference to the given string and assigns it to the ClusterId field. +func (o *V1beta1NodeInstance) SetClusterId(v string) { + o.ClusterId = &v +} + +// GetInstanceId returns the InstanceId field value if set, zero value otherwise. +func (o *V1beta1NodeInstance) GetInstanceId() string { + if o == nil || IsNil(o.InstanceId) { + var ret string + return ret + } + return *o.InstanceId +} + +// GetInstanceIdOk returns a tuple with the InstanceId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1NodeInstance) GetInstanceIdOk() (*string, bool) { + if o == nil || IsNil(o.InstanceId) { + return nil, false + } + return o.InstanceId, true +} + +// HasInstanceId returns a boolean if a field has been set. +func (o *V1beta1NodeInstance) HasInstanceId() bool { + if o != nil && !IsNil(o.InstanceId) { + return true + } + + return false +} + +// SetInstanceId gets a reference to the given string and assigns it to the InstanceId field. +func (o *V1beta1NodeInstance) SetInstanceId(v string) { + o.InstanceId = &v +} + +// GetComponentType returns the ComponentType field value if set, zero value otherwise. +func (o *V1beta1NodeInstance) GetComponentType() Dedicatedv1beta1ComponentType { + if o == nil || IsNil(o.ComponentType) { + var ret Dedicatedv1beta1ComponentType + return ret + } + return *o.ComponentType +} + +// GetComponentTypeOk returns a tuple with the ComponentType field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1NodeInstance) GetComponentTypeOk() (*Dedicatedv1beta1ComponentType, bool) { + if o == nil || IsNil(o.ComponentType) { + return nil, false + } + return o.ComponentType, true +} + +// HasComponentType returns a boolean if a field has been set. +func (o *V1beta1NodeInstance) HasComponentType() bool { + if o != nil && !IsNil(o.ComponentType) { + return true + } + + return false +} + +// SetComponentType gets a reference to the given Dedicatedv1beta1ComponentType and assigns it to the ComponentType field. +func (o *V1beta1NodeInstance) SetComponentType(v Dedicatedv1beta1ComponentType) { + o.ComponentType = &v +} + +// GetState returns the State field value if set, zero value otherwise. +func (o *V1beta1NodeInstance) GetState() V1beta1NodeInstanceState { + if o == nil || IsNil(o.State) { + var ret V1beta1NodeInstanceState + return ret + } + return *o.State +} + +// GetStateOk returns a tuple with the State field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1NodeInstance) GetStateOk() (*V1beta1NodeInstanceState, bool) { + if o == nil || IsNil(o.State) { + return nil, false + } + return o.State, true +} + +// HasState returns a boolean if a field has been set. +func (o *V1beta1NodeInstance) HasState() bool { + if o != nil && !IsNil(o.State) { + return true + } + + return false +} + +// SetState gets a reference to the given V1beta1NodeInstanceState and assigns it to the State field. +func (o *V1beta1NodeInstance) SetState(v V1beta1NodeInstanceState) { + o.State = &v +} + +// GetVCpu returns the VCpu field value if set, zero value otherwise. +func (o *V1beta1NodeInstance) GetVCpu() int32 { + if o == nil || IsNil(o.VCpu) { + var ret int32 + return ret + } + return *o.VCpu +} + +// GetVCpuOk returns a tuple with the VCpu field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1NodeInstance) GetVCpuOk() (*int32, bool) { + if o == nil || IsNil(o.VCpu) { + return nil, false + } + return o.VCpu, true +} + +// HasVCpu returns a boolean if a field has been set. +func (o *V1beta1NodeInstance) HasVCpu() bool { + if o != nil && !IsNil(o.VCpu) { + return true + } + + return false +} + +// SetVCpu gets a reference to the given int32 and assigns it to the VCpu field. +func (o *V1beta1NodeInstance) SetVCpu(v int32) { + o.VCpu = &v +} + +// GetMemorySizeGi returns the MemorySizeGi field value if set, zero value otherwise. +func (o *V1beta1NodeInstance) GetMemorySizeGi() int32 { + if o == nil || IsNil(o.MemorySizeGi) { + var ret int32 + return ret + } + return *o.MemorySizeGi +} + +// GetMemorySizeGiOk returns a tuple with the MemorySizeGi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1NodeInstance) GetMemorySizeGiOk() (*int32, bool) { + if o == nil || IsNil(o.MemorySizeGi) { + return nil, false + } + return o.MemorySizeGi, true +} + +// HasMemorySizeGi returns a boolean if a field has been set. +func (o *V1beta1NodeInstance) HasMemorySizeGi() bool { + if o != nil && !IsNil(o.MemorySizeGi) { + return true + } + + return false +} + +// SetMemorySizeGi gets a reference to the given int32 and assigns it to the MemorySizeGi field. +func (o *V1beta1NodeInstance) SetMemorySizeGi(v int32) { + o.MemorySizeGi = &v +} + +// GetAvailabilityZone returns the AvailabilityZone field value if set, zero value otherwise. +func (o *V1beta1NodeInstance) GetAvailabilityZone() string { + if o == nil || IsNil(o.AvailabilityZone) { + var ret string + return ret + } + return *o.AvailabilityZone +} + +// GetAvailabilityZoneOk returns a tuple with the AvailabilityZone field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1NodeInstance) GetAvailabilityZoneOk() (*string, bool) { + if o == nil || IsNil(o.AvailabilityZone) { + return nil, false + } + return o.AvailabilityZone, true +} + +// HasAvailabilityZone returns a boolean if a field has been set. +func (o *V1beta1NodeInstance) HasAvailabilityZone() bool { + if o != nil && !IsNil(o.AvailabilityZone) { + return true + } + + return false +} + +// SetAvailabilityZone gets a reference to the given string and assigns it to the AvailabilityZone field. +func (o *V1beta1NodeInstance) SetAvailabilityZone(v string) { + o.AvailabilityZone = &v +} + +// GetStorageSizeGi returns the StorageSizeGi field value if set, zero value otherwise. +func (o *V1beta1NodeInstance) GetStorageSizeGi() int32 { + if o == nil || IsNil(o.StorageSizeGi) { + var ret int32 + return ret + } + return *o.StorageSizeGi +} + +// GetStorageSizeGiOk returns a tuple with the StorageSizeGi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1NodeInstance) GetStorageSizeGiOk() (*int32, bool) { + if o == nil || IsNil(o.StorageSizeGi) { + return nil, false + } + return o.StorageSizeGi, true +} + +// HasStorageSizeGi returns a boolean if a field has been set. +func (o *V1beta1NodeInstance) HasStorageSizeGi() bool { + if o != nil && !IsNil(o.StorageSizeGi) { + return true + } + + return false +} + +// SetStorageSizeGi gets a reference to the given int32 and assigns it to the StorageSizeGi field. +func (o *V1beta1NodeInstance) SetStorageSizeGi(v int32) { + o.StorageSizeGi = &v +} + +// GetTidbNodeGroupId returns the TidbNodeGroupId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *V1beta1NodeInstance) GetTidbNodeGroupId() string { + if o == nil || IsNil(o.TidbNodeGroupId.Get()) { + var ret string + return ret + } + return *o.TidbNodeGroupId.Get() +} + +// GetTidbNodeGroupIdOk returns a tuple with the TidbNodeGroupId field value if set, nil otherwise +// 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 *V1beta1NodeInstance) GetTidbNodeGroupIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.TidbNodeGroupId.Get(), o.TidbNodeGroupId.IsSet() +} + +// HasTidbNodeGroupId returns a boolean if a field has been set. +func (o *V1beta1NodeInstance) HasTidbNodeGroupId() bool { + if o != nil && o.TidbNodeGroupId.IsSet() { + return true + } + + return false +} + +// SetTidbNodeGroupId gets a reference to the given NullableString and assigns it to the TidbNodeGroupId field. +func (o *V1beta1NodeInstance) SetTidbNodeGroupId(v string) { + o.TidbNodeGroupId.Set(&v) +} + +// SetTidbNodeGroupIdNil sets the value for TidbNodeGroupId to be an explicit nil +func (o *V1beta1NodeInstance) SetTidbNodeGroupIdNil() { + o.TidbNodeGroupId.Set(nil) +} + +// UnsetTidbNodeGroupId ensures that no value is present for TidbNodeGroupId, not even an explicit nil +func (o *V1beta1NodeInstance) UnsetTidbNodeGroupId() { + o.TidbNodeGroupId.Unset() +} + +// GetTidbNodeGroupDisplayName returns the TidbNodeGroupDisplayName field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *V1beta1NodeInstance) GetTidbNodeGroupDisplayName() string { + if o == nil || IsNil(o.TidbNodeGroupDisplayName.Get()) { + var ret string + return ret + } + return *o.TidbNodeGroupDisplayName.Get() +} + +// GetTidbNodeGroupDisplayNameOk returns a tuple with the TidbNodeGroupDisplayName field value if set, nil otherwise +// 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 *V1beta1NodeInstance) GetTidbNodeGroupDisplayNameOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.TidbNodeGroupDisplayName.Get(), o.TidbNodeGroupDisplayName.IsSet() +} + +// HasTidbNodeGroupDisplayName returns a boolean if a field has been set. +func (o *V1beta1NodeInstance) HasTidbNodeGroupDisplayName() bool { + if o != nil && o.TidbNodeGroupDisplayName.IsSet() { + return true + } + + return false +} + +// SetTidbNodeGroupDisplayName gets a reference to the given NullableString and assigns it to the TidbNodeGroupDisplayName field. +func (o *V1beta1NodeInstance) SetTidbNodeGroupDisplayName(v string) { + o.TidbNodeGroupDisplayName.Set(&v) +} + +// SetTidbNodeGroupDisplayNameNil sets the value for TidbNodeGroupDisplayName to be an explicit nil +func (o *V1beta1NodeInstance) SetTidbNodeGroupDisplayNameNil() { + o.TidbNodeGroupDisplayName.Set(nil) +} + +// UnsetTidbNodeGroupDisplayName ensures that no value is present for TidbNodeGroupDisplayName, not even an explicit nil +func (o *V1beta1NodeInstance) UnsetTidbNodeGroupDisplayName() { + o.TidbNodeGroupDisplayName.Unset() +} + +// GetIsDefaultTidbNodeGroup returns the IsDefaultTidbNodeGroup field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *V1beta1NodeInstance) GetIsDefaultTidbNodeGroup() bool { + if o == nil || IsNil(o.IsDefaultTidbNodeGroup.Get()) { + var ret bool + return ret + } + return *o.IsDefaultTidbNodeGroup.Get() +} + +// GetIsDefaultTidbNodeGroupOk returns a tuple with the IsDefaultTidbNodeGroup field value if set, nil otherwise +// 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 *V1beta1NodeInstance) GetIsDefaultTidbNodeGroupOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.IsDefaultTidbNodeGroup.Get(), o.IsDefaultTidbNodeGroup.IsSet() +} + +// HasIsDefaultTidbNodeGroup returns a boolean if a field has been set. +func (o *V1beta1NodeInstance) HasIsDefaultTidbNodeGroup() bool { + if o != nil && o.IsDefaultTidbNodeGroup.IsSet() { + return true + } + + return false +} + +// SetIsDefaultTidbNodeGroup gets a reference to the given NullableBool and assigns it to the IsDefaultTidbNodeGroup field. +func (o *V1beta1NodeInstance) SetIsDefaultTidbNodeGroup(v bool) { + o.IsDefaultTidbNodeGroup.Set(&v) +} + +// SetIsDefaultTidbNodeGroupNil sets the value for IsDefaultTidbNodeGroup to be an explicit nil +func (o *V1beta1NodeInstance) SetIsDefaultTidbNodeGroupNil() { + o.IsDefaultTidbNodeGroup.Set(nil) +} + +// UnsetIsDefaultTidbNodeGroup ensures that no value is present for IsDefaultTidbNodeGroup, not even an explicit nil +func (o *V1beta1NodeInstance) UnsetIsDefaultTidbNodeGroup() { + o.IsDefaultTidbNodeGroup.Unset() +} + +func (o V1beta1NodeInstance) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1NodeInstance) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + if !IsNil(o.ClusterId) { + toSerialize["clusterId"] = o.ClusterId + } + if !IsNil(o.InstanceId) { + toSerialize["instanceId"] = o.InstanceId + } + if !IsNil(o.ComponentType) { + toSerialize["componentType"] = o.ComponentType + } + if !IsNil(o.State) { + toSerialize["state"] = o.State + } + if !IsNil(o.VCpu) { + toSerialize["vCpu"] = o.VCpu + } + if !IsNil(o.MemorySizeGi) { + toSerialize["memorySizeGi"] = o.MemorySizeGi + } + if !IsNil(o.AvailabilityZone) { + toSerialize["availabilityZone"] = o.AvailabilityZone + } + if !IsNil(o.StorageSizeGi) { + toSerialize["storageSizeGi"] = o.StorageSizeGi + } + if o.TidbNodeGroupId.IsSet() { + toSerialize["tidbNodeGroupId"] = o.TidbNodeGroupId.Get() + } + if o.TidbNodeGroupDisplayName.IsSet() { + toSerialize["tidbNodeGroupDisplayName"] = o.TidbNodeGroupDisplayName.Get() + } + if o.IsDefaultTidbNodeGroup.IsSet() { + toSerialize["isDefaultTidbNodeGroup"] = o.IsDefaultTidbNodeGroup.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1NodeInstance) UnmarshalJSON(data []byte) (err error) { + varV1beta1NodeInstance := _V1beta1NodeInstance{} + + err = json.Unmarshal(data, &varV1beta1NodeInstance) + + if err != nil { + return err + } + + *o = V1beta1NodeInstance(varV1beta1NodeInstance) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "clusterId") + delete(additionalProperties, "instanceId") + delete(additionalProperties, "componentType") + delete(additionalProperties, "state") + delete(additionalProperties, "vCpu") + delete(additionalProperties, "memorySizeGi") + delete(additionalProperties, "availabilityZone") + delete(additionalProperties, "storageSizeGi") + delete(additionalProperties, "tidbNodeGroupId") + delete(additionalProperties, "tidbNodeGroupDisplayName") + delete(additionalProperties, "isDefaultTidbNodeGroup") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1NodeInstance struct { + value *V1beta1NodeInstance + isSet bool +} + +func (v NullableV1beta1NodeInstance) Get() *V1beta1NodeInstance { + return v.value +} + +func (v *NullableV1beta1NodeInstance) Set(val *V1beta1NodeInstance) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1NodeInstance) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1NodeInstance) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1NodeInstance(val *V1beta1NodeInstance) *NullableV1beta1NodeInstance { + return &NullableV1beta1NodeInstance{value: val, isSet: true} +} + +func (v NullableV1beta1NodeInstance) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1NodeInstance) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_node_instance_state.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_node_instance_state.go new file mode 100644 index 00000000..9136cf2d --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_node_instance_state.go @@ -0,0 +1,114 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// V1beta1NodeInstanceState the model 'V1beta1NodeInstanceState' +type V1beta1NodeInstanceState string + +// List of v1beta1NodeInstanceState +const ( + V1BETA1NODEINSTANCESTATE_CREATING V1beta1NodeInstanceState = "CREATING" + V1BETA1NODEINSTANCESTATE_AVAILABLE V1beta1NodeInstanceState = "AVAILABLE" + V1BETA1NODEINSTANCESTATE_DELETING V1beta1NodeInstanceState = "DELETING" + V1BETA1NODEINSTANCESTATE_UNAVAILABLE V1beta1NodeInstanceState = "UNAVAILABLE" +) + +// All allowed values of V1beta1NodeInstanceState enum +var AllowedV1beta1NodeInstanceStateEnumValues = []V1beta1NodeInstanceState{ + "CREATING", + "AVAILABLE", + "DELETING", + "UNAVAILABLE", +} + +func (v *V1beta1NodeInstanceState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := V1beta1NodeInstanceState(value) + for _, existing := range AllowedV1beta1NodeInstanceStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid V1beta1NodeInstanceState", value) +} + +// NewV1beta1NodeInstanceStateFromValue returns a pointer to a valid V1beta1NodeInstanceState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewV1beta1NodeInstanceStateFromValue(v string) (*V1beta1NodeInstanceState, error) { + ev := V1beta1NodeInstanceState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for V1beta1NodeInstanceState: valid values are %v", v, AllowedV1beta1NodeInstanceStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v V1beta1NodeInstanceState) IsValid() bool { + for _, existing := range AllowedV1beta1NodeInstanceStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to v1beta1NodeInstanceState value +func (v V1beta1NodeInstanceState) Ptr() *V1beta1NodeInstanceState { + return &v +} + +type NullableV1beta1NodeInstanceState struct { + value *V1beta1NodeInstanceState + isSet bool +} + +func (v NullableV1beta1NodeInstanceState) Get() *V1beta1NodeInstanceState { + return v.value +} + +func (v *NullableV1beta1NodeInstanceState) Set(val *V1beta1NodeInstanceState) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1NodeInstanceState) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1NodeInstanceState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1NodeInstanceState(val *V1beta1NodeInstanceState) *NullableV1beta1NodeInstanceState { + return &NullableV1beta1NodeInstanceState{value: val, isSet: true} +} + +func (v NullableV1beta1NodeInstanceState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1NodeInstanceState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_private_endpoint_connection.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_private_endpoint_connection.go new file mode 100644 index 00000000..d950cb5e --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_private_endpoint_connection.go @@ -0,0 +1,850 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the V1beta1PrivateEndpointConnection type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1PrivateEndpointConnection{} + +// V1beta1PrivateEndpointConnection struct for V1beta1PrivateEndpointConnection +type V1beta1PrivateEndpointConnection struct { + Name *string `json:"name,omitempty"` + TidbNodeGroupId string `json:"tidbNodeGroupId"` + PrivateEndpointConnectionId *string `json:"privateEndpointConnectionId,omitempty"` + ClusterId *string `json:"clusterId,omitempty"` + ClusterDisplayName *string `json:"clusterDisplayName,omitempty"` + // The labels of private link connection. It always contains the `project_id` label. + Labels *map[string]string `json:"labels,omitempty"` + // The endpoint ID of the private link connection. For AWS, it's VPC endpoint ID. For GCP, it's private service connect endpoint ID. For Azure, it's private endpoint resource ID. + EndpointId string `json:"endpointId"` + // The private IP address of the private endpoint in the user's vNet. TiDB Cloud will setup a public DNS record for this private IP address. So the user can use DNS address to connect to the cluster. Only available for Azure clusters. + PrivateIpAddress NullableString `json:"privateIpAddress,omitempty"` + EndpointState *PrivateEndpointConnectionEndpointState `json:"endpointState,omitempty"` + Massage *string `json:"massage,omitempty"` + RegionId *string `json:"regionId,omitempty"` + RegionDisplayName *string `json:"regionDisplayName,omitempty"` + CloudProvider *V1beta1RegionCloudProvider `json:"cloudProvider,omitempty"` + PrivateLinkServiceName *string `json:"privateLinkServiceName,omitempty"` + PrivateLinkServiceState *V1beta1PrivateLinkServiceState `json:"privateLinkServiceState,omitempty"` + TidbNodeGroupDisplayName *string `json:"tidbNodeGroupDisplayName,omitempty"` + // Only for GCP private service connections. It's GCP project name. + AccountId NullableString `json:"accountId,omitempty"` + Host *string `json:"host,omitempty"` + Port *int32 `json:"port,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1PrivateEndpointConnection V1beta1PrivateEndpointConnection + +// NewV1beta1PrivateEndpointConnection instantiates a new V1beta1PrivateEndpointConnection 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 NewV1beta1PrivateEndpointConnection(tidbNodeGroupId string, endpointId string) *V1beta1PrivateEndpointConnection { + this := V1beta1PrivateEndpointConnection{} + this.TidbNodeGroupId = tidbNodeGroupId + this.EndpointId = endpointId + return &this +} + +// NewV1beta1PrivateEndpointConnectionWithDefaults instantiates a new V1beta1PrivateEndpointConnection 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 NewV1beta1PrivateEndpointConnectionWithDefaults() *V1beta1PrivateEndpointConnection { + this := V1beta1PrivateEndpointConnection{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *V1beta1PrivateEndpointConnection) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1PrivateEndpointConnection) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *V1beta1PrivateEndpointConnection) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *V1beta1PrivateEndpointConnection) SetName(v string) { + o.Name = &v +} + +// GetTidbNodeGroupId returns the TidbNodeGroupId field value +func (o *V1beta1PrivateEndpointConnection) GetTidbNodeGroupId() string { + if o == nil { + var ret string + return ret + } + + return o.TidbNodeGroupId +} + +// GetTidbNodeGroupIdOk returns a tuple with the TidbNodeGroupId field value +// and a boolean to check if the value has been set. +func (o *V1beta1PrivateEndpointConnection) GetTidbNodeGroupIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TidbNodeGroupId, true +} + +// SetTidbNodeGroupId sets field value +func (o *V1beta1PrivateEndpointConnection) SetTidbNodeGroupId(v string) { + o.TidbNodeGroupId = v +} + +// GetPrivateEndpointConnectionId returns the PrivateEndpointConnectionId field value if set, zero value otherwise. +func (o *V1beta1PrivateEndpointConnection) GetPrivateEndpointConnectionId() string { + if o == nil || IsNil(o.PrivateEndpointConnectionId) { + var ret string + return ret + } + return *o.PrivateEndpointConnectionId +} + +// GetPrivateEndpointConnectionIdOk returns a tuple with the PrivateEndpointConnectionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1PrivateEndpointConnection) GetPrivateEndpointConnectionIdOk() (*string, bool) { + if o == nil || IsNil(o.PrivateEndpointConnectionId) { + return nil, false + } + return o.PrivateEndpointConnectionId, true +} + +// HasPrivateEndpointConnectionId returns a boolean if a field has been set. +func (o *V1beta1PrivateEndpointConnection) HasPrivateEndpointConnectionId() bool { + if o != nil && !IsNil(o.PrivateEndpointConnectionId) { + return true + } + + return false +} + +// SetPrivateEndpointConnectionId gets a reference to the given string and assigns it to the PrivateEndpointConnectionId field. +func (o *V1beta1PrivateEndpointConnection) SetPrivateEndpointConnectionId(v string) { + o.PrivateEndpointConnectionId = &v +} + +// GetClusterId returns the ClusterId field value if set, zero value otherwise. +func (o *V1beta1PrivateEndpointConnection) GetClusterId() string { + if o == nil || IsNil(o.ClusterId) { + var ret string + return ret + } + return *o.ClusterId +} + +// GetClusterIdOk returns a tuple with the ClusterId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1PrivateEndpointConnection) GetClusterIdOk() (*string, bool) { + if o == nil || IsNil(o.ClusterId) { + return nil, false + } + return o.ClusterId, true +} + +// HasClusterId returns a boolean if a field has been set. +func (o *V1beta1PrivateEndpointConnection) HasClusterId() bool { + if o != nil && !IsNil(o.ClusterId) { + return true + } + + return false +} + +// SetClusterId gets a reference to the given string and assigns it to the ClusterId field. +func (o *V1beta1PrivateEndpointConnection) SetClusterId(v string) { + o.ClusterId = &v +} + +// GetClusterDisplayName returns the ClusterDisplayName field value if set, zero value otherwise. +func (o *V1beta1PrivateEndpointConnection) GetClusterDisplayName() string { + if o == nil || IsNil(o.ClusterDisplayName) { + var ret string + return ret + } + return *o.ClusterDisplayName +} + +// GetClusterDisplayNameOk returns a tuple with the ClusterDisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1PrivateEndpointConnection) GetClusterDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.ClusterDisplayName) { + return nil, false + } + return o.ClusterDisplayName, true +} + +// HasClusterDisplayName returns a boolean if a field has been set. +func (o *V1beta1PrivateEndpointConnection) HasClusterDisplayName() bool { + if o != nil && !IsNil(o.ClusterDisplayName) { + return true + } + + return false +} + +// SetClusterDisplayName gets a reference to the given string and assigns it to the ClusterDisplayName field. +func (o *V1beta1PrivateEndpointConnection) SetClusterDisplayName(v string) { + o.ClusterDisplayName = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *V1beta1PrivateEndpointConnection) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1PrivateEndpointConnection) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *V1beta1PrivateEndpointConnection) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *V1beta1PrivateEndpointConnection) SetLabels(v map[string]string) { + o.Labels = &v +} + +// GetEndpointId returns the EndpointId field value +func (o *V1beta1PrivateEndpointConnection) GetEndpointId() string { + if o == nil { + var ret string + return ret + } + + return o.EndpointId +} + +// GetEndpointIdOk returns a tuple with the EndpointId field value +// and a boolean to check if the value has been set. +func (o *V1beta1PrivateEndpointConnection) GetEndpointIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.EndpointId, true +} + +// SetEndpointId sets field value +func (o *V1beta1PrivateEndpointConnection) SetEndpointId(v string) { + o.EndpointId = v +} + +// GetPrivateIpAddress returns the PrivateIpAddress field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *V1beta1PrivateEndpointConnection) GetPrivateIpAddress() string { + if o == nil || IsNil(o.PrivateIpAddress.Get()) { + var ret string + return ret + } + return *o.PrivateIpAddress.Get() +} + +// GetPrivateIpAddressOk returns a tuple with the PrivateIpAddress field value if set, nil otherwise +// 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 *V1beta1PrivateEndpointConnection) GetPrivateIpAddressOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.PrivateIpAddress.Get(), o.PrivateIpAddress.IsSet() +} + +// HasPrivateIpAddress returns a boolean if a field has been set. +func (o *V1beta1PrivateEndpointConnection) HasPrivateIpAddress() bool { + if o != nil && o.PrivateIpAddress.IsSet() { + return true + } + + return false +} + +// SetPrivateIpAddress gets a reference to the given NullableString and assigns it to the PrivateIpAddress field. +func (o *V1beta1PrivateEndpointConnection) SetPrivateIpAddress(v string) { + o.PrivateIpAddress.Set(&v) +} + +// SetPrivateIpAddressNil sets the value for PrivateIpAddress to be an explicit nil +func (o *V1beta1PrivateEndpointConnection) SetPrivateIpAddressNil() { + o.PrivateIpAddress.Set(nil) +} + +// UnsetPrivateIpAddress ensures that no value is present for PrivateIpAddress, not even an explicit nil +func (o *V1beta1PrivateEndpointConnection) UnsetPrivateIpAddress() { + o.PrivateIpAddress.Unset() +} + +// GetEndpointState returns the EndpointState field value if set, zero value otherwise. +func (o *V1beta1PrivateEndpointConnection) GetEndpointState() PrivateEndpointConnectionEndpointState { + if o == nil || IsNil(o.EndpointState) { + var ret PrivateEndpointConnectionEndpointState + return ret + } + return *o.EndpointState +} + +// GetEndpointStateOk returns a tuple with the EndpointState field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1PrivateEndpointConnection) GetEndpointStateOk() (*PrivateEndpointConnectionEndpointState, bool) { + if o == nil || IsNil(o.EndpointState) { + return nil, false + } + return o.EndpointState, true +} + +// HasEndpointState returns a boolean if a field has been set. +func (o *V1beta1PrivateEndpointConnection) HasEndpointState() bool { + if o != nil && !IsNil(o.EndpointState) { + return true + } + + return false +} + +// SetEndpointState gets a reference to the given PrivateEndpointConnectionEndpointState and assigns it to the EndpointState field. +func (o *V1beta1PrivateEndpointConnection) SetEndpointState(v PrivateEndpointConnectionEndpointState) { + o.EndpointState = &v +} + +// GetMassage returns the Massage field value if set, zero value otherwise. +func (o *V1beta1PrivateEndpointConnection) GetMassage() string { + if o == nil || IsNil(o.Massage) { + var ret string + return ret + } + return *o.Massage +} + +// GetMassageOk returns a tuple with the Massage field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1PrivateEndpointConnection) GetMassageOk() (*string, bool) { + if o == nil || IsNil(o.Massage) { + return nil, false + } + return o.Massage, true +} + +// HasMassage returns a boolean if a field has been set. +func (o *V1beta1PrivateEndpointConnection) HasMassage() bool { + if o != nil && !IsNil(o.Massage) { + return true + } + + return false +} + +// SetMassage gets a reference to the given string and assigns it to the Massage field. +func (o *V1beta1PrivateEndpointConnection) SetMassage(v string) { + o.Massage = &v +} + +// GetRegionId returns the RegionId field value if set, zero value otherwise. +func (o *V1beta1PrivateEndpointConnection) GetRegionId() string { + if o == nil || IsNil(o.RegionId) { + var ret string + return ret + } + return *o.RegionId +} + +// GetRegionIdOk returns a tuple with the RegionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1PrivateEndpointConnection) GetRegionIdOk() (*string, bool) { + if o == nil || IsNil(o.RegionId) { + return nil, false + } + return o.RegionId, true +} + +// HasRegionId returns a boolean if a field has been set. +func (o *V1beta1PrivateEndpointConnection) HasRegionId() bool { + if o != nil && !IsNil(o.RegionId) { + return true + } + + return false +} + +// SetRegionId gets a reference to the given string and assigns it to the RegionId field. +func (o *V1beta1PrivateEndpointConnection) SetRegionId(v string) { + o.RegionId = &v +} + +// GetRegionDisplayName returns the RegionDisplayName field value if set, zero value otherwise. +func (o *V1beta1PrivateEndpointConnection) GetRegionDisplayName() string { + if o == nil || IsNil(o.RegionDisplayName) { + var ret string + return ret + } + return *o.RegionDisplayName +} + +// GetRegionDisplayNameOk returns a tuple with the RegionDisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1PrivateEndpointConnection) GetRegionDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.RegionDisplayName) { + return nil, false + } + return o.RegionDisplayName, true +} + +// HasRegionDisplayName returns a boolean if a field has been set. +func (o *V1beta1PrivateEndpointConnection) HasRegionDisplayName() bool { + if o != nil && !IsNil(o.RegionDisplayName) { + return true + } + + return false +} + +// SetRegionDisplayName gets a reference to the given string and assigns it to the RegionDisplayName field. +func (o *V1beta1PrivateEndpointConnection) SetRegionDisplayName(v string) { + o.RegionDisplayName = &v +} + +// GetCloudProvider returns the CloudProvider field value if set, zero value otherwise. +func (o *V1beta1PrivateEndpointConnection) GetCloudProvider() V1beta1RegionCloudProvider { + if o == nil || IsNil(o.CloudProvider) { + var ret V1beta1RegionCloudProvider + return ret + } + return *o.CloudProvider +} + +// GetCloudProviderOk returns a tuple with the CloudProvider field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1PrivateEndpointConnection) GetCloudProviderOk() (*V1beta1RegionCloudProvider, bool) { + if o == nil || IsNil(o.CloudProvider) { + return nil, false + } + return o.CloudProvider, true +} + +// HasCloudProvider returns a boolean if a field has been set. +func (o *V1beta1PrivateEndpointConnection) HasCloudProvider() bool { + if o != nil && !IsNil(o.CloudProvider) { + return true + } + + return false +} + +// SetCloudProvider gets a reference to the given V1beta1RegionCloudProvider and assigns it to the CloudProvider field. +func (o *V1beta1PrivateEndpointConnection) SetCloudProvider(v V1beta1RegionCloudProvider) { + o.CloudProvider = &v +} + +// GetPrivateLinkServiceName returns the PrivateLinkServiceName field value if set, zero value otherwise. +func (o *V1beta1PrivateEndpointConnection) GetPrivateLinkServiceName() string { + if o == nil || IsNil(o.PrivateLinkServiceName) { + var ret string + return ret + } + return *o.PrivateLinkServiceName +} + +// GetPrivateLinkServiceNameOk returns a tuple with the PrivateLinkServiceName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1PrivateEndpointConnection) GetPrivateLinkServiceNameOk() (*string, bool) { + if o == nil || IsNil(o.PrivateLinkServiceName) { + return nil, false + } + return o.PrivateLinkServiceName, true +} + +// HasPrivateLinkServiceName returns a boolean if a field has been set. +func (o *V1beta1PrivateEndpointConnection) HasPrivateLinkServiceName() bool { + if o != nil && !IsNil(o.PrivateLinkServiceName) { + return true + } + + return false +} + +// SetPrivateLinkServiceName gets a reference to the given string and assigns it to the PrivateLinkServiceName field. +func (o *V1beta1PrivateEndpointConnection) SetPrivateLinkServiceName(v string) { + o.PrivateLinkServiceName = &v +} + +// GetPrivateLinkServiceState returns the PrivateLinkServiceState field value if set, zero value otherwise. +func (o *V1beta1PrivateEndpointConnection) GetPrivateLinkServiceState() V1beta1PrivateLinkServiceState { + if o == nil || IsNil(o.PrivateLinkServiceState) { + var ret V1beta1PrivateLinkServiceState + return ret + } + return *o.PrivateLinkServiceState +} + +// GetPrivateLinkServiceStateOk returns a tuple with the PrivateLinkServiceState field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1PrivateEndpointConnection) GetPrivateLinkServiceStateOk() (*V1beta1PrivateLinkServiceState, bool) { + if o == nil || IsNil(o.PrivateLinkServiceState) { + return nil, false + } + return o.PrivateLinkServiceState, true +} + +// HasPrivateLinkServiceState returns a boolean if a field has been set. +func (o *V1beta1PrivateEndpointConnection) HasPrivateLinkServiceState() bool { + if o != nil && !IsNil(o.PrivateLinkServiceState) { + return true + } + + return false +} + +// SetPrivateLinkServiceState gets a reference to the given V1beta1PrivateLinkServiceState and assigns it to the PrivateLinkServiceState field. +func (o *V1beta1PrivateEndpointConnection) SetPrivateLinkServiceState(v V1beta1PrivateLinkServiceState) { + o.PrivateLinkServiceState = &v +} + +// GetTidbNodeGroupDisplayName returns the TidbNodeGroupDisplayName field value if set, zero value otherwise. +func (o *V1beta1PrivateEndpointConnection) GetTidbNodeGroupDisplayName() string { + if o == nil || IsNil(o.TidbNodeGroupDisplayName) { + var ret string + return ret + } + return *o.TidbNodeGroupDisplayName +} + +// GetTidbNodeGroupDisplayNameOk returns a tuple with the TidbNodeGroupDisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1PrivateEndpointConnection) GetTidbNodeGroupDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.TidbNodeGroupDisplayName) { + return nil, false + } + return o.TidbNodeGroupDisplayName, true +} + +// HasTidbNodeGroupDisplayName returns a boolean if a field has been set. +func (o *V1beta1PrivateEndpointConnection) HasTidbNodeGroupDisplayName() bool { + if o != nil && !IsNil(o.TidbNodeGroupDisplayName) { + return true + } + + return false +} + +// SetTidbNodeGroupDisplayName gets a reference to the given string and assigns it to the TidbNodeGroupDisplayName field. +func (o *V1beta1PrivateEndpointConnection) SetTidbNodeGroupDisplayName(v string) { + o.TidbNodeGroupDisplayName = &v +} + +// GetAccountId returns the AccountId field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *V1beta1PrivateEndpointConnection) GetAccountId() string { + if o == nil || IsNil(o.AccountId.Get()) { + var ret string + return ret + } + return *o.AccountId.Get() +} + +// GetAccountIdOk returns a tuple with the AccountId field value if set, nil otherwise +// 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 *V1beta1PrivateEndpointConnection) GetAccountIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return o.AccountId.Get(), o.AccountId.IsSet() +} + +// HasAccountId returns a boolean if a field has been set. +func (o *V1beta1PrivateEndpointConnection) HasAccountId() bool { + if o != nil && o.AccountId.IsSet() { + return true + } + + return false +} + +// SetAccountId gets a reference to the given NullableString and assigns it to the AccountId field. +func (o *V1beta1PrivateEndpointConnection) SetAccountId(v string) { + o.AccountId.Set(&v) +} + +// SetAccountIdNil sets the value for AccountId to be an explicit nil +func (o *V1beta1PrivateEndpointConnection) SetAccountIdNil() { + o.AccountId.Set(nil) +} + +// UnsetAccountId ensures that no value is present for AccountId, not even an explicit nil +func (o *V1beta1PrivateEndpointConnection) UnsetAccountId() { + o.AccountId.Unset() +} + +// GetHost returns the Host field value if set, zero value otherwise. +func (o *V1beta1PrivateEndpointConnection) GetHost() string { + if o == nil || IsNil(o.Host) { + var ret string + return ret + } + return *o.Host +} + +// GetHostOk returns a tuple with the Host field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1PrivateEndpointConnection) GetHostOk() (*string, bool) { + if o == nil || IsNil(o.Host) { + return nil, false + } + return o.Host, true +} + +// HasHost returns a boolean if a field has been set. +func (o *V1beta1PrivateEndpointConnection) HasHost() bool { + if o != nil && !IsNil(o.Host) { + return true + } + + return false +} + +// SetHost gets a reference to the given string and assigns it to the Host field. +func (o *V1beta1PrivateEndpointConnection) SetHost(v string) { + o.Host = &v +} + +// GetPort returns the Port field value if set, zero value otherwise. +func (o *V1beta1PrivateEndpointConnection) GetPort() int32 { + if o == nil || IsNil(o.Port) { + var ret int32 + return ret + } + return *o.Port +} + +// GetPortOk returns a tuple with the Port field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1PrivateEndpointConnection) GetPortOk() (*int32, bool) { + if o == nil || IsNil(o.Port) { + return nil, false + } + return o.Port, true +} + +// HasPort returns a boolean if a field has been set. +func (o *V1beta1PrivateEndpointConnection) HasPort() bool { + if o != nil && !IsNil(o.Port) { + return true + } + + return false +} + +// SetPort gets a reference to the given int32 and assigns it to the Port field. +func (o *V1beta1PrivateEndpointConnection) SetPort(v int32) { + o.Port = &v +} + +func (o V1beta1PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1PrivateEndpointConnection) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + toSerialize["tidbNodeGroupId"] = o.TidbNodeGroupId + if !IsNil(o.PrivateEndpointConnectionId) { + toSerialize["privateEndpointConnectionId"] = o.PrivateEndpointConnectionId + } + if !IsNil(o.ClusterId) { + toSerialize["clusterId"] = o.ClusterId + } + if !IsNil(o.ClusterDisplayName) { + toSerialize["clusterDisplayName"] = o.ClusterDisplayName + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + toSerialize["endpointId"] = o.EndpointId + if o.PrivateIpAddress.IsSet() { + toSerialize["privateIpAddress"] = o.PrivateIpAddress.Get() + } + if !IsNil(o.EndpointState) { + toSerialize["endpointState"] = o.EndpointState + } + if !IsNil(o.Massage) { + toSerialize["massage"] = o.Massage + } + if !IsNil(o.RegionId) { + toSerialize["regionId"] = o.RegionId + } + if !IsNil(o.RegionDisplayName) { + toSerialize["regionDisplayName"] = o.RegionDisplayName + } + if !IsNil(o.CloudProvider) { + toSerialize["cloudProvider"] = o.CloudProvider + } + if !IsNil(o.PrivateLinkServiceName) { + toSerialize["privateLinkServiceName"] = o.PrivateLinkServiceName + } + if !IsNil(o.PrivateLinkServiceState) { + toSerialize["privateLinkServiceState"] = o.PrivateLinkServiceState + } + if !IsNil(o.TidbNodeGroupDisplayName) { + toSerialize["tidbNodeGroupDisplayName"] = o.TidbNodeGroupDisplayName + } + if o.AccountId.IsSet() { + toSerialize["accountId"] = o.AccountId.Get() + } + if !IsNil(o.Host) { + toSerialize["host"] = o.Host + } + if !IsNil(o.Port) { + toSerialize["port"] = o.Port + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1PrivateEndpointConnection) 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{ + "tidbNodeGroupId", + "endpointId", + } + + 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) + } + } + + varV1beta1PrivateEndpointConnection := _V1beta1PrivateEndpointConnection{} + + err = json.Unmarshal(data, &varV1beta1PrivateEndpointConnection) + + if err != nil { + return err + } + + *o = V1beta1PrivateEndpointConnection(varV1beta1PrivateEndpointConnection) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "tidbNodeGroupId") + delete(additionalProperties, "privateEndpointConnectionId") + delete(additionalProperties, "clusterId") + delete(additionalProperties, "clusterDisplayName") + delete(additionalProperties, "labels") + delete(additionalProperties, "endpointId") + delete(additionalProperties, "privateIpAddress") + delete(additionalProperties, "endpointState") + delete(additionalProperties, "massage") + delete(additionalProperties, "regionId") + delete(additionalProperties, "regionDisplayName") + delete(additionalProperties, "cloudProvider") + delete(additionalProperties, "privateLinkServiceName") + delete(additionalProperties, "privateLinkServiceState") + delete(additionalProperties, "tidbNodeGroupDisplayName") + delete(additionalProperties, "accountId") + delete(additionalProperties, "host") + delete(additionalProperties, "port") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1PrivateEndpointConnection struct { + value *V1beta1PrivateEndpointConnection + isSet bool +} + +func (v NullableV1beta1PrivateEndpointConnection) Get() *V1beta1PrivateEndpointConnection { + return v.value +} + +func (v *NullableV1beta1PrivateEndpointConnection) Set(val *V1beta1PrivateEndpointConnection) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1PrivateEndpointConnection) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1PrivateEndpointConnection) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1PrivateEndpointConnection(val *V1beta1PrivateEndpointConnection) *NullableV1beta1PrivateEndpointConnection { + return &NullableV1beta1PrivateEndpointConnection{value: val, isSet: true} +} + +func (v NullableV1beta1PrivateEndpointConnection) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1PrivateEndpointConnection) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_private_link_service_state.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_private_link_service_state.go new file mode 100644 index 00000000..e406491b --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_private_link_service_state.go @@ -0,0 +1,112 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// V1beta1PrivateLinkServiceState the model 'V1beta1PrivateLinkServiceState' +type V1beta1PrivateLinkServiceState string + +// List of v1beta1PrivateLinkServiceState +const ( + V1BETA1PRIVATELINKSERVICESTATE_CREATING V1beta1PrivateLinkServiceState = "CREATING" + V1BETA1PRIVATELINKSERVICESTATE_ACTIVE V1beta1PrivateLinkServiceState = "ACTIVE" + V1BETA1PRIVATELINKSERVICESTATE_DELETING V1beta1PrivateLinkServiceState = "DELETING" +) + +// All allowed values of V1beta1PrivateLinkServiceState enum +var AllowedV1beta1PrivateLinkServiceStateEnumValues = []V1beta1PrivateLinkServiceState{ + "CREATING", + "ACTIVE", + "DELETING", +} + +func (v *V1beta1PrivateLinkServiceState) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := V1beta1PrivateLinkServiceState(value) + for _, existing := range AllowedV1beta1PrivateLinkServiceStateEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid V1beta1PrivateLinkServiceState", value) +} + +// NewV1beta1PrivateLinkServiceStateFromValue returns a pointer to a valid V1beta1PrivateLinkServiceState +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewV1beta1PrivateLinkServiceStateFromValue(v string) (*V1beta1PrivateLinkServiceState, error) { + ev := V1beta1PrivateLinkServiceState(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for V1beta1PrivateLinkServiceState: valid values are %v", v, AllowedV1beta1PrivateLinkServiceStateEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v V1beta1PrivateLinkServiceState) IsValid() bool { + for _, existing := range AllowedV1beta1PrivateLinkServiceStateEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to v1beta1PrivateLinkServiceState value +func (v V1beta1PrivateLinkServiceState) Ptr() *V1beta1PrivateLinkServiceState { + return &v +} + +type NullableV1beta1PrivateLinkServiceState struct { + value *V1beta1PrivateLinkServiceState + isSet bool +} + +func (v NullableV1beta1PrivateLinkServiceState) Get() *V1beta1PrivateLinkServiceState { + return v.value +} + +func (v *NullableV1beta1PrivateLinkServiceState) Set(val *V1beta1PrivateLinkServiceState) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1PrivateLinkServiceState) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1PrivateLinkServiceState) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1PrivateLinkServiceState(val *V1beta1PrivateLinkServiceState) *NullableV1beta1PrivateLinkServiceState { + return &NullableV1beta1PrivateLinkServiceState{value: val, isSet: true} +} + +func (v NullableV1beta1PrivateLinkServiceState) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1PrivateLinkServiceState) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_public_endpoint_setting.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_public_endpoint_setting.go new file mode 100644 index 00000000..2a51b7c2 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_public_endpoint_setting.go @@ -0,0 +1,289 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the V1beta1PublicEndpointSetting type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1PublicEndpointSetting{} + +// V1beta1PublicEndpointSetting struct for V1beta1PublicEndpointSetting +type V1beta1PublicEndpointSetting struct { + Name *string `json:"name,omitempty"` + // If set to \"-\", the default TiDB group will be used. + TidbNodeGroupId string `json:"tidbNodeGroupId"` + Enabled NullableBool `json:"enabled,omitempty"` + IpAccessList []PublicEndpointSettingIpAccessList `json:"ipAccessList,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1PublicEndpointSetting V1beta1PublicEndpointSetting + +// NewV1beta1PublicEndpointSetting instantiates a new V1beta1PublicEndpointSetting 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 NewV1beta1PublicEndpointSetting(tidbNodeGroupId string) *V1beta1PublicEndpointSetting { + this := V1beta1PublicEndpointSetting{} + this.TidbNodeGroupId = tidbNodeGroupId + return &this +} + +// NewV1beta1PublicEndpointSettingWithDefaults instantiates a new V1beta1PublicEndpointSetting 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 NewV1beta1PublicEndpointSettingWithDefaults() *V1beta1PublicEndpointSetting { + this := V1beta1PublicEndpointSetting{} + return &this +} + +// GetName returns the Name field value if set, zero value otherwise. +func (o *V1beta1PublicEndpointSetting) GetName() string { + if o == nil || IsNil(o.Name) { + var ret string + return ret + } + return *o.Name +} + +// GetNameOk returns a tuple with the Name field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1PublicEndpointSetting) GetNameOk() (*string, bool) { + if o == nil || IsNil(o.Name) { + return nil, false + } + return o.Name, true +} + +// HasName returns a boolean if a field has been set. +func (o *V1beta1PublicEndpointSetting) HasName() bool { + if o != nil && !IsNil(o.Name) { + return true + } + + return false +} + +// SetName gets a reference to the given string and assigns it to the Name field. +func (o *V1beta1PublicEndpointSetting) SetName(v string) { + o.Name = &v +} + +// GetTidbNodeGroupId returns the TidbNodeGroupId field value +func (o *V1beta1PublicEndpointSetting) GetTidbNodeGroupId() string { + if o == nil { + var ret string + return ret + } + + return o.TidbNodeGroupId +} + +// GetTidbNodeGroupIdOk returns a tuple with the TidbNodeGroupId field value +// and a boolean to check if the value has been set. +func (o *V1beta1PublicEndpointSetting) GetTidbNodeGroupIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TidbNodeGroupId, true +} + +// SetTidbNodeGroupId sets field value +func (o *V1beta1PublicEndpointSetting) SetTidbNodeGroupId(v string) { + o.TidbNodeGroupId = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *V1beta1PublicEndpointSetting) GetEnabled() bool { + if o == nil || IsNil(o.Enabled.Get()) { + var ret bool + return ret + } + return *o.Enabled.Get() +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// 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 *V1beta1PublicEndpointSetting) GetEnabledOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.Enabled.Get(), o.Enabled.IsSet() +} + +// HasEnabled returns a boolean if a field has been set. +func (o *V1beta1PublicEndpointSetting) HasEnabled() bool { + if o != nil && o.Enabled.IsSet() { + return true + } + + return false +} + +// SetEnabled gets a reference to the given NullableBool and assigns it to the Enabled field. +func (o *V1beta1PublicEndpointSetting) SetEnabled(v bool) { + o.Enabled.Set(&v) +} + +// SetEnabledNil sets the value for Enabled to be an explicit nil +func (o *V1beta1PublicEndpointSetting) SetEnabledNil() { + o.Enabled.Set(nil) +} + +// UnsetEnabled ensures that no value is present for Enabled, not even an explicit nil +func (o *V1beta1PublicEndpointSetting) UnsetEnabled() { + o.Enabled.Unset() +} + +// GetIpAccessList returns the IpAccessList field value if set, zero value otherwise. +func (o *V1beta1PublicEndpointSetting) GetIpAccessList() []PublicEndpointSettingIpAccessList { + if o == nil || IsNil(o.IpAccessList) { + var ret []PublicEndpointSettingIpAccessList + return ret + } + return o.IpAccessList +} + +// GetIpAccessListOk returns a tuple with the IpAccessList field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1PublicEndpointSetting) GetIpAccessListOk() ([]PublicEndpointSettingIpAccessList, bool) { + if o == nil || IsNil(o.IpAccessList) { + return nil, false + } + return o.IpAccessList, true +} + +// HasIpAccessList returns a boolean if a field has been set. +func (o *V1beta1PublicEndpointSetting) HasIpAccessList() bool { + if o != nil && !IsNil(o.IpAccessList) { + return true + } + + return false +} + +// SetIpAccessList gets a reference to the given []PublicEndpointSettingIpAccessList and assigns it to the IpAccessList field. +func (o *V1beta1PublicEndpointSetting) SetIpAccessList(v []PublicEndpointSettingIpAccessList) { + o.IpAccessList = v +} + +func (o V1beta1PublicEndpointSetting) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1PublicEndpointSetting) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.Name) { + toSerialize["name"] = o.Name + } + toSerialize["tidbNodeGroupId"] = o.TidbNodeGroupId + if o.Enabled.IsSet() { + toSerialize["enabled"] = o.Enabled.Get() + } + if !IsNil(o.IpAccessList) { + toSerialize["ipAccessList"] = o.IpAccessList + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1PublicEndpointSetting) 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{ + "tidbNodeGroupId", + } + + 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) + } + } + + varV1beta1PublicEndpointSetting := _V1beta1PublicEndpointSetting{} + + err = json.Unmarshal(data, &varV1beta1PublicEndpointSetting) + + if err != nil { + return err + } + + *o = V1beta1PublicEndpointSetting(varV1beta1PublicEndpointSetting) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "name") + delete(additionalProperties, "tidbNodeGroupId") + delete(additionalProperties, "enabled") + delete(additionalProperties, "ipAccessList") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1PublicEndpointSetting struct { + value *V1beta1PublicEndpointSetting + isSet bool +} + +func (v NullableV1beta1PublicEndpointSetting) Get() *V1beta1PublicEndpointSetting { + return v.value +} + +func (v *NullableV1beta1PublicEndpointSetting) Set(val *V1beta1PublicEndpointSetting) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1PublicEndpointSetting) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1PublicEndpointSetting) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1PublicEndpointSetting(val *V1beta1PublicEndpointSetting) *NullableV1beta1PublicEndpointSetting { + return &NullableV1beta1PublicEndpointSetting{value: val, isSet: true} +} + +func (v NullableV1beta1PublicEndpointSetting) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1PublicEndpointSetting) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_region_cloud_provider.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_region_cloud_provider.go new file mode 100644 index 00000000..2ba3a8c2 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_region_cloud_provider.go @@ -0,0 +1,112 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// V1beta1RegionCloudProvider Enum of cloud provider names. - aws: Amazon Web Services. buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - gcp: Google Cloud Platform. buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE - azure: Microsoft Azure. buf:lint:ignore ENUM_VALUE_UPPER_SNAKE_CASE +type V1beta1RegionCloudProvider string + +// List of v1beta1RegionCloudProvider +const ( + V1BETA1REGIONCLOUDPROVIDER_AWS V1beta1RegionCloudProvider = "aws" + V1BETA1REGIONCLOUDPROVIDER_GCP V1beta1RegionCloudProvider = "gcp" + V1BETA1REGIONCLOUDPROVIDER_AZURE V1beta1RegionCloudProvider = "azure" +) + +// All allowed values of V1beta1RegionCloudProvider enum +var AllowedV1beta1RegionCloudProviderEnumValues = []V1beta1RegionCloudProvider{ + "aws", + "gcp", + "azure", +} + +func (v *V1beta1RegionCloudProvider) UnmarshalJSON(src []byte) error { + var value string + err := json.Unmarshal(src, &value) + if err != nil { + return err + } + enumTypeValue := V1beta1RegionCloudProvider(value) + for _, existing := range AllowedV1beta1RegionCloudProviderEnumValues { + if existing == enumTypeValue { + *v = enumTypeValue + return nil + } + } + + return fmt.Errorf("%+v is not a valid V1beta1RegionCloudProvider", value) +} + +// NewV1beta1RegionCloudProviderFromValue returns a pointer to a valid V1beta1RegionCloudProvider +// for the value passed as argument, or an error if the value passed is not allowed by the enum +func NewV1beta1RegionCloudProviderFromValue(v string) (*V1beta1RegionCloudProvider, error) { + ev := V1beta1RegionCloudProvider(v) + if ev.IsValid() { + return &ev, nil + } else { + return nil, fmt.Errorf("invalid value '%v' for V1beta1RegionCloudProvider: valid values are %v", v, AllowedV1beta1RegionCloudProviderEnumValues) + } +} + +// IsValid return true if the value is valid for the enum, false otherwise +func (v V1beta1RegionCloudProvider) IsValid() bool { + for _, existing := range AllowedV1beta1RegionCloudProviderEnumValues { + if existing == v { + return true + } + } + return false +} + +// Ptr returns reference to v1beta1RegionCloudProvider value +func (v V1beta1RegionCloudProvider) Ptr() *V1beta1RegionCloudProvider { + return &v +} + +type NullableV1beta1RegionCloudProvider struct { + value *V1beta1RegionCloudProvider + isSet bool +} + +func (v NullableV1beta1RegionCloudProvider) Get() *V1beta1RegionCloudProvider { + return v.value +} + +func (v *NullableV1beta1RegionCloudProvider) Set(val *V1beta1RegionCloudProvider) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1RegionCloudProvider) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1RegionCloudProvider) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1RegionCloudProvider(val *V1beta1RegionCloudProvider) *NullableV1beta1RegionCloudProvider { + return &NullableV1beta1RegionCloudProvider{value: val, isSet: true} +} + +func (v NullableV1beta1RegionCloudProvider) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1RegionCloudProvider) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_show_cloud_providers_response.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_show_cloud_providers_response.go new file mode 100644 index 00000000..de3c2637 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_show_cloud_providers_response.go @@ -0,0 +1,153 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the V1beta1ShowCloudProvidersResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1ShowCloudProvidersResponse{} + +// V1beta1ShowCloudProvidersResponse struct for V1beta1ShowCloudProvidersResponse +type V1beta1ShowCloudProvidersResponse struct { + CloudProviders []V1beta1RegionCloudProvider `json:"cloudProviders,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1ShowCloudProvidersResponse V1beta1ShowCloudProvidersResponse + +// NewV1beta1ShowCloudProvidersResponse instantiates a new V1beta1ShowCloudProvidersResponse 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 NewV1beta1ShowCloudProvidersResponse() *V1beta1ShowCloudProvidersResponse { + this := V1beta1ShowCloudProvidersResponse{} + return &this +} + +// NewV1beta1ShowCloudProvidersResponseWithDefaults instantiates a new V1beta1ShowCloudProvidersResponse 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 NewV1beta1ShowCloudProvidersResponseWithDefaults() *V1beta1ShowCloudProvidersResponse { + this := V1beta1ShowCloudProvidersResponse{} + return &this +} + +// GetCloudProviders returns the CloudProviders field value if set, zero value otherwise. +func (o *V1beta1ShowCloudProvidersResponse) GetCloudProviders() []V1beta1RegionCloudProvider { + if o == nil || IsNil(o.CloudProviders) { + var ret []V1beta1RegionCloudProvider + return ret + } + return o.CloudProviders +} + +// GetCloudProvidersOk returns a tuple with the CloudProviders field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ShowCloudProvidersResponse) GetCloudProvidersOk() ([]V1beta1RegionCloudProvider, bool) { + if o == nil || IsNil(o.CloudProviders) { + return nil, false + } + return o.CloudProviders, true +} + +// HasCloudProviders returns a boolean if a field has been set. +func (o *V1beta1ShowCloudProvidersResponse) HasCloudProviders() bool { + if o != nil && !IsNil(o.CloudProviders) { + return true + } + + return false +} + +// SetCloudProviders gets a reference to the given []V1beta1RegionCloudProvider and assigns it to the CloudProviders field. +func (o *V1beta1ShowCloudProvidersResponse) SetCloudProviders(v []V1beta1RegionCloudProvider) { + o.CloudProviders = v +} + +func (o V1beta1ShowCloudProvidersResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1ShowCloudProvidersResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.CloudProviders) { + toSerialize["cloudProviders"] = o.CloudProviders + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1ShowCloudProvidersResponse) UnmarshalJSON(data []byte) (err error) { + varV1beta1ShowCloudProvidersResponse := _V1beta1ShowCloudProvidersResponse{} + + err = json.Unmarshal(data, &varV1beta1ShowCloudProvidersResponse) + + if err != nil { + return err + } + + *o = V1beta1ShowCloudProvidersResponse(varV1beta1ShowCloudProvidersResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "cloudProviders") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1ShowCloudProvidersResponse struct { + value *V1beta1ShowCloudProvidersResponse + isSet bool +} + +func (v NullableV1beta1ShowCloudProvidersResponse) Get() *V1beta1ShowCloudProvidersResponse { + return v.value +} + +func (v *NullableV1beta1ShowCloudProvidersResponse) Set(val *V1beta1ShowCloudProvidersResponse) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1ShowCloudProvidersResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1ShowCloudProvidersResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1ShowCloudProvidersResponse(val *V1beta1ShowCloudProvidersResponse) *NullableV1beta1ShowCloudProvidersResponse { + return &NullableV1beta1ShowCloudProvidersResponse{value: val, isSet: true} +} + +func (v NullableV1beta1ShowCloudProvidersResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1ShowCloudProvidersResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_show_node_quota_response.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_show_node_quota_response.go new file mode 100644 index 00000000..bf8612bf --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_show_node_quota_response.go @@ -0,0 +1,153 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the V1beta1ShowNodeQuotaResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1ShowNodeQuotaResponse{} + +// V1beta1ShowNodeQuotaResponse struct for V1beta1ShowNodeQuotaResponse +type V1beta1ShowNodeQuotaResponse struct { + ComponentQuotas []ShowNodeQuotaResponseComponentQuota `json:"componentQuotas,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1ShowNodeQuotaResponse V1beta1ShowNodeQuotaResponse + +// NewV1beta1ShowNodeQuotaResponse instantiates a new V1beta1ShowNodeQuotaResponse 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 NewV1beta1ShowNodeQuotaResponse() *V1beta1ShowNodeQuotaResponse { + this := V1beta1ShowNodeQuotaResponse{} + return &this +} + +// NewV1beta1ShowNodeQuotaResponseWithDefaults instantiates a new V1beta1ShowNodeQuotaResponse 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 NewV1beta1ShowNodeQuotaResponseWithDefaults() *V1beta1ShowNodeQuotaResponse { + this := V1beta1ShowNodeQuotaResponse{} + return &this +} + +// GetComponentQuotas returns the ComponentQuotas field value if set, zero value otherwise. +func (o *V1beta1ShowNodeQuotaResponse) GetComponentQuotas() []ShowNodeQuotaResponseComponentQuota { + if o == nil || IsNil(o.ComponentQuotas) { + var ret []ShowNodeQuotaResponseComponentQuota + return ret + } + return o.ComponentQuotas +} + +// GetComponentQuotasOk returns a tuple with the ComponentQuotas field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ShowNodeQuotaResponse) GetComponentQuotasOk() ([]ShowNodeQuotaResponseComponentQuota, bool) { + if o == nil || IsNil(o.ComponentQuotas) { + return nil, false + } + return o.ComponentQuotas, true +} + +// HasComponentQuotas returns a boolean if a field has been set. +func (o *V1beta1ShowNodeQuotaResponse) HasComponentQuotas() bool { + if o != nil && !IsNil(o.ComponentQuotas) { + return true + } + + return false +} + +// SetComponentQuotas gets a reference to the given []ShowNodeQuotaResponseComponentQuota and assigns it to the ComponentQuotas field. +func (o *V1beta1ShowNodeQuotaResponse) SetComponentQuotas(v []ShowNodeQuotaResponseComponentQuota) { + o.ComponentQuotas = v +} + +func (o V1beta1ShowNodeQuotaResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1ShowNodeQuotaResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.ComponentQuotas) { + toSerialize["componentQuotas"] = o.ComponentQuotas + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1ShowNodeQuotaResponse) UnmarshalJSON(data []byte) (err error) { + varV1beta1ShowNodeQuotaResponse := _V1beta1ShowNodeQuotaResponse{} + + err = json.Unmarshal(data, &varV1beta1ShowNodeQuotaResponse) + + if err != nil { + return err + } + + *o = V1beta1ShowNodeQuotaResponse(varV1beta1ShowNodeQuotaResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "componentQuotas") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1ShowNodeQuotaResponse struct { + value *V1beta1ShowNodeQuotaResponse + isSet bool +} + +func (v NullableV1beta1ShowNodeQuotaResponse) Get() *V1beta1ShowNodeQuotaResponse { + return v.value +} + +func (v *NullableV1beta1ShowNodeQuotaResponse) Set(val *V1beta1ShowNodeQuotaResponse) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1ShowNodeQuotaResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1ShowNodeQuotaResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1ShowNodeQuotaResponse(val *V1beta1ShowNodeQuotaResponse) *NullableV1beta1ShowNodeQuotaResponse { + return &NullableV1beta1ShowNodeQuotaResponse{value: val, isSet: true} +} + +func (v NullableV1beta1ShowNodeQuotaResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1ShowNodeQuotaResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_show_object_storage_access_iam_principal_response.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_show_object_storage_access_iam_principal_response.go new file mode 100644 index 00000000..d3e21915 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_show_object_storage_access_iam_principal_response.go @@ -0,0 +1,153 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the V1beta1ShowObjectStorageAccessIamPrincipalResponse type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1ShowObjectStorageAccessIamPrincipalResponse{} + +// V1beta1ShowObjectStorageAccessIamPrincipalResponse struct for V1beta1ShowObjectStorageAccessIamPrincipalResponse +type V1beta1ShowObjectStorageAccessIamPrincipalResponse struct { + IamPrincipal *string `json:"iamPrincipal,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1ShowObjectStorageAccessIamPrincipalResponse V1beta1ShowObjectStorageAccessIamPrincipalResponse + +// NewV1beta1ShowObjectStorageAccessIamPrincipalResponse instantiates a new V1beta1ShowObjectStorageAccessIamPrincipalResponse 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 NewV1beta1ShowObjectStorageAccessIamPrincipalResponse() *V1beta1ShowObjectStorageAccessIamPrincipalResponse { + this := V1beta1ShowObjectStorageAccessIamPrincipalResponse{} + return &this +} + +// NewV1beta1ShowObjectStorageAccessIamPrincipalResponseWithDefaults instantiates a new V1beta1ShowObjectStorageAccessIamPrincipalResponse 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 NewV1beta1ShowObjectStorageAccessIamPrincipalResponseWithDefaults() *V1beta1ShowObjectStorageAccessIamPrincipalResponse { + this := V1beta1ShowObjectStorageAccessIamPrincipalResponse{} + return &this +} + +// GetIamPrincipal returns the IamPrincipal field value if set, zero value otherwise. +func (o *V1beta1ShowObjectStorageAccessIamPrincipalResponse) GetIamPrincipal() string { + if o == nil || IsNil(o.IamPrincipal) { + var ret string + return ret + } + return *o.IamPrincipal +} + +// GetIamPrincipalOk returns a tuple with the IamPrincipal field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1ShowObjectStorageAccessIamPrincipalResponse) GetIamPrincipalOk() (*string, bool) { + if o == nil || IsNil(o.IamPrincipal) { + return nil, false + } + return o.IamPrincipal, true +} + +// HasIamPrincipal returns a boolean if a field has been set. +func (o *V1beta1ShowObjectStorageAccessIamPrincipalResponse) HasIamPrincipal() bool { + if o != nil && !IsNil(o.IamPrincipal) { + return true + } + + return false +} + +// SetIamPrincipal gets a reference to the given string and assigns it to the IamPrincipal field. +func (o *V1beta1ShowObjectStorageAccessIamPrincipalResponse) SetIamPrincipal(v string) { + o.IamPrincipal = &v +} + +func (o V1beta1ShowObjectStorageAccessIamPrincipalResponse) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1ShowObjectStorageAccessIamPrincipalResponse) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.IamPrincipal) { + toSerialize["iamPrincipal"] = o.IamPrincipal + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1ShowObjectStorageAccessIamPrincipalResponse) UnmarshalJSON(data []byte) (err error) { + varV1beta1ShowObjectStorageAccessIamPrincipalResponse := _V1beta1ShowObjectStorageAccessIamPrincipalResponse{} + + err = json.Unmarshal(data, &varV1beta1ShowObjectStorageAccessIamPrincipalResponse) + + if err != nil { + return err + } + + *o = V1beta1ShowObjectStorageAccessIamPrincipalResponse(varV1beta1ShowObjectStorageAccessIamPrincipalResponse) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "iamPrincipal") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1ShowObjectStorageAccessIamPrincipalResponse struct { + value *V1beta1ShowObjectStorageAccessIamPrincipalResponse + isSet bool +} + +func (v NullableV1beta1ShowObjectStorageAccessIamPrincipalResponse) Get() *V1beta1ShowObjectStorageAccessIamPrincipalResponse { + return v.value +} + +func (v *NullableV1beta1ShowObjectStorageAccessIamPrincipalResponse) Set(val *V1beta1ShowObjectStorageAccessIamPrincipalResponse) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1ShowObjectStorageAccessIamPrincipalResponse) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1ShowObjectStorageAccessIamPrincipalResponse) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1ShowObjectStorageAccessIamPrincipalResponse(val *V1beta1ShowObjectStorageAccessIamPrincipalResponse) *NullableV1beta1ShowObjectStorageAccessIamPrincipalResponse { + return &NullableV1beta1ShowObjectStorageAccessIamPrincipalResponse{value: val, isSet: true} +} + +func (v NullableV1beta1ShowObjectStorageAccessIamPrincipalResponse) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1ShowObjectStorageAccessIamPrincipalResponse) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_update_audit_log_config_request_audit_log_config.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_update_audit_log_config_request_audit_log_config.go new file mode 100644 index 00000000..78ef22f8 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_update_audit_log_config_request_audit_log_config.go @@ -0,0 +1,362 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the V1beta1UpdateAuditLogConfigRequestAuditLogConfig type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1UpdateAuditLogConfigRequestAuditLogConfig{} + +// V1beta1UpdateAuditLogConfigRequestAuditLogConfig struct for V1beta1UpdateAuditLogConfigRequestAuditLogConfig +type V1beta1UpdateAuditLogConfigRequestAuditLogConfig struct { + ClusterId string `json:"clusterId"` + Enabled NullableBool `json:"enabled,omitempty"` + BucketUri *string `json:"bucketUri,omitempty"` + BucketRegionId *string `json:"bucketRegionId,omitempty"` + AwsRoleArn *string `json:"awsRoleArn,omitempty"` + AzureSasToken *string `json:"azureSasToken,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1UpdateAuditLogConfigRequestAuditLogConfig V1beta1UpdateAuditLogConfigRequestAuditLogConfig + +// NewV1beta1UpdateAuditLogConfigRequestAuditLogConfig instantiates a new V1beta1UpdateAuditLogConfigRequestAuditLogConfig 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 NewV1beta1UpdateAuditLogConfigRequestAuditLogConfig(clusterId string) *V1beta1UpdateAuditLogConfigRequestAuditLogConfig { + this := V1beta1UpdateAuditLogConfigRequestAuditLogConfig{} + this.ClusterId = clusterId + return &this +} + +// NewV1beta1UpdateAuditLogConfigRequestAuditLogConfigWithDefaults instantiates a new V1beta1UpdateAuditLogConfigRequestAuditLogConfig 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 NewV1beta1UpdateAuditLogConfigRequestAuditLogConfigWithDefaults() *V1beta1UpdateAuditLogConfigRequestAuditLogConfig { + this := V1beta1UpdateAuditLogConfigRequestAuditLogConfig{} + return &this +} + +// GetClusterId returns the ClusterId field value +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) GetClusterId() string { + if o == nil { + var ret string + return ret + } + + return o.ClusterId +} + +// GetClusterIdOk returns a tuple with the ClusterId field value +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) GetClusterIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClusterId, true +} + +// SetClusterId sets field value +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) SetClusterId(v string) { + o.ClusterId = v +} + +// GetEnabled returns the Enabled field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) GetEnabled() bool { + if o == nil || IsNil(o.Enabled.Get()) { + var ret bool + return ret + } + return *o.Enabled.Get() +} + +// GetEnabledOk returns a tuple with the Enabled field value if set, nil otherwise +// 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 *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) GetEnabledOk() (*bool, bool) { + if o == nil { + return nil, false + } + return o.Enabled.Get(), o.Enabled.IsSet() +} + +// HasEnabled returns a boolean if a field has been set. +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) HasEnabled() bool { + if o != nil && o.Enabled.IsSet() { + return true + } + + return false +} + +// SetEnabled gets a reference to the given NullableBool and assigns it to the Enabled field. +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) SetEnabled(v bool) { + o.Enabled.Set(&v) +} + +// SetEnabledNil sets the value for Enabled to be an explicit nil +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) SetEnabledNil() { + o.Enabled.Set(nil) +} + +// UnsetEnabled ensures that no value is present for Enabled, not even an explicit nil +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) UnsetEnabled() { + o.Enabled.Unset() +} + +// GetBucketUri returns the BucketUri field value if set, zero value otherwise. +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) GetBucketUri() string { + if o == nil || IsNil(o.BucketUri) { + var ret string + return ret + } + return *o.BucketUri +} + +// GetBucketUriOk returns a tuple with the BucketUri field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) GetBucketUriOk() (*string, bool) { + if o == nil || IsNil(o.BucketUri) { + return nil, false + } + return o.BucketUri, true +} + +// HasBucketUri returns a boolean if a field has been set. +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) HasBucketUri() bool { + if o != nil && !IsNil(o.BucketUri) { + return true + } + + return false +} + +// SetBucketUri gets a reference to the given string and assigns it to the BucketUri field. +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) SetBucketUri(v string) { + o.BucketUri = &v +} + +// GetBucketRegionId returns the BucketRegionId field value if set, zero value otherwise. +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) GetBucketRegionId() string { + if o == nil || IsNil(o.BucketRegionId) { + var ret string + return ret + } + return *o.BucketRegionId +} + +// GetBucketRegionIdOk returns a tuple with the BucketRegionId field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) GetBucketRegionIdOk() (*string, bool) { + if o == nil || IsNil(o.BucketRegionId) { + return nil, false + } + return o.BucketRegionId, true +} + +// HasBucketRegionId returns a boolean if a field has been set. +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) HasBucketRegionId() bool { + if o != nil && !IsNil(o.BucketRegionId) { + return true + } + + return false +} + +// SetBucketRegionId gets a reference to the given string and assigns it to the BucketRegionId field. +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) SetBucketRegionId(v string) { + o.BucketRegionId = &v +} + +// GetAwsRoleArn returns the AwsRoleArn field value if set, zero value otherwise. +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) GetAwsRoleArn() string { + if o == nil || IsNil(o.AwsRoleArn) { + var ret string + return ret + } + return *o.AwsRoleArn +} + +// GetAwsRoleArnOk returns a tuple with the AwsRoleArn field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) GetAwsRoleArnOk() (*string, bool) { + if o == nil || IsNil(o.AwsRoleArn) { + return nil, false + } + return o.AwsRoleArn, true +} + +// HasAwsRoleArn returns a boolean if a field has been set. +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) HasAwsRoleArn() bool { + if o != nil && !IsNil(o.AwsRoleArn) { + return true + } + + return false +} + +// SetAwsRoleArn gets a reference to the given string and assigns it to the AwsRoleArn field. +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) SetAwsRoleArn(v string) { + o.AwsRoleArn = &v +} + +// GetAzureSasToken returns the AzureSasToken field value if set, zero value otherwise. +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) GetAzureSasToken() string { + if o == nil || IsNil(o.AzureSasToken) { + var ret string + return ret + } + return *o.AzureSasToken +} + +// GetAzureSasTokenOk returns a tuple with the AzureSasToken field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) GetAzureSasTokenOk() (*string, bool) { + if o == nil || IsNil(o.AzureSasToken) { + return nil, false + } + return o.AzureSasToken, true +} + +// HasAzureSasToken returns a boolean if a field has been set. +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) HasAzureSasToken() bool { + if o != nil && !IsNil(o.AzureSasToken) { + return true + } + + return false +} + +// SetAzureSasToken gets a reference to the given string and assigns it to the AzureSasToken field. +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) SetAzureSasToken(v string) { + o.AzureSasToken = &v +} + +func (o V1beta1UpdateAuditLogConfigRequestAuditLogConfig) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1UpdateAuditLogConfigRequestAuditLogConfig) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["clusterId"] = o.ClusterId + if o.Enabled.IsSet() { + toSerialize["enabled"] = o.Enabled.Get() + } + if !IsNil(o.BucketUri) { + toSerialize["bucketUri"] = o.BucketUri + } + if !IsNil(o.BucketRegionId) { + toSerialize["bucketRegionId"] = o.BucketRegionId + } + if !IsNil(o.AwsRoleArn) { + toSerialize["awsRoleArn"] = o.AwsRoleArn + } + if !IsNil(o.AzureSasToken) { + toSerialize["azureSasToken"] = o.AzureSasToken + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) 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{ + "clusterId", + } + + 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) + } + } + + varV1beta1UpdateAuditLogConfigRequestAuditLogConfig := _V1beta1UpdateAuditLogConfigRequestAuditLogConfig{} + + err = json.Unmarshal(data, &varV1beta1UpdateAuditLogConfigRequestAuditLogConfig) + + if err != nil { + return err + } + + *o = V1beta1UpdateAuditLogConfigRequestAuditLogConfig(varV1beta1UpdateAuditLogConfigRequestAuditLogConfig) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "clusterId") + delete(additionalProperties, "enabled") + delete(additionalProperties, "bucketUri") + delete(additionalProperties, "bucketRegionId") + delete(additionalProperties, "awsRoleArn") + delete(additionalProperties, "azureSasToken") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1UpdateAuditLogConfigRequestAuditLogConfig struct { + value *V1beta1UpdateAuditLogConfigRequestAuditLogConfig + isSet bool +} + +func (v NullableV1beta1UpdateAuditLogConfigRequestAuditLogConfig) Get() *V1beta1UpdateAuditLogConfigRequestAuditLogConfig { + return v.value +} + +func (v *NullableV1beta1UpdateAuditLogConfigRequestAuditLogConfig) Set(val *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1UpdateAuditLogConfigRequestAuditLogConfig) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1UpdateAuditLogConfigRequestAuditLogConfig) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1UpdateAuditLogConfigRequestAuditLogConfig(val *V1beta1UpdateAuditLogConfigRequestAuditLogConfig) *NullableV1beta1UpdateAuditLogConfigRequestAuditLogConfig { + return &NullableV1beta1UpdateAuditLogConfigRequestAuditLogConfig{value: val, isSet: true} +} + +func (v NullableV1beta1UpdateAuditLogConfigRequestAuditLogConfig) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1UpdateAuditLogConfigRequestAuditLogConfig) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_update_cluster_request_cluster.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_update_cluster_request_cluster.go new file mode 100644 index 00000000..e5329e80 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_update_cluster_request_cluster.go @@ -0,0 +1,352 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the V1beta1UpdateClusterRequestCluster type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1UpdateClusterRequestCluster{} + +// V1beta1UpdateClusterRequestCluster struct for V1beta1UpdateClusterRequestCluster +type V1beta1UpdateClusterRequestCluster struct { + ClusterId string `json:"clusterId"` + TidbNodeSetting *V1beta1UpdateClusterRequestTidbNodeSetting `json:"tidbNodeSetting,omitempty"` + TikvNodeSetting *V1beta1UpdateClusterRequestStorageNodeSetting `json:"tikvNodeSetting,omitempty"` + TiflashNodeSetting *V1beta1UpdateClusterRequestStorageNodeSetting `json:"tiflashNodeSetting,omitempty"` + DisplayName *string `json:"displayName,omitempty"` + // The project_id key cannot be updated. If the project_id key is specified, it will be ignored. + Labels *map[string]string `json:"labels,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1UpdateClusterRequestCluster V1beta1UpdateClusterRequestCluster + +// NewV1beta1UpdateClusterRequestCluster instantiates a new V1beta1UpdateClusterRequestCluster 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 NewV1beta1UpdateClusterRequestCluster(clusterId string) *V1beta1UpdateClusterRequestCluster { + this := V1beta1UpdateClusterRequestCluster{} + this.ClusterId = clusterId + return &this +} + +// NewV1beta1UpdateClusterRequestClusterWithDefaults instantiates a new V1beta1UpdateClusterRequestCluster 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 NewV1beta1UpdateClusterRequestClusterWithDefaults() *V1beta1UpdateClusterRequestCluster { + this := V1beta1UpdateClusterRequestCluster{} + return &this +} + +// GetClusterId returns the ClusterId field value +func (o *V1beta1UpdateClusterRequestCluster) GetClusterId() string { + if o == nil { + var ret string + return ret + } + + return o.ClusterId +} + +// GetClusterIdOk returns a tuple with the ClusterId field value +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateClusterRequestCluster) GetClusterIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClusterId, true +} + +// SetClusterId sets field value +func (o *V1beta1UpdateClusterRequestCluster) SetClusterId(v string) { + o.ClusterId = v +} + +// GetTidbNodeSetting returns the TidbNodeSetting field value if set, zero value otherwise. +func (o *V1beta1UpdateClusterRequestCluster) GetTidbNodeSetting() V1beta1UpdateClusterRequestTidbNodeSetting { + if o == nil || IsNil(o.TidbNodeSetting) { + var ret V1beta1UpdateClusterRequestTidbNodeSetting + return ret + } + return *o.TidbNodeSetting +} + +// GetTidbNodeSettingOk returns a tuple with the TidbNodeSetting field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateClusterRequestCluster) GetTidbNodeSettingOk() (*V1beta1UpdateClusterRequestTidbNodeSetting, bool) { + if o == nil || IsNil(o.TidbNodeSetting) { + return nil, false + } + return o.TidbNodeSetting, true +} + +// HasTidbNodeSetting returns a boolean if a field has been set. +func (o *V1beta1UpdateClusterRequestCluster) HasTidbNodeSetting() bool { + if o != nil && !IsNil(o.TidbNodeSetting) { + return true + } + + return false +} + +// SetTidbNodeSetting gets a reference to the given V1beta1UpdateClusterRequestTidbNodeSetting and assigns it to the TidbNodeSetting field. +func (o *V1beta1UpdateClusterRequestCluster) SetTidbNodeSetting(v V1beta1UpdateClusterRequestTidbNodeSetting) { + o.TidbNodeSetting = &v +} + +// GetTikvNodeSetting returns the TikvNodeSetting field value if set, zero value otherwise. +func (o *V1beta1UpdateClusterRequestCluster) GetTikvNodeSetting() V1beta1UpdateClusterRequestStorageNodeSetting { + if o == nil || IsNil(o.TikvNodeSetting) { + var ret V1beta1UpdateClusterRequestStorageNodeSetting + return ret + } + return *o.TikvNodeSetting +} + +// GetTikvNodeSettingOk returns a tuple with the TikvNodeSetting field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateClusterRequestCluster) GetTikvNodeSettingOk() (*V1beta1UpdateClusterRequestStorageNodeSetting, bool) { + if o == nil || IsNil(o.TikvNodeSetting) { + return nil, false + } + return o.TikvNodeSetting, true +} + +// HasTikvNodeSetting returns a boolean if a field has been set. +func (o *V1beta1UpdateClusterRequestCluster) HasTikvNodeSetting() bool { + if o != nil && !IsNil(o.TikvNodeSetting) { + return true + } + + return false +} + +// SetTikvNodeSetting gets a reference to the given V1beta1UpdateClusterRequestStorageNodeSetting and assigns it to the TikvNodeSetting field. +func (o *V1beta1UpdateClusterRequestCluster) SetTikvNodeSetting(v V1beta1UpdateClusterRequestStorageNodeSetting) { + o.TikvNodeSetting = &v +} + +// GetTiflashNodeSetting returns the TiflashNodeSetting field value if set, zero value otherwise. +func (o *V1beta1UpdateClusterRequestCluster) GetTiflashNodeSetting() V1beta1UpdateClusterRequestStorageNodeSetting { + if o == nil || IsNil(o.TiflashNodeSetting) { + var ret V1beta1UpdateClusterRequestStorageNodeSetting + return ret + } + return *o.TiflashNodeSetting +} + +// GetTiflashNodeSettingOk returns a tuple with the TiflashNodeSetting field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateClusterRequestCluster) GetTiflashNodeSettingOk() (*V1beta1UpdateClusterRequestStorageNodeSetting, bool) { + if o == nil || IsNil(o.TiflashNodeSetting) { + return nil, false + } + return o.TiflashNodeSetting, true +} + +// HasTiflashNodeSetting returns a boolean if a field has been set. +func (o *V1beta1UpdateClusterRequestCluster) HasTiflashNodeSetting() bool { + if o != nil && !IsNil(o.TiflashNodeSetting) { + return true + } + + return false +} + +// SetTiflashNodeSetting gets a reference to the given V1beta1UpdateClusterRequestStorageNodeSetting and assigns it to the TiflashNodeSetting field. +func (o *V1beta1UpdateClusterRequestCluster) SetTiflashNodeSetting(v V1beta1UpdateClusterRequestStorageNodeSetting) { + o.TiflashNodeSetting = &v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *V1beta1UpdateClusterRequestCluster) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateClusterRequestCluster) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *V1beta1UpdateClusterRequestCluster) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *V1beta1UpdateClusterRequestCluster) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetLabels returns the Labels field value if set, zero value otherwise. +func (o *V1beta1UpdateClusterRequestCluster) GetLabels() map[string]string { + if o == nil || IsNil(o.Labels) { + var ret map[string]string + return ret + } + return *o.Labels +} + +// GetLabelsOk returns a tuple with the Labels field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateClusterRequestCluster) GetLabelsOk() (*map[string]string, bool) { + if o == nil || IsNil(o.Labels) { + return nil, false + } + return o.Labels, true +} + +// HasLabels returns a boolean if a field has been set. +func (o *V1beta1UpdateClusterRequestCluster) HasLabels() bool { + if o != nil && !IsNil(o.Labels) { + return true + } + + return false +} + +// SetLabels gets a reference to the given map[string]string and assigns it to the Labels field. +func (o *V1beta1UpdateClusterRequestCluster) SetLabels(v map[string]string) { + o.Labels = &v +} + +func (o V1beta1UpdateClusterRequestCluster) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1UpdateClusterRequestCluster) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["clusterId"] = o.ClusterId + if !IsNil(o.TidbNodeSetting) { + toSerialize["tidbNodeSetting"] = o.TidbNodeSetting + } + if !IsNil(o.TikvNodeSetting) { + toSerialize["tikvNodeSetting"] = o.TikvNodeSetting + } + if !IsNil(o.TiflashNodeSetting) { + toSerialize["tiflashNodeSetting"] = o.TiflashNodeSetting + } + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + if !IsNil(o.Labels) { + toSerialize["labels"] = o.Labels + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1UpdateClusterRequestCluster) 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{ + "clusterId", + } + + 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) + } + } + + varV1beta1UpdateClusterRequestCluster := _V1beta1UpdateClusterRequestCluster{} + + err = json.Unmarshal(data, &varV1beta1UpdateClusterRequestCluster) + + if err != nil { + return err + } + + *o = V1beta1UpdateClusterRequestCluster(varV1beta1UpdateClusterRequestCluster) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "clusterId") + delete(additionalProperties, "tidbNodeSetting") + delete(additionalProperties, "tikvNodeSetting") + delete(additionalProperties, "tiflashNodeSetting") + delete(additionalProperties, "displayName") + delete(additionalProperties, "labels") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1UpdateClusterRequestCluster struct { + value *V1beta1UpdateClusterRequestCluster + isSet bool +} + +func (v NullableV1beta1UpdateClusterRequestCluster) Get() *V1beta1UpdateClusterRequestCluster { + return v.value +} + +func (v *NullableV1beta1UpdateClusterRequestCluster) Set(val *V1beta1UpdateClusterRequestCluster) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1UpdateClusterRequestCluster) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1UpdateClusterRequestCluster) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1UpdateClusterRequestCluster(val *V1beta1UpdateClusterRequestCluster) *NullableV1beta1UpdateClusterRequestCluster { + return &NullableV1beta1UpdateClusterRequestCluster{value: val, isSet: true} +} + +func (v NullableV1beta1UpdateClusterRequestCluster) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1UpdateClusterRequestCluster) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_update_cluster_request_storage_node_setting.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_update_cluster_request_storage_node_setting.go new file mode 100644 index 00000000..f9729bfc --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_update_cluster_request_storage_node_setting.go @@ -0,0 +1,239 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the V1beta1UpdateClusterRequestStorageNodeSetting type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1UpdateClusterRequestStorageNodeSetting{} + +// V1beta1UpdateClusterRequestStorageNodeSetting struct for V1beta1UpdateClusterRequestStorageNodeSetting +type V1beta1UpdateClusterRequestStorageNodeSetting struct { + NodeSpecKey *string `json:"nodeSpecKey,omitempty"` + // When update TiFlash node setting: - If the node count is set to 0, the TiFlash node will be removed. - If the node count is null, the TiFlash node count won't change. For other components, if the node count is set to 0, server will ignore the node count. + NodeCount NullableInt32 `json:"nodeCount,omitempty"` + StorageSizeGi *int32 `json:"storageSizeGi,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1UpdateClusterRequestStorageNodeSetting V1beta1UpdateClusterRequestStorageNodeSetting + +// NewV1beta1UpdateClusterRequestStorageNodeSetting instantiates a new V1beta1UpdateClusterRequestStorageNodeSetting 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 NewV1beta1UpdateClusterRequestStorageNodeSetting() *V1beta1UpdateClusterRequestStorageNodeSetting { + this := V1beta1UpdateClusterRequestStorageNodeSetting{} + return &this +} + +// NewV1beta1UpdateClusterRequestStorageNodeSettingWithDefaults instantiates a new V1beta1UpdateClusterRequestStorageNodeSetting 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 NewV1beta1UpdateClusterRequestStorageNodeSettingWithDefaults() *V1beta1UpdateClusterRequestStorageNodeSetting { + this := V1beta1UpdateClusterRequestStorageNodeSetting{} + return &this +} + +// GetNodeSpecKey returns the NodeSpecKey field value if set, zero value otherwise. +func (o *V1beta1UpdateClusterRequestStorageNodeSetting) GetNodeSpecKey() string { + if o == nil || IsNil(o.NodeSpecKey) { + var ret string + return ret + } + return *o.NodeSpecKey +} + +// GetNodeSpecKeyOk returns a tuple with the NodeSpecKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateClusterRequestStorageNodeSetting) GetNodeSpecKeyOk() (*string, bool) { + if o == nil || IsNil(o.NodeSpecKey) { + return nil, false + } + return o.NodeSpecKey, true +} + +// HasNodeSpecKey returns a boolean if a field has been set. +func (o *V1beta1UpdateClusterRequestStorageNodeSetting) HasNodeSpecKey() bool { + if o != nil && !IsNil(o.NodeSpecKey) { + return true + } + + return false +} + +// SetNodeSpecKey gets a reference to the given string and assigns it to the NodeSpecKey field. +func (o *V1beta1UpdateClusterRequestStorageNodeSetting) SetNodeSpecKey(v string) { + o.NodeSpecKey = &v +} + +// GetNodeCount returns the NodeCount field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *V1beta1UpdateClusterRequestStorageNodeSetting) GetNodeCount() int32 { + if o == nil || IsNil(o.NodeCount.Get()) { + var ret int32 + return ret + } + return *o.NodeCount.Get() +} + +// GetNodeCountOk returns a tuple with the NodeCount field value if set, nil otherwise +// 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 *V1beta1UpdateClusterRequestStorageNodeSetting) GetNodeCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.NodeCount.Get(), o.NodeCount.IsSet() +} + +// HasNodeCount returns a boolean if a field has been set. +func (o *V1beta1UpdateClusterRequestStorageNodeSetting) HasNodeCount() bool { + if o != nil && o.NodeCount.IsSet() { + return true + } + + return false +} + +// SetNodeCount gets a reference to the given NullableInt32 and assigns it to the NodeCount field. +func (o *V1beta1UpdateClusterRequestStorageNodeSetting) SetNodeCount(v int32) { + o.NodeCount.Set(&v) +} + +// SetNodeCountNil sets the value for NodeCount to be an explicit nil +func (o *V1beta1UpdateClusterRequestStorageNodeSetting) SetNodeCountNil() { + o.NodeCount.Set(nil) +} + +// UnsetNodeCount ensures that no value is present for NodeCount, not even an explicit nil +func (o *V1beta1UpdateClusterRequestStorageNodeSetting) UnsetNodeCount() { + o.NodeCount.Unset() +} + +// GetStorageSizeGi returns the StorageSizeGi field value if set, zero value otherwise. +func (o *V1beta1UpdateClusterRequestStorageNodeSetting) GetStorageSizeGi() int32 { + if o == nil || IsNil(o.StorageSizeGi) { + var ret int32 + return ret + } + return *o.StorageSizeGi +} + +// GetStorageSizeGiOk returns a tuple with the StorageSizeGi field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateClusterRequestStorageNodeSetting) GetStorageSizeGiOk() (*int32, bool) { + if o == nil || IsNil(o.StorageSizeGi) { + return nil, false + } + return o.StorageSizeGi, true +} + +// HasStorageSizeGi returns a boolean if a field has been set. +func (o *V1beta1UpdateClusterRequestStorageNodeSetting) HasStorageSizeGi() bool { + if o != nil && !IsNil(o.StorageSizeGi) { + return true + } + + return false +} + +// SetStorageSizeGi gets a reference to the given int32 and assigns it to the StorageSizeGi field. +func (o *V1beta1UpdateClusterRequestStorageNodeSetting) SetStorageSizeGi(v int32) { + o.StorageSizeGi = &v +} + +func (o V1beta1UpdateClusterRequestStorageNodeSetting) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1UpdateClusterRequestStorageNodeSetting) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.NodeSpecKey) { + toSerialize["nodeSpecKey"] = o.NodeSpecKey + } + if o.NodeCount.IsSet() { + toSerialize["nodeCount"] = o.NodeCount.Get() + } + if !IsNil(o.StorageSizeGi) { + toSerialize["storageSizeGi"] = o.StorageSizeGi + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1UpdateClusterRequestStorageNodeSetting) UnmarshalJSON(data []byte) (err error) { + varV1beta1UpdateClusterRequestStorageNodeSetting := _V1beta1UpdateClusterRequestStorageNodeSetting{} + + err = json.Unmarshal(data, &varV1beta1UpdateClusterRequestStorageNodeSetting) + + if err != nil { + return err + } + + *o = V1beta1UpdateClusterRequestStorageNodeSetting(varV1beta1UpdateClusterRequestStorageNodeSetting) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "nodeSpecKey") + delete(additionalProperties, "nodeCount") + delete(additionalProperties, "storageSizeGi") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1UpdateClusterRequestStorageNodeSetting struct { + value *V1beta1UpdateClusterRequestStorageNodeSetting + isSet bool +} + +func (v NullableV1beta1UpdateClusterRequestStorageNodeSetting) Get() *V1beta1UpdateClusterRequestStorageNodeSetting { + return v.value +} + +func (v *NullableV1beta1UpdateClusterRequestStorageNodeSetting) Set(val *V1beta1UpdateClusterRequestStorageNodeSetting) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1UpdateClusterRequestStorageNodeSetting) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1UpdateClusterRequestStorageNodeSetting) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1UpdateClusterRequestStorageNodeSetting(val *V1beta1UpdateClusterRequestStorageNodeSetting) *NullableV1beta1UpdateClusterRequestStorageNodeSetting { + return &NullableV1beta1UpdateClusterRequestStorageNodeSetting{value: val, isSet: true} +} + +func (v NullableV1beta1UpdateClusterRequestStorageNodeSetting) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1UpdateClusterRequestStorageNodeSetting) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_update_cluster_request_tidb_node_setting.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_update_cluster_request_tidb_node_setting.go new file mode 100644 index 00000000..65589856 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_update_cluster_request_tidb_node_setting.go @@ -0,0 +1,190 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" +) + +// checks if the V1beta1UpdateClusterRequestTidbNodeSetting type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1UpdateClusterRequestTidbNodeSetting{} + +// V1beta1UpdateClusterRequestTidbNodeSetting struct for V1beta1UpdateClusterRequestTidbNodeSetting +type V1beta1UpdateClusterRequestTidbNodeSetting struct { + NodeSpecKey *string `json:"nodeSpecKey,omitempty"` + TidbNodeGroups []UpdateClusterRequestTidbNodeSettingTidbNodeGroup `json:"tidbNodeGroups,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1UpdateClusterRequestTidbNodeSetting V1beta1UpdateClusterRequestTidbNodeSetting + +// NewV1beta1UpdateClusterRequestTidbNodeSetting instantiates a new V1beta1UpdateClusterRequestTidbNodeSetting 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 NewV1beta1UpdateClusterRequestTidbNodeSetting() *V1beta1UpdateClusterRequestTidbNodeSetting { + this := V1beta1UpdateClusterRequestTidbNodeSetting{} + return &this +} + +// NewV1beta1UpdateClusterRequestTidbNodeSettingWithDefaults instantiates a new V1beta1UpdateClusterRequestTidbNodeSetting 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 NewV1beta1UpdateClusterRequestTidbNodeSettingWithDefaults() *V1beta1UpdateClusterRequestTidbNodeSetting { + this := V1beta1UpdateClusterRequestTidbNodeSetting{} + return &this +} + +// GetNodeSpecKey returns the NodeSpecKey field value if set, zero value otherwise. +func (o *V1beta1UpdateClusterRequestTidbNodeSetting) GetNodeSpecKey() string { + if o == nil || IsNil(o.NodeSpecKey) { + var ret string + return ret + } + return *o.NodeSpecKey +} + +// GetNodeSpecKeyOk returns a tuple with the NodeSpecKey field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateClusterRequestTidbNodeSetting) GetNodeSpecKeyOk() (*string, bool) { + if o == nil || IsNil(o.NodeSpecKey) { + return nil, false + } + return o.NodeSpecKey, true +} + +// HasNodeSpecKey returns a boolean if a field has been set. +func (o *V1beta1UpdateClusterRequestTidbNodeSetting) HasNodeSpecKey() bool { + if o != nil && !IsNil(o.NodeSpecKey) { + return true + } + + return false +} + +// SetNodeSpecKey gets a reference to the given string and assigns it to the NodeSpecKey field. +func (o *V1beta1UpdateClusterRequestTidbNodeSetting) SetNodeSpecKey(v string) { + o.NodeSpecKey = &v +} + +// GetTidbNodeGroups returns the TidbNodeGroups field value if set, zero value otherwise. +func (o *V1beta1UpdateClusterRequestTidbNodeSetting) GetTidbNodeGroups() []UpdateClusterRequestTidbNodeSettingTidbNodeGroup { + if o == nil || IsNil(o.TidbNodeGroups) { + var ret []UpdateClusterRequestTidbNodeSettingTidbNodeGroup + return ret + } + return o.TidbNodeGroups +} + +// GetTidbNodeGroupsOk returns a tuple with the TidbNodeGroups field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateClusterRequestTidbNodeSetting) GetTidbNodeGroupsOk() ([]UpdateClusterRequestTidbNodeSettingTidbNodeGroup, bool) { + if o == nil || IsNil(o.TidbNodeGroups) { + return nil, false + } + return o.TidbNodeGroups, true +} + +// HasTidbNodeGroups returns a boolean if a field has been set. +func (o *V1beta1UpdateClusterRequestTidbNodeSetting) HasTidbNodeGroups() bool { + if o != nil && !IsNil(o.TidbNodeGroups) { + return true + } + + return false +} + +// SetTidbNodeGroups gets a reference to the given []UpdateClusterRequestTidbNodeSettingTidbNodeGroup and assigns it to the TidbNodeGroups field. +func (o *V1beta1UpdateClusterRequestTidbNodeSetting) SetTidbNodeGroups(v []UpdateClusterRequestTidbNodeSettingTidbNodeGroup) { + o.TidbNodeGroups = v +} + +func (o V1beta1UpdateClusterRequestTidbNodeSetting) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1UpdateClusterRequestTidbNodeSetting) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + if !IsNil(o.NodeSpecKey) { + toSerialize["nodeSpecKey"] = o.NodeSpecKey + } + if !IsNil(o.TidbNodeGroups) { + toSerialize["tidbNodeGroups"] = o.TidbNodeGroups + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1UpdateClusterRequestTidbNodeSetting) UnmarshalJSON(data []byte) (err error) { + varV1beta1UpdateClusterRequestTidbNodeSetting := _V1beta1UpdateClusterRequestTidbNodeSetting{} + + err = json.Unmarshal(data, &varV1beta1UpdateClusterRequestTidbNodeSetting) + + if err != nil { + return err + } + + *o = V1beta1UpdateClusterRequestTidbNodeSetting(varV1beta1UpdateClusterRequestTidbNodeSetting) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "nodeSpecKey") + delete(additionalProperties, "tidbNodeGroups") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1UpdateClusterRequestTidbNodeSetting struct { + value *V1beta1UpdateClusterRequestTidbNodeSetting + isSet bool +} + +func (v NullableV1beta1UpdateClusterRequestTidbNodeSetting) Get() *V1beta1UpdateClusterRequestTidbNodeSetting { + return v.value +} + +func (v *NullableV1beta1UpdateClusterRequestTidbNodeSetting) Set(val *V1beta1UpdateClusterRequestTidbNodeSetting) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1UpdateClusterRequestTidbNodeSetting) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1UpdateClusterRequestTidbNodeSetting) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1UpdateClusterRequestTidbNodeSetting(val *V1beta1UpdateClusterRequestTidbNodeSetting) *NullableV1beta1UpdateClusterRequestTidbNodeSetting { + return &NullableV1beta1UpdateClusterRequestTidbNodeSetting{value: val, isSet: true} +} + +func (v NullableV1beta1UpdateClusterRequestTidbNodeSetting) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1UpdateClusterRequestTidbNodeSetting) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_update_maintenance_window_request_maintenance_window.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_update_maintenance_window_request_maintenance_window.go new file mode 100644 index 00000000..3421fa66 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_update_maintenance_window_request_maintenance_window.go @@ -0,0 +1,277 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow{} + +// V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow struct for V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow +type V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow struct { + MaintenanceWindowId string `json:"maintenanceWindowId"` + WeekDay *int32 `json:"weekDay,omitempty"` + DayHour *int32 `json:"dayHour,omitempty"` + HourMinute *int32 `json:"hourMinute,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow + +// NewV1beta1UpdateMaintenanceWindowRequestMaintenanceWindow instantiates a new V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow 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 NewV1beta1UpdateMaintenanceWindowRequestMaintenanceWindow(maintenanceWindowId string) *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow { + this := V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow{} + this.MaintenanceWindowId = maintenanceWindowId + return &this +} + +// NewV1beta1UpdateMaintenanceWindowRequestMaintenanceWindowWithDefaults instantiates a new V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow 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 NewV1beta1UpdateMaintenanceWindowRequestMaintenanceWindowWithDefaults() *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow { + this := V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow{} + return &this +} + +// GetMaintenanceWindowId returns the MaintenanceWindowId field value +func (o *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) GetMaintenanceWindowId() string { + if o == nil { + var ret string + return ret + } + + return o.MaintenanceWindowId +} + +// GetMaintenanceWindowIdOk returns a tuple with the MaintenanceWindowId field value +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) GetMaintenanceWindowIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.MaintenanceWindowId, true +} + +// SetMaintenanceWindowId sets field value +func (o *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) SetMaintenanceWindowId(v string) { + o.MaintenanceWindowId = v +} + +// GetWeekDay returns the WeekDay field value if set, zero value otherwise. +func (o *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) GetWeekDay() int32 { + if o == nil || IsNil(o.WeekDay) { + var ret int32 + return ret + } + return *o.WeekDay +} + +// GetWeekDayOk returns a tuple with the WeekDay field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) GetWeekDayOk() (*int32, bool) { + if o == nil || IsNil(o.WeekDay) { + return nil, false + } + return o.WeekDay, true +} + +// HasWeekDay returns a boolean if a field has been set. +func (o *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) HasWeekDay() bool { + if o != nil && !IsNil(o.WeekDay) { + return true + } + + return false +} + +// SetWeekDay gets a reference to the given int32 and assigns it to the WeekDay field. +func (o *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) SetWeekDay(v int32) { + o.WeekDay = &v +} + +// GetDayHour returns the DayHour field value if set, zero value otherwise. +func (o *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) GetDayHour() int32 { + if o == nil || IsNil(o.DayHour) { + var ret int32 + return ret + } + return *o.DayHour +} + +// GetDayHourOk returns a tuple with the DayHour field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) GetDayHourOk() (*int32, bool) { + if o == nil || IsNil(o.DayHour) { + return nil, false + } + return o.DayHour, true +} + +// HasDayHour returns a boolean if a field has been set. +func (o *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) HasDayHour() bool { + if o != nil && !IsNil(o.DayHour) { + return true + } + + return false +} + +// SetDayHour gets a reference to the given int32 and assigns it to the DayHour field. +func (o *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) SetDayHour(v int32) { + o.DayHour = &v +} + +// GetHourMinute returns the HourMinute field value if set, zero value otherwise. +func (o *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) GetHourMinute() int32 { + if o == nil || IsNil(o.HourMinute) { + var ret int32 + return ret + } + return *o.HourMinute +} + +// GetHourMinuteOk returns a tuple with the HourMinute field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) GetHourMinuteOk() (*int32, bool) { + if o == nil || IsNil(o.HourMinute) { + return nil, false + } + return o.HourMinute, true +} + +// HasHourMinute returns a boolean if a field has been set. +func (o *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) HasHourMinute() bool { + if o != nil && !IsNil(o.HourMinute) { + return true + } + + return false +} + +// SetHourMinute gets a reference to the given int32 and assigns it to the HourMinute field. +func (o *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) SetHourMinute(v int32) { + o.HourMinute = &v +} + +func (o V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["maintenanceWindowId"] = o.MaintenanceWindowId + if !IsNil(o.WeekDay) { + toSerialize["weekDay"] = o.WeekDay + } + if !IsNil(o.DayHour) { + toSerialize["dayHour"] = o.DayHour + } + if !IsNil(o.HourMinute) { + toSerialize["hourMinute"] = o.HourMinute + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) 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{ + "maintenanceWindowId", + } + + 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) + } + } + + varV1beta1UpdateMaintenanceWindowRequestMaintenanceWindow := _V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow{} + + err = json.Unmarshal(data, &varV1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) + + if err != nil { + return err + } + + *o = V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow(varV1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "maintenanceWindowId") + delete(additionalProperties, "weekDay") + delete(additionalProperties, "dayHour") + delete(additionalProperties, "hourMinute") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1UpdateMaintenanceWindowRequestMaintenanceWindow struct { + value *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow + isSet bool +} + +func (v NullableV1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) Get() *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow { + return v.value +} + +func (v *NullableV1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) Set(val *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1UpdateMaintenanceWindowRequestMaintenanceWindow(val *V1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) *NullableV1beta1UpdateMaintenanceWindowRequestMaintenanceWindow { + return &NullableV1beta1UpdateMaintenanceWindowRequestMaintenanceWindow{value: val, isSet: true} +} + +func (v NullableV1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1UpdateMaintenanceWindowRequestMaintenanceWindow) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_update_tidb_node_group_request_tidb_node_group.go b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_update_tidb_node_group_request_tidb_node_group.go new file mode 100644 index 00000000..7dee2139 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/model_v1beta1_update_tidb_node_group_request_tidb_node_group.go @@ -0,0 +1,280 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "encoding/json" + "fmt" +) + +// checks if the V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup type satisfies the MappedNullable interface at compile time +var _ MappedNullable = &V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup{} + +// V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup struct for V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup +type V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup struct { + ClusterId string `json:"clusterId"` + TidbNodeGroupId string `json:"tidbNodeGroupId"` + DisplayName *string `json:"displayName,omitempty"` + NodeCount NullableInt32 `json:"nodeCount,omitempty"` + AdditionalProperties map[string]interface{} +} + +type _V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup + +// NewV1beta1UpdateTidbNodeGroupRequestTidbNodeGroup instantiates a new V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup 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 NewV1beta1UpdateTidbNodeGroupRequestTidbNodeGroup(clusterId string, tidbNodeGroupId string) *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup { + this := V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup{} + this.ClusterId = clusterId + this.TidbNodeGroupId = tidbNodeGroupId + return &this +} + +// NewV1beta1UpdateTidbNodeGroupRequestTidbNodeGroupWithDefaults instantiates a new V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup 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 NewV1beta1UpdateTidbNodeGroupRequestTidbNodeGroupWithDefaults() *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup { + this := V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup{} + return &this +} + +// GetClusterId returns the ClusterId field value +func (o *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) GetClusterId() string { + if o == nil { + var ret string + return ret + } + + return o.ClusterId +} + +// GetClusterIdOk returns a tuple with the ClusterId field value +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) GetClusterIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.ClusterId, true +} + +// SetClusterId sets field value +func (o *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) SetClusterId(v string) { + o.ClusterId = v +} + +// GetTidbNodeGroupId returns the TidbNodeGroupId field value +func (o *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) GetTidbNodeGroupId() string { + if o == nil { + var ret string + return ret + } + + return o.TidbNodeGroupId +} + +// GetTidbNodeGroupIdOk returns a tuple with the TidbNodeGroupId field value +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) GetTidbNodeGroupIdOk() (*string, bool) { + if o == nil { + return nil, false + } + return &o.TidbNodeGroupId, true +} + +// SetTidbNodeGroupId sets field value +func (o *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) SetTidbNodeGroupId(v string) { + o.TidbNodeGroupId = v +} + +// GetDisplayName returns the DisplayName field value if set, zero value otherwise. +func (o *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) GetDisplayName() string { + if o == nil || IsNil(o.DisplayName) { + var ret string + return ret + } + return *o.DisplayName +} + +// GetDisplayNameOk returns a tuple with the DisplayName field value if set, nil otherwise +// and a boolean to check if the value has been set. +func (o *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) GetDisplayNameOk() (*string, bool) { + if o == nil || IsNil(o.DisplayName) { + return nil, false + } + return o.DisplayName, true +} + +// HasDisplayName returns a boolean if a field has been set. +func (o *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) HasDisplayName() bool { + if o != nil && !IsNil(o.DisplayName) { + return true + } + + return false +} + +// SetDisplayName gets a reference to the given string and assigns it to the DisplayName field. +func (o *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) SetDisplayName(v string) { + o.DisplayName = &v +} + +// GetNodeCount returns the NodeCount field value if set, zero value otherwise (both if not set or set to explicit null). +func (o *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) GetNodeCount() int32 { + if o == nil || IsNil(o.NodeCount.Get()) { + var ret int32 + return ret + } + return *o.NodeCount.Get() +} + +// GetNodeCountOk returns a tuple with the NodeCount field value if set, nil otherwise +// 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 *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) GetNodeCountOk() (*int32, bool) { + if o == nil { + return nil, false + } + return o.NodeCount.Get(), o.NodeCount.IsSet() +} + +// HasNodeCount returns a boolean if a field has been set. +func (o *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) HasNodeCount() bool { + if o != nil && o.NodeCount.IsSet() { + return true + } + + return false +} + +// SetNodeCount gets a reference to the given NullableInt32 and assigns it to the NodeCount field. +func (o *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) SetNodeCount(v int32) { + o.NodeCount.Set(&v) +} + +// SetNodeCountNil sets the value for NodeCount to be an explicit nil +func (o *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) SetNodeCountNil() { + o.NodeCount.Set(nil) +} + +// UnsetNodeCount ensures that no value is present for NodeCount, not even an explicit nil +func (o *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) UnsetNodeCount() { + o.NodeCount.Unset() +} + +func (o V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) MarshalJSON() ([]byte, error) { + toSerialize, err := o.ToMap() + if err != nil { + return []byte{}, err + } + return json.Marshal(toSerialize) +} + +func (o V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) ToMap() (map[string]interface{}, error) { + toSerialize := map[string]interface{}{} + toSerialize["clusterId"] = o.ClusterId + toSerialize["tidbNodeGroupId"] = o.TidbNodeGroupId + if !IsNil(o.DisplayName) { + toSerialize["displayName"] = o.DisplayName + } + if o.NodeCount.IsSet() { + toSerialize["nodeCount"] = o.NodeCount.Get() + } + + for key, value := range o.AdditionalProperties { + toSerialize[key] = value + } + + return toSerialize, nil +} + +func (o *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) 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{ + "clusterId", + "tidbNodeGroupId", + } + + 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) + } + } + + varV1beta1UpdateTidbNodeGroupRequestTidbNodeGroup := _V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup{} + + err = json.Unmarshal(data, &varV1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) + + if err != nil { + return err + } + + *o = V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup(varV1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) + + additionalProperties := make(map[string]interface{}) + + if err = json.Unmarshal(data, &additionalProperties); err == nil { + delete(additionalProperties, "clusterId") + delete(additionalProperties, "tidbNodeGroupId") + delete(additionalProperties, "displayName") + delete(additionalProperties, "nodeCount") + o.AdditionalProperties = additionalProperties + } + + return err +} + +type NullableV1beta1UpdateTidbNodeGroupRequestTidbNodeGroup struct { + value *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup + isSet bool +} + +func (v NullableV1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) Get() *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup { + return v.value +} + +func (v *NullableV1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) Set(val *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) { + v.value = val + v.isSet = true +} + +func (v NullableV1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) IsSet() bool { + return v.isSet +} + +func (v *NullableV1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableV1beta1UpdateTidbNodeGroupRequestTidbNodeGroup(val *V1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) *NullableV1beta1UpdateTidbNodeGroupRequestTidbNodeGroup { + return &NullableV1beta1UpdateTidbNodeGroupRequestTidbNodeGroup{value: val, isSet: true} +} + +func (v NullableV1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableV1beta1UpdateTidbNodeGroupRequestTidbNodeGroup) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/response.go b/pkg/tidbcloud/v1beta1/dedicated/response.go new file mode 100644 index 00000000..27d34342 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/response.go @@ -0,0 +1,47 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "net/http" +) + +// APIResponse stores the API response returned by the server. +type APIResponse struct { + *http.Response `json:"-"` + Message string `json:"message,omitempty"` + // Operation is the name of the OpenAPI operation. + Operation string `json:"operation,omitempty"` + // RequestURL is the request URL. This value is always available, even if the + // embedded *http.Response is nil. + RequestURL string `json:"url,omitempty"` + // Method is the HTTP method used for the request. This value is always + // available, even if the embedded *http.Response is nil. + Method string `json:"method,omitempty"` + // Payload holds the contents of the response body (which may be nil or empty). + // This is provided here as the raw response.Body() reader will have already + // been drained. + Payload []byte `json:"-"` +} + +// NewAPIResponse returns a new APIResponse object. +func NewAPIResponse(r *http.Response) *APIResponse { + + response := &APIResponse{Response: r} + return response +} + +// NewAPIResponseWithError returns a new APIResponse object with the provided error message. +func NewAPIResponseWithError(errorMessage string) *APIResponse { + + response := &APIResponse{Message: errorMessage} + return response +} diff --git a/pkg/tidbcloud/v1beta1/dedicated/utils.go b/pkg/tidbcloud/v1beta1/dedicated/utils.go new file mode 100644 index 00000000..992fcf03 --- /dev/null +++ b/pkg/tidbcloud/v1beta1/dedicated/utils.go @@ -0,0 +1,361 @@ +/* +TiDB Cloud Dedicated Open API + +TiDB Cloud Dedicated Open API. + +API version: v1beta1 +*/ + +// Code generated by OpenAPI Generator (https://openapi-generator.tech); DO NOT EDIT. + +package dedicated + +import ( + "bytes" + "encoding/json" + "fmt" + "reflect" + "time" +) + +// PtrBool is a helper routine that returns a pointer to given boolean value. +func PtrBool(v bool) *bool { return &v } + +// PtrInt is a helper routine that returns a pointer to given integer value. +func PtrInt(v int) *int { return &v } + +// PtrInt32 is a helper routine that returns a pointer to given integer value. +func PtrInt32(v int32) *int32 { return &v } + +// PtrInt64 is a helper routine that returns a pointer to given integer value. +func PtrInt64(v int64) *int64 { return &v } + +// PtrFloat32 is a helper routine that returns a pointer to given float value. +func PtrFloat32(v float32) *float32 { return &v } + +// PtrFloat64 is a helper routine that returns a pointer to given float value. +func PtrFloat64(v float64) *float64 { return &v } + +// PtrString is a helper routine that returns a pointer to given string value. +func PtrString(v string) *string { return &v } + +// PtrTime is helper routine that returns a pointer to given Time value. +func PtrTime(v time.Time) *time.Time { return &v } + +type NullableBool struct { + value *bool + isSet bool +} + +func (v NullableBool) Get() *bool { + return v.value +} + +func (v *NullableBool) Set(val *bool) { + v.value = val + v.isSet = true +} + +func (v NullableBool) IsSet() bool { + return v.isSet +} + +func (v *NullableBool) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableBool(val *bool) *NullableBool { + return &NullableBool{value: val, isSet: true} +} + +func (v NullableBool) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableBool) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt struct { + value *int + isSet bool +} + +func (v NullableInt) Get() *int { + return v.value +} + +func (v *NullableInt) Set(val *int) { + v.value = val + v.isSet = true +} + +func (v NullableInt) IsSet() bool { + return v.isSet +} + +func (v *NullableInt) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt(val *int) *NullableInt { + return &NullableInt{value: val, isSet: true} +} + +func (v NullableInt) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt32 struct { + value *int32 + isSet bool +} + +func (v NullableInt32) Get() *int32 { + return v.value +} + +func (v *NullableInt32) Set(val *int32) { + v.value = val + v.isSet = true +} + +func (v NullableInt32) IsSet() bool { + return v.isSet +} + +func (v *NullableInt32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt32(val *int32) *NullableInt32 { + return &NullableInt32{value: val, isSet: true} +} + +func (v NullableInt32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableInt64 struct { + value *int64 + isSet bool +} + +func (v NullableInt64) Get() *int64 { + return v.value +} + +func (v *NullableInt64) Set(val *int64) { + v.value = val + v.isSet = true +} + +func (v NullableInt64) IsSet() bool { + return v.isSet +} + +func (v *NullableInt64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableInt64(val *int64) *NullableInt64 { + return &NullableInt64{value: val, isSet: true} +} + +func (v NullableInt64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableInt64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat32 struct { + value *float32 + isSet bool +} + +func (v NullableFloat32) Get() *float32 { + return v.value +} + +func (v *NullableFloat32) Set(val *float32) { + v.value = val + v.isSet = true +} + +func (v NullableFloat32) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat32) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat32(val *float32) *NullableFloat32 { + return &NullableFloat32{value: val, isSet: true} +} + +func (v NullableFloat32) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat32) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableFloat64 struct { + value *float64 + isSet bool +} + +func (v NullableFloat64) Get() *float64 { + return v.value +} + +func (v *NullableFloat64) Set(val *float64) { + v.value = val + v.isSet = true +} + +func (v NullableFloat64) IsSet() bool { + return v.isSet +} + +func (v *NullableFloat64) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableFloat64(val *float64) *NullableFloat64 { + return &NullableFloat64{value: val, isSet: true} +} + +func (v NullableFloat64) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableFloat64) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableString struct { + value *string + isSet bool +} + +func (v NullableString) Get() *string { + return v.value +} + +func (v *NullableString) Set(val *string) { + v.value = val + v.isSet = true +} + +func (v NullableString) IsSet() bool { + return v.isSet +} + +func (v *NullableString) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableString(val *string) *NullableString { + return &NullableString{value: val, isSet: true} +} + +func (v NullableString) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableString) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +type NullableTime struct { + value *time.Time + isSet bool +} + +func (v NullableTime) Get() *time.Time { + return v.value +} + +func (v *NullableTime) Set(val *time.Time) { + v.value = val + v.isSet = true +} + +func (v NullableTime) IsSet() bool { + return v.isSet +} + +func (v *NullableTime) Unset() { + v.value = nil + v.isSet = false +} + +func NewNullableTime(val *time.Time) *NullableTime { + return &NullableTime{value: val, isSet: true} +} + +func (v NullableTime) MarshalJSON() ([]byte, error) { + return json.Marshal(v.value) +} + +func (v *NullableTime) UnmarshalJSON(src []byte) error { + v.isSet = true + return json.Unmarshal(src, &v.value) +} + +// IsNil checks if an input is nil +func IsNil(i interface{}) bool { + if i == nil { + return true + } + switch reflect.TypeOf(i).Kind() { + case reflect.Chan, reflect.Func, reflect.Map, reflect.Ptr, reflect.UnsafePointer, reflect.Interface, reflect.Slice: + return reflect.ValueOf(i).IsNil() + case reflect.Array: + return reflect.ValueOf(i).IsZero() + } + return false +} + +type MappedNullable interface { + ToMap() (map[string]interface{}, error) +} + +// A wrapper for strict JSON decoding +func newStrictDecoder(data []byte) *json.Decoder { + dec := json.NewDecoder(bytes.NewBuffer(data)) + dec.DisallowUnknownFields() + return dec +} + +// Prevent trying to import "fmt" +func reportError(format string, a ...interface{}) error { + return fmt.Errorf(format, a...) +}