mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
* Adds Remote Cluster related API endpoints
New endpoints for the following routes are added:
- Get Remote Clusters at `GET /api/v4/remotecluster`
- Create Remote Cluster at `POST /api/v4/remotecluster`
- Accept Remote Cluster invite at `POST
/api/v4/remotecluster/accept_invite`
- Generate Remote Cluster invite at `POST
/api/v4/remotecluster/{remote_id}/generate_invite`
- Get Remote Cluster at `GET /api/v4/remotecluster/{remote_id}`
- Patch Remote Cluster at `PATCH /api/v4/remotecluster/{remote_id}`
- Delete Remote Cluster at `DELETE /api/v4/remotecluster/{remote_id}`
These endpoints are planned to be used from the system console, and
gated through the `manage_secure_connections` permission.
* Update server/channels/api4/remote_cluster_test.go
Co-authored-by: Doug Lauder <wiggin77@warpmail.net>
* Fix AppError names
---------
Co-authored-by: Doug Lauder <wiggin77@warpmail.net>
Co-authored-by: Mattermost Build <build@mattermost.com>
256 lines
6.3 KiB
Go
256 lines
6.3 KiB
Go
// Code generated by mockery v2.42.2. DO NOT EDIT.
|
|
|
|
// Regenerate this file using `make store-mocks`.
|
|
|
|
package mocks
|
|
|
|
import (
|
|
model "github.com/mattermost/mattermost/server/public/model"
|
|
mock "github.com/stretchr/testify/mock"
|
|
)
|
|
|
|
// RemoteClusterStore is an autogenerated mock type for the RemoteClusterStore type
|
|
type RemoteClusterStore struct {
|
|
mock.Mock
|
|
}
|
|
|
|
// Delete provides a mock function with given fields: remoteClusterId
|
|
func (_m *RemoteClusterStore) Delete(remoteClusterId string) (bool, error) {
|
|
ret := _m.Called(remoteClusterId)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Delete")
|
|
}
|
|
|
|
var r0 bool
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string) (bool, error)); ok {
|
|
return rf(remoteClusterId)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string) bool); ok {
|
|
r0 = rf(remoteClusterId)
|
|
} else {
|
|
r0 = ret.Get(0).(bool)
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string) error); ok {
|
|
r1 = rf(remoteClusterId)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Get provides a mock function with given fields: remoteClusterId
|
|
func (_m *RemoteClusterStore) Get(remoteClusterId string) (*model.RemoteCluster, error) {
|
|
ret := _m.Called(remoteClusterId)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Get")
|
|
}
|
|
|
|
var r0 *model.RemoteCluster
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string) (*model.RemoteCluster, error)); ok {
|
|
return rf(remoteClusterId)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string) *model.RemoteCluster); ok {
|
|
r0 = rf(remoteClusterId)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*model.RemoteCluster)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string) error); ok {
|
|
r1 = rf(remoteClusterId)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetAll provides a mock function with given fields: offset, limit, filter
|
|
func (_m *RemoteClusterStore) GetAll(offset int, limit int, filter model.RemoteClusterQueryFilter) ([]*model.RemoteCluster, error) {
|
|
ret := _m.Called(offset, limit, filter)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetAll")
|
|
}
|
|
|
|
var r0 []*model.RemoteCluster
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(int, int, model.RemoteClusterQueryFilter) ([]*model.RemoteCluster, error)); ok {
|
|
return rf(offset, limit, filter)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(int, int, model.RemoteClusterQueryFilter) []*model.RemoteCluster); ok {
|
|
r0 = rf(offset, limit, filter)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).([]*model.RemoteCluster)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(int, int, model.RemoteClusterQueryFilter) error); ok {
|
|
r1 = rf(offset, limit, filter)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// GetByPluginID provides a mock function with given fields: pluginID
|
|
func (_m *RemoteClusterStore) GetByPluginID(pluginID string) (*model.RemoteCluster, error) {
|
|
ret := _m.Called(pluginID)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for GetByPluginID")
|
|
}
|
|
|
|
var r0 *model.RemoteCluster
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string) (*model.RemoteCluster, error)); ok {
|
|
return rf(pluginID)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string) *model.RemoteCluster); ok {
|
|
r0 = rf(pluginID)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*model.RemoteCluster)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string) error); ok {
|
|
r1 = rf(pluginID)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// Save provides a mock function with given fields: rc
|
|
func (_m *RemoteClusterStore) Save(rc *model.RemoteCluster) (*model.RemoteCluster, error) {
|
|
ret := _m.Called(rc)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Save")
|
|
}
|
|
|
|
var r0 *model.RemoteCluster
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(*model.RemoteCluster) (*model.RemoteCluster, error)); ok {
|
|
return rf(rc)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(*model.RemoteCluster) *model.RemoteCluster); ok {
|
|
r0 = rf(rc)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*model.RemoteCluster)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(*model.RemoteCluster) error); ok {
|
|
r1 = rf(rc)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// SetLastPingAt provides a mock function with given fields: remoteClusterId
|
|
func (_m *RemoteClusterStore) SetLastPingAt(remoteClusterId string) error {
|
|
ret := _m.Called(remoteClusterId)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for SetLastPingAt")
|
|
}
|
|
|
|
var r0 error
|
|
if rf, ok := ret.Get(0).(func(string) error); ok {
|
|
r0 = rf(remoteClusterId)
|
|
} else {
|
|
r0 = ret.Error(0)
|
|
}
|
|
|
|
return r0
|
|
}
|
|
|
|
// Update provides a mock function with given fields: rc
|
|
func (_m *RemoteClusterStore) Update(rc *model.RemoteCluster) (*model.RemoteCluster, error) {
|
|
ret := _m.Called(rc)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for Update")
|
|
}
|
|
|
|
var r0 *model.RemoteCluster
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(*model.RemoteCluster) (*model.RemoteCluster, error)); ok {
|
|
return rf(rc)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(*model.RemoteCluster) *model.RemoteCluster); ok {
|
|
r0 = rf(rc)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*model.RemoteCluster)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(*model.RemoteCluster) error); ok {
|
|
r1 = rf(rc)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// UpdateTopics provides a mock function with given fields: remoteClusterId, topics
|
|
func (_m *RemoteClusterStore) UpdateTopics(remoteClusterId string, topics string) (*model.RemoteCluster, error) {
|
|
ret := _m.Called(remoteClusterId, topics)
|
|
|
|
if len(ret) == 0 {
|
|
panic("no return value specified for UpdateTopics")
|
|
}
|
|
|
|
var r0 *model.RemoteCluster
|
|
var r1 error
|
|
if rf, ok := ret.Get(0).(func(string, string) (*model.RemoteCluster, error)); ok {
|
|
return rf(remoteClusterId, topics)
|
|
}
|
|
if rf, ok := ret.Get(0).(func(string, string) *model.RemoteCluster); ok {
|
|
r0 = rf(remoteClusterId, topics)
|
|
} else {
|
|
if ret.Get(0) != nil {
|
|
r0 = ret.Get(0).(*model.RemoteCluster)
|
|
}
|
|
}
|
|
|
|
if rf, ok := ret.Get(1).(func(string, string) error); ok {
|
|
r1 = rf(remoteClusterId, topics)
|
|
} else {
|
|
r1 = ret.Error(1)
|
|
}
|
|
|
|
return r0, r1
|
|
}
|
|
|
|
// NewRemoteClusterStore creates a new instance of RemoteClusterStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
|
|
// The first argument is typically a *testing.T value.
|
|
func NewRemoteClusterStore(t interface {
|
|
mock.TestingT
|
|
Cleanup(func())
|
|
}) *RemoteClusterStore {
|
|
mock := &RemoteClusterStore{}
|
|
mock.Mock.Test(t)
|
|
|
|
t.Cleanup(func() { mock.AssertExpectations(t) })
|
|
|
|
return mock
|
|
}
|