From 7dc26565aa7290a73271187666520a1d97a886a4 Mon Sep 17 00:00:00 2001 From: shiyuhang <1136742008@qq.com> Date: Wed, 13 Dec 2023 13:12:03 +0800 Subject: [PATCH] remove pkg --- Makefile | 17 +- internal/cli/connect/connect.go | 3 +- internal/cli/dataimport/start/mysql.go | 3 +- internal/cli/dataimport/start/mysql_test.go | 34 +- internal/cli/serverless/connectinfo.go | 8 +- internal/cli/serverless/connectinfo_test.go | 12 +- internal/cli/serverless/create.go | 5 +- internal/cli/serverless/create_test.go | 5 +- internal/cli/serverless/delete.go | 4 +- internal/cli/serverless/delete_test.go | 5 +- internal/cli/serverless/describe.go | 3 +- internal/cli/serverless/describe_test.go | 5 +- internal/cli/serverless/list.go | 3 +- internal/cli/serverless/list_test.go | 5 +- internal/cli/serverless/regions.go | 2 +- internal/cli/serverless/spending_limit.go | 4 +- internal/cli/serverless/update.go | 8 +- internal/cli/serverless/update_test.go | 3 +- internal/mock/api_client.go | 75 ++- internal/service/cloud/api_client.go | 28 +- internal/service/cloud/logic.go | 5 +- pkg/tidbcloud/branch/README.md | 54 -- pkg/tidbcloud/branch/branch.swagger.json | 468 ------------------ .../branch_service/branch_service_client.go | 193 -------- .../create_branch_parameters.go | 168 ------- .../branch_service/create_branch_responses.go | 243 --------- .../delete_branch_parameters.go | 173 ------- .../branch_service/delete_branch_responses.go | 180 ------- .../branch_service/get_branch_parameters.go | 173 ------- .../branch_service/get_branch_responses.go | 182 ------- .../list_branches_parameters.go | 240 --------- .../branch_service/list_branches_responses.go | 182 ------- .../branch/client/tidbcloud_branch_client.go | 112 ----- .../branch/models/googlerpc_status.go | 222 --------- .../branch/models/openapi_basic_branch.go | 265 ---------- pkg/tidbcloud/branch/models/openapi_branch.go | 397 --------------- .../branch/models/openapi_branch_state.go | 84 ---- .../models/openapi_create_branch_resp.go | 72 --- .../branch/models/openapi_endpoints.go | 109 ---- .../models/openapi_list_branches_resp.go | 141 ------ .../branch/models/openapi_private_endpoint.go | 169 ------- .../models/openapi_private_endpoint_aws.go | 53 -- .../models/openapi_private_endpoint_gcp.go | 50 -- .../branch/models/openapi_public_endpoint.go | 56 --- pkg/tidbcloud/branch/models/openapi_usages.go | 56 --- .../serverless/models/protobuf_any.go | 50 -- ...service_change_root_password_parameters.go | 0 ..._service_change_root_password_responses.go | 2 +- .../serverless_service_client.go | 0 ...rless_service_create_cluster_parameters.go | 2 +- ...erless_service_create_cluster_responses.go | 2 +- ...rless_service_delete_cluster_parameters.go | 0 ...erless_service_delete_cluster_responses.go | 2 +- ...rverless_service_get_cluster_parameters.go | 0 ...erverless_service_get_cluster_responses.go | 2 +- ...erless_service_list_clusters_parameters.go | 0 ...verless_service_list_clusters_responses.go | 2 +- ...verless_service_list_regions_parameters.go | 0 ...rverless_service_list_regions_responses.go | 2 +- ...rvice_partial_update_cluster_parameters.go | 0 ...ervice_partial_update_cluster_responses.go | 2 +- .../client/tidbcloud_serverless_client.go | 2 +- .../models/cluster_spending_limit.go | 0 .../serverless/models/cluster_usage.go | 0 .../serverless/models/endpoints_private.go | 0 .../serverless/models/endpoints_public.go | 0 .../serverless/models/googlerpc_status.go | 0 .../serverless/models/private_a_w_s.go | 0 .../serverless/models/private_g_c_p.go | 0 .../serverless}/models/protobuf_any.go | 0 ...cloud_open_apiserverlessv1beta1_cluster.go | 0 ...open_apiserverlessv1beta1_cluster_state.go | 0 ...erverlessv1beta1_list_clusters_response.go | 0 ...serverlessv1beta1_list_regions_response.go | 0 ..._cloud_open_apiserverlessv1beta1_region.go | 0 .../v1beta1_change_root_password_response.go | 0 ...v1beta1_cluster_automated_backup_policy.go | 0 .../v1beta1_cluster_encryption_config.go | 0 .../models/v1beta1_cluster_endpoints.go | 0 .../serverless/models/v1beta1_cluster_view.go | 0 .../models/v1beta1_region_cloud_provider.go | 0 .../serverless/serverless.swagger.json | 0 82 files changed, 117 insertions(+), 4230 deletions(-) delete mode 100644 pkg/tidbcloud/branch/README.md delete mode 100644 pkg/tidbcloud/branch/branch.swagger.json delete mode 100644 pkg/tidbcloud/branch/client/branch_service/branch_service_client.go delete mode 100644 pkg/tidbcloud/branch/client/branch_service/create_branch_parameters.go delete mode 100644 pkg/tidbcloud/branch/client/branch_service/create_branch_responses.go delete mode 100644 pkg/tidbcloud/branch/client/branch_service/delete_branch_parameters.go delete mode 100644 pkg/tidbcloud/branch/client/branch_service/delete_branch_responses.go delete mode 100644 pkg/tidbcloud/branch/client/branch_service/get_branch_parameters.go delete mode 100644 pkg/tidbcloud/branch/client/branch_service/get_branch_responses.go delete mode 100644 pkg/tidbcloud/branch/client/branch_service/list_branches_parameters.go delete mode 100644 pkg/tidbcloud/branch/client/branch_service/list_branches_responses.go delete mode 100644 pkg/tidbcloud/branch/client/tidbcloud_branch_client.go delete mode 100644 pkg/tidbcloud/branch/models/googlerpc_status.go delete mode 100644 pkg/tidbcloud/branch/models/openapi_basic_branch.go delete mode 100644 pkg/tidbcloud/branch/models/openapi_branch.go delete mode 100644 pkg/tidbcloud/branch/models/openapi_branch_state.go delete mode 100644 pkg/tidbcloud/branch/models/openapi_create_branch_resp.go delete mode 100644 pkg/tidbcloud/branch/models/openapi_endpoints.go delete mode 100644 pkg/tidbcloud/branch/models/openapi_list_branches_resp.go delete mode 100644 pkg/tidbcloud/branch/models/openapi_private_endpoint.go delete mode 100644 pkg/tidbcloud/branch/models/openapi_private_endpoint_aws.go delete mode 100644 pkg/tidbcloud/branch/models/openapi_private_endpoint_gcp.go delete mode 100644 pkg/tidbcloud/branch/models/openapi_public_endpoint.go delete mode 100644 pkg/tidbcloud/branch/models/openapi_usages.go delete mode 100644 pkg/tidbcloud/serverless/models/protobuf_any.go rename pkg/tidbcloud/{ => v1beta1}/serverless/client/serverless_service/serverless_service_change_root_password_parameters.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/client/serverless_service/serverless_service_change_root_password_responses.go (99%) rename pkg/tidbcloud/{ => v1beta1}/serverless/client/serverless_service/serverless_service_client.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/client/serverless_service/serverless_service_create_cluster_parameters.go (98%) rename pkg/tidbcloud/{ => v1beta1}/serverless/client/serverless_service/serverless_service_create_cluster_responses.go (99%) rename pkg/tidbcloud/{ => v1beta1}/serverless/client/serverless_service/serverless_service_delete_cluster_parameters.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/client/serverless_service/serverless_service_delete_cluster_responses.go (99%) rename pkg/tidbcloud/{ => v1beta1}/serverless/client/serverless_service/serverless_service_get_cluster_parameters.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/client/serverless_service/serverless_service_get_cluster_responses.go (99%) rename pkg/tidbcloud/{ => v1beta1}/serverless/client/serverless_service/serverless_service_list_clusters_parameters.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/client/serverless_service/serverless_service_list_clusters_responses.go (99%) rename pkg/tidbcloud/{ => v1beta1}/serverless/client/serverless_service/serverless_service_list_regions_parameters.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/client/serverless_service/serverless_service_list_regions_responses.go (99%) rename pkg/tidbcloud/{ => v1beta1}/serverless/client/serverless_service/serverless_service_partial_update_cluster_parameters.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/client/serverless_service/serverless_service_partial_update_cluster_responses.go (99%) rename pkg/tidbcloud/{ => v1beta1}/serverless/client/tidbcloud_serverless_client.go (97%) rename pkg/tidbcloud/{ => v1beta1}/serverless/models/cluster_spending_limit.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/models/cluster_usage.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/models/endpoints_private.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/models/endpoints_public.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/models/googlerpc_status.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/models/private_a_w_s.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/models/private_g_c_p.go (100%) rename pkg/tidbcloud/{branch => v1beta1/serverless}/models/protobuf_any.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/models/tidb_cloud_open_apiserverlessv1beta1_cluster.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/models/tidb_cloud_open_apiserverlessv1beta1_cluster_state.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/models/tidb_cloud_open_apiserverlessv1beta1_list_clusters_response.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/models/tidb_cloud_open_apiserverlessv1beta1_list_regions_response.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/models/tidb_cloud_open_apiserverlessv1beta1_region.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/models/v1beta1_change_root_password_response.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/models/v1beta1_cluster_automated_backup_policy.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/models/v1beta1_cluster_encryption_config.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/models/v1beta1_cluster_endpoints.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/models/v1beta1_cluster_view.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/models/v1beta1_region_cloud_provider.go (100%) rename pkg/tidbcloud/{ => v1beta1}/serverless/serverless.swagger.json (100%) diff --git a/Makefile b/Makefile index fa757951..3d256f70 100644 --- a/Makefile +++ b/Makefile @@ -43,23 +43,14 @@ generate-import-client: ## Generate import client addcopy: ## Add copyright to all files @scripts/add-copy.sh -.PHONY: generate-branch-client - generate-branch-client: - @echo "==> Generating branch client" - go install github.com/go-swagger/go-swagger/cmd/swagger@latest - swagger generate client -f pkg/tidbcloud/branch/branch.swagger.json -A tidbcloud-branch -t pkg/tidbcloud/branch - -.PHONY: generate-serverless-client - generate-serverless-client: - @echo "==> Generating serverless client" - go install github.com/go-swagger/go-swagger/cmd/swagger@latest - swagger generate client -f pkg/tidbcloud/serverless/serverless.swagger.json -A tidbcloud-serverless -t pkg/tidbcloud/serverless - .PHONY: generate-v1beta1-client generate-v1beta1-client: - @echo "==> Generating branch client" go install github.com/go-swagger/go-swagger/cmd/swagger@latest + @echo "==> Generating branch client" swagger generate client -f pkg/tidbcloud/v1beta1/branch/branch.swagger.json -A tidbcloud-serverless -t pkg/tidbcloud/v1beta1/branch + @echo "==> Generating serverless client" + swagger generate client -f pkg/tidbcloud/v1beta1/serverless/serverless.swagger.json -A tidbcloud-serverless -t pkg/tidbcloud/v1beta1/serverless + .PHONY: fmt fmt: ## Format changed go diff --git a/internal/cli/connect/connect.go b/internal/cli/connect/connect.go index 159141c5..5bb454a7 100644 --- a/internal/cli/connect/connect.go +++ b/internal/cli/connect/connect.go @@ -23,6 +23,7 @@ import ( "os/user" "strconv" "strings" + serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" "tidbcloud-cli/internal" "tidbcloud-cli/internal/config" @@ -31,8 +32,6 @@ import ( "tidbcloud-cli/internal/util" branchApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/branch/client/branch_service" - serverlessApi "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" - "github.com/AlecAivazis/survey/v2" "github.com/AlecAivazis/survey/v2/terminal" "github.com/fatih/color" diff --git a/internal/cli/dataimport/start/mysql.go b/internal/cli/dataimport/start/mysql.go index 2e22cdf7..479c7041 100644 --- a/internal/cli/dataimport/start/mysql.go +++ b/internal/cli/dataimport/start/mysql.go @@ -22,6 +22,7 @@ import ( "runtime" "strconv" "strings" + serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" "time" "tidbcloud-cli/internal" @@ -32,8 +33,6 @@ import ( "tidbcloud-cli/internal/ui" "tidbcloud-cli/internal/util" - serverlessApi "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" - "github.com/AlecAivazis/survey/v2" "github.com/AlecAivazis/survey/v2/terminal" diff --git a/internal/cli/dataimport/start/mysql_test.go b/internal/cli/dataimport/start/mysql_test.go index 4756efcb..07db4f32 100644 --- a/internal/cli/dataimport/start/mysql_test.go +++ b/internal/cli/dataimport/start/mysql_test.go @@ -22,6 +22,8 @@ import ( "path/filepath" "runtime" "testing" + "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" + "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models" "tidbcloud-cli/internal" "tidbcloud-cli/internal/config" @@ -30,8 +32,6 @@ import ( "tidbcloud-cli/internal/service/cloud" connectInfoService "tidbcloud-cli/pkg/tidbcloud/connect_info/client/connect_info_service" connectInfoModel "tidbcloud-cli/pkg/tidbcloud/connect_info/models" - serverlessApi "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" - serverlessModel "tidbcloud-cli/pkg/tidbcloud/serverless/models" mockTool "github.com/stretchr/testify/mock" "github.com/stretchr/testify/require" @@ -198,11 +198,11 @@ func (suite *MySQLImportSuite) TestMySQLImportArgs() { "-p" + password, } suite.mockHelper.On("ImportToServerless", mockTool.Anything, importArgs, cachePath).Return(nil) - suite.mockClient.On("GetCluster", serverlessApi.NewServerlessServiceGetClusterParams(). - WithClusterID(clusterID)).Return(&serverlessApi.ServerlessServiceGetClusterOK{ - Payload: &serverlessModel.TidbCloudOpenApiserverlessv1beta1Cluster{ - Endpoints: &serverlessModel.V1beta1ClusterEndpoints{ - PublicEndpoint: &serverlessModel.EndpointsPublic{ + suite.mockClient.On("GetCluster", serverless_service.NewServerlessServiceGetClusterParams(). + WithClusterID(clusterID)).Return(&serverless_service.ServerlessServiceGetClusterOK{ + Payload: &models.TidbCloudOpenApiserverlessv1beta1Cluster{ + Endpoints: &models.V1beta1ClusterEndpoints{ + PublicEndpoint: &models.EndpointsPublic{ Host: targetHost, Port: targetPort, }, @@ -312,11 +312,11 @@ func (suite *MySQLImportSuite) TestMySQLImportWithoutCreateTable() { "-p" + password, } suite.mockHelper.On("ImportToServerless", mockTool.Anything, importArgs, cachePath).Return(nil) - suite.mockClient.On("GetCluster", serverlessApi.NewServerlessServiceGetClusterParams(). - WithClusterID(clusterID)).Return(&serverlessApi.ServerlessServiceGetClusterOK{ - Payload: &serverlessModel.TidbCloudOpenApiserverlessv1beta1Cluster{ - Endpoints: &serverlessModel.V1beta1ClusterEndpoints{ - PublicEndpoint: &serverlessModel.EndpointsPublic{ + suite.mockClient.On("GetCluster", serverless_service.NewServerlessServiceGetClusterParams(). + WithClusterID(clusterID)).Return(&serverless_service.ServerlessServiceGetClusterOK{ + Payload: &models.TidbCloudOpenApiserverlessv1beta1Cluster{ + Endpoints: &models.V1beta1ClusterEndpoints{ + PublicEndpoint: &models.EndpointsPublic{ Host: targetHost, Port: targetPort, }, @@ -421,11 +421,11 @@ func (suite *MySQLImportSuite) TestMySQLImportWithSpecificUser() { "-p" + password, } suite.mockHelper.On("ImportToServerless", mockTool.Anything, importArgs, cachePath).Return(nil) - suite.mockClient.On("GetCluster", serverlessApi.NewServerlessServiceGetClusterParams(). - WithClusterID(clusterID)).Return(&serverlessApi.ServerlessServiceGetClusterOK{ - Payload: &serverlessModel.TidbCloudOpenApiserverlessv1beta1Cluster{ - Endpoints: &serverlessModel.V1beta1ClusterEndpoints{ - PublicEndpoint: &serverlessModel.EndpointsPublic{ + suite.mockClient.On("GetCluster", serverless_service.NewServerlessServiceGetClusterParams(). + WithClusterID(clusterID)).Return(&serverless_service.ServerlessServiceGetClusterOK{ + Payload: &models.TidbCloudOpenApiserverlessv1beta1Cluster{ + Endpoints: &models.V1beta1ClusterEndpoints{ + PublicEndpoint: &models.EndpointsPublic{ Host: targetHost, Port: targetPort, }, diff --git a/internal/cli/serverless/connectinfo.go b/internal/cli/serverless/connectinfo.go index aaf76b5e..9267d6ba 100644 --- a/internal/cli/serverless/connectinfo.go +++ b/internal/cli/serverless/connectinfo.go @@ -20,15 +20,15 @@ import ( "strconv" "strings" + "github.com/juju/errors" + "github.com/spf13/cobra" + "tidbcloud-cli/internal" "tidbcloud-cli/internal/config" "tidbcloud-cli/internal/flag" "tidbcloud-cli/internal/service/cloud" "tidbcloud-cli/internal/util" - serverlessApi "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" - - "github.com/juju/errors" - "github.com/spf13/cobra" + serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" ) type connectInfoOpts struct { diff --git a/internal/cli/serverless/connectinfo_test.go b/internal/cli/serverless/connectinfo_test.go index 2877d6ce..a8751d75 100644 --- a/internal/cli/serverless/connectinfo_test.go +++ b/internal/cli/serverless/connectinfo_test.go @@ -20,19 +20,19 @@ import ( "fmt" "os" "testing" - "tidbcloud-cli/internal/config" - "github.com/juju/errors" + "tidbcloud-cli/internal/config" + connectInfoService "tidbcloud-cli/pkg/tidbcloud/connect_info/client/connect_info_service" + connectInfoModel "tidbcloud-cli/pkg/tidbcloud/connect_info/models" + serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" + serverlessModel "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models" "tidbcloud-cli/internal" "tidbcloud-cli/internal/iostream" "tidbcloud-cli/internal/mock" "tidbcloud-cli/internal/service/cloud" - connectInfoService "tidbcloud-cli/pkg/tidbcloud/connect_info/client/connect_info_service" - connectInfoModel "tidbcloud-cli/pkg/tidbcloud/connect_info/models" - serverlessApi "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" - serverlessModel "tidbcloud-cli/pkg/tidbcloud/serverless/models" + "github.com/juju/errors" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" ) diff --git a/internal/cli/serverless/create.go b/internal/cli/serverless/create.go index ef721fae..ca4d4368 100644 --- a/internal/cli/serverless/create.go +++ b/internal/cli/serverless/create.go @@ -29,9 +29,8 @@ import ( "tidbcloud-cli/internal/telemetry" "tidbcloud-cli/internal/ui" "tidbcloud-cli/internal/util" - - serverlessApi "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" - serverlessModel "tidbcloud-cli/pkg/tidbcloud/serverless/models" + serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" + serverlessModel "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models" "github.com/charmbracelet/bubbles/textinput" tea "github.com/charmbracelet/bubbletea" diff --git a/internal/cli/serverless/create_test.go b/internal/cli/serverless/create_test.go index 1d4b05b0..04df2e94 100644 --- a/internal/cli/serverless/create_test.go +++ b/internal/cli/serverless/create_test.go @@ -24,9 +24,8 @@ import ( "tidbcloud-cli/internal/iostream" "tidbcloud-cli/internal/mock" "tidbcloud-cli/internal/service/cloud" - - serverlessApi "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" - serverlessModel "tidbcloud-cli/pkg/tidbcloud/serverless/models" + serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" + serverlessModel "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" diff --git a/internal/cli/serverless/delete.go b/internal/cli/serverless/delete.go index d6fa637f..6a38e969 100644 --- a/internal/cli/serverless/delete.go +++ b/internal/cli/serverless/delete.go @@ -16,14 +16,14 @@ package serverless import ( "fmt" + "tidbcloud-cli/internal" "tidbcloud-cli/internal/config" "tidbcloud-cli/internal/flag" "tidbcloud-cli/internal/service/cloud" "tidbcloud-cli/internal/telemetry" "tidbcloud-cli/internal/util" - - serverlessApi "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" + serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" "github.com/AlecAivazis/survey/v2" "github.com/AlecAivazis/survey/v2/terminal" diff --git a/internal/cli/serverless/delete_test.go b/internal/cli/serverless/delete_test.go index 01e6cf05..77b0576e 100644 --- a/internal/cli/serverless/delete_test.go +++ b/internal/cli/serverless/delete_test.go @@ -24,9 +24,8 @@ import ( "tidbcloud-cli/internal/iostream" "tidbcloud-cli/internal/mock" "tidbcloud-cli/internal/service/cloud" - - serverlessApi "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" - serverlessModel "tidbcloud-cli/pkg/tidbcloud/serverless/models" + serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" + serverlessModel "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" diff --git a/internal/cli/serverless/describe.go b/internal/cli/serverless/describe.go index b80de46c..815bfef0 100644 --- a/internal/cli/serverless/describe.go +++ b/internal/cli/serverless/describe.go @@ -23,8 +23,7 @@ import ( "tidbcloud-cli/internal/flag" "tidbcloud-cli/internal/service/cloud" "tidbcloud-cli/internal/telemetry" - - serverlessApi "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" + serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" "github.com/juju/errors" "github.com/spf13/cobra" diff --git a/internal/cli/serverless/describe_test.go b/internal/cli/serverless/describe_test.go index 84b9b74b..0d78cde5 100644 --- a/internal/cli/serverless/describe_test.go +++ b/internal/cli/serverless/describe_test.go @@ -24,9 +24,8 @@ import ( "tidbcloud-cli/internal/iostream" "tidbcloud-cli/internal/mock" "tidbcloud-cli/internal/service/cloud" - - serverlessApi "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" - serverlessModel "tidbcloud-cli/pkg/tidbcloud/serverless/models" + serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" + serverlessModel "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" diff --git a/internal/cli/serverless/list.go b/internal/cli/serverless/list.go index 5592a6ce..fe517b0b 100644 --- a/internal/cli/serverless/list.go +++ b/internal/cli/serverless/list.go @@ -23,8 +23,7 @@ import ( "tidbcloud-cli/internal/output" "tidbcloud-cli/internal/service/cloud" "tidbcloud-cli/internal/telemetry" - - serverlessModel "tidbcloud-cli/pkg/tidbcloud/serverless/models" + serverlessModel "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models" "github.com/juju/errors" "github.com/spf13/cobra" diff --git a/internal/cli/serverless/list_test.go b/internal/cli/serverless/list_test.go index 96761f33..4bd6aeff 100644 --- a/internal/cli/serverless/list_test.go +++ b/internal/cli/serverless/list_test.go @@ -26,9 +26,8 @@ import ( "tidbcloud-cli/internal/iostream" "tidbcloud-cli/internal/mock" "tidbcloud-cli/internal/service/cloud" - - serverlessApi "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" - serverlessModel "tidbcloud-cli/pkg/tidbcloud/serverless/models" + serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" + serverlessModel "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" diff --git a/internal/cli/serverless/regions.go b/internal/cli/serverless/regions.go index 070bd06d..ad355f1d 100644 --- a/internal/cli/serverless/regions.go +++ b/internal/cli/serverless/regions.go @@ -20,7 +20,7 @@ import ( "tidbcloud-cli/internal" "tidbcloud-cli/internal/config" - serverlessApi "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" + serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" "github.com/juju/errors" "github.com/spf13/cobra" diff --git a/internal/cli/serverless/spending_limit.go b/internal/cli/serverless/spending_limit.go index 0f5812fd..8479a51c 100644 --- a/internal/cli/serverless/spending_limit.go +++ b/internal/cli/serverless/spending_limit.go @@ -24,8 +24,8 @@ import ( "tidbcloud-cli/internal/service/cloud" "tidbcloud-cli/internal/ui" "tidbcloud-cli/internal/util" - serverlessApi "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" - serverlessModel "tidbcloud-cli/pkg/tidbcloud/serverless/models" + serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" + serverlessModel "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models" "github.com/charmbracelet/bubbles/textinput" tea "github.com/charmbracelet/bubbletea" diff --git a/internal/cli/serverless/update.go b/internal/cli/serverless/update.go index 68f2a49a..4efce94f 100644 --- a/internal/cli/serverless/update.go +++ b/internal/cli/serverless/update.go @@ -17,6 +17,7 @@ package serverless import ( "encoding/json" "fmt" + "tidbcloud-cli/internal" "tidbcloud-cli/internal/config" "tidbcloud-cli/internal/flag" @@ -24,14 +25,11 @@ import ( "tidbcloud-cli/internal/telemetry" "tidbcloud-cli/internal/ui" "tidbcloud-cli/internal/util" - - "github.com/fatih/color" + serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" "github.com/charmbracelet/bubbles/textinput" tea "github.com/charmbracelet/bubbletea" - - serverlessApi "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" - + "github.com/fatih/color" "github.com/juju/errors" "github.com/spf13/cobra" ) diff --git a/internal/cli/serverless/update_test.go b/internal/cli/serverless/update_test.go index 79a5568d..e888d23e 100644 --- a/internal/cli/serverless/update_test.go +++ b/internal/cli/serverless/update_test.go @@ -25,8 +25,7 @@ import ( "tidbcloud-cli/internal/iostream" "tidbcloud-cli/internal/mock" "tidbcloud-cli/internal/service/cloud" - - serverlessApi "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" + serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" "github.com/stretchr/testify/require" "github.com/stretchr/testify/suite" diff --git a/internal/mock/api_client.go b/internal/mock/api_client.go index 6ee41782..a4ac3157 100644 --- a/internal/mock/api_client.go +++ b/internal/mock/api_client.go @@ -4,6 +4,7 @@ package mock import ( branch_service "tidbcloud-cli/pkg/tidbcloud/v1beta1/branch/client/branch_service" + serverless_service2 "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" connect_info_service "tidbcloud-cli/pkg/tidbcloud/connect_info/client/connect_info_service" @@ -14,8 +15,6 @@ import ( os "os" project "github.com/c4pt0r/go-tidbcloud-sdk-v1/client/project" - - serverless_service "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" ) // TiDBCloudClient is an autogenerated mock type for the TiDBCloudClient type @@ -98,7 +97,7 @@ func (_m *TiDBCloudClient) CreateBranch(params *branch_service.BranchServiceCrea } // CreateCluster provides a mock function with given fields: params, opts -func (_m *TiDBCloudClient) CreateCluster(params *serverless_service.ServerlessServiceCreateClusterParams, opts ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceCreateClusterOK, error) { +func (_m *TiDBCloudClient) CreateCluster(params *serverless_service2.ServerlessServiceCreateClusterParams, opts ...serverless_service2.ClientOption) (*serverless_service2.ServerlessServiceCreateClusterOK, error) { _va := make([]interface{}, len(opts)) for _i := range opts { _va[_i] = opts[_i] @@ -112,20 +111,20 @@ func (_m *TiDBCloudClient) CreateCluster(params *serverless_service.ServerlessSe panic("no return value specified for CreateCluster") } - var r0 *serverless_service.ServerlessServiceCreateClusterOK + var r0 *serverless_service2.ServerlessServiceCreateClusterOK var r1 error - if rf, ok := ret.Get(0).(func(*serverless_service.ServerlessServiceCreateClusterParams, ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceCreateClusterOK, error)); ok { + if rf, ok := ret.Get(0).(func(*serverless_service2.ServerlessServiceCreateClusterParams, ...serverless_service2.ClientOption) (*serverless_service2.ServerlessServiceCreateClusterOK, error)); ok { return rf(params, opts...) } - if rf, ok := ret.Get(0).(func(*serverless_service.ServerlessServiceCreateClusterParams, ...serverless_service.ClientOption) *serverless_service.ServerlessServiceCreateClusterOK); ok { + if rf, ok := ret.Get(0).(func(*serverless_service2.ServerlessServiceCreateClusterParams, ...serverless_service2.ClientOption) *serverless_service2.ServerlessServiceCreateClusterOK); ok { r0 = rf(params, opts...) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*serverless_service.ServerlessServiceCreateClusterOK) + r0 = ret.Get(0).(*serverless_service2.ServerlessServiceCreateClusterOK) } } - if rf, ok := ret.Get(1).(func(*serverless_service.ServerlessServiceCreateClusterParams, ...serverless_service.ClientOption) error); ok { + if rf, ok := ret.Get(1).(func(*serverless_service2.ServerlessServiceCreateClusterParams, ...serverless_service2.ClientOption) error); ok { r1 = rf(params, opts...) } else { r1 = ret.Error(1) @@ -209,7 +208,7 @@ func (_m *TiDBCloudClient) DeleteBranch(params *branch_service.BranchServiceDele } // DeleteCluster provides a mock function with given fields: params, opts -func (_m *TiDBCloudClient) DeleteCluster(params *serverless_service.ServerlessServiceDeleteClusterParams, opts ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceDeleteClusterOK, error) { +func (_m *TiDBCloudClient) DeleteCluster(params *serverless_service2.ServerlessServiceDeleteClusterParams, opts ...serverless_service2.ClientOption) (*serverless_service2.ServerlessServiceDeleteClusterOK, error) { _va := make([]interface{}, len(opts)) for _i := range opts { _va[_i] = opts[_i] @@ -223,20 +222,20 @@ func (_m *TiDBCloudClient) DeleteCluster(params *serverless_service.ServerlessSe panic("no return value specified for DeleteCluster") } - var r0 *serverless_service.ServerlessServiceDeleteClusterOK + var r0 *serverless_service2.ServerlessServiceDeleteClusterOK var r1 error - if rf, ok := ret.Get(0).(func(*serverless_service.ServerlessServiceDeleteClusterParams, ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceDeleteClusterOK, error)); ok { + if rf, ok := ret.Get(0).(func(*serverless_service2.ServerlessServiceDeleteClusterParams, ...serverless_service2.ClientOption) (*serverless_service2.ServerlessServiceDeleteClusterOK, error)); ok { return rf(params, opts...) } - if rf, ok := ret.Get(0).(func(*serverless_service.ServerlessServiceDeleteClusterParams, ...serverless_service.ClientOption) *serverless_service.ServerlessServiceDeleteClusterOK); ok { + if rf, ok := ret.Get(0).(func(*serverless_service2.ServerlessServiceDeleteClusterParams, ...serverless_service2.ClientOption) *serverless_service2.ServerlessServiceDeleteClusterOK); ok { r0 = rf(params, opts...) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*serverless_service.ServerlessServiceDeleteClusterOK) + r0 = ret.Get(0).(*serverless_service2.ServerlessServiceDeleteClusterOK) } } - if rf, ok := ret.Get(1).(func(*serverless_service.ServerlessServiceDeleteClusterParams, ...serverless_service.ClientOption) error); ok { + if rf, ok := ret.Get(1).(func(*serverless_service2.ServerlessServiceDeleteClusterParams, ...serverless_service2.ClientOption) error); ok { r1 = rf(params, opts...) } else { r1 = ret.Error(1) @@ -320,7 +319,7 @@ func (_m *TiDBCloudClient) GetBranch(params *branch_service.BranchServiceGetBran } // GetCluster provides a mock function with given fields: params, opts -func (_m *TiDBCloudClient) GetCluster(params *serverless_service.ServerlessServiceGetClusterParams, opts ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceGetClusterOK, error) { +func (_m *TiDBCloudClient) GetCluster(params *serverless_service2.ServerlessServiceGetClusterParams, opts ...serverless_service2.ClientOption) (*serverless_service2.ServerlessServiceGetClusterOK, error) { _va := make([]interface{}, len(opts)) for _i := range opts { _va[_i] = opts[_i] @@ -334,20 +333,20 @@ func (_m *TiDBCloudClient) GetCluster(params *serverless_service.ServerlessServi panic("no return value specified for GetCluster") } - var r0 *serverless_service.ServerlessServiceGetClusterOK + var r0 *serverless_service2.ServerlessServiceGetClusterOK var r1 error - if rf, ok := ret.Get(0).(func(*serverless_service.ServerlessServiceGetClusterParams, ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceGetClusterOK, error)); ok { + if rf, ok := ret.Get(0).(func(*serverless_service2.ServerlessServiceGetClusterParams, ...serverless_service2.ClientOption) (*serverless_service2.ServerlessServiceGetClusterOK, error)); ok { return rf(params, opts...) } - if rf, ok := ret.Get(0).(func(*serverless_service.ServerlessServiceGetClusterParams, ...serverless_service.ClientOption) *serverless_service.ServerlessServiceGetClusterOK); ok { + if rf, ok := ret.Get(0).(func(*serverless_service2.ServerlessServiceGetClusterParams, ...serverless_service2.ClientOption) *serverless_service2.ServerlessServiceGetClusterOK); ok { r0 = rf(params, opts...) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*serverless_service.ServerlessServiceGetClusterOK) + r0 = ret.Get(0).(*serverless_service2.ServerlessServiceGetClusterOK) } } - if rf, ok := ret.Get(1).(func(*serverless_service.ServerlessServiceGetClusterParams, ...serverless_service.ClientOption) error); ok { + if rf, ok := ret.Get(1).(func(*serverless_service2.ServerlessServiceGetClusterParams, ...serverless_service2.ClientOption) error); ok { r1 = rf(params, opts...) } else { r1 = ret.Error(1) @@ -468,7 +467,7 @@ func (_m *TiDBCloudClient) ListBranches(params *branch_service.BranchServiceList } // ListClustersOfProject provides a mock function with given fields: params, opts -func (_m *TiDBCloudClient) ListClustersOfProject(params *serverless_service.ServerlessServiceListClustersParams, opts ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceListClustersOK, error) { +func (_m *TiDBCloudClient) ListClustersOfProject(params *serverless_service2.ServerlessServiceListClustersParams, opts ...serverless_service2.ClientOption) (*serverless_service2.ServerlessServiceListClustersOK, error) { _va := make([]interface{}, len(opts)) for _i := range opts { _va[_i] = opts[_i] @@ -482,20 +481,20 @@ func (_m *TiDBCloudClient) ListClustersOfProject(params *serverless_service.Serv panic("no return value specified for ListClustersOfProject") } - var r0 *serverless_service.ServerlessServiceListClustersOK + var r0 *serverless_service2.ServerlessServiceListClustersOK var r1 error - if rf, ok := ret.Get(0).(func(*serverless_service.ServerlessServiceListClustersParams, ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceListClustersOK, error)); ok { + if rf, ok := ret.Get(0).(func(*serverless_service2.ServerlessServiceListClustersParams, ...serverless_service2.ClientOption) (*serverless_service2.ServerlessServiceListClustersOK, error)); ok { return rf(params, opts...) } - if rf, ok := ret.Get(0).(func(*serverless_service.ServerlessServiceListClustersParams, ...serverless_service.ClientOption) *serverless_service.ServerlessServiceListClustersOK); ok { + if rf, ok := ret.Get(0).(func(*serverless_service2.ServerlessServiceListClustersParams, ...serverless_service2.ClientOption) *serverless_service2.ServerlessServiceListClustersOK); ok { r0 = rf(params, opts...) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*serverless_service.ServerlessServiceListClustersOK) + r0 = ret.Get(0).(*serverless_service2.ServerlessServiceListClustersOK) } } - if rf, ok := ret.Get(1).(func(*serverless_service.ServerlessServiceListClustersParams, ...serverless_service.ClientOption) error); ok { + if rf, ok := ret.Get(1).(func(*serverless_service2.ServerlessServiceListClustersParams, ...serverless_service2.ClientOption) error); ok { r1 = rf(params, opts...) } else { r1 = ret.Error(1) @@ -579,7 +578,7 @@ func (_m *TiDBCloudClient) ListProjects(params *project.ListProjectsParams, opts } // ListProviderRegions provides a mock function with given fields: params, opts -func (_m *TiDBCloudClient) ListProviderRegions(params *serverless_service.ServerlessServiceListRegionsParams, opts ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceListRegionsOK, error) { +func (_m *TiDBCloudClient) ListProviderRegions(params *serverless_service2.ServerlessServiceListRegionsParams, opts ...serverless_service2.ClientOption) (*serverless_service2.ServerlessServiceListRegionsOK, error) { _va := make([]interface{}, len(opts)) for _i := range opts { _va[_i] = opts[_i] @@ -593,20 +592,20 @@ func (_m *TiDBCloudClient) ListProviderRegions(params *serverless_service.Server panic("no return value specified for ListProviderRegions") } - var r0 *serverless_service.ServerlessServiceListRegionsOK + var r0 *serverless_service2.ServerlessServiceListRegionsOK var r1 error - if rf, ok := ret.Get(0).(func(*serverless_service.ServerlessServiceListRegionsParams, ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceListRegionsOK, error)); ok { + if rf, ok := ret.Get(0).(func(*serverless_service2.ServerlessServiceListRegionsParams, ...serverless_service2.ClientOption) (*serverless_service2.ServerlessServiceListRegionsOK, error)); ok { return rf(params, opts...) } - if rf, ok := ret.Get(0).(func(*serverless_service.ServerlessServiceListRegionsParams, ...serverless_service.ClientOption) *serverless_service.ServerlessServiceListRegionsOK); ok { + if rf, ok := ret.Get(0).(func(*serverless_service2.ServerlessServiceListRegionsParams, ...serverless_service2.ClientOption) *serverless_service2.ServerlessServiceListRegionsOK); ok { r0 = rf(params, opts...) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*serverless_service.ServerlessServiceListRegionsOK) + r0 = ret.Get(0).(*serverless_service2.ServerlessServiceListRegionsOK) } } - if rf, ok := ret.Get(1).(func(*serverless_service.ServerlessServiceListRegionsParams, ...serverless_service.ClientOption) error); ok { + if rf, ok := ret.Get(1).(func(*serverless_service2.ServerlessServiceListRegionsParams, ...serverless_service2.ClientOption) error); ok { r1 = rf(params, opts...) } else { r1 = ret.Error(1) @@ -616,7 +615,7 @@ func (_m *TiDBCloudClient) ListProviderRegions(params *serverless_service.Server } // PartialUpdateCluster provides a mock function with given fields: params, opts -func (_m *TiDBCloudClient) PartialUpdateCluster(params *serverless_service.ServerlessServicePartialUpdateClusterParams, opts ...serverless_service.ClientOption) (*serverless_service.ServerlessServicePartialUpdateClusterOK, error) { +func (_m *TiDBCloudClient) PartialUpdateCluster(params *serverless_service2.ServerlessServicePartialUpdateClusterParams, opts ...serverless_service2.ClientOption) (*serverless_service2.ServerlessServicePartialUpdateClusterOK, error) { _va := make([]interface{}, len(opts)) for _i := range opts { _va[_i] = opts[_i] @@ -630,20 +629,20 @@ func (_m *TiDBCloudClient) PartialUpdateCluster(params *serverless_service.Serve panic("no return value specified for PartialUpdateCluster") } - var r0 *serverless_service.ServerlessServicePartialUpdateClusterOK + var r0 *serverless_service2.ServerlessServicePartialUpdateClusterOK var r1 error - if rf, ok := ret.Get(0).(func(*serverless_service.ServerlessServicePartialUpdateClusterParams, ...serverless_service.ClientOption) (*serverless_service.ServerlessServicePartialUpdateClusterOK, error)); ok { + if rf, ok := ret.Get(0).(func(*serverless_service2.ServerlessServicePartialUpdateClusterParams, ...serverless_service2.ClientOption) (*serverless_service2.ServerlessServicePartialUpdateClusterOK, error)); ok { return rf(params, opts...) } - if rf, ok := ret.Get(0).(func(*serverless_service.ServerlessServicePartialUpdateClusterParams, ...serverless_service.ClientOption) *serverless_service.ServerlessServicePartialUpdateClusterOK); ok { + if rf, ok := ret.Get(0).(func(*serverless_service2.ServerlessServicePartialUpdateClusterParams, ...serverless_service2.ClientOption) *serverless_service2.ServerlessServicePartialUpdateClusterOK); ok { r0 = rf(params, opts...) } else { if ret.Get(0) != nil { - r0 = ret.Get(0).(*serverless_service.ServerlessServicePartialUpdateClusterOK) + r0 = ret.Get(0).(*serverless_service2.ServerlessServicePartialUpdateClusterOK) } } - if rf, ok := ret.Get(1).(func(*serverless_service.ServerlessServicePartialUpdateClusterParams, ...serverless_service.ClientOption) error); ok { + if rf, ok := ret.Get(1).(func(*serverless_service2.ServerlessServicePartialUpdateClusterParams, ...serverless_service2.ClientOption) error); ok { r1 = rf(params, opts...) } else { r1 = ret.Error(1) diff --git a/internal/service/cloud/api_client.go b/internal/service/cloud/api_client.go index 5c1e3710..ca3e936c 100644 --- a/internal/service/cloud/api_client.go +++ b/internal/service/cloud/api_client.go @@ -26,10 +26,10 @@ import ( connectInfoOp "tidbcloud-cli/pkg/tidbcloud/connect_info/client/connect_info_service" importClient "tidbcloud-cli/pkg/tidbcloud/import/client" importOp "tidbcloud-cli/pkg/tidbcloud/import/client/import_service" - serverlessClient "tidbcloud-cli/pkg/tidbcloud/serverless/client" - serverlessOp "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" branchClient "tidbcloud-cli/pkg/tidbcloud/v1beta1/branch/client" branchOp "tidbcloud-cli/pkg/tidbcloud/v1beta1/branch/client/branch_service" + serverlessClient "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client" + "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" apiClient "github.com/c4pt0r/go-tidbcloud-sdk-v1/client" "github.com/c4pt0r/go-tidbcloud-sdk-v1/client/project" @@ -45,17 +45,17 @@ const ( ) type TiDBCloudClient interface { - CreateCluster(params *serverlessOp.ServerlessServiceCreateClusterParams, opts ...serverlessOp.ClientOption) (*serverlessOp.ServerlessServiceCreateClusterOK, error) + CreateCluster(params *serverless_service.ServerlessServiceCreateClusterParams, opts ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceCreateClusterOK, error) - DeleteCluster(params *serverlessOp.ServerlessServiceDeleteClusterParams, opts ...serverlessOp.ClientOption) (*serverlessOp.ServerlessServiceDeleteClusterOK, error) + DeleteCluster(params *serverless_service.ServerlessServiceDeleteClusterParams, opts ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceDeleteClusterOK, error) - GetCluster(params *serverlessOp.ServerlessServiceGetClusterParams, opts ...serverlessOp.ClientOption) (*serverlessOp.ServerlessServiceGetClusterOK, error) + GetCluster(params *serverless_service.ServerlessServiceGetClusterParams, opts ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceGetClusterOK, error) - ListClustersOfProject(params *serverlessOp.ServerlessServiceListClustersParams, opts ...serverlessOp.ClientOption) (*serverlessOp.ServerlessServiceListClustersOK, error) + ListClustersOfProject(params *serverless_service.ServerlessServiceListClustersParams, opts ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceListClustersOK, error) - PartialUpdateCluster(params *serverlessOp.ServerlessServicePartialUpdateClusterParams, opts ...serverlessOp.ClientOption) (*serverlessOp.ServerlessServicePartialUpdateClusterOK, error) + PartialUpdateCluster(params *serverless_service.ServerlessServicePartialUpdateClusterParams, opts ...serverless_service.ClientOption) (*serverless_service.ServerlessServicePartialUpdateClusterOK, error) - ListProviderRegions(params *serverlessOp.ServerlessServiceListRegionsParams, opts ...serverlessOp.ClientOption) (*serverlessOp.ServerlessServiceListRegionsOK, error) + ListProviderRegions(params *serverless_service.ServerlessServiceListRegionsParams, opts ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceListRegionsOK, error) ListProjects(params *project.ListProjectsParams, opts ...project.ClientOption) (*project.ListProjectsOK, error) @@ -104,27 +104,27 @@ func NewClientDelegate(publicKey string, privateKey string, apiUrl string, serve }, nil } -func (d *ClientDelegate) CreateCluster(params *serverlessOp.ServerlessServiceCreateClusterParams, opts ...serverlessOp.ClientOption) (*serverlessOp.ServerlessServiceCreateClusterOK, error) { +func (d *ClientDelegate) CreateCluster(params *serverless_service.ServerlessServiceCreateClusterParams, opts ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceCreateClusterOK, error) { return d.sc.ServerlessService.ServerlessServiceCreateCluster(params, opts...) } -func (d *ClientDelegate) DeleteCluster(params *serverlessOp.ServerlessServiceDeleteClusterParams, opts ...serverlessOp.ClientOption) (*serverlessOp.ServerlessServiceDeleteClusterOK, error) { +func (d *ClientDelegate) DeleteCluster(params *serverless_service.ServerlessServiceDeleteClusterParams, opts ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceDeleteClusterOK, error) { return d.sc.ServerlessService.ServerlessServiceDeleteCluster(params, opts...) } -func (d *ClientDelegate) GetCluster(params *serverlessOp.ServerlessServiceGetClusterParams, opts ...serverlessOp.ClientOption) (*serverlessOp.ServerlessServiceGetClusterOK, error) { +func (d *ClientDelegate) GetCluster(params *serverless_service.ServerlessServiceGetClusterParams, opts ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceGetClusterOK, error) { return d.sc.ServerlessService.ServerlessServiceGetCluster(params, opts...) } -func (d *ClientDelegate) ListProviderRegions(params *serverlessOp.ServerlessServiceListRegionsParams, opts ...serverlessOp.ClientOption) (*serverlessOp.ServerlessServiceListRegionsOK, error) { +func (d *ClientDelegate) ListProviderRegions(params *serverless_service.ServerlessServiceListRegionsParams, opts ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceListRegionsOK, error) { return d.sc.ServerlessService.ServerlessServiceListRegions(params, opts...) } -func (d *ClientDelegate) ListClustersOfProject(params *serverlessOp.ServerlessServiceListClustersParams, opts ...serverlessOp.ClientOption) (*serverlessOp.ServerlessServiceListClustersOK, error) { +func (d *ClientDelegate) ListClustersOfProject(params *serverless_service.ServerlessServiceListClustersParams, opts ...serverless_service.ClientOption) (*serverless_service.ServerlessServiceListClustersOK, error) { return d.sc.ServerlessService.ServerlessServiceListClusters(params, opts...) } -func (d *ClientDelegate) PartialUpdateCluster(params *serverlessOp.ServerlessServicePartialUpdateClusterParams, opts ...serverlessOp.ClientOption) (*serverlessOp.ServerlessServicePartialUpdateClusterOK, error) { +func (d *ClientDelegate) PartialUpdateCluster(params *serverless_service.ServerlessServicePartialUpdateClusterParams, opts ...serverless_service.ClientOption) (*serverless_service.ServerlessServicePartialUpdateClusterOK, error) { return d.sc.ServerlessService.ServerlessServicePartialUpdateCluster(params, opts...) } diff --git a/internal/service/cloud/logic.go b/internal/service/cloud/logic.go index 1846dc0e..be3ce3d5 100644 --- a/internal/service/cloud/logic.go +++ b/internal/service/cloud/logic.go @@ -18,16 +18,17 @@ import ( "fmt" "math" "strconv" + "tidbcloud-cli/internal/ui" "tidbcloud-cli/internal/util" connectInfoApi "tidbcloud-cli/pkg/tidbcloud/connect_info/client/connect_info_service" connectInfoModel "tidbcloud-cli/pkg/tidbcloud/connect_info/models" importApi "tidbcloud-cli/pkg/tidbcloud/import/client/import_service" importModel "tidbcloud-cli/pkg/tidbcloud/import/models" - serverlessApi "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" - serverlessModel "tidbcloud-cli/pkg/tidbcloud/serverless/models" branchApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/branch/client/branch_service" branchModel "tidbcloud-cli/pkg/tidbcloud/v1beta1/branch/models" + serverlessApi "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" + serverlessModel "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models" projectApi "github.com/c4pt0r/go-tidbcloud-sdk-v1/client/project" tea "github.com/charmbracelet/bubbletea" diff --git a/pkg/tidbcloud/branch/README.md b/pkg/tidbcloud/branch/README.md deleted file mode 100644 index 668020fe..00000000 --- a/pkg/tidbcloud/branch/README.md +++ /dev/null @@ -1,54 +0,0 @@ -We need to change the googlerpcStatus in branch_openapi.swagger.json - -``` - "googlerpcStatus": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "details": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/protobufAny" - } - } - } - } -``` - -to - -``` - "googlerpcStatus": { - "type": "object", - "properties": { - "error": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "details": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/protobufAny" - } - } - } - } - } - } -``` - -Reason: open API's error output is different from `googlerpcStatus` (default error output) diff --git a/pkg/tidbcloud/branch/branch.swagger.json b/pkg/tidbcloud/branch/branch.swagger.json deleted file mode 100644 index 99e55aba..00000000 --- a/pkg/tidbcloud/branch/branch.swagger.json +++ /dev/null @@ -1,468 +0,0 @@ -{ - "swagger": "2.0", - "info": { - "title": "Branch OpenAPIs for TiDB Cloud", - "description": "The TiDB Cloud API uses HTTP Digest Authentication. It protects your private key from being sent over the network.The API key contains a public key and a private key, which act as the username and password required in the HTTP Digest Authentication. The private key only displays upon the key creation.", - "version": "v1beta" - }, - "tags": [ - { - "name": "BranchService" - } - ], - "host": "api.tidbcloud.com", - "schemes": [ - "https" - ], - "consumes": [ - "application/json" - ], - "produces": [ - "application/json" - ], - "paths": { - "/api/v1beta/clusters/{cluster_id}/branches": { - "get": { - "summary": "List all branches in the cluster.", - "operationId": "ListBranches", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/openapiListBranchesResp" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/googlerpcStatus" - } - } - }, - "parameters": [ - { - "name": "cluster_id", - "description": "The ID of the cluster.", - "in": "path", - "required": true, - "type": "string" - }, - { - "name": "page_token", - "description": "The number of pages.", - "in": "query", - "required": false, - "type": "integer", - "format": "int64", - "default": 1 - }, - { - "name": "page_size", - "description": "The size of a page.", - "in": "query", - "required": false, - "type": "integer", - "format": "int64", - "default": 10 - } - ], - "tags": [ - "BranchService" - ] - }, - "post": { - "summary": "Create a branch.", - "operationId": "CreateBranch", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/openapiCreateBranchResp" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/googlerpcStatus" - } - } - }, - "parameters": [ - { - "name": "cluster_id", - "description": "The ID of the cluster.", - "in": "path", - "required": true, - "type": "string" - }, - { - "name": "body", - "in": "body", - "required": true, - "schema": { - "type": "object", - "properties": { - "display_name": { - "type": "string", - "description": "The name of creating branch. It must be 4-64 characters long." - } - }, - "description": "CreateBranchReq is the request message for CreateBranch.", - "required": [ - "display_name" - ] - } - } - ], - "tags": [ - "BranchService" - ] - } - }, - "/api/v1beta/clusters/{cluster_id}/branches/{branch_id}": { - "get": { - "summary": "Get a branch.", - "operationId": "GetBranch", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "$ref": "#/definitions/openapiBranch" - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/googlerpcStatus" - } - } - }, - "parameters": [ - { - "name": "cluster_id", - "description": "The ID of the cluster.", - "in": "path", - "required": true, - "type": "string" - }, - { - "name": "branch_id", - "description": "The ID of the branch.", - "in": "path", - "required": true, - "type": "string" - } - ], - "tags": [ - "BranchService" - ] - }, - "delete": { - "summary": "Delete a branch.", - "operationId": "DeleteBranch", - "responses": { - "200": { - "description": "A successful response.", - "schema": { - "type": "object", - "properties": {} - } - }, - "default": { - "description": "An unexpected error response.", - "schema": { - "$ref": "#/definitions/googlerpcStatus" - } - } - }, - "parameters": [ - { - "name": "cluster_id", - "description": "The ID of the cluster.", - "in": "path", - "required": true, - "type": "string" - }, - { - "name": "branch_id", - "description": "The ID of the branch.", - "in": "path", - "required": true, - "type": "string" - } - ], - "tags": [ - "BranchService" - ] - } - } - }, - "definitions": { - "googlerpcStatus": { - "type": "object", - "properties": { - "error": { - "type": "object", - "properties": { - "code": { - "type": "integer", - "format": "int32" - }, - "message": { - "type": "string" - }, - "details": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/protobufAny" - } - } - } - } - } - }, - "openapiBasicBranch": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The ID of the branch." - }, - "name": { - "type": "string", - "description": "The name of the branch." - }, - "display_name": { - "type": "string", - "description": "The display name of the branch." - }, - "cluster_id": { - "type": "string", - "description": "The ID of the cluster." - }, - "parent_id": { - "type": "string", - "description": "The ID of the parent branch." - }, - "state": { - "$ref": "#/definitions/openapiBranchState", - "description": "The status of the branch." - }, - "create_time": { - "type": "string", - "format": "date-time", - "description": "The creation timestamp of the branch." - }, - "update_time": { - "type": "string", - "format": "date-time", - "description": "The update timestamp of the branch." - }, - "delete_time": { - "type": "string", - "format": "date-time", - "description": "The delete timestamp of the branch." - } - }, - "description": "BranchItem is the information of branch.", - "title": "BranchItem", - "required": [ - "id", - "name", - "display_name", - "cluster_id", - "parent_id", - "state", - "create_time", - "update_time", - "delete_time" - ] - }, - "openapiBranch": { - "type": "object", - "properties": { - "id": { - "type": "string", - "description": "The ID of the branch." - }, - "name": { - "type": "string", - "description": "The name of the branch." - }, - "display_name": { - "type": "string", - "description": "The display name of the branch." - }, - "cluster_id": { - "type": "string", - "description": "The ID of the cluster." - }, - "parent_id": { - "type": "string", - "description": "The ID of the parent branch." - }, - "state": { - "$ref": "#/definitions/openapiBranchState", - "description": "The status of the branch." - }, - "endpoints": { - "$ref": "#/definitions/openapiEndpoints", - "description": "The endpoint of the branch." - }, - "user_prefix": { - "type": "string", - "description": "The userPrefix of the branch." - }, - "usages": { - "$ref": "#/definitions/openapiUsages", - "description": "The usages of the branch." - }, - "create_time": { - "type": "string", - "format": "date-time", - "description": "The creation timestamp of the branch." - }, - "update_time": { - "type": "string", - "format": "date-time", - "description": "The update timestamp of the branch." - }, - "delete_time": { - "type": "string", - "format": "date-time", - "description": "The delete timestamp of the branch." - }, - "annotations": { - "type": "object", - "additionalProperties": { - "type": "string" - }, - "description": "The annotations of the branch." - } - }, - "description": "BranchItem is the information of branch.", - "title": "BranchItem", - "required": [ - "id", - "name", - "display_name", - "cluster_id", - "parent_id", - "state", - "endpoints", - "user_prefix", - "usages", - "create_time", - "update_time", - "delete_time", - "annotations" - ] - }, - "openapiBranchState": { - "type": "string", - "enum": [ - "CREATING", - "READY", - "DELETING", - "MAINTENANCE" - ] - }, - "openapiCreateBranchResp": { - "type": "object", - "properties": { - "id": { - "type": "string", - "example": "branch-SDUAOISD", - "description": "The ID of the branch." - } - }, - "description": "CreateBranchResp is the response message for CreateBranch.", - "required": [ - "id" - ] - }, - "openapiEndpoints": { - "type": "object", - "properties": { - "public_endpoint": { - "$ref": "#/definitions/openapiPublicEndpoint", - "description": "The public endpoint of the branch." - } - }, - "description": "Endpoints is the endpoint of the branch." - }, - "openapiListBranchesResp": { - "type": "object", - "properties": { - "branches": { - "type": "array", - "items": { - "type": "object", - "$ref": "#/definitions/openapiBasicBranch" - }, - "description": "The items of branches in the cluster." - }, - "total": { - "type": "integer", - "format": "int64", - "description": "The total number of branches in the cluster." - } - }, - "description": "ListBranchesResp is the response of ListBranches.", - "required": [ - "branches", - "total" - ] - }, - "openapiPublicEndpoint": { - "type": "object", - "properties": { - "host": { - "type": "string", - "description": "The host of the public endpoint." - }, - "port": { - "type": "integer", - "format": "int32", - "description": "The port of the public endpoint." - }, - "disabled": { - "type": "boolean", - "description": "The disabled of the public endpoint." - } - }, - "description": "PublicEndpoint is the public endpoint of the branch." - }, - "openapiUsages": { - "type": "object", - "properties": { - "request_unit": { - "type": "string", - "format": "int64", - "description": "The request unit of the branch." - }, - "row_storage": { - "type": "string", - "format": "int64", - "description": "The storage of the branch." - }, - "column_storage": { - "type": "string", - "format": "int64", - "description": "The column storage of the branch." - } - }, - "description": "Usages is the usages of the branch." - }, - "protobufAny": { - "type": "object", - "properties": { - "@type": { - "type": "string" - } - }, - "additionalProperties": {} - } - } -} diff --git a/pkg/tidbcloud/branch/client/branch_service/branch_service_client.go b/pkg/tidbcloud/branch/client/branch_service/branch_service_client.go deleted file mode 100644 index 303d4790..00000000 --- a/pkg/tidbcloud/branch/client/branch_service/branch_service_client.go +++ /dev/null @@ -1,193 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package branch_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" -) - -// New creates a new branch service API client. -func New(transport runtime.ClientTransport, formats strfmt.Registry) ClientService { - return &Client{transport: transport, formats: formats} -} - -/* -Client for branch service API -*/ -type Client struct { - transport runtime.ClientTransport - formats strfmt.Registry -} - -// ClientOption is the option for Client methods -type ClientOption func(*runtime.ClientOperation) - -// ClientService is the interface for Client methods -type ClientService interface { - CreateBranch(params *CreateBranchParams, opts ...ClientOption) (*CreateBranchOK, error) - - DeleteBranch(params *DeleteBranchParams, opts ...ClientOption) (*DeleteBranchOK, error) - - GetBranch(params *GetBranchParams, opts ...ClientOption) (*GetBranchOK, error) - - ListBranches(params *ListBranchesParams, opts ...ClientOption) (*ListBranchesOK, error) - - SetTransport(transport runtime.ClientTransport) -} - -/* -CreateBranch creates a branch -*/ -func (a *Client) CreateBranch(params *CreateBranchParams, opts ...ClientOption) (*CreateBranchOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewCreateBranchParams() - } - op := &runtime.ClientOperation{ - ID: "CreateBranch", - Method: "POST", - PathPattern: "/api/v1beta/clusters/{cluster_id}/branches", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"https"}, - Params: params, - Reader: &CreateBranchReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*CreateBranchOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*CreateBranchDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - -/* -DeleteBranch deletes a branch -*/ -func (a *Client) DeleteBranch(params *DeleteBranchParams, opts ...ClientOption) (*DeleteBranchOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewDeleteBranchParams() - } - op := &runtime.ClientOperation{ - ID: "DeleteBranch", - Method: "DELETE", - PathPattern: "/api/v1beta/clusters/{cluster_id}/branches/{branch_id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"https"}, - Params: params, - Reader: &DeleteBranchReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*DeleteBranchOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*DeleteBranchDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - -/* -GetBranch gets a branch -*/ -func (a *Client) GetBranch(params *GetBranchParams, opts ...ClientOption) (*GetBranchOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewGetBranchParams() - } - op := &runtime.ClientOperation{ - ID: "GetBranch", - Method: "GET", - PathPattern: "/api/v1beta/clusters/{cluster_id}/branches/{branch_id}", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"https"}, - Params: params, - Reader: &GetBranchReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*GetBranchOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*GetBranchDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - -/* -ListBranches lists all branches in the cluster -*/ -func (a *Client) ListBranches(params *ListBranchesParams, opts ...ClientOption) (*ListBranchesOK, error) { - // TODO: Validate the params before sending - if params == nil { - params = NewListBranchesParams() - } - op := &runtime.ClientOperation{ - ID: "ListBranches", - Method: "GET", - PathPattern: "/api/v1beta/clusters/{cluster_id}/branches", - ProducesMediaTypes: []string{"application/json"}, - ConsumesMediaTypes: []string{"application/json"}, - Schemes: []string{"https"}, - Params: params, - Reader: &ListBranchesReader{formats: a.formats}, - Context: params.Context, - Client: params.HTTPClient, - } - for _, opt := range opts { - opt(op) - } - - result, err := a.transport.Submit(op) - if err != nil { - return nil, err - } - success, ok := result.(*ListBranchesOK) - if ok { - return success, nil - } - // unexpected success response - unexpectedSuccess := result.(*ListBranchesDefault) - return nil, runtime.NewAPIError("unexpected success response: content available as default response in error", unexpectedSuccess, unexpectedSuccess.Code()) -} - -// SetTransport changes the transport on the client -func (a *Client) SetTransport(transport runtime.ClientTransport) { - a.transport = transport -} diff --git a/pkg/tidbcloud/branch/client/branch_service/create_branch_parameters.go b/pkg/tidbcloud/branch/client/branch_service/create_branch_parameters.go deleted file mode 100644 index 8f4d7a94..00000000 --- a/pkg/tidbcloud/branch/client/branch_service/create_branch_parameters.go +++ /dev/null @@ -1,168 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package branch_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewCreateBranchParams creates a new CreateBranchParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewCreateBranchParams() *CreateBranchParams { - return &CreateBranchParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewCreateBranchParamsWithTimeout creates a new CreateBranchParams object -// with the ability to set a timeout on a request. -func NewCreateBranchParamsWithTimeout(timeout time.Duration) *CreateBranchParams { - return &CreateBranchParams{ - timeout: timeout, - } -} - -// NewCreateBranchParamsWithContext creates a new CreateBranchParams object -// with the ability to set a context for a request. -func NewCreateBranchParamsWithContext(ctx context.Context) *CreateBranchParams { - return &CreateBranchParams{ - Context: ctx, - } -} - -// NewCreateBranchParamsWithHTTPClient creates a new CreateBranchParams object -// with the ability to set a custom HTTPClient for a request. -func NewCreateBranchParamsWithHTTPClient(client *http.Client) *CreateBranchParams { - return &CreateBranchParams{ - HTTPClient: client, - } -} - -/* -CreateBranchParams contains all the parameters to send to the API endpoint - - for the create branch operation. - - Typically these are written to a http.Request. -*/ -type CreateBranchParams struct { - - // Body. - Body CreateBranchBody - - /* ClusterID. - - The ID of the cluster. - */ - ClusterID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the create branch params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *CreateBranchParams) WithDefaults() *CreateBranchParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the create branch params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *CreateBranchParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the create branch params -func (o *CreateBranchParams) WithTimeout(timeout time.Duration) *CreateBranchParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the create branch params -func (o *CreateBranchParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the create branch params -func (o *CreateBranchParams) WithContext(ctx context.Context) *CreateBranchParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the create branch params -func (o *CreateBranchParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the create branch params -func (o *CreateBranchParams) WithHTTPClient(client *http.Client) *CreateBranchParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the create branch params -func (o *CreateBranchParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBody adds the body to the create branch params -func (o *CreateBranchParams) WithBody(body CreateBranchBody) *CreateBranchParams { - o.SetBody(body) - return o -} - -// SetBody adds the body to the create branch params -func (o *CreateBranchParams) SetBody(body CreateBranchBody) { - o.Body = body -} - -// WithClusterID adds the clusterID to the create branch params -func (o *CreateBranchParams) WithClusterID(clusterID string) *CreateBranchParams { - o.SetClusterID(clusterID) - return o -} - -// SetClusterID adds the clusterId to the create branch params -func (o *CreateBranchParams) SetClusterID(clusterID string) { - o.ClusterID = clusterID -} - -// WriteToRequest writes these params to a swagger request -func (o *CreateBranchParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - if err := r.SetBodyParam(o.Body); err != nil { - return err - } - - // path param cluster_id - if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/pkg/tidbcloud/branch/client/branch_service/create_branch_responses.go b/pkg/tidbcloud/branch/client/branch_service/create_branch_responses.go deleted file mode 100644 index a51610bc..00000000 --- a/pkg/tidbcloud/branch/client/branch_service/create_branch_responses.go +++ /dev/null @@ -1,243 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package branch_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "fmt" - "io" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" - - "tidbcloud-cli/pkg/tidbcloud/branch/models" -) - -// CreateBranchReader is a Reader for the CreateBranch structure. -type CreateBranchReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *CreateBranchReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewCreateBranchOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewCreateBranchDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewCreateBranchOK creates a CreateBranchOK with default headers values -func NewCreateBranchOK() *CreateBranchOK { - return &CreateBranchOK{} -} - -/* -CreateBranchOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type CreateBranchOK struct { - Payload *models.OpenapiCreateBranchResp -} - -// IsSuccess returns true when this create branch o k response has a 2xx status code -func (o *CreateBranchOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this create branch o k response has a 3xx status code -func (o *CreateBranchOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this create branch o k response has a 4xx status code -func (o *CreateBranchOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this create branch o k response has a 5xx status code -func (o *CreateBranchOK) IsServerError() bool { - return false -} - -// IsCode returns true when this create branch o k response a status code equal to that given -func (o *CreateBranchOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the create branch o k response -func (o *CreateBranchOK) Code() int { - return 200 -} - -func (o *CreateBranchOK) Error() string { - return fmt.Sprintf("[POST /api/v1beta/clusters/{cluster_id}/branches][%d] createBranchOK %+v", 200, o.Payload) -} - -func (o *CreateBranchOK) String() string { - return fmt.Sprintf("[POST /api/v1beta/clusters/{cluster_id}/branches][%d] createBranchOK %+v", 200, o.Payload) -} - -func (o *CreateBranchOK) GetPayload() *models.OpenapiCreateBranchResp { - return o.Payload -} - -func (o *CreateBranchOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.OpenapiCreateBranchResp) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewCreateBranchDefault creates a CreateBranchDefault with default headers values -func NewCreateBranchDefault(code int) *CreateBranchDefault { - return &CreateBranchDefault{ - _statusCode: code, - } -} - -/* -CreateBranchDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type CreateBranchDefault struct { - _statusCode int - - Payload *models.GooglerpcStatus -} - -// IsSuccess returns true when this create branch default response has a 2xx status code -func (o *CreateBranchDefault) IsSuccess() bool { - return o._statusCode/100 == 2 -} - -// IsRedirect returns true when this create branch default response has a 3xx status code -func (o *CreateBranchDefault) IsRedirect() bool { - return o._statusCode/100 == 3 -} - -// IsClientError returns true when this create branch default response has a 4xx status code -func (o *CreateBranchDefault) IsClientError() bool { - return o._statusCode/100 == 4 -} - -// IsServerError returns true when this create branch default response has a 5xx status code -func (o *CreateBranchDefault) IsServerError() bool { - return o._statusCode/100 == 5 -} - -// IsCode returns true when this create branch default response a status code equal to that given -func (o *CreateBranchDefault) IsCode(code int) bool { - return o._statusCode == code -} - -// Code gets the status code for the create branch default response -func (o *CreateBranchDefault) Code() int { - return o._statusCode -} - -func (o *CreateBranchDefault) Error() string { - return fmt.Sprintf("[POST /api/v1beta/clusters/{cluster_id}/branches][%d] CreateBranch default %+v", o._statusCode, o.Payload) -} - -func (o *CreateBranchDefault) String() string { - return fmt.Sprintf("[POST /api/v1beta/clusters/{cluster_id}/branches][%d] CreateBranch default %+v", o._statusCode, o.Payload) -} - -func (o *CreateBranchDefault) GetPayload() *models.GooglerpcStatus { - return o.Payload -} - -func (o *CreateBranchDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.GooglerpcStatus) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -/* -CreateBranchBody CreateBranchReq is the request message for CreateBranch. -swagger:model CreateBranchBody -*/ -type CreateBranchBody struct { - - // The name of creating branch. It must be 4-64 characters long. - // Required: true - DisplayName *string `json:"display_name"` -} - -// Validate validates this create branch body -func (o *CreateBranchBody) Validate(formats strfmt.Registry) error { - var res []error - - if err := o.validateDisplayName(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (o *CreateBranchBody) validateDisplayName(formats strfmt.Registry) error { - - if err := validate.Required("body"+"."+"display_name", "body", o.DisplayName); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this create branch body based on context it is used -func (o *CreateBranchBody) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (o *CreateBranchBody) MarshalBinary() ([]byte, error) { - if o == nil { - return nil, nil - } - return swag.WriteJSON(o) -} - -// UnmarshalBinary interface implementation -func (o *CreateBranchBody) UnmarshalBinary(b []byte) error { - var res CreateBranchBody - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *o = res - return nil -} diff --git a/pkg/tidbcloud/branch/client/branch_service/delete_branch_parameters.go b/pkg/tidbcloud/branch/client/branch_service/delete_branch_parameters.go deleted file mode 100644 index d61d31a9..00000000 --- a/pkg/tidbcloud/branch/client/branch_service/delete_branch_parameters.go +++ /dev/null @@ -1,173 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package branch_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewDeleteBranchParams creates a new DeleteBranchParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewDeleteBranchParams() *DeleteBranchParams { - return &DeleteBranchParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewDeleteBranchParamsWithTimeout creates a new DeleteBranchParams object -// with the ability to set a timeout on a request. -func NewDeleteBranchParamsWithTimeout(timeout time.Duration) *DeleteBranchParams { - return &DeleteBranchParams{ - timeout: timeout, - } -} - -// NewDeleteBranchParamsWithContext creates a new DeleteBranchParams object -// with the ability to set a context for a request. -func NewDeleteBranchParamsWithContext(ctx context.Context) *DeleteBranchParams { - return &DeleteBranchParams{ - Context: ctx, - } -} - -// NewDeleteBranchParamsWithHTTPClient creates a new DeleteBranchParams object -// with the ability to set a custom HTTPClient for a request. -func NewDeleteBranchParamsWithHTTPClient(client *http.Client) *DeleteBranchParams { - return &DeleteBranchParams{ - HTTPClient: client, - } -} - -/* -DeleteBranchParams contains all the parameters to send to the API endpoint - - for the delete branch operation. - - Typically these are written to a http.Request. -*/ -type DeleteBranchParams struct { - - /* BranchID. - - The ID of the branch. - */ - BranchID string - - /* ClusterID. - - The ID of the cluster. - */ - ClusterID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the delete branch params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteBranchParams) WithDefaults() *DeleteBranchParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the delete branch params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *DeleteBranchParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the delete branch params -func (o *DeleteBranchParams) WithTimeout(timeout time.Duration) *DeleteBranchParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the delete branch params -func (o *DeleteBranchParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the delete branch params -func (o *DeleteBranchParams) WithContext(ctx context.Context) *DeleteBranchParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the delete branch params -func (o *DeleteBranchParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the delete branch params -func (o *DeleteBranchParams) WithHTTPClient(client *http.Client) *DeleteBranchParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the delete branch params -func (o *DeleteBranchParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBranchID adds the branchID to the delete branch params -func (o *DeleteBranchParams) WithBranchID(branchID string) *DeleteBranchParams { - o.SetBranchID(branchID) - return o -} - -// SetBranchID adds the branchId to the delete branch params -func (o *DeleteBranchParams) SetBranchID(branchID string) { - o.BranchID = branchID -} - -// WithClusterID adds the clusterID to the delete branch params -func (o *DeleteBranchParams) WithClusterID(clusterID string) *DeleteBranchParams { - o.SetClusterID(clusterID) - return o -} - -// SetClusterID adds the clusterId to the delete branch params -func (o *DeleteBranchParams) SetClusterID(clusterID string) { - o.ClusterID = clusterID -} - -// WriteToRequest writes these params to a swagger request -func (o *DeleteBranchParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param branch_id - if err := r.SetPathParam("branch_id", o.BranchID); err != nil { - return err - } - - // path param cluster_id - if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/pkg/tidbcloud/branch/client/branch_service/delete_branch_responses.go b/pkg/tidbcloud/branch/client/branch_service/delete_branch_responses.go deleted file mode 100644 index 529a0512..00000000 --- a/pkg/tidbcloud/branch/client/branch_service/delete_branch_responses.go +++ /dev/null @@ -1,180 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package branch_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "tidbcloud-cli/pkg/tidbcloud/branch/models" -) - -// DeleteBranchReader is a Reader for the DeleteBranch structure. -type DeleteBranchReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *DeleteBranchReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewDeleteBranchOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewDeleteBranchDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewDeleteBranchOK creates a DeleteBranchOK with default headers values -func NewDeleteBranchOK() *DeleteBranchOK { - return &DeleteBranchOK{} -} - -/* -DeleteBranchOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type DeleteBranchOK struct { - Payload interface{} -} - -// IsSuccess returns true when this delete branch o k response has a 2xx status code -func (o *DeleteBranchOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this delete branch o k response has a 3xx status code -func (o *DeleteBranchOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this delete branch o k response has a 4xx status code -func (o *DeleteBranchOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this delete branch o k response has a 5xx status code -func (o *DeleteBranchOK) IsServerError() bool { - return false -} - -// IsCode returns true when this delete branch o k response a status code equal to that given -func (o *DeleteBranchOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the delete branch o k response -func (o *DeleteBranchOK) Code() int { - return 200 -} - -func (o *DeleteBranchOK) Error() string { - return fmt.Sprintf("[DELETE /api/v1beta/clusters/{cluster_id}/branches/{branch_id}][%d] deleteBranchOK %+v", 200, o.Payload) -} - -func (o *DeleteBranchOK) String() string { - return fmt.Sprintf("[DELETE /api/v1beta/clusters/{cluster_id}/branches/{branch_id}][%d] deleteBranchOK %+v", 200, o.Payload) -} - -func (o *DeleteBranchOK) GetPayload() interface{} { - return o.Payload -} - -func (o *DeleteBranchOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - // response payload - if err := consumer.Consume(response.Body(), &o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewDeleteBranchDefault creates a DeleteBranchDefault with default headers values -func NewDeleteBranchDefault(code int) *DeleteBranchDefault { - return &DeleteBranchDefault{ - _statusCode: code, - } -} - -/* -DeleteBranchDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type DeleteBranchDefault struct { - _statusCode int - - Payload *models.GooglerpcStatus -} - -// IsSuccess returns true when this delete branch default response has a 2xx status code -func (o *DeleteBranchDefault) IsSuccess() bool { - return o._statusCode/100 == 2 -} - -// IsRedirect returns true when this delete branch default response has a 3xx status code -func (o *DeleteBranchDefault) IsRedirect() bool { - return o._statusCode/100 == 3 -} - -// IsClientError returns true when this delete branch default response has a 4xx status code -func (o *DeleteBranchDefault) IsClientError() bool { - return o._statusCode/100 == 4 -} - -// IsServerError returns true when this delete branch default response has a 5xx status code -func (o *DeleteBranchDefault) IsServerError() bool { - return o._statusCode/100 == 5 -} - -// IsCode returns true when this delete branch default response a status code equal to that given -func (o *DeleteBranchDefault) IsCode(code int) bool { - return o._statusCode == code -} - -// Code gets the status code for the delete branch default response -func (o *DeleteBranchDefault) Code() int { - return o._statusCode -} - -func (o *DeleteBranchDefault) Error() string { - return fmt.Sprintf("[DELETE /api/v1beta/clusters/{cluster_id}/branches/{branch_id}][%d] DeleteBranch default %+v", o._statusCode, o.Payload) -} - -func (o *DeleteBranchDefault) String() string { - return fmt.Sprintf("[DELETE /api/v1beta/clusters/{cluster_id}/branches/{branch_id}][%d] DeleteBranch default %+v", o._statusCode, o.Payload) -} - -func (o *DeleteBranchDefault) GetPayload() *models.GooglerpcStatus { - return o.Payload -} - -func (o *DeleteBranchDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.GooglerpcStatus) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/pkg/tidbcloud/branch/client/branch_service/get_branch_parameters.go b/pkg/tidbcloud/branch/client/branch_service/get_branch_parameters.go deleted file mode 100644 index f4308f34..00000000 --- a/pkg/tidbcloud/branch/client/branch_service/get_branch_parameters.go +++ /dev/null @@ -1,173 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package branch_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" -) - -// NewGetBranchParams creates a new GetBranchParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewGetBranchParams() *GetBranchParams { - return &GetBranchParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewGetBranchParamsWithTimeout creates a new GetBranchParams object -// with the ability to set a timeout on a request. -func NewGetBranchParamsWithTimeout(timeout time.Duration) *GetBranchParams { - return &GetBranchParams{ - timeout: timeout, - } -} - -// NewGetBranchParamsWithContext creates a new GetBranchParams object -// with the ability to set a context for a request. -func NewGetBranchParamsWithContext(ctx context.Context) *GetBranchParams { - return &GetBranchParams{ - Context: ctx, - } -} - -// NewGetBranchParamsWithHTTPClient creates a new GetBranchParams object -// with the ability to set a custom HTTPClient for a request. -func NewGetBranchParamsWithHTTPClient(client *http.Client) *GetBranchParams { - return &GetBranchParams{ - HTTPClient: client, - } -} - -/* -GetBranchParams contains all the parameters to send to the API endpoint - - for the get branch operation. - - Typically these are written to a http.Request. -*/ -type GetBranchParams struct { - - /* BranchID. - - The ID of the branch. - */ - BranchID string - - /* ClusterID. - - The ID of the cluster. - */ - ClusterID string - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the get branch params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetBranchParams) WithDefaults() *GetBranchParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the get branch params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *GetBranchParams) SetDefaults() { - // no default values defined for this parameter -} - -// WithTimeout adds the timeout to the get branch params -func (o *GetBranchParams) WithTimeout(timeout time.Duration) *GetBranchParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the get branch params -func (o *GetBranchParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the get branch params -func (o *GetBranchParams) WithContext(ctx context.Context) *GetBranchParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the get branch params -func (o *GetBranchParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the get branch params -func (o *GetBranchParams) WithHTTPClient(client *http.Client) *GetBranchParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the get branch params -func (o *GetBranchParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithBranchID adds the branchID to the get branch params -func (o *GetBranchParams) WithBranchID(branchID string) *GetBranchParams { - o.SetBranchID(branchID) - return o -} - -// SetBranchID adds the branchId to the get branch params -func (o *GetBranchParams) SetBranchID(branchID string) { - o.BranchID = branchID -} - -// WithClusterID adds the clusterID to the get branch params -func (o *GetBranchParams) WithClusterID(clusterID string) *GetBranchParams { - o.SetClusterID(clusterID) - return o -} - -// SetClusterID adds the clusterId to the get branch params -func (o *GetBranchParams) SetClusterID(clusterID string) { - o.ClusterID = clusterID -} - -// WriteToRequest writes these params to a swagger request -func (o *GetBranchParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param branch_id - if err := r.SetPathParam("branch_id", o.BranchID); err != nil { - return err - } - - // path param cluster_id - if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/pkg/tidbcloud/branch/client/branch_service/get_branch_responses.go b/pkg/tidbcloud/branch/client/branch_service/get_branch_responses.go deleted file mode 100644 index 2783d7a0..00000000 --- a/pkg/tidbcloud/branch/client/branch_service/get_branch_responses.go +++ /dev/null @@ -1,182 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package branch_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "tidbcloud-cli/pkg/tidbcloud/branch/models" -) - -// GetBranchReader is a Reader for the GetBranch structure. -type GetBranchReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *GetBranchReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewGetBranchOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewGetBranchDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewGetBranchOK creates a GetBranchOK with default headers values -func NewGetBranchOK() *GetBranchOK { - return &GetBranchOK{} -} - -/* -GetBranchOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type GetBranchOK struct { - Payload *models.OpenapiBranch -} - -// IsSuccess returns true when this get branch o k response has a 2xx status code -func (o *GetBranchOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this get branch o k response has a 3xx status code -func (o *GetBranchOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this get branch o k response has a 4xx status code -func (o *GetBranchOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this get branch o k response has a 5xx status code -func (o *GetBranchOK) IsServerError() bool { - return false -} - -// IsCode returns true when this get branch o k response a status code equal to that given -func (o *GetBranchOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the get branch o k response -func (o *GetBranchOK) Code() int { - return 200 -} - -func (o *GetBranchOK) Error() string { - return fmt.Sprintf("[GET /api/v1beta/clusters/{cluster_id}/branches/{branch_id}][%d] getBranchOK %+v", 200, o.Payload) -} - -func (o *GetBranchOK) String() string { - return fmt.Sprintf("[GET /api/v1beta/clusters/{cluster_id}/branches/{branch_id}][%d] getBranchOK %+v", 200, o.Payload) -} - -func (o *GetBranchOK) GetPayload() *models.OpenapiBranch { - return o.Payload -} - -func (o *GetBranchOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.OpenapiBranch) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewGetBranchDefault creates a GetBranchDefault with default headers values -func NewGetBranchDefault(code int) *GetBranchDefault { - return &GetBranchDefault{ - _statusCode: code, - } -} - -/* -GetBranchDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type GetBranchDefault struct { - _statusCode int - - Payload *models.GooglerpcStatus -} - -// IsSuccess returns true when this get branch default response has a 2xx status code -func (o *GetBranchDefault) IsSuccess() bool { - return o._statusCode/100 == 2 -} - -// IsRedirect returns true when this get branch default response has a 3xx status code -func (o *GetBranchDefault) IsRedirect() bool { - return o._statusCode/100 == 3 -} - -// IsClientError returns true when this get branch default response has a 4xx status code -func (o *GetBranchDefault) IsClientError() bool { - return o._statusCode/100 == 4 -} - -// IsServerError returns true when this get branch default response has a 5xx status code -func (o *GetBranchDefault) IsServerError() bool { - return o._statusCode/100 == 5 -} - -// IsCode returns true when this get branch default response a status code equal to that given -func (o *GetBranchDefault) IsCode(code int) bool { - return o._statusCode == code -} - -// Code gets the status code for the get branch default response -func (o *GetBranchDefault) Code() int { - return o._statusCode -} - -func (o *GetBranchDefault) Error() string { - return fmt.Sprintf("[GET /api/v1beta/clusters/{cluster_id}/branches/{branch_id}][%d] GetBranch default %+v", o._statusCode, o.Payload) -} - -func (o *GetBranchDefault) String() string { - return fmt.Sprintf("[GET /api/v1beta/clusters/{cluster_id}/branches/{branch_id}][%d] GetBranch default %+v", o._statusCode, o.Payload) -} - -func (o *GetBranchDefault) GetPayload() *models.GooglerpcStatus { - return o.Payload -} - -func (o *GetBranchDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.GooglerpcStatus) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/pkg/tidbcloud/branch/client/branch_service/list_branches_parameters.go b/pkg/tidbcloud/branch/client/branch_service/list_branches_parameters.go deleted file mode 100644 index aeeab25a..00000000 --- a/pkg/tidbcloud/branch/client/branch_service/list_branches_parameters.go +++ /dev/null @@ -1,240 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package branch_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "net/http" - "time" - - "github.com/go-openapi/errors" - "github.com/go-openapi/runtime" - cr "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// NewListBranchesParams creates a new ListBranchesParams object, -// with the default timeout for this client. -// -// Default values are not hydrated, since defaults are normally applied by the API server side. -// -// To enforce default values in parameter, use SetDefaults or WithDefaults. -func NewListBranchesParams() *ListBranchesParams { - return &ListBranchesParams{ - timeout: cr.DefaultTimeout, - } -} - -// NewListBranchesParamsWithTimeout creates a new ListBranchesParams object -// with the ability to set a timeout on a request. -func NewListBranchesParamsWithTimeout(timeout time.Duration) *ListBranchesParams { - return &ListBranchesParams{ - timeout: timeout, - } -} - -// NewListBranchesParamsWithContext creates a new ListBranchesParams object -// with the ability to set a context for a request. -func NewListBranchesParamsWithContext(ctx context.Context) *ListBranchesParams { - return &ListBranchesParams{ - Context: ctx, - } -} - -// NewListBranchesParamsWithHTTPClient creates a new ListBranchesParams object -// with the ability to set a custom HTTPClient for a request. -func NewListBranchesParamsWithHTTPClient(client *http.Client) *ListBranchesParams { - return &ListBranchesParams{ - HTTPClient: client, - } -} - -/* -ListBranchesParams contains all the parameters to send to the API endpoint - - for the list branches operation. - - Typically these are written to a http.Request. -*/ -type ListBranchesParams struct { - - /* ClusterID. - - The ID of the cluster. - */ - ClusterID string - - /* PageSize. - - The size of a page. - - Format: int64 - Default: 10 - */ - PageSize *int64 - - /* PageToken. - - The number of pages. - - Format: int64 - Default: 1 - */ - PageToken *int64 - - timeout time.Duration - Context context.Context - HTTPClient *http.Client -} - -// WithDefaults hydrates default values in the list branches params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *ListBranchesParams) WithDefaults() *ListBranchesParams { - o.SetDefaults() - return o -} - -// SetDefaults hydrates default values in the list branches params (not the query body). -// -// All values with no default are reset to their zero value. -func (o *ListBranchesParams) SetDefaults() { - var ( - pageSizeDefault = int64(10) - - pageTokenDefault = int64(1) - ) - - val := ListBranchesParams{ - PageSize: &pageSizeDefault, - PageToken: &pageTokenDefault, - } - - val.timeout = o.timeout - val.Context = o.Context - val.HTTPClient = o.HTTPClient - *o = val -} - -// WithTimeout adds the timeout to the list branches params -func (o *ListBranchesParams) WithTimeout(timeout time.Duration) *ListBranchesParams { - o.SetTimeout(timeout) - return o -} - -// SetTimeout adds the timeout to the list branches params -func (o *ListBranchesParams) SetTimeout(timeout time.Duration) { - o.timeout = timeout -} - -// WithContext adds the context to the list branches params -func (o *ListBranchesParams) WithContext(ctx context.Context) *ListBranchesParams { - o.SetContext(ctx) - return o -} - -// SetContext adds the context to the list branches params -func (o *ListBranchesParams) SetContext(ctx context.Context) { - o.Context = ctx -} - -// WithHTTPClient adds the HTTPClient to the list branches params -func (o *ListBranchesParams) WithHTTPClient(client *http.Client) *ListBranchesParams { - o.SetHTTPClient(client) - return o -} - -// SetHTTPClient adds the HTTPClient to the list branches params -func (o *ListBranchesParams) SetHTTPClient(client *http.Client) { - o.HTTPClient = client -} - -// WithClusterID adds the clusterID to the list branches params -func (o *ListBranchesParams) WithClusterID(clusterID string) *ListBranchesParams { - o.SetClusterID(clusterID) - return o -} - -// SetClusterID adds the clusterId to the list branches params -func (o *ListBranchesParams) SetClusterID(clusterID string) { - o.ClusterID = clusterID -} - -// WithPageSize adds the pageSize to the list branches params -func (o *ListBranchesParams) WithPageSize(pageSize *int64) *ListBranchesParams { - o.SetPageSize(pageSize) - return o -} - -// SetPageSize adds the pageSize to the list branches params -func (o *ListBranchesParams) SetPageSize(pageSize *int64) { - o.PageSize = pageSize -} - -// WithPageToken adds the pageToken to the list branches params -func (o *ListBranchesParams) WithPageToken(pageToken *int64) *ListBranchesParams { - o.SetPageToken(pageToken) - return o -} - -// SetPageToken adds the pageToken to the list branches params -func (o *ListBranchesParams) SetPageToken(pageToken *int64) { - o.PageToken = pageToken -} - -// WriteToRequest writes these params to a swagger request -func (o *ListBranchesParams) WriteToRequest(r runtime.ClientRequest, reg strfmt.Registry) error { - - if err := r.SetTimeout(o.timeout); err != nil { - return err - } - var res []error - - // path param cluster_id - if err := r.SetPathParam("cluster_id", o.ClusterID); err != nil { - return err - } - - if o.PageSize != nil { - - // query param page_size - var qrPageSize int64 - - if o.PageSize != nil { - qrPageSize = *o.PageSize - } - qPageSize := swag.FormatInt64(qrPageSize) - if qPageSize != "" { - - if err := r.SetQueryParam("page_size", qPageSize); err != nil { - return err - } - } - } - - if o.PageToken != nil { - - // query param page_token - var qrPageToken int64 - - if o.PageToken != nil { - qrPageToken = *o.PageToken - } - qPageToken := swag.FormatInt64(qrPageToken) - if qPageToken != "" { - - if err := r.SetQueryParam("page_token", qPageToken); err != nil { - return err - } - } - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} diff --git a/pkg/tidbcloud/branch/client/branch_service/list_branches_responses.go b/pkg/tidbcloud/branch/client/branch_service/list_branches_responses.go deleted file mode 100644 index 6fef9965..00000000 --- a/pkg/tidbcloud/branch/client/branch_service/list_branches_responses.go +++ /dev/null @@ -1,182 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package branch_service - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "fmt" - "io" - - "github.com/go-openapi/runtime" - "github.com/go-openapi/strfmt" - - "tidbcloud-cli/pkg/tidbcloud/branch/models" -) - -// ListBranchesReader is a Reader for the ListBranches structure. -type ListBranchesReader struct { - formats strfmt.Registry -} - -// ReadResponse reads a server response into the received o. -func (o *ListBranchesReader) ReadResponse(response runtime.ClientResponse, consumer runtime.Consumer) (interface{}, error) { - switch response.Code() { - case 200: - result := NewListBranchesOK() - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - return result, nil - default: - result := NewListBranchesDefault(response.Code()) - if err := result.readResponse(response, consumer, o.formats); err != nil { - return nil, err - } - if response.Code()/100 == 2 { - return result, nil - } - return nil, result - } -} - -// NewListBranchesOK creates a ListBranchesOK with default headers values -func NewListBranchesOK() *ListBranchesOK { - return &ListBranchesOK{} -} - -/* -ListBranchesOK describes a response with status code 200, with default header values. - -A successful response. -*/ -type ListBranchesOK struct { - Payload *models.OpenapiListBranchesResp -} - -// IsSuccess returns true when this list branches o k response has a 2xx status code -func (o *ListBranchesOK) IsSuccess() bool { - return true -} - -// IsRedirect returns true when this list branches o k response has a 3xx status code -func (o *ListBranchesOK) IsRedirect() bool { - return false -} - -// IsClientError returns true when this list branches o k response has a 4xx status code -func (o *ListBranchesOK) IsClientError() bool { - return false -} - -// IsServerError returns true when this list branches o k response has a 5xx status code -func (o *ListBranchesOK) IsServerError() bool { - return false -} - -// IsCode returns true when this list branches o k response a status code equal to that given -func (o *ListBranchesOK) IsCode(code int) bool { - return code == 200 -} - -// Code gets the status code for the list branches o k response -func (o *ListBranchesOK) Code() int { - return 200 -} - -func (o *ListBranchesOK) Error() string { - return fmt.Sprintf("[GET /api/v1beta/clusters/{cluster_id}/branches][%d] listBranchesOK %+v", 200, o.Payload) -} - -func (o *ListBranchesOK) String() string { - return fmt.Sprintf("[GET /api/v1beta/clusters/{cluster_id}/branches][%d] listBranchesOK %+v", 200, o.Payload) -} - -func (o *ListBranchesOK) GetPayload() *models.OpenapiListBranchesResp { - return o.Payload -} - -func (o *ListBranchesOK) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.OpenapiListBranchesResp) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} - -// NewListBranchesDefault creates a ListBranchesDefault with default headers values -func NewListBranchesDefault(code int) *ListBranchesDefault { - return &ListBranchesDefault{ - _statusCode: code, - } -} - -/* -ListBranchesDefault describes a response with status code -1, with default header values. - -An unexpected error response. -*/ -type ListBranchesDefault struct { - _statusCode int - - Payload *models.GooglerpcStatus -} - -// IsSuccess returns true when this list branches default response has a 2xx status code -func (o *ListBranchesDefault) IsSuccess() bool { - return o._statusCode/100 == 2 -} - -// IsRedirect returns true when this list branches default response has a 3xx status code -func (o *ListBranchesDefault) IsRedirect() bool { - return o._statusCode/100 == 3 -} - -// IsClientError returns true when this list branches default response has a 4xx status code -func (o *ListBranchesDefault) IsClientError() bool { - return o._statusCode/100 == 4 -} - -// IsServerError returns true when this list branches default response has a 5xx status code -func (o *ListBranchesDefault) IsServerError() bool { - return o._statusCode/100 == 5 -} - -// IsCode returns true when this list branches default response a status code equal to that given -func (o *ListBranchesDefault) IsCode(code int) bool { - return o._statusCode == code -} - -// Code gets the status code for the list branches default response -func (o *ListBranchesDefault) Code() int { - return o._statusCode -} - -func (o *ListBranchesDefault) Error() string { - return fmt.Sprintf("[GET /api/v1beta/clusters/{cluster_id}/branches][%d] ListBranches default %+v", o._statusCode, o.Payload) -} - -func (o *ListBranchesDefault) String() string { - return fmt.Sprintf("[GET /api/v1beta/clusters/{cluster_id}/branches][%d] ListBranches default %+v", o._statusCode, o.Payload) -} - -func (o *ListBranchesDefault) GetPayload() *models.GooglerpcStatus { - return o.Payload -} - -func (o *ListBranchesDefault) readResponse(response runtime.ClientResponse, consumer runtime.Consumer, formats strfmt.Registry) error { - - o.Payload = new(models.GooglerpcStatus) - - // response payload - if err := consumer.Consume(response.Body(), o.Payload); err != nil && err != io.EOF { - return err - } - - return nil -} diff --git a/pkg/tidbcloud/branch/client/tidbcloud_branch_client.go b/pkg/tidbcloud/branch/client/tidbcloud_branch_client.go deleted file mode 100644 index e43604e1..00000000 --- a/pkg/tidbcloud/branch/client/tidbcloud_branch_client.go +++ /dev/null @@ -1,112 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package client - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "github.com/go-openapi/runtime" - httptransport "github.com/go-openapi/runtime/client" - "github.com/go-openapi/strfmt" - - "tidbcloud-cli/pkg/tidbcloud/branch/client/branch_service" -) - -// Default tidbcloud branch HTTP client. -var Default = NewHTTPClient(nil) - -const ( - // DefaultHost is the default Host - // found in Meta (info) section of spec file - DefaultHost string = "api.tidbcloud.com" - // DefaultBasePath is the default BasePath - // found in Meta (info) section of spec file - DefaultBasePath string = "/" -) - -// DefaultSchemes are the default schemes found in Meta (info) section of spec file -var DefaultSchemes = []string{"https"} - -// NewHTTPClient creates a new tidbcloud branch HTTP client. -func NewHTTPClient(formats strfmt.Registry) *TidbcloudBranch { - return NewHTTPClientWithConfig(formats, nil) -} - -// NewHTTPClientWithConfig creates a new tidbcloud branch HTTP client, -// using a customizable transport config. -func NewHTTPClientWithConfig(formats strfmt.Registry, cfg *TransportConfig) *TidbcloudBranch { - // ensure nullable parameters have default - if cfg == nil { - cfg = DefaultTransportConfig() - } - - // create transport and client - transport := httptransport.New(cfg.Host, cfg.BasePath, cfg.Schemes) - return New(transport, formats) -} - -// New creates a new tidbcloud branch client -func New(transport runtime.ClientTransport, formats strfmt.Registry) *TidbcloudBranch { - // ensure nullable parameters have default - if formats == nil { - formats = strfmt.Default - } - - cli := new(TidbcloudBranch) - cli.Transport = transport - cli.BranchService = branch_service.New(transport, formats) - return cli -} - -// DefaultTransportConfig creates a TransportConfig with the -// default settings taken from the meta section of the spec file. -func DefaultTransportConfig() *TransportConfig { - return &TransportConfig{ - Host: DefaultHost, - BasePath: DefaultBasePath, - Schemes: DefaultSchemes, - } -} - -// TransportConfig contains the transport related info, -// found in the meta section of the spec file. -type TransportConfig struct { - Host string - BasePath string - Schemes []string -} - -// WithHost overrides the default host, -// provided by the meta section of the spec file. -func (cfg *TransportConfig) WithHost(host string) *TransportConfig { - cfg.Host = host - return cfg -} - -// WithBasePath overrides the default basePath, -// provided by the meta section of the spec file. -func (cfg *TransportConfig) WithBasePath(basePath string) *TransportConfig { - cfg.BasePath = basePath - return cfg -} - -// WithSchemes overrides the default schemes, -// provided by the meta section of the spec file. -func (cfg *TransportConfig) WithSchemes(schemes []string) *TransportConfig { - cfg.Schemes = schemes - return cfg -} - -// TidbcloudBranch is a client for tidbcloud branch -type TidbcloudBranch struct { - BranchService branch_service.ClientService - - Transport runtime.ClientTransport -} - -// SetTransport changes the transport on the client and all its subresources -func (c *TidbcloudBranch) SetTransport(transport runtime.ClientTransport) { - c.Transport = transport - c.BranchService.SetTransport(transport) -} diff --git a/pkg/tidbcloud/branch/models/googlerpc_status.go b/pkg/tidbcloud/branch/models/googlerpc_status.go deleted file mode 100644 index fd14346e..00000000 --- a/pkg/tidbcloud/branch/models/googlerpc_status.go +++ /dev/null @@ -1,222 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// GooglerpcStatus googlerpc status -// -// swagger:model googlerpcStatus -type GooglerpcStatus struct { - - // error - Error *GooglerpcStatusError `json:"error,omitempty"` -} - -// Validate validates this googlerpc status -func (m *GooglerpcStatus) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateError(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GooglerpcStatus) validateError(formats strfmt.Registry) error { - if swag.IsZero(m.Error) { // not required - return nil - } - - if m.Error != nil { - if err := m.Error.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("error") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("error") - } - return err - } - } - - return nil -} - -// ContextValidate validate this googlerpc status based on the context it is used -func (m *GooglerpcStatus) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateError(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GooglerpcStatus) contextValidateError(ctx context.Context, formats strfmt.Registry) error { - - if m.Error != nil { - - if swag.IsZero(m.Error) { // not required - return nil - } - - if err := m.Error.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("error") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("error") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *GooglerpcStatus) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *GooglerpcStatus) UnmarshalBinary(b []byte) error { - var res GooglerpcStatus - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} - -// GooglerpcStatusError googlerpc status error -// -// swagger:model GooglerpcStatusError -type GooglerpcStatusError struct { - - // code - Code int32 `json:"code,omitempty"` - - // details - Details []*ProtobufAny `json:"details"` - - // message - Message string `json:"message,omitempty"` -} - -// Validate validates this googlerpc status error -func (m *GooglerpcStatusError) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateDetails(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GooglerpcStatusError) validateDetails(formats strfmt.Registry) error { - if swag.IsZero(m.Details) { // not required - return nil - } - - for i := 0; i < len(m.Details); i++ { - if swag.IsZero(m.Details[i]) { // not required - continue - } - - if m.Details[i] != nil { - if err := m.Details[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("error" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("error" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// ContextValidate validate this googlerpc status error based on the context it is used -func (m *GooglerpcStatusError) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateDetails(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *GooglerpcStatusError) contextValidateDetails(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Details); i++ { - - if m.Details[i] != nil { - - if swag.IsZero(m.Details[i]) { // not required - return nil - } - - if err := m.Details[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("error" + "." + "details" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("error" + "." + "details" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *GooglerpcStatusError) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *GooglerpcStatusError) UnmarshalBinary(b []byte) error { - var res GooglerpcStatusError - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/pkg/tidbcloud/branch/models/openapi_basic_branch.go b/pkg/tidbcloud/branch/models/openapi_basic_branch.go deleted file mode 100644 index 4a306f3c..00000000 --- a/pkg/tidbcloud/branch/models/openapi_basic_branch.go +++ /dev/null @@ -1,265 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// OpenapiBasicBranch BranchItem -// -// BranchItem is the information of branch. -// -// swagger:model openapiBasicBranch -type OpenapiBasicBranch struct { - - // The ID of the cluster. - // Required: true - ClusterID *string `json:"cluster_id"` - - // The creation timestamp of the branch. - // Required: true - // Format: date-time - CreateTime *strfmt.DateTime `json:"create_time"` - - // The delete timestamp of the branch. - // Required: true - // Format: date-time - DeleteTime *strfmt.DateTime `json:"delete_time"` - - // The display name of the branch. - // Required: true - DisplayName *string `json:"display_name"` - - // The ID of the branch. - // Required: true - ID *string `json:"id"` - - // The name of the branch. - // Required: true - Name *string `json:"name"` - - // The ID of the parent branch. - // Required: true - ParentID *string `json:"parent_id"` - - // The status of the branch. - // Required: true - State *OpenapiBranchState `json:"state"` - - // The update timestamp of the branch. - // Required: true - // Format: date-time - UpdateTime *strfmt.DateTime `json:"update_time"` -} - -// Validate validates this openapi basic branch -func (m *OpenapiBasicBranch) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateClusterID(formats); err != nil { - res = append(res, err) - } - - if err := m.validateCreateTime(formats); err != nil { - res = append(res, err) - } - - if err := m.validateDeleteTime(formats); err != nil { - res = append(res, err) - } - - if err := m.validateDisplayName(formats); err != nil { - res = append(res, err) - } - - if err := m.validateID(formats); err != nil { - res = append(res, err) - } - - if err := m.validateName(formats); err != nil { - res = append(res, err) - } - - if err := m.validateParentID(formats); err != nil { - res = append(res, err) - } - - if err := m.validateState(formats); err != nil { - res = append(res, err) - } - - if err := m.validateUpdateTime(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *OpenapiBasicBranch) validateClusterID(formats strfmt.Registry) error { - - if err := validate.Required("cluster_id", "body", m.ClusterID); err != nil { - return err - } - - return nil -} - -func (m *OpenapiBasicBranch) validateCreateTime(formats strfmt.Registry) error { - - if err := validate.Required("create_time", "body", m.CreateTime); err != nil { - return err - } - - if err := validate.FormatOf("create_time", "body", "date-time", m.CreateTime.String(), formats); err != nil { - return err - } - - return nil -} - -func (m *OpenapiBasicBranch) validateDeleteTime(formats strfmt.Registry) error { - - if err := validate.Required("delete_time", "body", m.DeleteTime); err != nil { - return err - } - - if err := validate.FormatOf("delete_time", "body", "date-time", m.DeleteTime.String(), formats); err != nil { - return err - } - - return nil -} - -func (m *OpenapiBasicBranch) validateDisplayName(formats strfmt.Registry) error { - - if err := validate.Required("display_name", "body", m.DisplayName); err != nil { - return err - } - - return nil -} - -func (m *OpenapiBasicBranch) validateID(formats strfmt.Registry) error { - - if err := validate.Required("id", "body", m.ID); err != nil { - return err - } - - return nil -} - -func (m *OpenapiBasicBranch) validateName(formats strfmt.Registry) error { - - if err := validate.Required("name", "body", m.Name); err != nil { - return err - } - - return nil -} - -func (m *OpenapiBasicBranch) validateParentID(formats strfmt.Registry) error { - - if err := validate.Required("parent_id", "body", m.ParentID); err != nil { - return err - } - - return nil -} - -func (m *OpenapiBasicBranch) validateState(formats strfmt.Registry) error { - - if err := validate.Required("state", "body", m.State); err != nil { - return err - } - - if err := validate.Required("state", "body", m.State); err != nil { - return err - } - - if m.State != nil { - if err := m.State.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("state") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("state") - } - return err - } - } - - return nil -} - -func (m *OpenapiBasicBranch) validateUpdateTime(formats strfmt.Registry) error { - - if err := validate.Required("update_time", "body", m.UpdateTime); err != nil { - return err - } - - if err := validate.FormatOf("update_time", "body", "date-time", m.UpdateTime.String(), formats); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this openapi basic branch based on the context it is used -func (m *OpenapiBasicBranch) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateState(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *OpenapiBasicBranch) contextValidateState(ctx context.Context, formats strfmt.Registry) error { - - if m.State != nil { - - if err := m.State.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("state") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("state") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *OpenapiBasicBranch) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *OpenapiBasicBranch) UnmarshalBinary(b []byte) error { - var res OpenapiBasicBranch - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/pkg/tidbcloud/branch/models/openapi_branch.go b/pkg/tidbcloud/branch/models/openapi_branch.go deleted file mode 100644 index c5150eb7..00000000 --- a/pkg/tidbcloud/branch/models/openapi_branch.go +++ /dev/null @@ -1,397 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// OpenapiBranch BranchItem -// -// BranchItem is the information of branch. -// -// swagger:model openapiBranch -type OpenapiBranch struct { - - // The annotations of the branch. - // Required: true - Annotations map[string]string `json:"annotations"` - - // The ID of the cluster. - // Required: true - ClusterID *string `json:"cluster_id"` - - // The creation timestamp of the branch. - // Required: true - // Format: date-time - CreateTime *strfmt.DateTime `json:"create_time"` - - // The delete timestamp of the branch. - // Required: true - // Format: date-time - DeleteTime *strfmt.DateTime `json:"delete_time"` - - // The display name of the branch. - // Required: true - DisplayName *string `json:"display_name"` - - // The endpoint of the branch. - // Required: true - Endpoints *OpenapiEndpoints `json:"endpoints"` - - // The ID of the branch. - // Required: true - ID *string `json:"id"` - - // The name of the branch. - // Required: true - Name *string `json:"name"` - - // The ID of the parent branch. - // Required: true - ParentID *string `json:"parent_id"` - - // The status of the branch. - // Required: true - State *OpenapiBranchState `json:"state"` - - // The update timestamp of the branch. - // Required: true - // Format: date-time - UpdateTime *strfmt.DateTime `json:"update_time"` - - // The usages of the branch. - // Required: true - Usages *OpenapiUsages `json:"usages"` - - // The userPrefix of the branch. - // Required: true - UserPrefix *string `json:"user_prefix"` -} - -// Validate validates this openapi branch -func (m *OpenapiBranch) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAnnotations(formats); err != nil { - res = append(res, err) - } - - if err := m.validateClusterID(formats); err != nil { - res = append(res, err) - } - - if err := m.validateCreateTime(formats); err != nil { - res = append(res, err) - } - - if err := m.validateDeleteTime(formats); err != nil { - res = append(res, err) - } - - if err := m.validateDisplayName(formats); err != nil { - res = append(res, err) - } - - if err := m.validateEndpoints(formats); err != nil { - res = append(res, err) - } - - if err := m.validateID(formats); err != nil { - res = append(res, err) - } - - if err := m.validateName(formats); err != nil { - res = append(res, err) - } - - if err := m.validateParentID(formats); err != nil { - res = append(res, err) - } - - if err := m.validateState(formats); err != nil { - res = append(res, err) - } - - if err := m.validateUpdateTime(formats); err != nil { - res = append(res, err) - } - - if err := m.validateUsages(formats); err != nil { - res = append(res, err) - } - - if err := m.validateUserPrefix(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *OpenapiBranch) validateAnnotations(formats strfmt.Registry) error { - - if err := validate.Required("annotations", "body", m.Annotations); err != nil { - return err - } - - return nil -} - -func (m *OpenapiBranch) validateClusterID(formats strfmt.Registry) error { - - if err := validate.Required("cluster_id", "body", m.ClusterID); err != nil { - return err - } - - return nil -} - -func (m *OpenapiBranch) validateCreateTime(formats strfmt.Registry) error { - - if err := validate.Required("create_time", "body", m.CreateTime); err != nil { - return err - } - - if err := validate.FormatOf("create_time", "body", "date-time", m.CreateTime.String(), formats); err != nil { - return err - } - - return nil -} - -func (m *OpenapiBranch) validateDeleteTime(formats strfmt.Registry) error { - - if err := validate.Required("delete_time", "body", m.DeleteTime); err != nil { - return err - } - - if err := validate.FormatOf("delete_time", "body", "date-time", m.DeleteTime.String(), formats); err != nil { - return err - } - - return nil -} - -func (m *OpenapiBranch) validateDisplayName(formats strfmt.Registry) error { - - if err := validate.Required("display_name", "body", m.DisplayName); err != nil { - return err - } - - return nil -} - -func (m *OpenapiBranch) validateEndpoints(formats strfmt.Registry) error { - - if err := validate.Required("endpoints", "body", m.Endpoints); err != nil { - return err - } - - if m.Endpoints != nil { - if err := m.Endpoints.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("endpoints") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("endpoints") - } - return err - } - } - - return nil -} - -func (m *OpenapiBranch) validateID(formats strfmt.Registry) error { - - if err := validate.Required("id", "body", m.ID); err != nil { - return err - } - - return nil -} - -func (m *OpenapiBranch) validateName(formats strfmt.Registry) error { - - if err := validate.Required("name", "body", m.Name); err != nil { - return err - } - - return nil -} - -func (m *OpenapiBranch) validateParentID(formats strfmt.Registry) error { - - if err := validate.Required("parent_id", "body", m.ParentID); err != nil { - return err - } - - return nil -} - -func (m *OpenapiBranch) validateState(formats strfmt.Registry) error { - - if err := validate.Required("state", "body", m.State); err != nil { - return err - } - - if err := validate.Required("state", "body", m.State); err != nil { - return err - } - - if m.State != nil { - if err := m.State.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("state") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("state") - } - return err - } - } - - return nil -} - -func (m *OpenapiBranch) validateUpdateTime(formats strfmt.Registry) error { - - if err := validate.Required("update_time", "body", m.UpdateTime); err != nil { - return err - } - - if err := validate.FormatOf("update_time", "body", "date-time", m.UpdateTime.String(), formats); err != nil { - return err - } - - return nil -} - -func (m *OpenapiBranch) validateUsages(formats strfmt.Registry) error { - - if err := validate.Required("usages", "body", m.Usages); err != nil { - return err - } - - if m.Usages != nil { - if err := m.Usages.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("usages") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("usages") - } - return err - } - } - - return nil -} - -func (m *OpenapiBranch) validateUserPrefix(formats strfmt.Registry) error { - - if err := validate.Required("user_prefix", "body", m.UserPrefix); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this openapi branch based on the context it is used -func (m *OpenapiBranch) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateEndpoints(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateState(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateUsages(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *OpenapiBranch) contextValidateEndpoints(ctx context.Context, formats strfmt.Registry) error { - - if m.Endpoints != nil { - - if err := m.Endpoints.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("endpoints") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("endpoints") - } - return err - } - } - - return nil -} - -func (m *OpenapiBranch) contextValidateState(ctx context.Context, formats strfmt.Registry) error { - - if m.State != nil { - - if err := m.State.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("state") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("state") - } - return err - } - } - - return nil -} - -func (m *OpenapiBranch) contextValidateUsages(ctx context.Context, formats strfmt.Registry) error { - - if m.Usages != nil { - - if err := m.Usages.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("usages") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("usages") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *OpenapiBranch) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *OpenapiBranch) UnmarshalBinary(b []byte) error { - var res OpenapiBranch - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/pkg/tidbcloud/branch/models/openapi_branch_state.go b/pkg/tidbcloud/branch/models/openapi_branch_state.go deleted file mode 100644 index 8c8b27f6..00000000 --- a/pkg/tidbcloud/branch/models/openapi_branch_state.go +++ /dev/null @@ -1,84 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "encoding/json" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/validate" -) - -// OpenapiBranchState openapi branch state -// -// swagger:model openapiBranchState -type OpenapiBranchState string - -func NewOpenapiBranchState(value OpenapiBranchState) *OpenapiBranchState { - return &value -} - -// Pointer returns a pointer to a freshly-allocated OpenapiBranchState. -func (m OpenapiBranchState) Pointer() *OpenapiBranchState { - return &m -} - -const ( - - // OpenapiBranchStateCREATING captures enum value "CREATING" - OpenapiBranchStateCREATING OpenapiBranchState = "CREATING" - - // OpenapiBranchStateREADY captures enum value "READY" - OpenapiBranchStateREADY OpenapiBranchState = "READY" - - // OpenapiBranchStateDELETING captures enum value "DELETING" - OpenapiBranchStateDELETING OpenapiBranchState = "DELETING" - - // OpenapiBranchStateMAINTENANCE captures enum value "MAINTENANCE" - OpenapiBranchStateMAINTENANCE OpenapiBranchState = "MAINTENANCE" -) - -// for schema -var openapiBranchStateEnum []interface{} - -func init() { - var res []OpenapiBranchState - if err := json.Unmarshal([]byte(`["CREATING","READY","DELETING","MAINTENANCE"]`), &res); err != nil { - panic(err) - } - for _, v := range res { - openapiBranchStateEnum = append(openapiBranchStateEnum, v) - } -} - -func (m OpenapiBranchState) validateOpenapiBranchStateEnum(path, location string, value OpenapiBranchState) error { - if err := validate.EnumCase(path, location, value, openapiBranchStateEnum, true); err != nil { - return err - } - return nil -} - -// Validate validates this openapi branch state -func (m OpenapiBranchState) Validate(formats strfmt.Registry) error { - var res []error - - // value enum - if err := m.validateOpenapiBranchStateEnum("", "body", m); err != nil { - return err - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -// ContextValidate validates this openapi branch state based on context it is used -func (m OpenapiBranchState) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} diff --git a/pkg/tidbcloud/branch/models/openapi_create_branch_resp.go b/pkg/tidbcloud/branch/models/openapi_create_branch_resp.go deleted file mode 100644 index a044f2ad..00000000 --- a/pkg/tidbcloud/branch/models/openapi_create_branch_resp.go +++ /dev/null @@ -1,72 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// OpenapiCreateBranchResp CreateBranchResp is the response message for CreateBranch. -// -// swagger:model openapiCreateBranchResp -type OpenapiCreateBranchResp struct { - - // The ID of the branch. - // Example: branch-SDUAOISD - // Required: true - ID *string `json:"id"` -} - -// Validate validates this openapi create branch resp -func (m *OpenapiCreateBranchResp) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateID(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *OpenapiCreateBranchResp) validateID(formats strfmt.Registry) error { - - if err := validate.Required("id", "body", m.ID); err != nil { - return err - } - - return nil -} - -// ContextValidate validates this openapi create branch resp based on context it is used -func (m *OpenapiCreateBranchResp) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *OpenapiCreateBranchResp) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *OpenapiCreateBranchResp) UnmarshalBinary(b []byte) error { - var res OpenapiCreateBranchResp - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/pkg/tidbcloud/branch/models/openapi_endpoints.go b/pkg/tidbcloud/branch/models/openapi_endpoints.go deleted file mode 100644 index 97c85740..00000000 --- a/pkg/tidbcloud/branch/models/openapi_endpoints.go +++ /dev/null @@ -1,109 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// OpenapiEndpoints Endpoints is the endpoint of the branch. -// -// swagger:model openapiEndpoints -type OpenapiEndpoints struct { - - // The public endpoint of the branch. - PublicEndpoint *OpenapiPublicEndpoint `json:"public_endpoint,omitempty"` -} - -// Validate validates this openapi endpoints -func (m *OpenapiEndpoints) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validatePublicEndpoint(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *OpenapiEndpoints) validatePublicEndpoint(formats strfmt.Registry) error { - if swag.IsZero(m.PublicEndpoint) { // not required - return nil - } - - if m.PublicEndpoint != nil { - if err := m.PublicEndpoint.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("public_endpoint") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("public_endpoint") - } - return err - } - } - - return nil -} - -// ContextValidate validate this openapi endpoints based on the context it is used -func (m *OpenapiEndpoints) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidatePublicEndpoint(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *OpenapiEndpoints) contextValidatePublicEndpoint(ctx context.Context, formats strfmt.Registry) error { - - if m.PublicEndpoint != nil { - - if swag.IsZero(m.PublicEndpoint) { // not required - return nil - } - - if err := m.PublicEndpoint.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("public_endpoint") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("public_endpoint") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *OpenapiEndpoints) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *OpenapiEndpoints) UnmarshalBinary(b []byte) error { - var res OpenapiEndpoints - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/pkg/tidbcloud/branch/models/openapi_list_branches_resp.go b/pkg/tidbcloud/branch/models/openapi_list_branches_resp.go deleted file mode 100644 index 91b8389b..00000000 --- a/pkg/tidbcloud/branch/models/openapi_list_branches_resp.go +++ /dev/null @@ -1,141 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - "strconv" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" - "github.com/go-openapi/validate" -) - -// OpenapiListBranchesResp ListBranchesResp is the response of ListBranches. -// -// swagger:model openapiListBranchesResp -type OpenapiListBranchesResp struct { - - // The items of branches in the cluster. - // Required: true - Branches []*OpenapiBasicBranch `json:"branches"` - - // The total number of branches in the cluster. - // Required: true - Total *int64 `json:"total"` -} - -// Validate validates this openapi list branches resp -func (m *OpenapiListBranchesResp) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateBranches(formats); err != nil { - res = append(res, err) - } - - if err := m.validateTotal(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *OpenapiListBranchesResp) validateBranches(formats strfmt.Registry) error { - - if err := validate.Required("branches", "body", m.Branches); err != nil { - return err - } - - for i := 0; i < len(m.Branches); i++ { - if swag.IsZero(m.Branches[i]) { // not required - continue - } - - if m.Branches[i] != nil { - if err := m.Branches[i].Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("branches" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("branches" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -func (m *OpenapiListBranchesResp) validateTotal(formats strfmt.Registry) error { - - if err := validate.Required("total", "body", m.Total); err != nil { - return err - } - - return nil -} - -// ContextValidate validate this openapi list branches resp based on the context it is used -func (m *OpenapiListBranchesResp) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateBranches(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *OpenapiListBranchesResp) contextValidateBranches(ctx context.Context, formats strfmt.Registry) error { - - for i := 0; i < len(m.Branches); i++ { - - if m.Branches[i] != nil { - - if swag.IsZero(m.Branches[i]) { // not required - return nil - } - - if err := m.Branches[i].ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("branches" + "." + strconv.Itoa(i)) - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("branches" + "." + strconv.Itoa(i)) - } - return err - } - } - - } - - return nil -} - -// MarshalBinary interface implementation -func (m *OpenapiListBranchesResp) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *OpenapiListBranchesResp) UnmarshalBinary(b []byte) error { - var res OpenapiListBranchesResp - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/pkg/tidbcloud/branch/models/openapi_private_endpoint.go b/pkg/tidbcloud/branch/models/openapi_private_endpoint.go deleted file mode 100644 index c9be8b24..00000000 --- a/pkg/tidbcloud/branch/models/openapi_private_endpoint.go +++ /dev/null @@ -1,169 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/errors" - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// OpenapiPrivateEndpoint PrivateEndpoint is the private endpoint of the branch. -// -// swagger:model openapiPrivateEndpoint -type OpenapiPrivateEndpoint struct { - - // The provider of the private endpoint is AWS. - Aws *OpenapiPrivateEndpointAws `json:"aws,omitempty"` - - // The disabled of the private endpoint. - Disabled bool `json:"disabled,omitempty"` - - // The provider of the private endpoint is GCP. - Gcp *OpenapiPrivateEndpointGcp `json:"gcp,omitempty"` - - // The host of the private endpoint. - Host string `json:"host,omitempty"` - - // The port of the private endpoint. - Port int32 `json:"port,omitempty"` -} - -// Validate validates this openapi private endpoint -func (m *OpenapiPrivateEndpoint) Validate(formats strfmt.Registry) error { - var res []error - - if err := m.validateAws(formats); err != nil { - res = append(res, err) - } - - if err := m.validateGcp(formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *OpenapiPrivateEndpoint) validateAws(formats strfmt.Registry) error { - if swag.IsZero(m.Aws) { // not required - return nil - } - - if m.Aws != nil { - if err := m.Aws.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("aws") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("aws") - } - return err - } - } - - return nil -} - -func (m *OpenapiPrivateEndpoint) validateGcp(formats strfmt.Registry) error { - if swag.IsZero(m.Gcp) { // not required - return nil - } - - if m.Gcp != nil { - if err := m.Gcp.Validate(formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("gcp") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("gcp") - } - return err - } - } - - return nil -} - -// ContextValidate validate this openapi private endpoint based on the context it is used -func (m *OpenapiPrivateEndpoint) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - var res []error - - if err := m.contextValidateAws(ctx, formats); err != nil { - res = append(res, err) - } - - if err := m.contextValidateGcp(ctx, formats); err != nil { - res = append(res, err) - } - - if len(res) > 0 { - return errors.CompositeValidationError(res...) - } - return nil -} - -func (m *OpenapiPrivateEndpoint) contextValidateAws(ctx context.Context, formats strfmt.Registry) error { - - if m.Aws != nil { - - if swag.IsZero(m.Aws) { // not required - return nil - } - - if err := m.Aws.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("aws") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("aws") - } - return err - } - } - - return nil -} - -func (m *OpenapiPrivateEndpoint) contextValidateGcp(ctx context.Context, formats strfmt.Registry) error { - - if m.Gcp != nil { - - if swag.IsZero(m.Gcp) { // not required - return nil - } - - if err := m.Gcp.ContextValidate(ctx, formats); err != nil { - if ve, ok := err.(*errors.Validation); ok { - return ve.ValidateName("gcp") - } else if ce, ok := err.(*errors.CompositeError); ok { - return ce.ValidateName("gcp") - } - return err - } - } - - return nil -} - -// MarshalBinary interface implementation -func (m *OpenapiPrivateEndpoint) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *OpenapiPrivateEndpoint) UnmarshalBinary(b []byte) error { - var res OpenapiPrivateEndpoint - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/pkg/tidbcloud/branch/models/openapi_private_endpoint_aws.go b/pkg/tidbcloud/branch/models/openapi_private_endpoint_aws.go deleted file mode 100644 index 08228804..00000000 --- a/pkg/tidbcloud/branch/models/openapi_private_endpoint_aws.go +++ /dev/null @@ -1,53 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// OpenapiPrivateEndpointAws PrivateEndpointAws is the private endpoint of the branch on AWS. -// -// swagger:model openapiPrivateEndpointAws -type OpenapiPrivateEndpointAws struct { - - // availability zone - AvailabilityZone []string `json:"availability_zone"` - - // The service name of the branch on AWS. - ServiceMame string `json:"service_mame,omitempty"` -} - -// Validate validates this openapi private endpoint aws -func (m *OpenapiPrivateEndpointAws) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this openapi private endpoint aws based on context it is used -func (m *OpenapiPrivateEndpointAws) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *OpenapiPrivateEndpointAws) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *OpenapiPrivateEndpointAws) UnmarshalBinary(b []byte) error { - var res OpenapiPrivateEndpointAws - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/pkg/tidbcloud/branch/models/openapi_private_endpoint_gcp.go b/pkg/tidbcloud/branch/models/openapi_private_endpoint_gcp.go deleted file mode 100644 index f36523d7..00000000 --- a/pkg/tidbcloud/branch/models/openapi_private_endpoint_gcp.go +++ /dev/null @@ -1,50 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// OpenapiPrivateEndpointGcp PrivateEndpointGcp is the private endpoint of the branch on GCP. -// -// swagger:model openapiPrivateEndpointGcp -type OpenapiPrivateEndpointGcp struct { - - // The service name of the branch on GCP. - TargetServiceAttachment string `json:"target_service_attachment,omitempty"` -} - -// Validate validates this openapi private endpoint gcp -func (m *OpenapiPrivateEndpointGcp) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this openapi private endpoint gcp based on context it is used -func (m *OpenapiPrivateEndpointGcp) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *OpenapiPrivateEndpointGcp) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *OpenapiPrivateEndpointGcp) UnmarshalBinary(b []byte) error { - var res OpenapiPrivateEndpointGcp - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/pkg/tidbcloud/branch/models/openapi_public_endpoint.go b/pkg/tidbcloud/branch/models/openapi_public_endpoint.go deleted file mode 100644 index ffec69c1..00000000 --- a/pkg/tidbcloud/branch/models/openapi_public_endpoint.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// OpenapiPublicEndpoint PublicEndpoint is the public endpoint of the branch. -// -// swagger:model openapiPublicEndpoint -type OpenapiPublicEndpoint struct { - - // The disabled of the public endpoint. - Disabled bool `json:"disabled,omitempty"` - - // The host of the public endpoint. - Host string `json:"host,omitempty"` - - // The port of the public endpoint. - Port int32 `json:"port,omitempty"` -} - -// Validate validates this openapi public endpoint -func (m *OpenapiPublicEndpoint) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this openapi public endpoint based on context it is used -func (m *OpenapiPublicEndpoint) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *OpenapiPublicEndpoint) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *OpenapiPublicEndpoint) UnmarshalBinary(b []byte) error { - var res OpenapiPublicEndpoint - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/pkg/tidbcloud/branch/models/openapi_usages.go b/pkg/tidbcloud/branch/models/openapi_usages.go deleted file mode 100644 index b59f9240..00000000 --- a/pkg/tidbcloud/branch/models/openapi_usages.go +++ /dev/null @@ -1,56 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// OpenapiUsages Usages is the usages of the branch. -// -// swagger:model openapiUsages -type OpenapiUsages struct { - - // The column storage of the branch. - ColumnStorage string `json:"column_storage,omitempty"` - - // The request unit of the branch. - RequestUnit string `json:"request_unit,omitempty"` - - // The storage of the branch. - RowStorage string `json:"row_storage,omitempty"` -} - -// Validate validates this openapi usages -func (m *OpenapiUsages) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this openapi usages based on context it is used -func (m *OpenapiUsages) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *OpenapiUsages) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *OpenapiUsages) UnmarshalBinary(b []byte) error { - var res OpenapiUsages - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/pkg/tidbcloud/serverless/models/protobuf_any.go b/pkg/tidbcloud/serverless/models/protobuf_any.go deleted file mode 100644 index cbc97997..00000000 --- a/pkg/tidbcloud/serverless/models/protobuf_any.go +++ /dev/null @@ -1,50 +0,0 @@ -// Code generated by go-swagger; DO NOT EDIT. - -package models - -// This file was generated by the swagger tool. -// Editing this file might prove futile when you re-run the swagger generate command - -import ( - "context" - - "github.com/go-openapi/strfmt" - "github.com/go-openapi/swag" -) - -// ProtobufAny protobuf any -// -// swagger:model protobufAny -type ProtobufAny struct { - - // at type - AtType string `json:"@type,omitempty"` -} - -// Validate validates this protobuf any -func (m *ProtobufAny) Validate(formats strfmt.Registry) error { - return nil -} - -// ContextValidate validates this protobuf any based on context it is used -func (m *ProtobufAny) ContextValidate(ctx context.Context, formats strfmt.Registry) error { - return nil -} - -// MarshalBinary interface implementation -func (m *ProtobufAny) MarshalBinary() ([]byte, error) { - if m == nil { - return nil, nil - } - return swag.WriteJSON(m) -} - -// UnmarshalBinary interface implementation -func (m *ProtobufAny) UnmarshalBinary(b []byte) error { - var res ProtobufAny - if err := swag.ReadJSON(b, &res); err != nil { - return err - } - *m = res - return nil -} diff --git a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_change_root_password_parameters.go b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_change_root_password_parameters.go similarity index 100% rename from pkg/tidbcloud/serverless/client/serverless_service/serverless_service_change_root_password_parameters.go rename to pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_change_root_password_parameters.go diff --git a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_change_root_password_responses.go b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_change_root_password_responses.go similarity index 99% rename from pkg/tidbcloud/serverless/client/serverless_service/serverless_service_change_root_password_responses.go rename to pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_change_root_password_responses.go index 52e52a77..e2585df1 100644 --- a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_change_root_password_responses.go +++ b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_change_root_password_responses.go @@ -16,7 +16,7 @@ import ( "github.com/go-openapi/swag" "github.com/go-openapi/validate" - "tidbcloud-cli/pkg/tidbcloud/serverless/models" + "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models" ) // ServerlessServiceChangeRootPasswordReader is a Reader for the ServerlessServiceChangeRootPassword structure. diff --git a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_client.go b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_client.go similarity index 100% rename from pkg/tidbcloud/serverless/client/serverless_service/serverless_service_client.go rename to pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_client.go diff --git a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_create_cluster_parameters.go b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_create_cluster_parameters.go similarity index 98% rename from pkg/tidbcloud/serverless/client/serverless_service/serverless_service_create_cluster_parameters.go rename to pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_create_cluster_parameters.go index 71bf2707..12c60eff 100644 --- a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_create_cluster_parameters.go +++ b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_create_cluster_parameters.go @@ -15,7 +15,7 @@ import ( cr "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" - "tidbcloud-cli/pkg/tidbcloud/serverless/models" + "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models" ) // NewServerlessServiceCreateClusterParams creates a new ServerlessServiceCreateClusterParams object, diff --git a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_create_cluster_responses.go b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_create_cluster_responses.go similarity index 99% rename from pkg/tidbcloud/serverless/client/serverless_service/serverless_service_create_cluster_responses.go rename to pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_create_cluster_responses.go index 7d71faab..975d6c6d 100644 --- a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_create_cluster_responses.go +++ b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_create_cluster_responses.go @@ -12,7 +12,7 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" - "tidbcloud-cli/pkg/tidbcloud/serverless/models" + "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models" ) // ServerlessServiceCreateClusterReader is a Reader for the ServerlessServiceCreateCluster structure. diff --git a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_delete_cluster_parameters.go b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_delete_cluster_parameters.go similarity index 100% rename from pkg/tidbcloud/serverless/client/serverless_service/serverless_service_delete_cluster_parameters.go rename to pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_delete_cluster_parameters.go diff --git a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_delete_cluster_responses.go b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_delete_cluster_responses.go similarity index 99% rename from pkg/tidbcloud/serverless/client/serverless_service/serverless_service_delete_cluster_responses.go rename to pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_delete_cluster_responses.go index 5a285fd2..b88031ac 100644 --- a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_delete_cluster_responses.go +++ b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_delete_cluster_responses.go @@ -12,7 +12,7 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" - "tidbcloud-cli/pkg/tidbcloud/serverless/models" + "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models" ) // ServerlessServiceDeleteClusterReader is a Reader for the ServerlessServiceDeleteCluster structure. diff --git a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_get_cluster_parameters.go b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_get_cluster_parameters.go similarity index 100% rename from pkg/tidbcloud/serverless/client/serverless_service/serverless_service_get_cluster_parameters.go rename to pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_get_cluster_parameters.go diff --git a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_get_cluster_responses.go b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_get_cluster_responses.go similarity index 99% rename from pkg/tidbcloud/serverless/client/serverless_service/serverless_service_get_cluster_responses.go rename to pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_get_cluster_responses.go index 09b81531..1f1160dd 100644 --- a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_get_cluster_responses.go +++ b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_get_cluster_responses.go @@ -12,7 +12,7 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" - "tidbcloud-cli/pkg/tidbcloud/serverless/models" + "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models" ) // ServerlessServiceGetClusterReader is a Reader for the ServerlessServiceGetCluster structure. diff --git a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_list_clusters_parameters.go b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_list_clusters_parameters.go similarity index 100% rename from pkg/tidbcloud/serverless/client/serverless_service/serverless_service_list_clusters_parameters.go rename to pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_list_clusters_parameters.go diff --git a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_list_clusters_responses.go b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_list_clusters_responses.go similarity index 99% rename from pkg/tidbcloud/serverless/client/serverless_service/serverless_service_list_clusters_responses.go rename to pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_list_clusters_responses.go index 543c8d4f..df6ec8d5 100644 --- a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_list_clusters_responses.go +++ b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_list_clusters_responses.go @@ -12,7 +12,7 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" - "tidbcloud-cli/pkg/tidbcloud/serverless/models" + "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models" ) // ServerlessServiceListClustersReader is a Reader for the ServerlessServiceListClusters structure. diff --git a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_list_regions_parameters.go b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_list_regions_parameters.go similarity index 100% rename from pkg/tidbcloud/serverless/client/serverless_service/serverless_service_list_regions_parameters.go rename to pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_list_regions_parameters.go diff --git a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_list_regions_responses.go b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_list_regions_responses.go similarity index 99% rename from pkg/tidbcloud/serverless/client/serverless_service/serverless_service_list_regions_responses.go rename to pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_list_regions_responses.go index f9beeb8b..b0c917c8 100644 --- a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_list_regions_responses.go +++ b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_list_regions_responses.go @@ -12,7 +12,7 @@ import ( "github.com/go-openapi/runtime" "github.com/go-openapi/strfmt" - "tidbcloud-cli/pkg/tidbcloud/serverless/models" + "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models" ) // ServerlessServiceListRegionsReader is a Reader for the ServerlessServiceListRegions structure. diff --git a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_partial_update_cluster_parameters.go b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_partial_update_cluster_parameters.go similarity index 100% rename from pkg/tidbcloud/serverless/client/serverless_service/serverless_service_partial_update_cluster_parameters.go rename to pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_partial_update_cluster_parameters.go diff --git a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_partial_update_cluster_responses.go b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_partial_update_cluster_responses.go similarity index 99% rename from pkg/tidbcloud/serverless/client/serverless_service/serverless_service_partial_update_cluster_responses.go rename to pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_partial_update_cluster_responses.go index 20ee9d04..f44ae049 100644 --- a/pkg/tidbcloud/serverless/client/serverless_service/serverless_service_partial_update_cluster_responses.go +++ b/pkg/tidbcloud/v1beta1/serverless/client/serverless_service/serverless_service_partial_update_cluster_responses.go @@ -16,7 +16,7 @@ import ( "github.com/go-openapi/swag" "github.com/go-openapi/validate" - "tidbcloud-cli/pkg/tidbcloud/serverless/models" + "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/models" ) // ServerlessServicePartialUpdateClusterReader is a Reader for the ServerlessServicePartialUpdateCluster structure. diff --git a/pkg/tidbcloud/serverless/client/tidbcloud_serverless_client.go b/pkg/tidbcloud/v1beta1/serverless/client/tidbcloud_serverless_client.go similarity index 97% rename from pkg/tidbcloud/serverless/client/tidbcloud_serverless_client.go rename to pkg/tidbcloud/v1beta1/serverless/client/tidbcloud_serverless_client.go index d7b315c3..9467aa2c 100644 --- a/pkg/tidbcloud/serverless/client/tidbcloud_serverless_client.go +++ b/pkg/tidbcloud/v1beta1/serverless/client/tidbcloud_serverless_client.go @@ -10,7 +10,7 @@ import ( httptransport "github.com/go-openapi/runtime/client" "github.com/go-openapi/strfmt" - "tidbcloud-cli/pkg/tidbcloud/serverless/client/serverless_service" + "tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/client/serverless_service" ) // Default tidbcloud serverless HTTP client. diff --git a/pkg/tidbcloud/serverless/models/cluster_spending_limit.go b/pkg/tidbcloud/v1beta1/serverless/models/cluster_spending_limit.go similarity index 100% rename from pkg/tidbcloud/serverless/models/cluster_spending_limit.go rename to pkg/tidbcloud/v1beta1/serverless/models/cluster_spending_limit.go diff --git a/pkg/tidbcloud/serverless/models/cluster_usage.go b/pkg/tidbcloud/v1beta1/serverless/models/cluster_usage.go similarity index 100% rename from pkg/tidbcloud/serverless/models/cluster_usage.go rename to pkg/tidbcloud/v1beta1/serverless/models/cluster_usage.go diff --git a/pkg/tidbcloud/serverless/models/endpoints_private.go b/pkg/tidbcloud/v1beta1/serverless/models/endpoints_private.go similarity index 100% rename from pkg/tidbcloud/serverless/models/endpoints_private.go rename to pkg/tidbcloud/v1beta1/serverless/models/endpoints_private.go diff --git a/pkg/tidbcloud/serverless/models/endpoints_public.go b/pkg/tidbcloud/v1beta1/serverless/models/endpoints_public.go similarity index 100% rename from pkg/tidbcloud/serverless/models/endpoints_public.go rename to pkg/tidbcloud/v1beta1/serverless/models/endpoints_public.go diff --git a/pkg/tidbcloud/serverless/models/googlerpc_status.go b/pkg/tidbcloud/v1beta1/serverless/models/googlerpc_status.go similarity index 100% rename from pkg/tidbcloud/serverless/models/googlerpc_status.go rename to pkg/tidbcloud/v1beta1/serverless/models/googlerpc_status.go diff --git a/pkg/tidbcloud/serverless/models/private_a_w_s.go b/pkg/tidbcloud/v1beta1/serverless/models/private_a_w_s.go similarity index 100% rename from pkg/tidbcloud/serverless/models/private_a_w_s.go rename to pkg/tidbcloud/v1beta1/serverless/models/private_a_w_s.go diff --git a/pkg/tidbcloud/serverless/models/private_g_c_p.go b/pkg/tidbcloud/v1beta1/serverless/models/private_g_c_p.go similarity index 100% rename from pkg/tidbcloud/serverless/models/private_g_c_p.go rename to pkg/tidbcloud/v1beta1/serverless/models/private_g_c_p.go diff --git a/pkg/tidbcloud/branch/models/protobuf_any.go b/pkg/tidbcloud/v1beta1/serverless/models/protobuf_any.go similarity index 100% rename from pkg/tidbcloud/branch/models/protobuf_any.go rename to pkg/tidbcloud/v1beta1/serverless/models/protobuf_any.go diff --git a/pkg/tidbcloud/serverless/models/tidb_cloud_open_apiserverlessv1beta1_cluster.go b/pkg/tidbcloud/v1beta1/serverless/models/tidb_cloud_open_apiserverlessv1beta1_cluster.go similarity index 100% rename from pkg/tidbcloud/serverless/models/tidb_cloud_open_apiserverlessv1beta1_cluster.go rename to pkg/tidbcloud/v1beta1/serverless/models/tidb_cloud_open_apiserverlessv1beta1_cluster.go diff --git a/pkg/tidbcloud/serverless/models/tidb_cloud_open_apiserverlessv1beta1_cluster_state.go b/pkg/tidbcloud/v1beta1/serverless/models/tidb_cloud_open_apiserverlessv1beta1_cluster_state.go similarity index 100% rename from pkg/tidbcloud/serverless/models/tidb_cloud_open_apiserverlessv1beta1_cluster_state.go rename to pkg/tidbcloud/v1beta1/serverless/models/tidb_cloud_open_apiserverlessv1beta1_cluster_state.go diff --git a/pkg/tidbcloud/serverless/models/tidb_cloud_open_apiserverlessv1beta1_list_clusters_response.go b/pkg/tidbcloud/v1beta1/serverless/models/tidb_cloud_open_apiserverlessv1beta1_list_clusters_response.go similarity index 100% rename from pkg/tidbcloud/serverless/models/tidb_cloud_open_apiserverlessv1beta1_list_clusters_response.go rename to pkg/tidbcloud/v1beta1/serverless/models/tidb_cloud_open_apiserverlessv1beta1_list_clusters_response.go diff --git a/pkg/tidbcloud/serverless/models/tidb_cloud_open_apiserverlessv1beta1_list_regions_response.go b/pkg/tidbcloud/v1beta1/serverless/models/tidb_cloud_open_apiserverlessv1beta1_list_regions_response.go similarity index 100% rename from pkg/tidbcloud/serverless/models/tidb_cloud_open_apiserverlessv1beta1_list_regions_response.go rename to pkg/tidbcloud/v1beta1/serverless/models/tidb_cloud_open_apiserverlessv1beta1_list_regions_response.go diff --git a/pkg/tidbcloud/serverless/models/tidb_cloud_open_apiserverlessv1beta1_region.go b/pkg/tidbcloud/v1beta1/serverless/models/tidb_cloud_open_apiserverlessv1beta1_region.go similarity index 100% rename from pkg/tidbcloud/serverless/models/tidb_cloud_open_apiserverlessv1beta1_region.go rename to pkg/tidbcloud/v1beta1/serverless/models/tidb_cloud_open_apiserverlessv1beta1_region.go diff --git a/pkg/tidbcloud/serverless/models/v1beta1_change_root_password_response.go b/pkg/tidbcloud/v1beta1/serverless/models/v1beta1_change_root_password_response.go similarity index 100% rename from pkg/tidbcloud/serverless/models/v1beta1_change_root_password_response.go rename to pkg/tidbcloud/v1beta1/serverless/models/v1beta1_change_root_password_response.go diff --git a/pkg/tidbcloud/serverless/models/v1beta1_cluster_automated_backup_policy.go b/pkg/tidbcloud/v1beta1/serverless/models/v1beta1_cluster_automated_backup_policy.go similarity index 100% rename from pkg/tidbcloud/serverless/models/v1beta1_cluster_automated_backup_policy.go rename to pkg/tidbcloud/v1beta1/serverless/models/v1beta1_cluster_automated_backup_policy.go diff --git a/pkg/tidbcloud/serverless/models/v1beta1_cluster_encryption_config.go b/pkg/tidbcloud/v1beta1/serverless/models/v1beta1_cluster_encryption_config.go similarity index 100% rename from pkg/tidbcloud/serverless/models/v1beta1_cluster_encryption_config.go rename to pkg/tidbcloud/v1beta1/serverless/models/v1beta1_cluster_encryption_config.go diff --git a/pkg/tidbcloud/serverless/models/v1beta1_cluster_endpoints.go b/pkg/tidbcloud/v1beta1/serverless/models/v1beta1_cluster_endpoints.go similarity index 100% rename from pkg/tidbcloud/serverless/models/v1beta1_cluster_endpoints.go rename to pkg/tidbcloud/v1beta1/serverless/models/v1beta1_cluster_endpoints.go diff --git a/pkg/tidbcloud/serverless/models/v1beta1_cluster_view.go b/pkg/tidbcloud/v1beta1/serverless/models/v1beta1_cluster_view.go similarity index 100% rename from pkg/tidbcloud/serverless/models/v1beta1_cluster_view.go rename to pkg/tidbcloud/v1beta1/serverless/models/v1beta1_cluster_view.go diff --git a/pkg/tidbcloud/serverless/models/v1beta1_region_cloud_provider.go b/pkg/tidbcloud/v1beta1/serverless/models/v1beta1_region_cloud_provider.go similarity index 100% rename from pkg/tidbcloud/serverless/models/v1beta1_region_cloud_provider.go rename to pkg/tidbcloud/v1beta1/serverless/models/v1beta1_region_cloud_provider.go diff --git a/pkg/tidbcloud/serverless/serverless.swagger.json b/pkg/tidbcloud/v1beta1/serverless/serverless.swagger.json similarity index 100% rename from pkg/tidbcloud/serverless/serverless.swagger.json rename to pkg/tidbcloud/v1beta1/serverless/serverless.swagger.json