From abc63d5351af88bef8ff9781906588cc4c871e4a Mon Sep 17 00:00:00 2001 From: Wojciech Trocki Date: Fri, 4 Feb 2022 13:17:37 +0000 Subject: [PATCH] Connectors patch (#359) * fix: add generate script to match other sdks * fix: reorder patch requests for connectors --- .openapi/connector_mgmt.yaml | 11 +- connectormgmt/apiv1/client/api/openapi.yaml | 10 +- connectormgmt/apiv1/client/api_connectors.go | 14 +- .../client/connector_clusters_api_mock.go | 572 ++++++++++++++++++ .../client/connector_service_api_mock.go | 118 ++++ .../apiv1/client/connector_types_api_mock.go | 210 +++++++ .../apiv1/client/connectors_api_mock.go | 480 +++++++++++++++ .../apiv1/client/docs/ConnectorsApi.md | 10 +- scripts/generate.sh | 5 + 9 files changed, 1406 insertions(+), 24 deletions(-) create mode 100644 connectormgmt/apiv1/client/connector_clusters_api_mock.go create mode 100644 connectormgmt/apiv1/client/connector_service_api_mock.go create mode 100644 connectormgmt/apiv1/client/connector_types_api_mock.go create mode 100644 connectormgmt/apiv1/client/connectors_api_mock.go create mode 100755 scripts/generate.sh diff --git a/.openapi/connector_mgmt.yaml b/.openapi/connector_mgmt.yaml index 9b3cf3a7..bb326b07 100644 --- a/.openapi/connector_mgmt.yaml +++ b/.openapi/connector_mgmt.yaml @@ -351,18 +351,17 @@ paths: requestBody: description: Data to patch the connector with content: - application/json: - schema: - anyOf: - - $ref: "#/components/schemas/ConnectorRequest" - - type: object application/merge-patch+json: schema: - $ref: "#/components/schemas/ConnectorRequest" + type: object application/json-patch+json: schema: description: A JSON Patch, RFC 6902 - https://tools.ietf.org/html/rfc6902 type: object + application/json: + schema: + $ref: "#/components/schemas/ConnectorRequest" + required: true responses: "202": diff --git a/connectormgmt/apiv1/client/api/openapi.yaml b/connectormgmt/apiv1/client/api/openapi.yaml index acfa7bf1..6daaf4b0 100644 --- a/connectormgmt/apiv1/client/api/openapi.yaml +++ b/connectormgmt/apiv1/client/api/openapi.yaml @@ -452,18 +452,16 @@ paths: style: simple requestBody: content: - application/json: - schema: - anyOf: - - $ref: '#/components/schemas/ConnectorRequest' - - type: object application/merge-patch+json: schema: - $ref: '#/components/schemas/ConnectorRequest' + type: object application/json-patch+json: schema: description: A JSON Patch, RFC 6902 - https://tools.ietf.org/html/rfc6902 type: object + application/json: + schema: + $ref: '#/components/schemas/ConnectorRequest' description: Data to patch the connector with required: true responses: diff --git a/connectormgmt/apiv1/client/api_connectors.go b/connectormgmt/apiv1/client/api_connectors.go index ea0f319a..6944addd 100644 --- a/connectormgmt/apiv1/client/api_connectors.go +++ b/connectormgmt/apiv1/client/api_connectors.go @@ -674,11 +674,11 @@ type ApiPatchConnectorRequest struct { ctx _context.Context ApiService ConnectorsApi id string - uNKNOWNBASETYPE *UNKNOWN_BASE_TYPE + body *map[string]interface{} } -func (r ApiPatchConnectorRequest) UNKNOWNBASETYPE(uNKNOWNBASETYPE UNKNOWN_BASE_TYPE) ApiPatchConnectorRequest { - r.uNKNOWNBASETYPE = &uNKNOWNBASETYPE +func (r ApiPatchConnectorRequest) Body(body map[string]interface{}) ApiPatchConnectorRequest { + r.body = &body return r } @@ -726,12 +726,12 @@ func (a *ConnectorsApiService) PatchConnectorExecute(r ApiPatchConnectorRequest) localVarHeaderParams := make(map[string]string) localVarQueryParams := _neturl.Values{} localVarFormParams := _neturl.Values{} - if r.uNKNOWNBASETYPE == nil { - return localVarReturnValue, nil, reportError("uNKNOWNBASETYPE is required and must be specified") + if r.body == nil { + return localVarReturnValue, nil, reportError("body is required and must be specified") } // to determine the Content-Type header - localVarHTTPContentTypes := []string{"application/json", "application/merge-patch+json", "application/json-patch+json"} + localVarHTTPContentTypes := []string{"application/merge-patch+json", "application/json-patch+json", "application/json"} // set Content-Type header localVarHTTPContentType := selectHeaderContentType(localVarHTTPContentTypes) @@ -748,7 +748,7 @@ func (a *ConnectorsApiService) PatchConnectorExecute(r ApiPatchConnectorRequest) localVarHeaderParams["Accept"] = localVarHTTPHeaderAccept } // body params - localVarPostBody = r.uNKNOWNBASETYPE + localVarPostBody = r.body req, err := a.client.prepareRequest(r.ctx, localVarPath, localVarHTTPMethod, localVarPostBody, localVarHeaderParams, localVarQueryParams, localVarFormParams, localVarFormFileName, localVarFileName, localVarFileBytes) if err != nil { return localVarReturnValue, nil, err diff --git a/connectormgmt/apiv1/client/connector_clusters_api_mock.go b/connectormgmt/apiv1/client/connector_clusters_api_mock.go new file mode 100644 index 00000000..f4e5c414 --- /dev/null +++ b/connectormgmt/apiv1/client/connector_clusters_api_mock.go @@ -0,0 +1,572 @@ +// Code generated by moq; DO NOT EDIT. +// github.com/matryer/moq + +package connectormgmtclient + +import ( + _context "context" + _nethttp "net/http" + "sync" +) + +// Ensure, that ConnectorClustersApiMock does implement ConnectorClustersApi. +// If this is not the case, regenerate this file with moq. +var _ ConnectorClustersApi = &ConnectorClustersApiMock{} + +// ConnectorClustersApiMock is a mock implementation of ConnectorClustersApi. +// +// func TestSomethingThatUsesConnectorClustersApi(t *testing.T) { +// +// // make and configure a mocked ConnectorClustersApi +// mockedConnectorClustersApi := &ConnectorClustersApiMock{ +// CreateConnectorClusterFunc: func(ctx _context.Context) ApiCreateConnectorClusterRequest { +// panic("mock out the CreateConnectorCluster method") +// }, +// CreateConnectorClusterExecuteFunc: func(r ApiCreateConnectorClusterRequest) (ConnectorCluster, *_nethttp.Response, error) { +// panic("mock out the CreateConnectorClusterExecute method") +// }, +// DeleteConnectorClusterFunc: func(ctx _context.Context, connectorClusterId string) ApiDeleteConnectorClusterRequest { +// panic("mock out the DeleteConnectorCluster method") +// }, +// DeleteConnectorClusterExecuteFunc: func(r ApiDeleteConnectorClusterRequest) (Error, *_nethttp.Response, error) { +// panic("mock out the DeleteConnectorClusterExecute method") +// }, +// GetConnectorClusterFunc: func(ctx _context.Context, connectorClusterId string) ApiGetConnectorClusterRequest { +// panic("mock out the GetConnectorCluster method") +// }, +// GetConnectorClusterAddonParametersFunc: func(ctx _context.Context, connectorClusterId string) ApiGetConnectorClusterAddonParametersRequest { +// panic("mock out the GetConnectorClusterAddonParameters method") +// }, +// GetConnectorClusterAddonParametersExecuteFunc: func(r ApiGetConnectorClusterAddonParametersRequest) ([]AddonParameter, *_nethttp.Response, error) { +// panic("mock out the GetConnectorClusterAddonParametersExecute method") +// }, +// GetConnectorClusterExecuteFunc: func(r ApiGetConnectorClusterRequest) (ConnectorCluster, *_nethttp.Response, error) { +// panic("mock out the GetConnectorClusterExecute method") +// }, +// ListConnectorClustersFunc: func(ctx _context.Context) ApiListConnectorClustersRequest { +// panic("mock out the ListConnectorClusters method") +// }, +// ListConnectorClustersExecuteFunc: func(r ApiListConnectorClustersRequest) (ConnectorClusterList, *_nethttp.Response, error) { +// panic("mock out the ListConnectorClustersExecute method") +// }, +// UpdateConnectorClusterByIdFunc: func(ctx _context.Context, connectorClusterId string) ApiUpdateConnectorClusterByIdRequest { +// panic("mock out the UpdateConnectorClusterById method") +// }, +// UpdateConnectorClusterByIdExecuteFunc: func(r ApiUpdateConnectorClusterByIdRequest) (*_nethttp.Response, error) { +// panic("mock out the UpdateConnectorClusterByIdExecute method") +// }, +// } +// +// // use mockedConnectorClustersApi in code that requires ConnectorClustersApi +// // and then make assertions. +// +// } +type ConnectorClustersApiMock struct { + // CreateConnectorClusterFunc mocks the CreateConnectorCluster method. + CreateConnectorClusterFunc func(ctx _context.Context) ApiCreateConnectorClusterRequest + + // CreateConnectorClusterExecuteFunc mocks the CreateConnectorClusterExecute method. + CreateConnectorClusterExecuteFunc func(r ApiCreateConnectorClusterRequest) (ConnectorCluster, *_nethttp.Response, error) + + // DeleteConnectorClusterFunc mocks the DeleteConnectorCluster method. + DeleteConnectorClusterFunc func(ctx _context.Context, connectorClusterId string) ApiDeleteConnectorClusterRequest + + // DeleteConnectorClusterExecuteFunc mocks the DeleteConnectorClusterExecute method. + DeleteConnectorClusterExecuteFunc func(r ApiDeleteConnectorClusterRequest) (Error, *_nethttp.Response, error) + + // GetConnectorClusterFunc mocks the GetConnectorCluster method. + GetConnectorClusterFunc func(ctx _context.Context, connectorClusterId string) ApiGetConnectorClusterRequest + + // GetConnectorClusterAddonParametersFunc mocks the GetConnectorClusterAddonParameters method. + GetConnectorClusterAddonParametersFunc func(ctx _context.Context, connectorClusterId string) ApiGetConnectorClusterAddonParametersRequest + + // GetConnectorClusterAddonParametersExecuteFunc mocks the GetConnectorClusterAddonParametersExecute method. + GetConnectorClusterAddonParametersExecuteFunc func(r ApiGetConnectorClusterAddonParametersRequest) ([]AddonParameter, *_nethttp.Response, error) + + // GetConnectorClusterExecuteFunc mocks the GetConnectorClusterExecute method. + GetConnectorClusterExecuteFunc func(r ApiGetConnectorClusterRequest) (ConnectorCluster, *_nethttp.Response, error) + + // ListConnectorClustersFunc mocks the ListConnectorClusters method. + ListConnectorClustersFunc func(ctx _context.Context) ApiListConnectorClustersRequest + + // ListConnectorClustersExecuteFunc mocks the ListConnectorClustersExecute method. + ListConnectorClustersExecuteFunc func(r ApiListConnectorClustersRequest) (ConnectorClusterList, *_nethttp.Response, error) + + // UpdateConnectorClusterByIdFunc mocks the UpdateConnectorClusterById method. + UpdateConnectorClusterByIdFunc func(ctx _context.Context, connectorClusterId string) ApiUpdateConnectorClusterByIdRequest + + // UpdateConnectorClusterByIdExecuteFunc mocks the UpdateConnectorClusterByIdExecute method. + UpdateConnectorClusterByIdExecuteFunc func(r ApiUpdateConnectorClusterByIdRequest) (*_nethttp.Response, error) + + // calls tracks calls to the methods. + calls struct { + // CreateConnectorCluster holds details about calls to the CreateConnectorCluster method. + CreateConnectorCluster []struct { + // Ctx is the ctx argument value. + Ctx _context.Context + } + // CreateConnectorClusterExecute holds details about calls to the CreateConnectorClusterExecute method. + CreateConnectorClusterExecute []struct { + // R is the r argument value. + R ApiCreateConnectorClusterRequest + } + // DeleteConnectorCluster holds details about calls to the DeleteConnectorCluster method. + DeleteConnectorCluster []struct { + // Ctx is the ctx argument value. + Ctx _context.Context + // ConnectorClusterId is the connectorClusterId argument value. + ConnectorClusterId string + } + // DeleteConnectorClusterExecute holds details about calls to the DeleteConnectorClusterExecute method. + DeleteConnectorClusterExecute []struct { + // R is the r argument value. + R ApiDeleteConnectorClusterRequest + } + // GetConnectorCluster holds details about calls to the GetConnectorCluster method. + GetConnectorCluster []struct { + // Ctx is the ctx argument value. + Ctx _context.Context + // ConnectorClusterId is the connectorClusterId argument value. + ConnectorClusterId string + } + // GetConnectorClusterAddonParameters holds details about calls to the GetConnectorClusterAddonParameters method. + GetConnectorClusterAddonParameters []struct { + // Ctx is the ctx argument value. + Ctx _context.Context + // ConnectorClusterId is the connectorClusterId argument value. + ConnectorClusterId string + } + // GetConnectorClusterAddonParametersExecute holds details about calls to the GetConnectorClusterAddonParametersExecute method. + GetConnectorClusterAddonParametersExecute []struct { + // R is the r argument value. + R ApiGetConnectorClusterAddonParametersRequest + } + // GetConnectorClusterExecute holds details about calls to the GetConnectorClusterExecute method. + GetConnectorClusterExecute []struct { + // R is the r argument value. + R ApiGetConnectorClusterRequest + } + // ListConnectorClusters holds details about calls to the ListConnectorClusters method. + ListConnectorClusters []struct { + // Ctx is the ctx argument value. + Ctx _context.Context + } + // ListConnectorClustersExecute holds details about calls to the ListConnectorClustersExecute method. + ListConnectorClustersExecute []struct { + // R is the r argument value. + R ApiListConnectorClustersRequest + } + // UpdateConnectorClusterById holds details about calls to the UpdateConnectorClusterById method. + UpdateConnectorClusterById []struct { + // Ctx is the ctx argument value. + Ctx _context.Context + // ConnectorClusterId is the connectorClusterId argument value. + ConnectorClusterId string + } + // UpdateConnectorClusterByIdExecute holds details about calls to the UpdateConnectorClusterByIdExecute method. + UpdateConnectorClusterByIdExecute []struct { + // R is the r argument value. + R ApiUpdateConnectorClusterByIdRequest + } + } + lockCreateConnectorCluster sync.RWMutex + lockCreateConnectorClusterExecute sync.RWMutex + lockDeleteConnectorCluster sync.RWMutex + lockDeleteConnectorClusterExecute sync.RWMutex + lockGetConnectorCluster sync.RWMutex + lockGetConnectorClusterAddonParameters sync.RWMutex + lockGetConnectorClusterAddonParametersExecute sync.RWMutex + lockGetConnectorClusterExecute sync.RWMutex + lockListConnectorClusters sync.RWMutex + lockListConnectorClustersExecute sync.RWMutex + lockUpdateConnectorClusterById sync.RWMutex + lockUpdateConnectorClusterByIdExecute sync.RWMutex +} + +// CreateConnectorCluster calls CreateConnectorClusterFunc. +func (mock *ConnectorClustersApiMock) CreateConnectorCluster(ctx _context.Context) ApiCreateConnectorClusterRequest { + if mock.CreateConnectorClusterFunc == nil { + panic("ConnectorClustersApiMock.CreateConnectorClusterFunc: method is nil but ConnectorClustersApi.CreateConnectorCluster was just called") + } + callInfo := struct { + Ctx _context.Context + }{ + Ctx: ctx, + } + mock.lockCreateConnectorCluster.Lock() + mock.calls.CreateConnectorCluster = append(mock.calls.CreateConnectorCluster, callInfo) + mock.lockCreateConnectorCluster.Unlock() + return mock.CreateConnectorClusterFunc(ctx) +} + +// CreateConnectorClusterCalls gets all the calls that were made to CreateConnectorCluster. +// Check the length with: +// len(mockedConnectorClustersApi.CreateConnectorClusterCalls()) +func (mock *ConnectorClustersApiMock) CreateConnectorClusterCalls() []struct { + Ctx _context.Context +} { + var calls []struct { + Ctx _context.Context + } + mock.lockCreateConnectorCluster.RLock() + calls = mock.calls.CreateConnectorCluster + mock.lockCreateConnectorCluster.RUnlock() + return calls +} + +// CreateConnectorClusterExecute calls CreateConnectorClusterExecuteFunc. +func (mock *ConnectorClustersApiMock) CreateConnectorClusterExecute(r ApiCreateConnectorClusterRequest) (ConnectorCluster, *_nethttp.Response, error) { + if mock.CreateConnectorClusterExecuteFunc == nil { + panic("ConnectorClustersApiMock.CreateConnectorClusterExecuteFunc: method is nil but ConnectorClustersApi.CreateConnectorClusterExecute was just called") + } + callInfo := struct { + R ApiCreateConnectorClusterRequest + }{ + R: r, + } + mock.lockCreateConnectorClusterExecute.Lock() + mock.calls.CreateConnectorClusterExecute = append(mock.calls.CreateConnectorClusterExecute, callInfo) + mock.lockCreateConnectorClusterExecute.Unlock() + return mock.CreateConnectorClusterExecuteFunc(r) +} + +// CreateConnectorClusterExecuteCalls gets all the calls that were made to CreateConnectorClusterExecute. +// Check the length with: +// len(mockedConnectorClustersApi.CreateConnectorClusterExecuteCalls()) +func (mock *ConnectorClustersApiMock) CreateConnectorClusterExecuteCalls() []struct { + R ApiCreateConnectorClusterRequest +} { + var calls []struct { + R ApiCreateConnectorClusterRequest + } + mock.lockCreateConnectorClusterExecute.RLock() + calls = mock.calls.CreateConnectorClusterExecute + mock.lockCreateConnectorClusterExecute.RUnlock() + return calls +} + +// DeleteConnectorCluster calls DeleteConnectorClusterFunc. +func (mock *ConnectorClustersApiMock) DeleteConnectorCluster(ctx _context.Context, connectorClusterId string) ApiDeleteConnectorClusterRequest { + if mock.DeleteConnectorClusterFunc == nil { + panic("ConnectorClustersApiMock.DeleteConnectorClusterFunc: method is nil but ConnectorClustersApi.DeleteConnectorCluster was just called") + } + callInfo := struct { + Ctx _context.Context + ConnectorClusterId string + }{ + Ctx: ctx, + ConnectorClusterId: connectorClusterId, + } + mock.lockDeleteConnectorCluster.Lock() + mock.calls.DeleteConnectorCluster = append(mock.calls.DeleteConnectorCluster, callInfo) + mock.lockDeleteConnectorCluster.Unlock() + return mock.DeleteConnectorClusterFunc(ctx, connectorClusterId) +} + +// DeleteConnectorClusterCalls gets all the calls that were made to DeleteConnectorCluster. +// Check the length with: +// len(mockedConnectorClustersApi.DeleteConnectorClusterCalls()) +func (mock *ConnectorClustersApiMock) DeleteConnectorClusterCalls() []struct { + Ctx _context.Context + ConnectorClusterId string +} { + var calls []struct { + Ctx _context.Context + ConnectorClusterId string + } + mock.lockDeleteConnectorCluster.RLock() + calls = mock.calls.DeleteConnectorCluster + mock.lockDeleteConnectorCluster.RUnlock() + return calls +} + +// DeleteConnectorClusterExecute calls DeleteConnectorClusterExecuteFunc. +func (mock *ConnectorClustersApiMock) DeleteConnectorClusterExecute(r ApiDeleteConnectorClusterRequest) (Error, *_nethttp.Response, error) { + if mock.DeleteConnectorClusterExecuteFunc == nil { + panic("ConnectorClustersApiMock.DeleteConnectorClusterExecuteFunc: method is nil but ConnectorClustersApi.DeleteConnectorClusterExecute was just called") + } + callInfo := struct { + R ApiDeleteConnectorClusterRequest + }{ + R: r, + } + mock.lockDeleteConnectorClusterExecute.Lock() + mock.calls.DeleteConnectorClusterExecute = append(mock.calls.DeleteConnectorClusterExecute, callInfo) + mock.lockDeleteConnectorClusterExecute.Unlock() + return mock.DeleteConnectorClusterExecuteFunc(r) +} + +// DeleteConnectorClusterExecuteCalls gets all the calls that were made to DeleteConnectorClusterExecute. +// Check the length with: +// len(mockedConnectorClustersApi.DeleteConnectorClusterExecuteCalls()) +func (mock *ConnectorClustersApiMock) DeleteConnectorClusterExecuteCalls() []struct { + R ApiDeleteConnectorClusterRequest +} { + var calls []struct { + R ApiDeleteConnectorClusterRequest + } + mock.lockDeleteConnectorClusterExecute.RLock() + calls = mock.calls.DeleteConnectorClusterExecute + mock.lockDeleteConnectorClusterExecute.RUnlock() + return calls +} + +// GetConnectorCluster calls GetConnectorClusterFunc. +func (mock *ConnectorClustersApiMock) GetConnectorCluster(ctx _context.Context, connectorClusterId string) ApiGetConnectorClusterRequest { + if mock.GetConnectorClusterFunc == nil { + panic("ConnectorClustersApiMock.GetConnectorClusterFunc: method is nil but ConnectorClustersApi.GetConnectorCluster was just called") + } + callInfo := struct { + Ctx _context.Context + ConnectorClusterId string + }{ + Ctx: ctx, + ConnectorClusterId: connectorClusterId, + } + mock.lockGetConnectorCluster.Lock() + mock.calls.GetConnectorCluster = append(mock.calls.GetConnectorCluster, callInfo) + mock.lockGetConnectorCluster.Unlock() + return mock.GetConnectorClusterFunc(ctx, connectorClusterId) +} + +// GetConnectorClusterCalls gets all the calls that were made to GetConnectorCluster. +// Check the length with: +// len(mockedConnectorClustersApi.GetConnectorClusterCalls()) +func (mock *ConnectorClustersApiMock) GetConnectorClusterCalls() []struct { + Ctx _context.Context + ConnectorClusterId string +} { + var calls []struct { + Ctx _context.Context + ConnectorClusterId string + } + mock.lockGetConnectorCluster.RLock() + calls = mock.calls.GetConnectorCluster + mock.lockGetConnectorCluster.RUnlock() + return calls +} + +// GetConnectorClusterAddonParameters calls GetConnectorClusterAddonParametersFunc. +func (mock *ConnectorClustersApiMock) GetConnectorClusterAddonParameters(ctx _context.Context, connectorClusterId string) ApiGetConnectorClusterAddonParametersRequest { + if mock.GetConnectorClusterAddonParametersFunc == nil { + panic("ConnectorClustersApiMock.GetConnectorClusterAddonParametersFunc: method is nil but ConnectorClustersApi.GetConnectorClusterAddonParameters was just called") + } + callInfo := struct { + Ctx _context.Context + ConnectorClusterId string + }{ + Ctx: ctx, + ConnectorClusterId: connectorClusterId, + } + mock.lockGetConnectorClusterAddonParameters.Lock() + mock.calls.GetConnectorClusterAddonParameters = append(mock.calls.GetConnectorClusterAddonParameters, callInfo) + mock.lockGetConnectorClusterAddonParameters.Unlock() + return mock.GetConnectorClusterAddonParametersFunc(ctx, connectorClusterId) +} + +// GetConnectorClusterAddonParametersCalls gets all the calls that were made to GetConnectorClusterAddonParameters. +// Check the length with: +// len(mockedConnectorClustersApi.GetConnectorClusterAddonParametersCalls()) +func (mock *ConnectorClustersApiMock) GetConnectorClusterAddonParametersCalls() []struct { + Ctx _context.Context + ConnectorClusterId string +} { + var calls []struct { + Ctx _context.Context + ConnectorClusterId string + } + mock.lockGetConnectorClusterAddonParameters.RLock() + calls = mock.calls.GetConnectorClusterAddonParameters + mock.lockGetConnectorClusterAddonParameters.RUnlock() + return calls +} + +// GetConnectorClusterAddonParametersExecute calls GetConnectorClusterAddonParametersExecuteFunc. +func (mock *ConnectorClustersApiMock) GetConnectorClusterAddonParametersExecute(r ApiGetConnectorClusterAddonParametersRequest) ([]AddonParameter, *_nethttp.Response, error) { + if mock.GetConnectorClusterAddonParametersExecuteFunc == nil { + panic("ConnectorClustersApiMock.GetConnectorClusterAddonParametersExecuteFunc: method is nil but ConnectorClustersApi.GetConnectorClusterAddonParametersExecute was just called") + } + callInfo := struct { + R ApiGetConnectorClusterAddonParametersRequest + }{ + R: r, + } + mock.lockGetConnectorClusterAddonParametersExecute.Lock() + mock.calls.GetConnectorClusterAddonParametersExecute = append(mock.calls.GetConnectorClusterAddonParametersExecute, callInfo) + mock.lockGetConnectorClusterAddonParametersExecute.Unlock() + return mock.GetConnectorClusterAddonParametersExecuteFunc(r) +} + +// GetConnectorClusterAddonParametersExecuteCalls gets all the calls that were made to GetConnectorClusterAddonParametersExecute. +// Check the length with: +// len(mockedConnectorClustersApi.GetConnectorClusterAddonParametersExecuteCalls()) +func (mock *ConnectorClustersApiMock) GetConnectorClusterAddonParametersExecuteCalls() []struct { + R ApiGetConnectorClusterAddonParametersRequest +} { + var calls []struct { + R ApiGetConnectorClusterAddonParametersRequest + } + mock.lockGetConnectorClusterAddonParametersExecute.RLock() + calls = mock.calls.GetConnectorClusterAddonParametersExecute + mock.lockGetConnectorClusterAddonParametersExecute.RUnlock() + return calls +} + +// GetConnectorClusterExecute calls GetConnectorClusterExecuteFunc. +func (mock *ConnectorClustersApiMock) GetConnectorClusterExecute(r ApiGetConnectorClusterRequest) (ConnectorCluster, *_nethttp.Response, error) { + if mock.GetConnectorClusterExecuteFunc == nil { + panic("ConnectorClustersApiMock.GetConnectorClusterExecuteFunc: method is nil but ConnectorClustersApi.GetConnectorClusterExecute was just called") + } + callInfo := struct { + R ApiGetConnectorClusterRequest + }{ + R: r, + } + mock.lockGetConnectorClusterExecute.Lock() + mock.calls.GetConnectorClusterExecute = append(mock.calls.GetConnectorClusterExecute, callInfo) + mock.lockGetConnectorClusterExecute.Unlock() + return mock.GetConnectorClusterExecuteFunc(r) +} + +// GetConnectorClusterExecuteCalls gets all the calls that were made to GetConnectorClusterExecute. +// Check the length with: +// len(mockedConnectorClustersApi.GetConnectorClusterExecuteCalls()) +func (mock *ConnectorClustersApiMock) GetConnectorClusterExecuteCalls() []struct { + R ApiGetConnectorClusterRequest +} { + var calls []struct { + R ApiGetConnectorClusterRequest + } + mock.lockGetConnectorClusterExecute.RLock() + calls = mock.calls.GetConnectorClusterExecute + mock.lockGetConnectorClusterExecute.RUnlock() + return calls +} + +// ListConnectorClusters calls ListConnectorClustersFunc. +func (mock *ConnectorClustersApiMock) ListConnectorClusters(ctx _context.Context) ApiListConnectorClustersRequest { + if mock.ListConnectorClustersFunc == nil { + panic("ConnectorClustersApiMock.ListConnectorClustersFunc: method is nil but ConnectorClustersApi.ListConnectorClusters was just called") + } + callInfo := struct { + Ctx _context.Context + }{ + Ctx: ctx, + } + mock.lockListConnectorClusters.Lock() + mock.calls.ListConnectorClusters = append(mock.calls.ListConnectorClusters, callInfo) + mock.lockListConnectorClusters.Unlock() + return mock.ListConnectorClustersFunc(ctx) +} + +// ListConnectorClustersCalls gets all the calls that were made to ListConnectorClusters. +// Check the length with: +// len(mockedConnectorClustersApi.ListConnectorClustersCalls()) +func (mock *ConnectorClustersApiMock) ListConnectorClustersCalls() []struct { + Ctx _context.Context +} { + var calls []struct { + Ctx _context.Context + } + mock.lockListConnectorClusters.RLock() + calls = mock.calls.ListConnectorClusters + mock.lockListConnectorClusters.RUnlock() + return calls +} + +// ListConnectorClustersExecute calls ListConnectorClustersExecuteFunc. +func (mock *ConnectorClustersApiMock) ListConnectorClustersExecute(r ApiListConnectorClustersRequest) (ConnectorClusterList, *_nethttp.Response, error) { + if mock.ListConnectorClustersExecuteFunc == nil { + panic("ConnectorClustersApiMock.ListConnectorClustersExecuteFunc: method is nil but ConnectorClustersApi.ListConnectorClustersExecute was just called") + } + callInfo := struct { + R ApiListConnectorClustersRequest + }{ + R: r, + } + mock.lockListConnectorClustersExecute.Lock() + mock.calls.ListConnectorClustersExecute = append(mock.calls.ListConnectorClustersExecute, callInfo) + mock.lockListConnectorClustersExecute.Unlock() + return mock.ListConnectorClustersExecuteFunc(r) +} + +// ListConnectorClustersExecuteCalls gets all the calls that were made to ListConnectorClustersExecute. +// Check the length with: +// len(mockedConnectorClustersApi.ListConnectorClustersExecuteCalls()) +func (mock *ConnectorClustersApiMock) ListConnectorClustersExecuteCalls() []struct { + R ApiListConnectorClustersRequest +} { + var calls []struct { + R ApiListConnectorClustersRequest + } + mock.lockListConnectorClustersExecute.RLock() + calls = mock.calls.ListConnectorClustersExecute + mock.lockListConnectorClustersExecute.RUnlock() + return calls +} + +// UpdateConnectorClusterById calls UpdateConnectorClusterByIdFunc. +func (mock *ConnectorClustersApiMock) UpdateConnectorClusterById(ctx _context.Context, connectorClusterId string) ApiUpdateConnectorClusterByIdRequest { + if mock.UpdateConnectorClusterByIdFunc == nil { + panic("ConnectorClustersApiMock.UpdateConnectorClusterByIdFunc: method is nil but ConnectorClustersApi.UpdateConnectorClusterById was just called") + } + callInfo := struct { + Ctx _context.Context + ConnectorClusterId string + }{ + Ctx: ctx, + ConnectorClusterId: connectorClusterId, + } + mock.lockUpdateConnectorClusterById.Lock() + mock.calls.UpdateConnectorClusterById = append(mock.calls.UpdateConnectorClusterById, callInfo) + mock.lockUpdateConnectorClusterById.Unlock() + return mock.UpdateConnectorClusterByIdFunc(ctx, connectorClusterId) +} + +// UpdateConnectorClusterByIdCalls gets all the calls that were made to UpdateConnectorClusterById. +// Check the length with: +// len(mockedConnectorClustersApi.UpdateConnectorClusterByIdCalls()) +func (mock *ConnectorClustersApiMock) UpdateConnectorClusterByIdCalls() []struct { + Ctx _context.Context + ConnectorClusterId string +} { + var calls []struct { + Ctx _context.Context + ConnectorClusterId string + } + mock.lockUpdateConnectorClusterById.RLock() + calls = mock.calls.UpdateConnectorClusterById + mock.lockUpdateConnectorClusterById.RUnlock() + return calls +} + +// UpdateConnectorClusterByIdExecute calls UpdateConnectorClusterByIdExecuteFunc. +func (mock *ConnectorClustersApiMock) UpdateConnectorClusterByIdExecute(r ApiUpdateConnectorClusterByIdRequest) (*_nethttp.Response, error) { + if mock.UpdateConnectorClusterByIdExecuteFunc == nil { + panic("ConnectorClustersApiMock.UpdateConnectorClusterByIdExecuteFunc: method is nil but ConnectorClustersApi.UpdateConnectorClusterByIdExecute was just called") + } + callInfo := struct { + R ApiUpdateConnectorClusterByIdRequest + }{ + R: r, + } + mock.lockUpdateConnectorClusterByIdExecute.Lock() + mock.calls.UpdateConnectorClusterByIdExecute = append(mock.calls.UpdateConnectorClusterByIdExecute, callInfo) + mock.lockUpdateConnectorClusterByIdExecute.Unlock() + return mock.UpdateConnectorClusterByIdExecuteFunc(r) +} + +// UpdateConnectorClusterByIdExecuteCalls gets all the calls that were made to UpdateConnectorClusterByIdExecute. +// Check the length with: +// len(mockedConnectorClustersApi.UpdateConnectorClusterByIdExecuteCalls()) +func (mock *ConnectorClustersApiMock) UpdateConnectorClusterByIdExecuteCalls() []struct { + R ApiUpdateConnectorClusterByIdRequest +} { + var calls []struct { + R ApiUpdateConnectorClusterByIdRequest + } + mock.lockUpdateConnectorClusterByIdExecute.RLock() + calls = mock.calls.UpdateConnectorClusterByIdExecute + mock.lockUpdateConnectorClusterByIdExecute.RUnlock() + return calls +} diff --git a/connectormgmt/apiv1/client/connector_service_api_mock.go b/connectormgmt/apiv1/client/connector_service_api_mock.go new file mode 100644 index 00000000..3fda764c --- /dev/null +++ b/connectormgmt/apiv1/client/connector_service_api_mock.go @@ -0,0 +1,118 @@ +// Code generated by moq; DO NOT EDIT. +// github.com/matryer/moq + +package connectormgmtclient + +import ( + _context "context" + _nethttp "net/http" + "sync" +) + +// Ensure, that ConnectorServiceApiMock does implement ConnectorServiceApi. +// If this is not the case, regenerate this file with moq. +var _ ConnectorServiceApi = &ConnectorServiceApiMock{} + +// ConnectorServiceApiMock is a mock implementation of ConnectorServiceApi. +// +// func TestSomethingThatUsesConnectorServiceApi(t *testing.T) { +// +// // make and configure a mocked ConnectorServiceApi +// mockedConnectorServiceApi := &ConnectorServiceApiMock{ +// GetVersionMetadataFunc: func(ctx _context.Context) ApiGetVersionMetadataRequest { +// panic("mock out the GetVersionMetadata method") +// }, +// GetVersionMetadataExecuteFunc: func(r ApiGetVersionMetadataRequest) (VersionMetadata, *_nethttp.Response, error) { +// panic("mock out the GetVersionMetadataExecute method") +// }, +// } +// +// // use mockedConnectorServiceApi in code that requires ConnectorServiceApi +// // and then make assertions. +// +// } +type ConnectorServiceApiMock struct { + // GetVersionMetadataFunc mocks the GetVersionMetadata method. + GetVersionMetadataFunc func(ctx _context.Context) ApiGetVersionMetadataRequest + + // GetVersionMetadataExecuteFunc mocks the GetVersionMetadataExecute method. + GetVersionMetadataExecuteFunc func(r ApiGetVersionMetadataRequest) (VersionMetadata, *_nethttp.Response, error) + + // calls tracks calls to the methods. + calls struct { + // GetVersionMetadata holds details about calls to the GetVersionMetadata method. + GetVersionMetadata []struct { + // Ctx is the ctx argument value. + Ctx _context.Context + } + // GetVersionMetadataExecute holds details about calls to the GetVersionMetadataExecute method. + GetVersionMetadataExecute []struct { + // R is the r argument value. + R ApiGetVersionMetadataRequest + } + } + lockGetVersionMetadata sync.RWMutex + lockGetVersionMetadataExecute sync.RWMutex +} + +// GetVersionMetadata calls GetVersionMetadataFunc. +func (mock *ConnectorServiceApiMock) GetVersionMetadata(ctx _context.Context) ApiGetVersionMetadataRequest { + if mock.GetVersionMetadataFunc == nil { + panic("ConnectorServiceApiMock.GetVersionMetadataFunc: method is nil but ConnectorServiceApi.GetVersionMetadata was just called") + } + callInfo := struct { + Ctx _context.Context + }{ + Ctx: ctx, + } + mock.lockGetVersionMetadata.Lock() + mock.calls.GetVersionMetadata = append(mock.calls.GetVersionMetadata, callInfo) + mock.lockGetVersionMetadata.Unlock() + return mock.GetVersionMetadataFunc(ctx) +} + +// GetVersionMetadataCalls gets all the calls that were made to GetVersionMetadata. +// Check the length with: +// len(mockedConnectorServiceApi.GetVersionMetadataCalls()) +func (mock *ConnectorServiceApiMock) GetVersionMetadataCalls() []struct { + Ctx _context.Context +} { + var calls []struct { + Ctx _context.Context + } + mock.lockGetVersionMetadata.RLock() + calls = mock.calls.GetVersionMetadata + mock.lockGetVersionMetadata.RUnlock() + return calls +} + +// GetVersionMetadataExecute calls GetVersionMetadataExecuteFunc. +func (mock *ConnectorServiceApiMock) GetVersionMetadataExecute(r ApiGetVersionMetadataRequest) (VersionMetadata, *_nethttp.Response, error) { + if mock.GetVersionMetadataExecuteFunc == nil { + panic("ConnectorServiceApiMock.GetVersionMetadataExecuteFunc: method is nil but ConnectorServiceApi.GetVersionMetadataExecute was just called") + } + callInfo := struct { + R ApiGetVersionMetadataRequest + }{ + R: r, + } + mock.lockGetVersionMetadataExecute.Lock() + mock.calls.GetVersionMetadataExecute = append(mock.calls.GetVersionMetadataExecute, callInfo) + mock.lockGetVersionMetadataExecute.Unlock() + return mock.GetVersionMetadataExecuteFunc(r) +} + +// GetVersionMetadataExecuteCalls gets all the calls that were made to GetVersionMetadataExecute. +// Check the length with: +// len(mockedConnectorServiceApi.GetVersionMetadataExecuteCalls()) +func (mock *ConnectorServiceApiMock) GetVersionMetadataExecuteCalls() []struct { + R ApiGetVersionMetadataRequest +} { + var calls []struct { + R ApiGetVersionMetadataRequest + } + mock.lockGetVersionMetadataExecute.RLock() + calls = mock.calls.GetVersionMetadataExecute + mock.lockGetVersionMetadataExecute.RUnlock() + return calls +} diff --git a/connectormgmt/apiv1/client/connector_types_api_mock.go b/connectormgmt/apiv1/client/connector_types_api_mock.go new file mode 100644 index 00000000..56df2ff8 --- /dev/null +++ b/connectormgmt/apiv1/client/connector_types_api_mock.go @@ -0,0 +1,210 @@ +// Code generated by moq; DO NOT EDIT. +// github.com/matryer/moq + +package connectormgmtclient + +import ( + _context "context" + _nethttp "net/http" + "sync" +) + +// Ensure, that ConnectorTypesApiMock does implement ConnectorTypesApi. +// If this is not the case, regenerate this file with moq. +var _ ConnectorTypesApi = &ConnectorTypesApiMock{} + +// ConnectorTypesApiMock is a mock implementation of ConnectorTypesApi. +// +// func TestSomethingThatUsesConnectorTypesApi(t *testing.T) { +// +// // make and configure a mocked ConnectorTypesApi +// mockedConnectorTypesApi := &ConnectorTypesApiMock{ +// GetConnectorTypeByIDFunc: func(ctx _context.Context, connectorTypeId string) ApiGetConnectorTypeByIDRequest { +// panic("mock out the GetConnectorTypeByID method") +// }, +// GetConnectorTypeByIDExecuteFunc: func(r ApiGetConnectorTypeByIDRequest) (ConnectorType, *_nethttp.Response, error) { +// panic("mock out the GetConnectorTypeByIDExecute method") +// }, +// GetConnectorTypesFunc: func(ctx _context.Context) ApiGetConnectorTypesRequest { +// panic("mock out the GetConnectorTypes method") +// }, +// GetConnectorTypesExecuteFunc: func(r ApiGetConnectorTypesRequest) (ConnectorTypeList, *_nethttp.Response, error) { +// panic("mock out the GetConnectorTypesExecute method") +// }, +// } +// +// // use mockedConnectorTypesApi in code that requires ConnectorTypesApi +// // and then make assertions. +// +// } +type ConnectorTypesApiMock struct { + // GetConnectorTypeByIDFunc mocks the GetConnectorTypeByID method. + GetConnectorTypeByIDFunc func(ctx _context.Context, connectorTypeId string) ApiGetConnectorTypeByIDRequest + + // GetConnectorTypeByIDExecuteFunc mocks the GetConnectorTypeByIDExecute method. + GetConnectorTypeByIDExecuteFunc func(r ApiGetConnectorTypeByIDRequest) (ConnectorType, *_nethttp.Response, error) + + // GetConnectorTypesFunc mocks the GetConnectorTypes method. + GetConnectorTypesFunc func(ctx _context.Context) ApiGetConnectorTypesRequest + + // GetConnectorTypesExecuteFunc mocks the GetConnectorTypesExecute method. + GetConnectorTypesExecuteFunc func(r ApiGetConnectorTypesRequest) (ConnectorTypeList, *_nethttp.Response, error) + + // calls tracks calls to the methods. + calls struct { + // GetConnectorTypeByID holds details about calls to the GetConnectorTypeByID method. + GetConnectorTypeByID []struct { + // Ctx is the ctx argument value. + Ctx _context.Context + // ConnectorTypeId is the connectorTypeId argument value. + ConnectorTypeId string + } + // GetConnectorTypeByIDExecute holds details about calls to the GetConnectorTypeByIDExecute method. + GetConnectorTypeByIDExecute []struct { + // R is the r argument value. + R ApiGetConnectorTypeByIDRequest + } + // GetConnectorTypes holds details about calls to the GetConnectorTypes method. + GetConnectorTypes []struct { + // Ctx is the ctx argument value. + Ctx _context.Context + } + // GetConnectorTypesExecute holds details about calls to the GetConnectorTypesExecute method. + GetConnectorTypesExecute []struct { + // R is the r argument value. + R ApiGetConnectorTypesRequest + } + } + lockGetConnectorTypeByID sync.RWMutex + lockGetConnectorTypeByIDExecute sync.RWMutex + lockGetConnectorTypes sync.RWMutex + lockGetConnectorTypesExecute sync.RWMutex +} + +// GetConnectorTypeByID calls GetConnectorTypeByIDFunc. +func (mock *ConnectorTypesApiMock) GetConnectorTypeByID(ctx _context.Context, connectorTypeId string) ApiGetConnectorTypeByIDRequest { + if mock.GetConnectorTypeByIDFunc == nil { + panic("ConnectorTypesApiMock.GetConnectorTypeByIDFunc: method is nil but ConnectorTypesApi.GetConnectorTypeByID was just called") + } + callInfo := struct { + Ctx _context.Context + ConnectorTypeId string + }{ + Ctx: ctx, + ConnectorTypeId: connectorTypeId, + } + mock.lockGetConnectorTypeByID.Lock() + mock.calls.GetConnectorTypeByID = append(mock.calls.GetConnectorTypeByID, callInfo) + mock.lockGetConnectorTypeByID.Unlock() + return mock.GetConnectorTypeByIDFunc(ctx, connectorTypeId) +} + +// GetConnectorTypeByIDCalls gets all the calls that were made to GetConnectorTypeByID. +// Check the length with: +// len(mockedConnectorTypesApi.GetConnectorTypeByIDCalls()) +func (mock *ConnectorTypesApiMock) GetConnectorTypeByIDCalls() []struct { + Ctx _context.Context + ConnectorTypeId string +} { + var calls []struct { + Ctx _context.Context + ConnectorTypeId string + } + mock.lockGetConnectorTypeByID.RLock() + calls = mock.calls.GetConnectorTypeByID + mock.lockGetConnectorTypeByID.RUnlock() + return calls +} + +// GetConnectorTypeByIDExecute calls GetConnectorTypeByIDExecuteFunc. +func (mock *ConnectorTypesApiMock) GetConnectorTypeByIDExecute(r ApiGetConnectorTypeByIDRequest) (ConnectorType, *_nethttp.Response, error) { + if mock.GetConnectorTypeByIDExecuteFunc == nil { + panic("ConnectorTypesApiMock.GetConnectorTypeByIDExecuteFunc: method is nil but ConnectorTypesApi.GetConnectorTypeByIDExecute was just called") + } + callInfo := struct { + R ApiGetConnectorTypeByIDRequest + }{ + R: r, + } + mock.lockGetConnectorTypeByIDExecute.Lock() + mock.calls.GetConnectorTypeByIDExecute = append(mock.calls.GetConnectorTypeByIDExecute, callInfo) + mock.lockGetConnectorTypeByIDExecute.Unlock() + return mock.GetConnectorTypeByIDExecuteFunc(r) +} + +// GetConnectorTypeByIDExecuteCalls gets all the calls that were made to GetConnectorTypeByIDExecute. +// Check the length with: +// len(mockedConnectorTypesApi.GetConnectorTypeByIDExecuteCalls()) +func (mock *ConnectorTypesApiMock) GetConnectorTypeByIDExecuteCalls() []struct { + R ApiGetConnectorTypeByIDRequest +} { + var calls []struct { + R ApiGetConnectorTypeByIDRequest + } + mock.lockGetConnectorTypeByIDExecute.RLock() + calls = mock.calls.GetConnectorTypeByIDExecute + mock.lockGetConnectorTypeByIDExecute.RUnlock() + return calls +} + +// GetConnectorTypes calls GetConnectorTypesFunc. +func (mock *ConnectorTypesApiMock) GetConnectorTypes(ctx _context.Context) ApiGetConnectorTypesRequest { + if mock.GetConnectorTypesFunc == nil { + panic("ConnectorTypesApiMock.GetConnectorTypesFunc: method is nil but ConnectorTypesApi.GetConnectorTypes was just called") + } + callInfo := struct { + Ctx _context.Context + }{ + Ctx: ctx, + } + mock.lockGetConnectorTypes.Lock() + mock.calls.GetConnectorTypes = append(mock.calls.GetConnectorTypes, callInfo) + mock.lockGetConnectorTypes.Unlock() + return mock.GetConnectorTypesFunc(ctx) +} + +// GetConnectorTypesCalls gets all the calls that were made to GetConnectorTypes. +// Check the length with: +// len(mockedConnectorTypesApi.GetConnectorTypesCalls()) +func (mock *ConnectorTypesApiMock) GetConnectorTypesCalls() []struct { + Ctx _context.Context +} { + var calls []struct { + Ctx _context.Context + } + mock.lockGetConnectorTypes.RLock() + calls = mock.calls.GetConnectorTypes + mock.lockGetConnectorTypes.RUnlock() + return calls +} + +// GetConnectorTypesExecute calls GetConnectorTypesExecuteFunc. +func (mock *ConnectorTypesApiMock) GetConnectorTypesExecute(r ApiGetConnectorTypesRequest) (ConnectorTypeList, *_nethttp.Response, error) { + if mock.GetConnectorTypesExecuteFunc == nil { + panic("ConnectorTypesApiMock.GetConnectorTypesExecuteFunc: method is nil but ConnectorTypesApi.GetConnectorTypesExecute was just called") + } + callInfo := struct { + R ApiGetConnectorTypesRequest + }{ + R: r, + } + mock.lockGetConnectorTypesExecute.Lock() + mock.calls.GetConnectorTypesExecute = append(mock.calls.GetConnectorTypesExecute, callInfo) + mock.lockGetConnectorTypesExecute.Unlock() + return mock.GetConnectorTypesExecuteFunc(r) +} + +// GetConnectorTypesExecuteCalls gets all the calls that were made to GetConnectorTypesExecute. +// Check the length with: +// len(mockedConnectorTypesApi.GetConnectorTypesExecuteCalls()) +func (mock *ConnectorTypesApiMock) GetConnectorTypesExecuteCalls() []struct { + R ApiGetConnectorTypesRequest +} { + var calls []struct { + R ApiGetConnectorTypesRequest + } + mock.lockGetConnectorTypesExecute.RLock() + calls = mock.calls.GetConnectorTypesExecute + mock.lockGetConnectorTypesExecute.RUnlock() + return calls +} diff --git a/connectormgmt/apiv1/client/connectors_api_mock.go b/connectormgmt/apiv1/client/connectors_api_mock.go new file mode 100644 index 00000000..0ac7496a --- /dev/null +++ b/connectormgmt/apiv1/client/connectors_api_mock.go @@ -0,0 +1,480 @@ +// Code generated by moq; DO NOT EDIT. +// github.com/matryer/moq + +package connectormgmtclient + +import ( + _context "context" + _nethttp "net/http" + "sync" +) + +// Ensure, that ConnectorsApiMock does implement ConnectorsApi. +// If this is not the case, regenerate this file with moq. +var _ ConnectorsApi = &ConnectorsApiMock{} + +// ConnectorsApiMock is a mock implementation of ConnectorsApi. +// +// func TestSomethingThatUsesConnectorsApi(t *testing.T) { +// +// // make and configure a mocked ConnectorsApi +// mockedConnectorsApi := &ConnectorsApiMock{ +// CreateConnectorFunc: func(ctx _context.Context) ApiCreateConnectorRequest { +// panic("mock out the CreateConnector method") +// }, +// CreateConnectorExecuteFunc: func(r ApiCreateConnectorRequest) (Connector, *_nethttp.Response, error) { +// panic("mock out the CreateConnectorExecute method") +// }, +// DeleteConnectorFunc: func(ctx _context.Context, id string) ApiDeleteConnectorRequest { +// panic("mock out the DeleteConnector method") +// }, +// DeleteConnectorExecuteFunc: func(r ApiDeleteConnectorRequest) (Error, *_nethttp.Response, error) { +// panic("mock out the DeleteConnectorExecute method") +// }, +// GetConnectorFunc: func(ctx _context.Context, id string) ApiGetConnectorRequest { +// panic("mock out the GetConnector method") +// }, +// GetConnectorExecuteFunc: func(r ApiGetConnectorRequest) (Connector, *_nethttp.Response, error) { +// panic("mock out the GetConnectorExecute method") +// }, +// ListConnectorsFunc: func(ctx _context.Context) ApiListConnectorsRequest { +// panic("mock out the ListConnectors method") +// }, +// ListConnectorsExecuteFunc: func(r ApiListConnectorsRequest) (ConnectorList, *_nethttp.Response, error) { +// panic("mock out the ListConnectorsExecute method") +// }, +// PatchConnectorFunc: func(ctx _context.Context, id string) ApiPatchConnectorRequest { +// panic("mock out the PatchConnector method") +// }, +// PatchConnectorExecuteFunc: func(r ApiPatchConnectorRequest) (Connector, *_nethttp.Response, error) { +// panic("mock out the PatchConnectorExecute method") +// }, +// } +// +// // use mockedConnectorsApi in code that requires ConnectorsApi +// // and then make assertions. +// +// } +type ConnectorsApiMock struct { + // CreateConnectorFunc mocks the CreateConnector method. + CreateConnectorFunc func(ctx _context.Context) ApiCreateConnectorRequest + + // CreateConnectorExecuteFunc mocks the CreateConnectorExecute method. + CreateConnectorExecuteFunc func(r ApiCreateConnectorRequest) (Connector, *_nethttp.Response, error) + + // DeleteConnectorFunc mocks the DeleteConnector method. + DeleteConnectorFunc func(ctx _context.Context, id string) ApiDeleteConnectorRequest + + // DeleteConnectorExecuteFunc mocks the DeleteConnectorExecute method. + DeleteConnectorExecuteFunc func(r ApiDeleteConnectorRequest) (Error, *_nethttp.Response, error) + + // GetConnectorFunc mocks the GetConnector method. + GetConnectorFunc func(ctx _context.Context, id string) ApiGetConnectorRequest + + // GetConnectorExecuteFunc mocks the GetConnectorExecute method. + GetConnectorExecuteFunc func(r ApiGetConnectorRequest) (Connector, *_nethttp.Response, error) + + // ListConnectorsFunc mocks the ListConnectors method. + ListConnectorsFunc func(ctx _context.Context) ApiListConnectorsRequest + + // ListConnectorsExecuteFunc mocks the ListConnectorsExecute method. + ListConnectorsExecuteFunc func(r ApiListConnectorsRequest) (ConnectorList, *_nethttp.Response, error) + + // PatchConnectorFunc mocks the PatchConnector method. + PatchConnectorFunc func(ctx _context.Context, id string) ApiPatchConnectorRequest + + // PatchConnectorExecuteFunc mocks the PatchConnectorExecute method. + PatchConnectorExecuteFunc func(r ApiPatchConnectorRequest) (Connector, *_nethttp.Response, error) + + // calls tracks calls to the methods. + calls struct { + // CreateConnector holds details about calls to the CreateConnector method. + CreateConnector []struct { + // Ctx is the ctx argument value. + Ctx _context.Context + } + // CreateConnectorExecute holds details about calls to the CreateConnectorExecute method. + CreateConnectorExecute []struct { + // R is the r argument value. + R ApiCreateConnectorRequest + } + // DeleteConnector holds details about calls to the DeleteConnector method. + DeleteConnector []struct { + // Ctx is the ctx argument value. + Ctx _context.Context + // ID is the id argument value. + ID string + } + // DeleteConnectorExecute holds details about calls to the DeleteConnectorExecute method. + DeleteConnectorExecute []struct { + // R is the r argument value. + R ApiDeleteConnectorRequest + } + // GetConnector holds details about calls to the GetConnector method. + GetConnector []struct { + // Ctx is the ctx argument value. + Ctx _context.Context + // ID is the id argument value. + ID string + } + // GetConnectorExecute holds details about calls to the GetConnectorExecute method. + GetConnectorExecute []struct { + // R is the r argument value. + R ApiGetConnectorRequest + } + // ListConnectors holds details about calls to the ListConnectors method. + ListConnectors []struct { + // Ctx is the ctx argument value. + Ctx _context.Context + } + // ListConnectorsExecute holds details about calls to the ListConnectorsExecute method. + ListConnectorsExecute []struct { + // R is the r argument value. + R ApiListConnectorsRequest + } + // PatchConnector holds details about calls to the PatchConnector method. + PatchConnector []struct { + // Ctx is the ctx argument value. + Ctx _context.Context + // ID is the id argument value. + ID string + } + // PatchConnectorExecute holds details about calls to the PatchConnectorExecute method. + PatchConnectorExecute []struct { + // R is the r argument value. + R ApiPatchConnectorRequest + } + } + lockCreateConnector sync.RWMutex + lockCreateConnectorExecute sync.RWMutex + lockDeleteConnector sync.RWMutex + lockDeleteConnectorExecute sync.RWMutex + lockGetConnector sync.RWMutex + lockGetConnectorExecute sync.RWMutex + lockListConnectors sync.RWMutex + lockListConnectorsExecute sync.RWMutex + lockPatchConnector sync.RWMutex + lockPatchConnectorExecute sync.RWMutex +} + +// CreateConnector calls CreateConnectorFunc. +func (mock *ConnectorsApiMock) CreateConnector(ctx _context.Context) ApiCreateConnectorRequest { + if mock.CreateConnectorFunc == nil { + panic("ConnectorsApiMock.CreateConnectorFunc: method is nil but ConnectorsApi.CreateConnector was just called") + } + callInfo := struct { + Ctx _context.Context + }{ + Ctx: ctx, + } + mock.lockCreateConnector.Lock() + mock.calls.CreateConnector = append(mock.calls.CreateConnector, callInfo) + mock.lockCreateConnector.Unlock() + return mock.CreateConnectorFunc(ctx) +} + +// CreateConnectorCalls gets all the calls that were made to CreateConnector. +// Check the length with: +// len(mockedConnectorsApi.CreateConnectorCalls()) +func (mock *ConnectorsApiMock) CreateConnectorCalls() []struct { + Ctx _context.Context +} { + var calls []struct { + Ctx _context.Context + } + mock.lockCreateConnector.RLock() + calls = mock.calls.CreateConnector + mock.lockCreateConnector.RUnlock() + return calls +} + +// CreateConnectorExecute calls CreateConnectorExecuteFunc. +func (mock *ConnectorsApiMock) CreateConnectorExecute(r ApiCreateConnectorRequest) (Connector, *_nethttp.Response, error) { + if mock.CreateConnectorExecuteFunc == nil { + panic("ConnectorsApiMock.CreateConnectorExecuteFunc: method is nil but ConnectorsApi.CreateConnectorExecute was just called") + } + callInfo := struct { + R ApiCreateConnectorRequest + }{ + R: r, + } + mock.lockCreateConnectorExecute.Lock() + mock.calls.CreateConnectorExecute = append(mock.calls.CreateConnectorExecute, callInfo) + mock.lockCreateConnectorExecute.Unlock() + return mock.CreateConnectorExecuteFunc(r) +} + +// CreateConnectorExecuteCalls gets all the calls that were made to CreateConnectorExecute. +// Check the length with: +// len(mockedConnectorsApi.CreateConnectorExecuteCalls()) +func (mock *ConnectorsApiMock) CreateConnectorExecuteCalls() []struct { + R ApiCreateConnectorRequest +} { + var calls []struct { + R ApiCreateConnectorRequest + } + mock.lockCreateConnectorExecute.RLock() + calls = mock.calls.CreateConnectorExecute + mock.lockCreateConnectorExecute.RUnlock() + return calls +} + +// DeleteConnector calls DeleteConnectorFunc. +func (mock *ConnectorsApiMock) DeleteConnector(ctx _context.Context, id string) ApiDeleteConnectorRequest { + if mock.DeleteConnectorFunc == nil { + panic("ConnectorsApiMock.DeleteConnectorFunc: method is nil but ConnectorsApi.DeleteConnector was just called") + } + callInfo := struct { + Ctx _context.Context + ID string + }{ + Ctx: ctx, + ID: id, + } + mock.lockDeleteConnector.Lock() + mock.calls.DeleteConnector = append(mock.calls.DeleteConnector, callInfo) + mock.lockDeleteConnector.Unlock() + return mock.DeleteConnectorFunc(ctx, id) +} + +// DeleteConnectorCalls gets all the calls that were made to DeleteConnector. +// Check the length with: +// len(mockedConnectorsApi.DeleteConnectorCalls()) +func (mock *ConnectorsApiMock) DeleteConnectorCalls() []struct { + Ctx _context.Context + ID string +} { + var calls []struct { + Ctx _context.Context + ID string + } + mock.lockDeleteConnector.RLock() + calls = mock.calls.DeleteConnector + mock.lockDeleteConnector.RUnlock() + return calls +} + +// DeleteConnectorExecute calls DeleteConnectorExecuteFunc. +func (mock *ConnectorsApiMock) DeleteConnectorExecute(r ApiDeleteConnectorRequest) (Error, *_nethttp.Response, error) { + if mock.DeleteConnectorExecuteFunc == nil { + panic("ConnectorsApiMock.DeleteConnectorExecuteFunc: method is nil but ConnectorsApi.DeleteConnectorExecute was just called") + } + callInfo := struct { + R ApiDeleteConnectorRequest + }{ + R: r, + } + mock.lockDeleteConnectorExecute.Lock() + mock.calls.DeleteConnectorExecute = append(mock.calls.DeleteConnectorExecute, callInfo) + mock.lockDeleteConnectorExecute.Unlock() + return mock.DeleteConnectorExecuteFunc(r) +} + +// DeleteConnectorExecuteCalls gets all the calls that were made to DeleteConnectorExecute. +// Check the length with: +// len(mockedConnectorsApi.DeleteConnectorExecuteCalls()) +func (mock *ConnectorsApiMock) DeleteConnectorExecuteCalls() []struct { + R ApiDeleteConnectorRequest +} { + var calls []struct { + R ApiDeleteConnectorRequest + } + mock.lockDeleteConnectorExecute.RLock() + calls = mock.calls.DeleteConnectorExecute + mock.lockDeleteConnectorExecute.RUnlock() + return calls +} + +// GetConnector calls GetConnectorFunc. +func (mock *ConnectorsApiMock) GetConnector(ctx _context.Context, id string) ApiGetConnectorRequest { + if mock.GetConnectorFunc == nil { + panic("ConnectorsApiMock.GetConnectorFunc: method is nil but ConnectorsApi.GetConnector was just called") + } + callInfo := struct { + Ctx _context.Context + ID string + }{ + Ctx: ctx, + ID: id, + } + mock.lockGetConnector.Lock() + mock.calls.GetConnector = append(mock.calls.GetConnector, callInfo) + mock.lockGetConnector.Unlock() + return mock.GetConnectorFunc(ctx, id) +} + +// GetConnectorCalls gets all the calls that were made to GetConnector. +// Check the length with: +// len(mockedConnectorsApi.GetConnectorCalls()) +func (mock *ConnectorsApiMock) GetConnectorCalls() []struct { + Ctx _context.Context + ID string +} { + var calls []struct { + Ctx _context.Context + ID string + } + mock.lockGetConnector.RLock() + calls = mock.calls.GetConnector + mock.lockGetConnector.RUnlock() + return calls +} + +// GetConnectorExecute calls GetConnectorExecuteFunc. +func (mock *ConnectorsApiMock) GetConnectorExecute(r ApiGetConnectorRequest) (Connector, *_nethttp.Response, error) { + if mock.GetConnectorExecuteFunc == nil { + panic("ConnectorsApiMock.GetConnectorExecuteFunc: method is nil but ConnectorsApi.GetConnectorExecute was just called") + } + callInfo := struct { + R ApiGetConnectorRequest + }{ + R: r, + } + mock.lockGetConnectorExecute.Lock() + mock.calls.GetConnectorExecute = append(mock.calls.GetConnectorExecute, callInfo) + mock.lockGetConnectorExecute.Unlock() + return mock.GetConnectorExecuteFunc(r) +} + +// GetConnectorExecuteCalls gets all the calls that were made to GetConnectorExecute. +// Check the length with: +// len(mockedConnectorsApi.GetConnectorExecuteCalls()) +func (mock *ConnectorsApiMock) GetConnectorExecuteCalls() []struct { + R ApiGetConnectorRequest +} { + var calls []struct { + R ApiGetConnectorRequest + } + mock.lockGetConnectorExecute.RLock() + calls = mock.calls.GetConnectorExecute + mock.lockGetConnectorExecute.RUnlock() + return calls +} + +// ListConnectors calls ListConnectorsFunc. +func (mock *ConnectorsApiMock) ListConnectors(ctx _context.Context) ApiListConnectorsRequest { + if mock.ListConnectorsFunc == nil { + panic("ConnectorsApiMock.ListConnectorsFunc: method is nil but ConnectorsApi.ListConnectors was just called") + } + callInfo := struct { + Ctx _context.Context + }{ + Ctx: ctx, + } + mock.lockListConnectors.Lock() + mock.calls.ListConnectors = append(mock.calls.ListConnectors, callInfo) + mock.lockListConnectors.Unlock() + return mock.ListConnectorsFunc(ctx) +} + +// ListConnectorsCalls gets all the calls that were made to ListConnectors. +// Check the length with: +// len(mockedConnectorsApi.ListConnectorsCalls()) +func (mock *ConnectorsApiMock) ListConnectorsCalls() []struct { + Ctx _context.Context +} { + var calls []struct { + Ctx _context.Context + } + mock.lockListConnectors.RLock() + calls = mock.calls.ListConnectors + mock.lockListConnectors.RUnlock() + return calls +} + +// ListConnectorsExecute calls ListConnectorsExecuteFunc. +func (mock *ConnectorsApiMock) ListConnectorsExecute(r ApiListConnectorsRequest) (ConnectorList, *_nethttp.Response, error) { + if mock.ListConnectorsExecuteFunc == nil { + panic("ConnectorsApiMock.ListConnectorsExecuteFunc: method is nil but ConnectorsApi.ListConnectorsExecute was just called") + } + callInfo := struct { + R ApiListConnectorsRequest + }{ + R: r, + } + mock.lockListConnectorsExecute.Lock() + mock.calls.ListConnectorsExecute = append(mock.calls.ListConnectorsExecute, callInfo) + mock.lockListConnectorsExecute.Unlock() + return mock.ListConnectorsExecuteFunc(r) +} + +// ListConnectorsExecuteCalls gets all the calls that were made to ListConnectorsExecute. +// Check the length with: +// len(mockedConnectorsApi.ListConnectorsExecuteCalls()) +func (mock *ConnectorsApiMock) ListConnectorsExecuteCalls() []struct { + R ApiListConnectorsRequest +} { + var calls []struct { + R ApiListConnectorsRequest + } + mock.lockListConnectorsExecute.RLock() + calls = mock.calls.ListConnectorsExecute + mock.lockListConnectorsExecute.RUnlock() + return calls +} + +// PatchConnector calls PatchConnectorFunc. +func (mock *ConnectorsApiMock) PatchConnector(ctx _context.Context, id string) ApiPatchConnectorRequest { + if mock.PatchConnectorFunc == nil { + panic("ConnectorsApiMock.PatchConnectorFunc: method is nil but ConnectorsApi.PatchConnector was just called") + } + callInfo := struct { + Ctx _context.Context + ID string + }{ + Ctx: ctx, + ID: id, + } + mock.lockPatchConnector.Lock() + mock.calls.PatchConnector = append(mock.calls.PatchConnector, callInfo) + mock.lockPatchConnector.Unlock() + return mock.PatchConnectorFunc(ctx, id) +} + +// PatchConnectorCalls gets all the calls that were made to PatchConnector. +// Check the length with: +// len(mockedConnectorsApi.PatchConnectorCalls()) +func (mock *ConnectorsApiMock) PatchConnectorCalls() []struct { + Ctx _context.Context + ID string +} { + var calls []struct { + Ctx _context.Context + ID string + } + mock.lockPatchConnector.RLock() + calls = mock.calls.PatchConnector + mock.lockPatchConnector.RUnlock() + return calls +} + +// PatchConnectorExecute calls PatchConnectorExecuteFunc. +func (mock *ConnectorsApiMock) PatchConnectorExecute(r ApiPatchConnectorRequest) (Connector, *_nethttp.Response, error) { + if mock.PatchConnectorExecuteFunc == nil { + panic("ConnectorsApiMock.PatchConnectorExecuteFunc: method is nil but ConnectorsApi.PatchConnectorExecute was just called") + } + callInfo := struct { + R ApiPatchConnectorRequest + }{ + R: r, + } + mock.lockPatchConnectorExecute.Lock() + mock.calls.PatchConnectorExecute = append(mock.calls.PatchConnectorExecute, callInfo) + mock.lockPatchConnectorExecute.Unlock() + return mock.PatchConnectorExecuteFunc(r) +} + +// PatchConnectorExecuteCalls gets all the calls that were made to PatchConnectorExecute. +// Check the length with: +// len(mockedConnectorsApi.PatchConnectorExecuteCalls()) +func (mock *ConnectorsApiMock) PatchConnectorExecuteCalls() []struct { + R ApiPatchConnectorRequest +} { + var calls []struct { + R ApiPatchConnectorRequest + } + mock.lockPatchConnectorExecute.RLock() + calls = mock.calls.PatchConnectorExecute + mock.lockPatchConnectorExecute.RUnlock() + return calls +} diff --git a/connectormgmt/apiv1/client/docs/ConnectorsApi.md b/connectormgmt/apiv1/client/docs/ConnectorsApi.md index b41f90ae..70d3dcfc 100644 --- a/connectormgmt/apiv1/client/docs/ConnectorsApi.md +++ b/connectormgmt/apiv1/client/docs/ConnectorsApi.md @@ -290,7 +290,7 @@ Name | Type | Description | Notes ## PatchConnector -> Connector PatchConnector(ctx, id).UNKNOWNBASETYPE(uNKNOWNBASETYPE).Execute() +> Connector PatchConnector(ctx, id).Body(body).Execute() Patch a connector @@ -310,11 +310,11 @@ import ( func main() { id := "id_example" // string | The ID of record - uNKNOWNBASETYPE := TODO // UNKNOWN_BASE_TYPE | Data to patch the connector with + body := map[string]interface{}(Object) // map[string]interface{} | Data to patch the connector with configuration := openapiclient.NewConfiguration() api_client := openapiclient.NewAPIClient(configuration) - resp, r, err := api_client.ConnectorsApi.PatchConnector(context.Background(), id).UNKNOWNBASETYPE(uNKNOWNBASETYPE).Execute() + resp, r, err := api_client.ConnectorsApi.PatchConnector(context.Background(), id).Body(body).Execute() if err != nil { fmt.Fprintf(os.Stderr, "Error when calling `ConnectorsApi.PatchConnector``: %v\n", err) fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r) @@ -340,7 +340,7 @@ Other parameters are passed through a pointer to a apiPatchConnectorRequest stru Name | Type | Description | Notes ------------- | ------------- | ------------- | ------------- - **uNKNOWNBASETYPE** | [**UNKNOWN_BASE_TYPE**](UNKNOWN_BASE_TYPE.md) | Data to patch the connector with | + **body** | **map[string]interface{}** | Data to patch the connector with | ### Return type @@ -352,7 +352,7 @@ Name | Type | Description | Notes ### HTTP request headers -- **Content-Type**: application/json, application/merge-patch+json, application/json-patch+json +- **Content-Type**: application/merge-patch+json, application/json-patch+json, application/json - **Accept**: application/json [[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) diff --git a/scripts/generate.sh b/scripts/generate.sh new file mode 100755 index 00000000..915544e2 --- /dev/null +++ b/scripts/generate.sh @@ -0,0 +1,5 @@ +### Go SDK uses golang wrapper for generating go code + +go get -u github.com/redhat-developer/app-services-sdk-go/internal/apigen/cmd/api-generate-all@latest + +api-generate-all --repo-metadata=.config/api-client-metadata.json --generator go --templates-dir=./scripts/templates \ No newline at end of file