mirror of
https://github.com/mattermost/mattermost.git
synced 2025-02-25 18:55:24 -06:00
Adds Remote Cluster related API endpoints (#27432)
* 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>
This commit is contained in:
committed by
GitHub
parent
cc5e87ae24
commit
809ad4f76d
@@ -40,6 +40,7 @@ build-v4: node_modules playbooks
|
||||
@cat $(V4_SRC)/roles.yaml >> $(V4_YAML)
|
||||
@cat $(V4_SRC)/schemes.yaml >> $(V4_YAML)
|
||||
@cat $(V4_SRC)/service_terms.yaml >> $(V4_YAML)
|
||||
@cat $(V4_SRC)/remoteclusters.yaml >> $(V4_YAML)
|
||||
@cat $(V4_SRC)/sharedchannels.yaml >> $(V4_YAML)
|
||||
@cat $(V4_SRC)/reactions.yaml >> $(V4_YAML)
|
||||
@cat $(V4_SRC)/actions.yaml >> $(V4_YAML)
|
||||
|
||||
@@ -3485,6 +3485,39 @@ components:
|
||||
remote_id:
|
||||
description: Id of the remote cluster where the shared channel is homed
|
||||
type: string
|
||||
RemoteCluster:
|
||||
type: object
|
||||
properties:
|
||||
remote_id:
|
||||
type: string
|
||||
remote_team_id:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
display_name:
|
||||
type: string
|
||||
site_url:
|
||||
description: URL of the remote cluster
|
||||
type: string
|
||||
create_at:
|
||||
description: Time in milliseconds that the remote cluster was created
|
||||
type: integer
|
||||
last_ping_at:
|
||||
description: Time in milliseconds when the last ping to the remote cluster was run
|
||||
type: integer
|
||||
token:
|
||||
type: string
|
||||
remote_token:
|
||||
type: string
|
||||
topics:
|
||||
type: string
|
||||
creator_id:
|
||||
type: string
|
||||
plugin_id:
|
||||
type: string
|
||||
options:
|
||||
description: A bitmask with a set of option flags
|
||||
type: integer
|
||||
RemoteClusterInfo:
|
||||
type: object
|
||||
properties:
|
||||
|
||||
@@ -598,6 +598,7 @@ x-tagGroups:
|
||||
- roles
|
||||
- schemes
|
||||
- integration_actions
|
||||
- remote clusters
|
||||
- shared channels
|
||||
- terms of service
|
||||
- imports
|
||||
|
||||
282
api/v4/source/remoteclusters.yaml
Normal file
282
api/v4/source/remoteclusters.yaml
Normal file
@@ -0,0 +1,282 @@
|
||||
"/api/v4/remotecluster":
|
||||
get:
|
||||
tags:
|
||||
- remote clusters
|
||||
summary: Get a list of remote clusters.
|
||||
description: |
|
||||
Get a list of remote clusters.
|
||||
|
||||
##### Permissions
|
||||
`manage_secure_connections`
|
||||
operationId: GetRemoteClusters
|
||||
parameters:
|
||||
- name: page
|
||||
in: query
|
||||
description: The page to select
|
||||
schema:
|
||||
type: integer
|
||||
- name: per_page
|
||||
in: query
|
||||
description: The number of remote clusters per page
|
||||
schema:
|
||||
type: integer
|
||||
- name: exclude_offline
|
||||
in: query
|
||||
description: Exclude offline remote clusters
|
||||
schema:
|
||||
type: boolean
|
||||
- name: in_channel
|
||||
in: query
|
||||
description: Select remote clusters in channel
|
||||
schema:
|
||||
type: string
|
||||
- name: not_in_channel
|
||||
in: query
|
||||
description: Select remote clusters not in this channel
|
||||
schema:
|
||||
type: string
|
||||
- name: only_confirmed
|
||||
in: query
|
||||
description: Select only remote clusters already confirmed
|
||||
schema:
|
||||
type: boolean
|
||||
- name: only_plugins
|
||||
in: query
|
||||
description: Select only remote clusters that belong to a plugin
|
||||
schema:
|
||||
type: boolean
|
||||
- name: exclude_plugins
|
||||
in: query
|
||||
description: Select only remote clusters that don't belong to a plugin
|
||||
schema:
|
||||
type: boolean
|
||||
responses:
|
||||
"200":
|
||||
description: Remote clusters fetch successful. Result might be empty.
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: array
|
||||
items:
|
||||
$ref: "#/components/schemas/RemoteCluster"
|
||||
"401":
|
||||
$ref: "#/components/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
|
||||
post:
|
||||
tags:
|
||||
- remote clusters
|
||||
summary: Create a new remote cluster.
|
||||
description: |
|
||||
Create a new remote cluster and generate an invite code.
|
||||
|
||||
##### Permissions
|
||||
`manage_secure_connections`
|
||||
operationId: CreateRemoteCluster
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- name
|
||||
- password
|
||||
properties:
|
||||
name:
|
||||
type: string
|
||||
display_name:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
description: The password to use in the invite code.
|
||||
responses:
|
||||
"201":
|
||||
description: Remote cluster creation successful
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
remote_cluster:
|
||||
$ref: "#/components/schemas/RemoteCluster"
|
||||
invite:
|
||||
type: string
|
||||
description: The encrypted invite for the newly created remote cluster
|
||||
"401":
|
||||
$ref: "#/components/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
|
||||
"/api/v4/remotecluster/{remote_id}":
|
||||
get:
|
||||
tags:
|
||||
- remote clusters
|
||||
summary: Get a remote cluster.
|
||||
description: |
|
||||
Get the Remote Cluster details from the provided id string.
|
||||
|
||||
##### Permissions
|
||||
`manage_secure_connections`
|
||||
operationId: GetRemoteCluster
|
||||
parameters:
|
||||
- name: remote_id
|
||||
in: path
|
||||
description: Remote Cluster GUID
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Remote Cluster retrieval successful
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/RemoteCluster"
|
||||
"401":
|
||||
$ref: "#/components/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
"404":
|
||||
$ref: "#/components/responses/NotFound"
|
||||
patch:
|
||||
tags:
|
||||
- remote clusters
|
||||
summary: Patch a remote cluster.
|
||||
description: |
|
||||
Partially update a Remote Cluster by providing only the fields you want to update. Ommited fields will not be updated.
|
||||
|
||||
##### Permissions
|
||||
`manage_secure_connections`
|
||||
operationId: PatchRemoteCluster
|
||||
parameters:
|
||||
- name: remote_id
|
||||
in: path
|
||||
description: Remote Cluster GUID
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
display_name:
|
||||
type: string
|
||||
responses:
|
||||
"200":
|
||||
description: Remote Cluster patch successful
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
$ref: "#/components/schemas/RemoteCluster"
|
||||
"401":
|
||||
$ref: "#/components/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
"404":
|
||||
$ref: "#/components/responses/NotFound"
|
||||
delete:
|
||||
tags:
|
||||
- remote clusters
|
||||
summary: Delete a remote cluster.
|
||||
description: |
|
||||
Deletes a Remote Cluster.
|
||||
|
||||
##### Permissions
|
||||
`manage_secure_connections`
|
||||
operationId: DeleteRemoteCluster
|
||||
parameters:
|
||||
- name: remote_id
|
||||
in: path
|
||||
description: Remote Cluster GUID
|
||||
required: true
|
||||
schema:
|
||||
type: string
|
||||
responses:
|
||||
"204":
|
||||
description: Remote Cluster deletion successful
|
||||
"401":
|
||||
$ref: "#/components/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
"404":
|
||||
$ref: "#/components/responses/NotFound"
|
||||
|
||||
"/api/v4/remotecluster/{remote_id}/generate_invite":
|
||||
post:
|
||||
tags:
|
||||
- remote clusters
|
||||
summary: Generate invite code.
|
||||
description: |
|
||||
Generates an invite code for a given remote cluster.
|
||||
|
||||
##### Permissions
|
||||
`manage_secure_connections`
|
||||
operationId: GenerateRemoteClusterInvite
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- password
|
||||
properties:
|
||||
password:
|
||||
type: string
|
||||
description: The password to encrypt the invite code with.
|
||||
responses:
|
||||
"201":
|
||||
description: Invite code generated
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: string
|
||||
"401":
|
||||
$ref: "#/components/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
|
||||
"/api/v4/remotecluster/accept_invite":
|
||||
post:
|
||||
tags:
|
||||
- remote clusters
|
||||
summary: Accept a remote cluster invite code.
|
||||
description: |
|
||||
Accepts a remote cluster invite code.
|
||||
|
||||
##### Permissions
|
||||
`manage_secure_connections`
|
||||
operationId: AcceptRemoteClusterInvite
|
||||
requestBody:
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
required:
|
||||
- invite
|
||||
- name
|
||||
- password
|
||||
properties:
|
||||
invite:
|
||||
type: string
|
||||
name:
|
||||
type: string
|
||||
display_name:
|
||||
type: string
|
||||
password:
|
||||
type: string
|
||||
description: The password to decrypt the invite code.
|
||||
responses:
|
||||
"201":
|
||||
description: Invite successfully accepted
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
type: object
|
||||
$ref: "#/components/schemas/RemoteCluster"
|
||||
"401":
|
||||
$ref: "#/components/responses/Unauthorized"
|
||||
"403":
|
||||
$ref: "#/components/responses/Forbidden"
|
||||
Reference in New Issue
Block a user