From cebb6bc83cd54f3e0e9a4fea7e4de2026cb1a307 Mon Sep 17 00:00:00 2001 From: Roland Kunkel Date: Tue, 3 Feb 2026 14:52:24 +0100 Subject: [PATCH] SREP-3384: update backplane-cli to allow remediations on infrastructure clusters --- cmd/ocm-backplane/remediation/remediation.go | 4 +- go.mod | 2 +- go.sum | 2 + pkg/backplaneapi/mocks/clientUtilsMock.go | 10 +-- pkg/client/mocks/ClientMock.go | 84 +++++++++++++++++++- pkg/client/mocks/ClientWithResponsesMock.go | 84 +++++++++++++++++++- pkg/ocm/mocks/ocmWrapperMock.go | 12 +-- pkg/remediation/remediation.go | 8 +- 8 files changed, 185 insertions(+), 21 deletions(-) diff --git a/cmd/ocm-backplane/remediation/remediation.go b/cmd/ocm-backplane/remediation/remediation.go index 4e972301..c30d18a8 100644 --- a/cmd/ocm-backplane/remediation/remediation.go +++ b/cmd/ocm-backplane/remediation/remediation.go @@ -3,6 +3,8 @@ package remediation import ( "fmt" + BackplaneApi "github.com/openshift/backplane-api/pkg/client" + "github.com/openshift/backplane-cli/pkg/backplaneapi" "github.com/openshift/backplane-cli/pkg/cli/config" "github.com/openshift/backplane-cli/pkg/cli/globalflags" @@ -137,7 +139,7 @@ func runCreateRemediation(args []string, clusterKey string, urlFlag string) erro logger.Debugln("backplane configuration file also contains a proxy url, using that one instead") logger.Debugf("New backplane Proxy URL: %s\n", proxyURL) } - proxyURI, remediationInstanceID, err := remediation.DoCreateRemediation(bpURL, clusterID, *accessToken, remediationName) + proxyURI, remediationInstanceID, err := remediation.DoCreateRemediation(bpURL, clusterID, *accessToken, &BackplaneApi.CreateRemediationParams{RemediationName: remediationName}) // ======== Render Results ======== if err != nil { return err diff --git a/go.mod b/go.mod index 569a128d..bf46f09a 100644 --- a/go.mod +++ b/go.mod @@ -18,7 +18,7 @@ require ( github.com/onsi/gomega v1.39.1 github.com/openshift-online/ocm-cli v1.0.10 github.com/openshift-online/ocm-sdk-go v0.1.493 - github.com/openshift/backplane-api v0.0.0-20251026011953-7861d08b3674 + github.com/openshift/backplane-api v0.0.0-20251117160932-490f3091533f github.com/openshift/client-go v0.0.0-20221019143426-16aed247da5c github.com/pkg/browser v0.0.0-20240102092130-5ac0b6a4141c github.com/sirupsen/logrus v1.9.4 diff --git a/go.sum b/go.sum index ef663224..bb735d1e 100644 --- a/go.sum +++ b/go.sum @@ -405,6 +405,8 @@ github.com/openshift/api v0.0.0-20221018124113-7edcfe3c76cb h1:QsBjYe5UfHIZi/3SM github.com/openshift/api v0.0.0-20221018124113-7edcfe3c76cb/go.mod h1:JRz+ZvTqu9u7t6suhhPTacbFl5K65Y6rJbNM7HjWA3g= github.com/openshift/backplane-api v0.0.0-20251026011953-7861d08b3674 h1:2MgXsvaOZzh2oQpyZMvWd2U6xHzpzBC5LaI9sX1rGQ8= github.com/openshift/backplane-api v0.0.0-20251026011953-7861d08b3674/go.mod h1:0+HQ/Ujo/hRKpBFePq2Zitrk6sc5viJNrDtbBTx1uh0= +github.com/openshift/backplane-api v0.0.0-20251117160932-490f3091533f h1:7VGTnBRgyKpyXOitwNVtR05HsPNZARqow8rU5Qo2bGY= +github.com/openshift/backplane-api v0.0.0-20251117160932-490f3091533f/go.mod h1:0+HQ/Ujo/hRKpBFePq2Zitrk6sc5viJNrDtbBTx1uh0= github.com/openshift/client-go v0.0.0-20221019143426-16aed247da5c h1:CV76yFOTXmq9VciBR3Bve5ZWzSxdft7gaMVB3kS0rwg= github.com/openshift/client-go v0.0.0-20221019143426-16aed247da5c/go.mod h1:lFMO8mLHXWFzSdYvGNo8ivF9SfF6zInA8ZGw4phRnUE= github.com/pelletier/go-toml/v2 v2.2.4 h1:mye9XuhQ6gvn5h28+VilKrrPoQVanw5PMw/TB0t5Ec4= diff --git a/pkg/backplaneapi/mocks/clientUtilsMock.go b/pkg/backplaneapi/mocks/clientUtilsMock.go index 05ab9d4e..0a498579 100644 --- a/pkg/backplaneapi/mocks/clientUtilsMock.go +++ b/pkg/backplaneapi/mocks/clientUtilsMock.go @@ -12,9 +12,9 @@ package mocks import ( reflect "reflect" + sdk "github.com/openshift-online/ocm-sdk-go" Openapi "github.com/openshift/backplane-api/pkg/client" gomock "go.uber.org/mock/gomock" - ocmsdk "github.com/openshift-online/ocm-sdk-go" ) // MockClientUtils is a mock of ClientUtils interface. @@ -117,18 +117,18 @@ func (mr *MockClientUtilsMockRecorder) MakeRawBackplaneAPIClientWithAccessToken( } // MakeRawBackplaneAPIClientWithAccessTokenWithConn mocks base method. -func (m *MockClientUtils) MakeRawBackplaneAPIClientWithAccessTokenWithConn(arg0, arg1 string, arg2 *ocmsdk.Connection) (Openapi.ClientInterface, error) { +func (m *MockClientUtils) MakeRawBackplaneAPIClientWithAccessTokenWithConn(base, accessToken string, ocmConn *sdk.Connection) (Openapi.ClientInterface, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "MakeRawBackplaneAPIClientWithAccessTokenWithConn", arg0, arg1) + ret := m.ctrl.Call(m, "MakeRawBackplaneAPIClientWithAccessTokenWithConn", base, accessToken, ocmConn) ret0, _ := ret[0].(Openapi.ClientInterface) ret1, _ := ret[1].(error) return ret0, ret1 } // MakeRawBackplaneAPIClientWithAccessTokenWithConn indicates an expected call of MakeRawBackplaneAPIClientWithAccessTokenWithConn. -func (mr *MockClientUtilsMockRecorder) MakeRawBackplaneAPIClientWithAccessTokenWithConn(arg0, arg1 interface{}, arg2 interface{}) *gomock.Call { +func (mr *MockClientUtilsMockRecorder) MakeRawBackplaneAPIClientWithAccessTokenWithConn(base, accessToken, ocmConn any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MakeRawBackplaneAPIClientWithAccessTokenWithConn", reflect.TypeOf((*MockClientUtils)(nil).MakeRawBackplaneAPIClientWithAccessTokenWithConn), arg0, arg1) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "MakeRawBackplaneAPIClientWithAccessTokenWithConn", reflect.TypeOf((*MockClientUtils)(nil).MakeRawBackplaneAPIClientWithAccessTokenWithConn), base, accessToken, ocmConn) } // SetClientProxyURL mocks base method. diff --git a/pkg/client/mocks/ClientMock.go b/pkg/client/mocks/ClientMock.go index 3b474248..3b6c3350 100644 --- a/pkg/client/mocks/ClientMock.go +++ b/pkg/client/mocks/ClientMock.go @@ -44,7 +44,7 @@ func (m *MockClientInterface) EXPECT() *MockClientInterfaceMockRecorder { } // CreateJob mocks base method. -func (m *MockClientInterface) CreateJob(ctx context.Context, clusterId string, body Openapi.CreateJobJSONRequestBody, reqEditors ...Openapi.RequestEditorFn) (*http.Response, error) { +func (m *MockClientInterface) CreateJob(ctx context.Context, clusterId string, body Openapi.CreateJob, reqEditors ...Openapi.RequestEditorFn) (*http.Response, error) { m.ctrl.T.Helper() varargs := []any{ctx, clusterId, body} for _, a := range reqEditors { @@ -103,8 +103,48 @@ func (mr *MockClientInterfaceMockRecorder) CreateRemediation(ctx, clusterId, par return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRemediation", reflect.TypeOf((*MockClientInterface)(nil).CreateRemediation), varargs...) } +// CreateReport mocks base method. +func (m *MockClientInterface) CreateReport(ctx context.Context, clusterId string, body Openapi.CreateReport, reqEditors ...Openapi.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []any{ctx, clusterId, body} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateReport", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateReport indicates an expected call of CreateReport. +func (mr *MockClientInterfaceMockRecorder) CreateReport(ctx, clusterId, body any, reqEditors ...any) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]any{ctx, clusterId, body}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateReport", reflect.TypeOf((*MockClientInterface)(nil).CreateReport), varargs...) +} + +// CreateReportWithBody mocks base method. +func (m *MockClientInterface) CreateReportWithBody(ctx context.Context, clusterId, contentType string, body io.Reader, reqEditors ...Openapi.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []any{ctx, clusterId, contentType, body} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateReportWithBody", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateReportWithBody indicates an expected call of CreateReportWithBody. +func (mr *MockClientInterfaceMockRecorder) CreateReportWithBody(ctx, clusterId, contentType, body any, reqEditors ...any) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]any{ctx, clusterId, contentType, body}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateReportWithBody", reflect.TypeOf((*MockClientInterface)(nil).CreateReportWithBody), varargs...) +} + // CreateTestScriptRun mocks base method. -func (m *MockClientInterface) CreateTestScriptRun(ctx context.Context, clusterId string, body Openapi.CreateTestScriptRunJSONRequestBody, reqEditors ...Openapi.RequestEditorFn) (*http.Response, error) { +func (m *MockClientInterface) CreateTestScriptRun(ctx context.Context, clusterId string, body Openapi.CreateTestJob, reqEditors ...Openapi.RequestEditorFn) (*http.Response, error) { m.ctrl.T.Helper() varargs := []any{ctx, clusterId, body} for _, a := range reqEditors { @@ -383,6 +423,46 @@ func (mr *MockClientInterfaceMockRecorder) GetJobLogs(ctx, clusterId, jobId, par return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetJobLogs", reflect.TypeOf((*MockClientInterface)(nil).GetJobLogs), varargs...) } +// GetReportById mocks base method. +func (m *MockClientInterface) GetReportById(ctx context.Context, clusterId, reportId string, reqEditors ...Openapi.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []any{ctx, clusterId, reportId} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetReportById", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetReportById indicates an expected call of GetReportById. +func (mr *MockClientInterfaceMockRecorder) GetReportById(ctx, clusterId, reportId any, reqEditors ...any) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]any{ctx, clusterId, reportId}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReportById", reflect.TypeOf((*MockClientInterface)(nil).GetReportById), varargs...) +} + +// GetReportsByCluster mocks base method. +func (m *MockClientInterface) GetReportsByCluster(ctx context.Context, clusterId string, params *Openapi.GetReportsByClusterParams, reqEditors ...Openapi.RequestEditorFn) (*http.Response, error) { + m.ctrl.T.Helper() + varargs := []any{ctx, clusterId, params} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetReportsByCluster", varargs...) + ret0, _ := ret[0].(*http.Response) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetReportsByCluster indicates an expected call of GetReportsByCluster. +func (mr *MockClientInterfaceMockRecorder) GetReportsByCluster(ctx, clusterId, params any, reqEditors ...any) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]any{ctx, clusterId, params}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReportsByCluster", reflect.TypeOf((*MockClientInterface)(nil).GetReportsByCluster), varargs...) +} + // GetRun mocks base method. func (m *MockClientInterface) GetRun(ctx context.Context, clusterId, jobId string, reqEditors ...Openapi.RequestEditorFn) (*http.Response, error) { m.ctrl.T.Helper() diff --git a/pkg/client/mocks/ClientWithResponsesMock.go b/pkg/client/mocks/ClientWithResponsesMock.go index e02d4388..22ab9765 100644 --- a/pkg/client/mocks/ClientWithResponsesMock.go +++ b/pkg/client/mocks/ClientWithResponsesMock.go @@ -63,7 +63,7 @@ func (mr *MockClientWithResponsesInterfaceMockRecorder) CreateJobWithBodyWithRes } // CreateJobWithResponse mocks base method. -func (m *MockClientWithResponsesInterface) CreateJobWithResponse(ctx context.Context, clusterId string, body Openapi.CreateJobJSONRequestBody, reqEditors ...Openapi.RequestEditorFn) (*Openapi.CreateJobResponse, error) { +func (m *MockClientWithResponsesInterface) CreateJobWithResponse(ctx context.Context, clusterId string, body Openapi.CreateJob, reqEditors ...Openapi.RequestEditorFn) (*Openapi.CreateJobResponse, error) { m.ctrl.T.Helper() varargs := []any{ctx, clusterId, body} for _, a := range reqEditors { @@ -102,6 +102,46 @@ func (mr *MockClientWithResponsesInterfaceMockRecorder) CreateRemediationWithRes return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateRemediationWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).CreateRemediationWithResponse), varargs...) } +// CreateReportWithBodyWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) CreateReportWithBodyWithResponse(ctx context.Context, clusterId, contentType string, body io.Reader, reqEditors ...Openapi.RequestEditorFn) (*Openapi.CreateReportResponse, error) { + m.ctrl.T.Helper() + varargs := []any{ctx, clusterId, contentType, body} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateReportWithBodyWithResponse", varargs...) + ret0, _ := ret[0].(*Openapi.CreateReportResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateReportWithBodyWithResponse indicates an expected call of CreateReportWithBodyWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) CreateReportWithBodyWithResponse(ctx, clusterId, contentType, body any, reqEditors ...any) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]any{ctx, clusterId, contentType, body}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateReportWithBodyWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).CreateReportWithBodyWithResponse), varargs...) +} + +// CreateReportWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) CreateReportWithResponse(ctx context.Context, clusterId string, body Openapi.CreateReport, reqEditors ...Openapi.RequestEditorFn) (*Openapi.CreateReportResponse, error) { + m.ctrl.T.Helper() + varargs := []any{ctx, clusterId, body} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "CreateReportWithResponse", varargs...) + ret0, _ := ret[0].(*Openapi.CreateReportResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// CreateReportWithResponse indicates an expected call of CreateReportWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) CreateReportWithResponse(ctx, clusterId, body any, reqEditors ...any) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]any{ctx, clusterId, body}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "CreateReportWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).CreateReportWithResponse), varargs...) +} + // CreateTestScriptRunWithBodyWithResponse mocks base method. func (m *MockClientWithResponsesInterface) CreateTestScriptRunWithBodyWithResponse(ctx context.Context, clusterId, contentType string, body io.Reader, reqEditors ...Openapi.RequestEditorFn) (*Openapi.CreateTestScriptRunResponse, error) { m.ctrl.T.Helper() @@ -123,7 +163,7 @@ func (mr *MockClientWithResponsesInterfaceMockRecorder) CreateTestScriptRunWithB } // CreateTestScriptRunWithResponse mocks base method. -func (m *MockClientWithResponsesInterface) CreateTestScriptRunWithResponse(ctx context.Context, clusterId string, body Openapi.CreateTestScriptRunJSONRequestBody, reqEditors ...Openapi.RequestEditorFn) (*Openapi.CreateTestScriptRunResponse, error) { +func (m *MockClientWithResponsesInterface) CreateTestScriptRunWithResponse(ctx context.Context, clusterId string, body Openapi.CreateTestJob, reqEditors ...Openapi.RequestEditorFn) (*Openapi.CreateTestScriptRunResponse, error) { m.ctrl.T.Helper() varargs := []any{ctx, clusterId, body} for _, a := range reqEditors { @@ -382,6 +422,46 @@ func (mr *MockClientWithResponsesInterfaceMockRecorder) GetJobLogsWithResponse(c return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetJobLogsWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).GetJobLogsWithResponse), varargs...) } +// GetReportByIdWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) GetReportByIdWithResponse(ctx context.Context, clusterId, reportId string, reqEditors ...Openapi.RequestEditorFn) (*Openapi.GetReportByIdResponse, error) { + m.ctrl.T.Helper() + varargs := []any{ctx, clusterId, reportId} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetReportByIdWithResponse", varargs...) + ret0, _ := ret[0].(*Openapi.GetReportByIdResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetReportByIdWithResponse indicates an expected call of GetReportByIdWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) GetReportByIdWithResponse(ctx, clusterId, reportId any, reqEditors ...any) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]any{ctx, clusterId, reportId}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReportByIdWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).GetReportByIdWithResponse), varargs...) +} + +// GetReportsByClusterWithResponse mocks base method. +func (m *MockClientWithResponsesInterface) GetReportsByClusterWithResponse(ctx context.Context, clusterId string, params *Openapi.GetReportsByClusterParams, reqEditors ...Openapi.RequestEditorFn) (*Openapi.GetReportsByClusterResponse, error) { + m.ctrl.T.Helper() + varargs := []any{ctx, clusterId, params} + for _, a := range reqEditors { + varargs = append(varargs, a) + } + ret := m.ctrl.Call(m, "GetReportsByClusterWithResponse", varargs...) + ret0, _ := ret[0].(*Openapi.GetReportsByClusterResponse) + ret1, _ := ret[1].(error) + return ret0, ret1 +} + +// GetReportsByClusterWithResponse indicates an expected call of GetReportsByClusterWithResponse. +func (mr *MockClientWithResponsesInterfaceMockRecorder) GetReportsByClusterWithResponse(ctx, clusterId, params any, reqEditors ...any) *gomock.Call { + mr.mock.ctrl.T.Helper() + varargs := append([]any{ctx, clusterId, params}, reqEditors...) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetReportsByClusterWithResponse", reflect.TypeOf((*MockClientWithResponsesInterface)(nil).GetReportsByClusterWithResponse), varargs...) +} + // GetRunWithResponse mocks base method. func (m *MockClientWithResponsesInterface) GetRunWithResponse(ctx context.Context, clusterId, jobId string, reqEditors ...Openapi.RequestEditorFn) (*Openapi.GetRunResponse, error) { m.ctrl.T.Helper() diff --git a/pkg/ocm/mocks/ocmWrapperMock.go b/pkg/ocm/mocks/ocmWrapperMock.go index a2aed734..31d998d1 100644 --- a/pkg/ocm/mocks/ocmWrapperMock.go +++ b/pkg/ocm/mocks/ocmWrapperMock.go @@ -12,9 +12,9 @@ package mocks import ( reflect "reflect" + v1 "github.com/openshift-online/ocm-api-model/clientapi/accesstransparency/v1" + v10 "github.com/openshift-online/ocm-api-model/clientapi/clustersmgmt/v1" sdk "github.com/openshift-online/ocm-sdk-go" - v1 "github.com/openshift-online/ocm-sdk-go/accesstransparency/v1" - v10 "github.com/openshift-online/ocm-sdk-go/clustersmgmt/v1" gomock "go.uber.org/mock/gomock" ) @@ -180,18 +180,18 @@ func (mr *MockOCMInterfaceMockRecorder) GetOCMEnvironment() *gomock.Call { } // GetOCMEnvironmentWithConn mocks base method. -func (m *MockOCMInterface) GetOCMEnvironmentWithConn(arg0 *sdk.Connection) (*v10.Environment, error) { +func (m *MockOCMInterface) GetOCMEnvironmentWithConn(connection *sdk.Connection) (*v10.Environment, error) { m.ctrl.T.Helper() - ret := m.ctrl.Call(m, "GetOCMEnvironmentWithConn") + ret := m.ctrl.Call(m, "GetOCMEnvironmentWithConn", connection) ret0, _ := ret[0].(*v10.Environment) ret1, _ := ret[1].(error) return ret0, ret1 } // GetOCMEnvironmentWithConn indicates an expected call of GetOCMEnvironmentWithConn. -func (mr *MockOCMInterfaceMockRecorder) GetOCMEnvironmentWithConn(arg0 *sdk.Connection) *gomock.Call { +func (mr *MockOCMInterfaceMockRecorder) GetOCMEnvironmentWithConn(connection any) *gomock.Call { mr.mock.ctrl.T.Helper() - return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOCMEnvironmentWithConn", reflect.TypeOf((*MockOCMInterface)(nil).GetOCMEnvironment)) + return mr.mock.ctrl.RecordCallWithMethodType(mr.mock, "GetOCMEnvironmentWithConn", reflect.TypeOf((*MockOCMInterface)(nil).GetOCMEnvironmentWithConn), connection) } // GetPullSecret mocks base method. diff --git a/pkg/remediation/remediation.go b/pkg/remediation/remediation.go index 5d1916d1..85a22325 100644 --- a/pkg/remediation/remediation.go +++ b/pkg/remediation/remediation.go @@ -18,13 +18,13 @@ import ( // DoCreateRemediation creates a remediation instance for a cluster using the Backplane API. // It sends a request to create a remediation and returns the proxy URI and remediation instance ID. // The function takes API endpoint, cluster ID, access token, and remediation name as parameters. -func DoCreateRemediation(api string, clusterID string, accessToken string, remediationName string) (proxyURI string, remediationInstanceID string, err error) { +func DoCreateRemediation(api string, clusterID string, accessToken string, createRemediationParams *BackplaneApi.CreateRemediationParams) (proxyURI string, remediationInstanceID string, err error) { client, err := backplaneapi.DefaultClientUtils.MakeRawBackplaneAPIClientWithAccessToken(api, accessToken) if err != nil { return "", "", fmt.Errorf("unable to create backplane api client") } - resp, err := client.CreateRemediation(context.TODO(), clusterID, &BackplaneApi.CreateRemediationParams{RemediationName: remediationName}) + resp, err := client.CreateRemediation(context.TODO(), clusterID, createRemediationParams) if err != nil { return "", "", err } @@ -44,13 +44,13 @@ func DoCreateRemediation(api string, clusterID string, accessToken string, remed // CreateRemediationWithConn creates a remediation instance and returns a configured Kubernetes client. // This function can be used to programmatically interact with the Backplane API. // It creates a rest.Config that can be used with Kubernetes client libraries. -func CreateRemediationWithConn(bp config.BackplaneConfiguration, ocmConnection *ocmsdk.Connection, clusterID string, remediationName string) (config *rest.Config, remediationInstanceID string, err error) { +func CreateRemediationWithConn(bp config.BackplaneConfiguration, ocmConnection *ocmsdk.Connection, clusterID string, createRemediationParams *BackplaneApi.CreateRemediationParams) (config *rest.Config, remediationInstanceID string, err error) { accessToken, err := ocm.DefaultOCMInterface.GetOCMAccessTokenWithConn(ocmConnection) if err != nil { return nil, "", err } - bpAPIClusterURL, remediationInstanceID, err := DoCreateRemediation(bp.URL, clusterID, *accessToken, remediationName) + bpAPIClusterURL, remediationInstanceID, err := DoCreateRemediation(bp.URL, clusterID, *accessToken, createRemediationParams) if err != nil { return nil, "", err }