From 7a9fa68f58b3ee141971282857db1b73a44289a9 Mon Sep 17 00:00:00 2001 From: Xiang Zhang Date: Tue, 1 Oct 2024 12:16:37 +0800 Subject: [PATCH] use view when get branch/cluster (#248) --- internal/cli/serverless/branch/create.go | 4 +- internal/cli/serverless/branch/create_test.go | 2 +- internal/cli/serverless/branch/describe.go | 3 +- .../cli/serverless/branch/describe_test.go | 2 +- internal/cli/serverless/branch/reset.go | 4 +- internal/cli/serverless/branch/reset_test.go | 2 +- internal/cli/serverless/branch/shell.go | 3 +- internal/cli/serverless/create.go | 4 +- internal/cli/serverless/create_test.go | 4 +- internal/cli/serverless/describe.go | 3 +- internal/cli/serverless/describe_test.go | 2 +- internal/cli/serverless/shell.go | 3 +- internal/cli/serverless/sqluser/create.go | 3 +- .../cli/serverless/sqluser/create_test.go | 2 +- .../cli/serverless/sqluser/update_test.go | 2 +- internal/mock/api_client.go | 38 +++++++++---------- internal/mock/uploader.go | 2 +- internal/service/cloud/api_client.go | 16 +++++--- 18 files changed, 54 insertions(+), 45 deletions(-) diff --git a/internal/cli/serverless/branch/create.go b/internal/cli/serverless/branch/create.go index 9ce61332..52c84ee5 100644 --- a/internal/cli/serverless/branch/create.go +++ b/internal/cli/serverless/branch/create.go @@ -226,7 +226,7 @@ func CreateAndWaitReady(ctx context.Context, h *internal.Helper, d cloud.TiDBClo case <-timer: return errors.New(fmt.Sprintf("Timeout waiting for branch %s to be ready, please check status on dashboard.", newBranchID)) case <-ticker.C: - b, err := d.GetBranch(ctx, clusterId, newBranchID) + b, err := d.GetBranch(ctx, clusterId, newBranchID, branch.BRANCHSERVICEGETBRANCHVIEWPARAMETER_BASIC) if err != nil { return errors.Trace(err) } @@ -255,7 +255,7 @@ func CreateAndSpinnerWait(ctx context.Context, h *internal.Helper, d cloud.TiDBC case <-timer: return errors.New(fmt.Sprintf("Timeout waiting for branch %s to be ready, please check status on dashboard.", newBranchID)) case <-ticker.C: - b, err := d.GetBranch(ctx, clusterId, newBranchID) + b, err := d.GetBranch(ctx, clusterId, newBranchID, branch.BRANCHSERVICEGETBRANCHVIEWPARAMETER_BASIC) if err != nil { return errors.Trace(err) } diff --git a/internal/cli/serverless/branch/create_test.go b/internal/cli/serverless/branch/create_test.go index 3781f080..b24b4111 100644 --- a/internal/cli/serverless/branch/create_test.go +++ b/internal/cli/serverless/branch/create_test.go @@ -73,7 +73,7 @@ func (suite *CreateBranchSuite) TestCreateBranchArgs() { body := &branch.Branch{} err := json.Unmarshal([]byte(getBranchResultStr), body) assert.Nil(err) - suite.mockClient.On("GetBranch", ctx, clusterID, branchId).Return(body, nil) + suite.mockClient.On("GetBranch", ctx, clusterID, branchId, branch.BRANCHSERVICEGETBRANCHVIEWPARAMETER_BASIC).Return(body, nil) tests := []struct { name string diff --git a/internal/cli/serverless/branch/describe.go b/internal/cli/serverless/branch/describe.go index e873a87b..5c3ac762 100644 --- a/internal/cli/serverless/branch/describe.go +++ b/internal/cli/serverless/branch/describe.go @@ -22,6 +22,7 @@ import ( "github.com/tidbcloud/tidbcloud-cli/internal/flag" "github.com/tidbcloud/tidbcloud-cli/internal/output" "github.com/tidbcloud/tidbcloud-cli/internal/service/cloud" + "github.com/tidbcloud/tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/branch" "github.com/juju/errors" "github.com/spf13/cobra" @@ -124,7 +125,7 @@ func DescribeCmd(h *internal.Helper) *cobra.Command { } } - branch, err := d.GetBranch(ctx, clusterID, branchID) + branch, err := d.GetBranch(ctx, clusterID, branchID, branch.BRANCHSERVICEGETBRANCHVIEWPARAMETER_FULL) if err != nil { return errors.Trace(err) } diff --git a/internal/cli/serverless/branch/describe_test.go b/internal/cli/serverless/branch/describe_test.go index e03a90b7..4d6b3019 100644 --- a/internal/cli/serverless/branch/describe_test.go +++ b/internal/cli/serverless/branch/describe_test.go @@ -90,7 +90,7 @@ func (suite *DescribeBranchSuite) TestDescribeBranchArgs() { assert.Nil(err) clusterID := "10202848322613926203" branchID := "bran-fgwdnpasmrahnh5iozqawnmijq" - suite.mockClient.On("GetBranch", ctx, clusterID, branchID).Return(body, nil) + suite.mockClient.On("GetBranch", ctx, clusterID, branchID, branch.BRANCHSERVICEGETBRANCHVIEWPARAMETER_FULL).Return(body, nil) tests := []struct { name string diff --git a/internal/cli/serverless/branch/reset.go b/internal/cli/serverless/branch/reset.go index ce758bb3..ed6d55fc 100644 --- a/internal/cli/serverless/branch/reset.go +++ b/internal/cli/serverless/branch/reset.go @@ -199,7 +199,7 @@ func ResetAndWaitReady(ctx context.Context, h *internal.Helper, d cloud.TiDBClou case <-timer: return errors.New(fmt.Sprintf("Timeout waiting for branch %s to be ready, please check status on dashboard.", branchID)) case <-ticker.C: - b, err := d.GetBranch(ctx, clusterID, branchID) + b, err := d.GetBranch(ctx, clusterID, branchID, branch.BRANCHSERVICEGETBRANCHVIEWPARAMETER_BASIC) if err != nil { return errors.Trace(err) } @@ -227,7 +227,7 @@ func ResetAndSpinnerWait(ctx context.Context, h *internal.Helper, d cloud.TiDBCl case <-timer: return ui.Result(fmt.Sprintf("Timeout waiting for branch %s to be ready, please check status on dashboard.", branchID)) case <-ticker.C: - b, err := d.GetBranch(ctx, clusterID, branchID) + b, err := d.GetBranch(ctx, clusterID, branchID, branch.BRANCHSERVICEGETBRANCHVIEWPARAMETER_BASIC) if err != nil { return errors.Trace(err) } diff --git a/internal/cli/serverless/branch/reset_test.go b/internal/cli/serverless/branch/reset_test.go index 9a4815f0..17b2a13c 100644 --- a/internal/cli/serverless/branch/reset_test.go +++ b/internal/cli/serverless/branch/reset_test.go @@ -65,7 +65,7 @@ func (suite *ResetBranchSuite) TestResetBranchArgs() { body := &branch.Branch{} err := json.Unmarshal([]byte(getBranchResultStr), body) assert.Nil(err) - suite.mockClient.On("GetBranch", ctx, clusterID, branchID).Return(body, nil) + suite.mockClient.On("GetBranch", ctx, clusterID, branchID, branch.BRANCHSERVICEGETBRANCHVIEWPARAMETER_BASIC).Return(body, nil) tests := []struct { name string diff --git a/internal/cli/serverless/branch/shell.go b/internal/cli/serverless/branch/shell.go index 18611d32..cb50b533 100644 --- a/internal/cli/serverless/branch/shell.go +++ b/internal/cli/serverless/branch/shell.go @@ -23,6 +23,7 @@ import ( "github.com/tidbcloud/tidbcloud-cli/internal/flag" "github.com/tidbcloud/tidbcloud-cli/internal/service/cloud" "github.com/tidbcloud/tidbcloud-cli/internal/util" + "github.com/tidbcloud/tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/branch" "github.com/AlecAivazis/survey/v2" "github.com/AlecAivazis/survey/v2/terminal" @@ -197,7 +198,7 @@ The connection forces the [ANSI SQL mode](https://dev.mysql.com/doc/refman/8.0/e } var host, name, port string - branchInfo, err := d.GetBranch(ctx, clusterID, branchID) + branchInfo, err := d.GetBranch(ctx, clusterID, branchID, branch.BRANCHSERVICEGETBRANCHVIEWPARAMETER_BASIC) if err != nil { return errors.Trace(err) } diff --git a/internal/cli/serverless/create.go b/internal/cli/serverless/create.go index aef09831..e88f1a82 100644 --- a/internal/cli/serverless/create.go +++ b/internal/cli/serverless/create.go @@ -327,7 +327,7 @@ func CreateAndWaitReady(ctx context.Context, h *internal.Helper, d cloud.TiDBClo case <-timer: return errors.New(fmt.Sprintf("Timeout waiting for cluster %s to be ready, please check status on dashboard.", newClusterID)) case <-ticker.C: - clusterResult, err := d.GetCluster(ctx, newClusterID) + clusterResult, err := d.GetCluster(ctx, newClusterID, cluster.SERVERLESSSERVICEGETCLUSTERVIEWPARAMETER_BASIC) if err != nil { return errors.Trace(err) } @@ -356,7 +356,7 @@ func CreateAndSpinnerWait(ctx context.Context, h *internal.Helper, d cloud.TiDBC case <-timer: return ui.Result(fmt.Sprintf("Timeout waiting for cluster %s to be ready, please check status on dashboard.", newClusterID)) case <-ticker.C: - clusterResult, err := d.GetCluster(ctx, newClusterID) + clusterResult, err := d.GetCluster(ctx, newClusterID, cluster.SERVERLESSSERVICEGETCLUSTERVIEWPARAMETER_BASIC) if err != nil { return errors.Trace(err) } diff --git a/internal/cli/serverless/create_test.go b/internal/cli/serverless/create_test.go index 6674fc82..5ad20044 100644 --- a/internal/cli/serverless/create_test.go +++ b/internal/cli/serverless/create_test.go @@ -77,7 +77,7 @@ func (suite *CreateClusterSuite) TestCreateClusterArgs() { Return(&cluster.TidbCloudOpenApiserverlessv1beta1Cluster{ ClusterId: &clusterID, }, nil) - suite.mockClient.On("GetCluster", ctx, clusterID).Return(body, nil) + suite.mockClient.On("GetCluster", ctx, clusterID, cluster.SERVERLESSSERVICEGETCLUSTERVIEWPARAMETER_BASIC).Return(body, nil) tests := []struct { name string @@ -140,7 +140,7 @@ func (suite *CreateClusterSuite) TestCreateClusterWithoutProject() { Return(&cluster.TidbCloudOpenApiserverlessv1beta1Cluster{ ClusterId: &clusterID, }, nil) - suite.mockClient.On("GetCluster", ctx, clusterID).Return(body, nil) + suite.mockClient.On("GetCluster", ctx, clusterID, cluster.SERVERLESSSERVICEGETCLUSTERVIEWPARAMETER_BASIC).Return(body, nil) tests := []struct { name string diff --git a/internal/cli/serverless/describe.go b/internal/cli/serverless/describe.go index 71cc8515..12bcf118 100644 --- a/internal/cli/serverless/describe.go +++ b/internal/cli/serverless/describe.go @@ -23,6 +23,7 @@ import ( "github.com/tidbcloud/tidbcloud-cli/internal/output" "github.com/tidbcloud/tidbcloud-cli/internal/service/cloud" "github.com/tidbcloud/tidbcloud-cli/internal/telemetry" + "github.com/tidbcloud/tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/cluster" "github.com/juju/errors" "github.com/spf13/cobra" @@ -110,7 +111,7 @@ func DescribeCmd(h *internal.Helper) *cobra.Command { clusterID = cID } - c, err := d.GetCluster(ctx, clusterID) + c, err := d.GetCluster(ctx, clusterID, cluster.SERVERLESSSERVICEGETCLUSTERVIEWPARAMETER_FULL) if err != nil { return errors.Trace(err) } diff --git a/internal/cli/serverless/describe_test.go b/internal/cli/serverless/describe_test.go index d1c6c847..ff2a7293 100644 --- a/internal/cli/serverless/describe_test.go +++ b/internal/cli/serverless/describe_test.go @@ -111,7 +111,7 @@ func (suite *DescribeClusterSuite) TestDescribeClusterArgs() { assert.Nil(err) clusterID := "12345" - suite.mockClient.On("GetCluster", ctx, clusterID).Return(body, nil) + suite.mockClient.On("GetCluster", ctx, clusterID, cluster.SERVERLESSSERVICEGETCLUSTERVIEWPARAMETER_FULL).Return(body, nil) tests := []struct { name string diff --git a/internal/cli/serverless/shell.go b/internal/cli/serverless/shell.go index 8210d5ff..9a30b06d 100644 --- a/internal/cli/serverless/shell.go +++ b/internal/cli/serverless/shell.go @@ -23,6 +23,7 @@ import ( "github.com/tidbcloud/tidbcloud-cli/internal/flag" "github.com/tidbcloud/tidbcloud-cli/internal/service/cloud" "github.com/tidbcloud/tidbcloud-cli/internal/util" + "github.com/tidbcloud/tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/cluster" "github.com/AlecAivazis/survey/v2" "github.com/AlecAivazis/survey/v2/terminal" @@ -167,7 +168,7 @@ The connection forces the [ANSI SQL mode](https://dev.mysql.com/doc/refman/8.0/e } var host, name, port string - cluster, err := d.GetCluster(ctx, clusterID) + cluster, err := d.GetCluster(ctx, clusterID, cluster.SERVERLESSSERVICEGETCLUSTERVIEWPARAMETER_BASIC) if err != nil { return errors.Trace(err) } diff --git a/internal/cli/serverless/sqluser/create.go b/internal/cli/serverless/sqluser/create.go index ffe2ff36..0249f9d4 100644 --- a/internal/cli/serverless/sqluser/create.go +++ b/internal/cli/serverless/sqluser/create.go @@ -29,6 +29,7 @@ import ( "github.com/tidbcloud/tidbcloud-cli/internal/util" "github.com/tidbcloud/tidbcloud-cli/pkg/tidbcloud/v1beta1/iam" + "github.com/tidbcloud/tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/cluster" "github.com/charmbracelet/bubbles/textinput" tea "github.com/charmbracelet/bubbletea" @@ -266,7 +267,7 @@ func initialCreateInputModel(userPrefix string) ui.TextInputModel { } func getUserPrefix(ctx context.Context, d cloud.TiDBCloudClient, clusterID string) (string, error) { - cluster, err := d.GetCluster(ctx, clusterID) + cluster, err := d.GetCluster(ctx, clusterID, cluster.SERVERLESSSERVICEGETCLUSTERVIEWPARAMETER_BASIC) if err != nil { return "", errors.Trace(err) } diff --git a/internal/cli/serverless/sqluser/create_test.go b/internal/cli/serverless/sqluser/create_test.go index f80813cf..5a807870 100644 --- a/internal/cli/serverless/sqluser/create_test.go +++ b/internal/cli/serverless/sqluser/create_test.go @@ -110,7 +110,7 @@ func (suite *CreateSQLUserSuite) TestCreateSQLUserArgs() { res := &cluster.TidbCloudOpenApiserverlessv1beta1Cluster{} err = json.Unmarshal([]byte(getClusterResultStr), res) assert.Nil(err) - suite.mockClient.On("GetCluster", ctx, clusterID).Return(res, nil) + suite.mockClient.On("GetCluster", ctx, clusterID, cluster.SERVERLESSSERVICEGETCLUSTERVIEWPARAMETER_BASIC).Return(res, nil) tests := []struct { name string diff --git a/internal/cli/serverless/sqluser/update_test.go b/internal/cli/serverless/sqluser/update_test.go index 3f04ac03..04585d19 100644 --- a/internal/cli/serverless/sqluser/update_test.go +++ b/internal/cli/serverless/sqluser/update_test.go @@ -83,7 +83,7 @@ func (suite *UpdateSQLUserSuite) TestUpdateSQLUserArgs() { res := &cluster.TidbCloudOpenApiserverlessv1beta1Cluster{} err = json.Unmarshal([]byte(getClusterResultStr), res) assert.Nil(err) - suite.mockClient.On("GetCluster", ctx, clusterID).Return(res, nil) + suite.mockClient.On("GetCluster", ctx, clusterID, cluster.SERVERLESSSERVICEGETCLUSTERVIEWPARAMETER_BASIC).Return(res, nil) updateBody := &iam.ApiUpdateSqlUserReq{ BuiltinRole: &builtinRole, diff --git a/internal/mock/api_client.go b/internal/mock/api_client.go index 07be258e..a67873a1 100644 --- a/internal/mock/api_client.go +++ b/internal/mock/api_client.go @@ -14,7 +14,7 @@ import ( iam "github.com/tidbcloud/tidbcloud-cli/pkg/tidbcloud/v1beta1/iam" - "github.com/tidbcloud/tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/imp" + imp "github.com/tidbcloud/tidbcloud-cli/pkg/tidbcloud/v1beta1/serverless/imp" mock "github.com/stretchr/testify/mock" @@ -500,9 +500,9 @@ func (_m *TiDBCloudClient) GetBackup(ctx context.Context, backupId string) (*br. return r0, r1 } -// GetBranch provides a mock function with given fields: ctx, clusterId, branchId -func (_m *TiDBCloudClient) GetBranch(ctx context.Context, clusterId string, branchId string) (*branch.Branch, error) { - ret := _m.Called(ctx, clusterId, branchId) +// GetBranch provides a mock function with given fields: ctx, clusterId, branchId, view +func (_m *TiDBCloudClient) GetBranch(ctx context.Context, clusterId string, branchId string, view branch.BranchServiceGetBranchViewParameter) (*branch.Branch, error) { + ret := _m.Called(ctx, clusterId, branchId, view) if len(ret) == 0 { panic("no return value specified for GetBranch") @@ -510,19 +510,19 @@ func (_m *TiDBCloudClient) GetBranch(ctx context.Context, clusterId string, bran var r0 *branch.Branch var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string, string) (*branch.Branch, error)); ok { - return rf(ctx, clusterId, branchId) + if rf, ok := ret.Get(0).(func(context.Context, string, string, branch.BranchServiceGetBranchViewParameter) (*branch.Branch, error)); ok { + return rf(ctx, clusterId, branchId, view) } - if rf, ok := ret.Get(0).(func(context.Context, string, string) *branch.Branch); ok { - r0 = rf(ctx, clusterId, branchId) + if rf, ok := ret.Get(0).(func(context.Context, string, string, branch.BranchServiceGetBranchViewParameter) *branch.Branch); ok { + r0 = rf(ctx, clusterId, branchId, view) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*branch.Branch) } } - if rf, ok := ret.Get(1).(func(context.Context, string, string) error); ok { - r1 = rf(ctx, clusterId, branchId) + if rf, ok := ret.Get(1).(func(context.Context, string, string, branch.BranchServiceGetBranchViewParameter) error); ok { + r1 = rf(ctx, clusterId, branchId, view) } else { r1 = ret.Error(1) } @@ -530,9 +530,9 @@ func (_m *TiDBCloudClient) GetBranch(ctx context.Context, clusterId string, bran return r0, r1 } -// GetCluster provides a mock function with given fields: ctx, clusterId -func (_m *TiDBCloudClient) GetCluster(ctx context.Context, clusterId string) (*cluster.TidbCloudOpenApiserverlessv1beta1Cluster, error) { - ret := _m.Called(ctx, clusterId) +// GetCluster provides a mock function with given fields: ctx, clusterId, view +func (_m *TiDBCloudClient) GetCluster(ctx context.Context, clusterId string, view cluster.ServerlessServiceGetClusterViewParameter) (*cluster.TidbCloudOpenApiserverlessv1beta1Cluster, error) { + ret := _m.Called(ctx, clusterId, view) if len(ret) == 0 { panic("no return value specified for GetCluster") @@ -540,19 +540,19 @@ func (_m *TiDBCloudClient) GetCluster(ctx context.Context, clusterId string) (*c var r0 *cluster.TidbCloudOpenApiserverlessv1beta1Cluster var r1 error - if rf, ok := ret.Get(0).(func(context.Context, string) (*cluster.TidbCloudOpenApiserverlessv1beta1Cluster, error)); ok { - return rf(ctx, clusterId) + if rf, ok := ret.Get(0).(func(context.Context, string, cluster.ServerlessServiceGetClusterViewParameter) (*cluster.TidbCloudOpenApiserverlessv1beta1Cluster, error)); ok { + return rf(ctx, clusterId, view) } - if rf, ok := ret.Get(0).(func(context.Context, string) *cluster.TidbCloudOpenApiserverlessv1beta1Cluster); ok { - r0 = rf(ctx, clusterId) + if rf, ok := ret.Get(0).(func(context.Context, string, cluster.ServerlessServiceGetClusterViewParameter) *cluster.TidbCloudOpenApiserverlessv1beta1Cluster); ok { + r0 = rf(ctx, clusterId, view) } else { if ret.Get(0) != nil { r0 = ret.Get(0).(*cluster.TidbCloudOpenApiserverlessv1beta1Cluster) } } - if rf, ok := ret.Get(1).(func(context.Context, string) error); ok { - r1 = rf(ctx, clusterId) + if rf, ok := ret.Get(1).(func(context.Context, string, cluster.ServerlessServiceGetClusterViewParameter) error); ok { + r1 = rf(ctx, clusterId, view) } else { r1 = ret.Error(1) } diff --git a/internal/mock/uploader.go b/internal/mock/uploader.go index 7d21d7b5..bc417f52 100644 --- a/internal/mock/uploader.go +++ b/internal/mock/uploader.go @@ -4,9 +4,9 @@ package mock import ( context "context" - s3 "github.com/tidbcloud/tidbcloud-cli/internal/service/aws/s3" mock "github.com/stretchr/testify/mock" + s3 "github.com/tidbcloud/tidbcloud-cli/internal/service/aws/s3" ) // Uploader is an autogenerated mock type for the Uploader type diff --git a/internal/service/cloud/api_client.go b/internal/service/cloud/api_client.go index 4da03555..cef51376 100644 --- a/internal/service/cloud/api_client.go +++ b/internal/service/cloud/api_client.go @@ -48,7 +48,7 @@ type TiDBCloudClient interface { DeleteCluster(ctx context.Context, clusterId string) (*cluster.TidbCloudOpenApiserverlessv1beta1Cluster, error) - GetCluster(ctx context.Context, clusterId string) (*cluster.TidbCloudOpenApiserverlessv1beta1Cluster, error) + GetCluster(ctx context.Context, clusterId string, view cluster.ServerlessServiceGetClusterViewParameter) (*cluster.TidbCloudOpenApiserverlessv1beta1Cluster, error) ListClusters(ctx context.Context, filter *string, pageSize *int32, pageToken *string, orderBy *string, skip *int32) (*cluster.TidbCloudOpenApiserverlessv1beta1ListClustersResponse, error) @@ -66,7 +66,7 @@ type TiDBCloudClient interface { ListImports(ctx context.Context, clusterId string, pageSize *int32, pageToken, orderBy *string) (*imp.ListImportsResp, error) - GetBranch(ctx context.Context, clusterId, branchId string) (*branch.Branch, error) + GetBranch(ctx context.Context, clusterId, branchId string, view branch.BranchServiceGetBranchViewParameter) (*branch.Branch, error) ListBranches(ctx context.Context, clusterId string, pageSize *int32, pageToken *string) (*branch.ListBranchesResponse, error) @@ -174,8 +174,10 @@ func (d *ClientDelegate) DeleteCluster(ctx context.Context, clusterId string) (* return c, parseError(err, h) } -func (d *ClientDelegate) GetCluster(ctx context.Context, clusterId string) (*cluster.TidbCloudOpenApiserverlessv1beta1Cluster, error) { - c, h, err := d.sc.ServerlessServiceAPI.ServerlessServiceGetCluster(ctx, clusterId).Execute() +func (d *ClientDelegate) GetCluster(ctx context.Context, clusterId string, view cluster.ServerlessServiceGetClusterViewParameter) (*cluster.TidbCloudOpenApiserverlessv1beta1Cluster, error) { + r := d.sc.ServerlessServiceAPI.ServerlessServiceGetCluster(ctx, clusterId) + r = r.View(view) + c, h, err := r.Execute() return c, parseError(err, h) } @@ -260,8 +262,10 @@ func (d *ClientDelegate) ListImports(ctx context.Context, clusterId string, page return is, parseError(err, h) } -func (d *ClientDelegate) GetBranch(ctx context.Context, clusterId, branchId string) (*branch.Branch, error) { - b, h, err := d.bc.BranchServiceAPI.BranchServiceGetBranch(ctx, clusterId, branchId).Execute() +func (d *ClientDelegate) GetBranch(ctx context.Context, clusterId, branchId string, view branch.BranchServiceGetBranchViewParameter) (*branch.Branch, error) { + r := d.bc.BranchServiceAPI.BranchServiceGetBranch(ctx, clusterId, branchId) + r = r.View(view) + b, h, err := r.Execute() return b, parseError(err, h) }