Skip to content

Commit

Permalink
Fixes #24826: Add an API endpoint to get plugin license info
Browse files Browse the repository at this point in the history
  • Loading branch information
fanf committed May 17, 2024
1 parent ceb282b commit 84a5ee0
Show file tree
Hide file tree
Showing 17 changed files with 686 additions and 25 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
curl --header "X-API-Token: yourToken" https://rudder.example.com/rudder/api/latest/plugins/settings
1 change: 1 addition & 0 deletions webapp/sources/api-doc/code_samples/curl/plugins/info.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
curl --header "X-API-Token: yourToken" https://rudder.example.com/rudder/api/latest/plugins/info
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# settings.json:
#
#{
# "username": "my-account-login",
# "password": "xxxxxxxxx",
# "url": "https://download.rudder.io/plugins",
# "proxyUrl": ""
# "proxyUser": ""
# "proxyPassword": ""
#}
curl --header "X-API-Token: yourToken" --request POST https://rudder.example.com/rudder/api/latest/plugins/settings --header "Content-type: application/json" --data @dsettings.json
99 changes: 99 additions & 0 deletions webapp/sources/api-doc/components/schemas/plugins-info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,99 @@
# SPDX-License-Identifier: CC-BY-SA-2.0
# SPDX-FileCopyrightText: 2013-2020 Normation SAS
type: object
required:
- details
properties:
# FIXME: required on not depends on where it's used
globalLimits:
type: object
description: Most restrictive limits computed from each plugin license limits
properties:
licensees:
type: array
description: list of licensees for these plugins
items:
type: string
description: a licensee
example: Customer Inc
startDate:
type: string
description: the latest date of start of validity for plugins
example: 2023-08-14T02:00:00+02:00
endDate:
type: string
description: the earliest date of end of validity for plugins
example: 2023-08-14T02:00:00+02:00
maxNodes:
type: integer
description: the lowest limit on maximum number of nodes for plugins
example: 5000
details:
type: array
description: the list of details for each plugins
properties:
id:
type: string
description: internal id of the plugin
example: com.normation.plugins.authbackends.AuthBackendsPluginDef
name:
type: string
description: fully qualified name of the plugin
example: rudder-plugin-auth-backends
shortName:
type: string
description: short name of the plugin
example: auth-backends
description:
type: string
description: description of the plugin
example: <p>This plugin provides additional authentication backends for Rudder, like LDAP, OIDC, etc</p>
version:
type: string
description: version of the plugin
example: 7.3.12-2.1.0
status:
type: string
description: status of the plugin, enabled or disabled
example: enabled
enum:
- enabled
- disabled
statusMessage:
type: string
description: a message explaining the status when disabled
example: this plugin is disabled because its end of validity date is in the past
license:
type: object
description: information about the plugin
properties:
licensee:
type: string
description: name of the licensee for that plugin
example: Customer Inc
softwareId:
type: string
description: the fully qualified name of the plugin for which that license was issued
example: rudder-plugin-auth-backends
minVersion:
type: string
description: lowest version of the software for which that license is valid
example: 0.0-0.0
maxVersion:
type: string
description: highest version of the software for which that license is valid
example: 2023-08-14T02:00:00+02:00
startDate:
type: string
description: start of validity date
example: 2023-08-14T02:00:00+02:00
endDate:
type: string
description: end of validity date
example: 2023-08-14T02:00:00+02:00
maxNodes:
type: integer
description: maximum number of node in Rudder for that license
additionalInfo:
type: object
description: additional information provided by the license
32 changes: 32 additions & 0 deletions webapp/sources/api-doc/components/schemas/plugins-settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# SPDX-License-Identifier: CC-BY-SA-2.0
# SPDX-FileCopyrightText: 2013-2020 Normation SAS
type: object
required:
- username
- password
properties:
# FIXME: required on not depends on where it's used
username:
type: string
description: username to use for Rudder account
example: Customer Inc
password:
type:
description: password to access Rudder account
example: some password
url:
type: string
description: URL for getting plugins
example: https://download.rudder.io/plugins
proxyUser:
type: string
description: if an authenticated proxy is necessary, username of proxy
example: proxy_user
proxyPassword:
type: string
description: if an authenticated proxy is necessary, password of the proxy
example: some password
proxyUrl:
type: string
description: proxy URL to use
example: https://proxy.url
6 changes: 6 additions & 0 deletions webapp/sources/api-doc/openapi.src.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,8 @@ tags:
description: Server configuration
- name: System
description: Internal components and administration
- name: Plugins
description: Information about installed plugins
- name: "🧩 Change requests"
description: >-
**Requires that the `changes-validation` plugin is installed on the server.**
Expand Down Expand Up @@ -180,6 +182,10 @@ paths:
$ref: paths/system/healthcheck.yml
"/system/maintenance/purgeSoftware":
$ref: paths/system/purge-software.yml
"/plugins/info":
$ref: paths/plugins/info.yml
"/plugins/settings":
$ref: paths/plugins/settings.yml
"/settings":
$ref: paths/settings/list.yml
"/settings/{settingId}":
Expand Down
45 changes: 45 additions & 0 deletions webapp/sources/api-doc/paths/plugins/info.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
# SPDX-License-Identifier: CC-BY-SA-2.0
# SPDX-FileCopyrightText: 2013-2020 Normation SAS
get:
summary: Information about installed plugins
description: Get the list of plugin details and their licenses information
operationId: getPluginsInfo
responses:
"200":
description: Settings
content:
application/json:
schema:
type: object
required:
- result
- action
- data
properties:
result:
type: string
description: Result of the request
enum:
- success
- error
action:
type: string
description: The id of the action
enum:
- getPluginsInfo
data:
type: object
description: Plugins info
required:
- plugins
properties:
parameters:
type: array
items:
$ref: ../../components/schemas/plugins-info.yml
tags:
- Plugins
x-codeSamples:
- lang: curl
source:
$ref: ../../code_samples/curl/plugins/info.sh
88 changes: 88 additions & 0 deletions webapp/sources/api-doc/paths/plugins/settings.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# SPDX-License-Identifier: CC-BY-SA-2.0
# SPDX-FileCopyrightText: 2013-2020 Normation SAS
get:
summary: Get plugins repository settings
description: Get plugins url and proxy settings
operationId: pluginSettings
responses:
"200":
description: Settings
content:
application/json:
schema:
type: object
required:
- result
- action
- data
properties:
result:
type: string
description: Result of the request
enum:
- success
- error
action:
type: string
description: The id of the action
enum:
- pluginSettings
data:
type: object
description: Settings
required:
- plugins
properties:
plugins:
type: array
items:
$ref: ../../components/schemas/plugins-settings.yml
tags:
- Plugins
x-codeSamples:
- lang: curl
source:
$ref: ../../code_samples/curl/plugins/get-plugins-settings.sh
post:
summary: Update plugins settings
description: Update plugins repository URL and proxy
operationId: updateSettings
responses:
"200":
description: Settings
content:
application/json:
schema:
type: object
required:
- result
- action
- data
properties:
result:
type: string
description: Result of the request
enum:
- success
- error
action:
type: string
description: The id of the action
enum:
- updateSettings
data:
type: object
description: Parameters
required:
- plugins
properties:
parameters:
type: array
items:
$ref: ../../components/schemas/plugins-settings.yml
tags:
- Plugins
x-codeSamples:
- lang: curl
source:
$ref: ../../code_samples/curl/plugins/set-plugins-settings.sh
Loading

0 comments on commit 84a5ee0

Please sign in to comment.