Skip to content

Commit

Permalink
PMM-12985 migrate from IDs to slugs
Browse files Browse the repository at this point in the history
  • Loading branch information
ademidoff committed Sep 20, 2024
1 parent 70e644b commit 3e2bf0c
Show file tree
Hide file tree
Showing 21 changed files with 214 additions and 153 deletions.
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
title: Overview
slug: access-control-overview
category: 66eaff8bc9d854001991ee4f
slug: access-control
categorySlug: access-control-api
hidden: 0
---

Access Control in PMM can be used to restrict access to individual metrics.
Access Control is in **tech preview** and needs to be enabled manually from PMM settings before it can be used.

Currently, Access Control is in **tech preview** and needs to be enabled manually from PMM settings before it can be used.

Once enabled, restricting access to metrics can be performed by:

Expand All @@ -16,10 +17,10 @@ Once enabled, restricting access to metrics can be performed by:
### Create a Percona role

```shell
curl -X POST "http://localhost/v1/role/Create" \
-H "Authorization: Basic xxx" \
-H "Content-Type: application/json" \
-d '{
curl -X POST -k "http://127.0.0.1/v1/accesscontrol/roles" \
--header "Authorization: Basic XXXXX" \
--header "Content-Type: application/json" \
--data '{
"title": "My custom role",
"filter": "{environment=\"staging\"}"
}'
Expand All @@ -30,14 +31,14 @@ Full access can be provided by specifying an empty `filter` field.

### Assign a Percona role

Users can be assigned roles by using the `/v1/role/Assign` API.
Users can be assigned roles by using the `/v1/accesscontrol/roles:assign` API.
The endpoint assigns new roles to a user. Other roles, that may have been assigned to the user previously, stay intact.

```shell
curl -X POST "http://localhost/v1/role/Assign" \
-H "Authorization: Basic xxx" \
-H "Content-Type: application/json" \
-d '{
curl -X POST -k "http://127.0.0.1/v1/accesscontrol/roles:assign" \
--header "Authorization: Basic XXXXX" \
--header "Content-Type: application/json" \
--data '{
"user_id": 1,
"role_ids": [2, 3, 4]
}'
Expand Down
2 changes: 1 addition & 1 deletion docs/api/advisor-api/advisors-and-advisor-checks.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Percona Advisors and Advisor checks
slug: advisors-and-advisor-checks
category: 66eb0386f81fe000105dbea7
categorySlug: advisor-api
order: 1
hidden: 1
---
2 changes: 1 addition & 1 deletion docs/api/advisor-api/changing-advisor-checks.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Changing Advisors and Advisor checks
slug: changing-advisor-checks
category: 66eb0386f81fe000105dbea7
categorySlug: advisor-api
order: 3
hidden: 1
---
2 changes: 1 addition & 1 deletion docs/api/advisor-api/failed-checks.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Get Failed Advisor Checks
slug: failed-checks
category: 66eb0386f81fe000105dbea7
categorySlug: advisor-api
order: 2
hidden: 1
---
4 changes: 2 additions & 2 deletions docs/api/advisor-api/overview.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Overview
slug: pmm-advisors
category: 66eb0386f81fe000105dbea7
categorySlug: advisor-api
order: 0
---

Expand All @@ -10,7 +10,7 @@ This section describes APIs to deal with Percona [Advisors](https://docs.percona

- In [List of problems detected by Advisors](getfailedchecks) you can find API to get information about potential problems with your Infrastructure detected by Advisors.
- [List Percona Advisors](ref:listadvisors) lists all Advisors available in your PMM.
- [List Advisor Chekcs](ref:listadvisorchecks) lists all Advisor Checks available in your PMM.
- [List Advisor Checks](ref:listadvisorchecks) lists all Advisor Checks available in your PMM.
- [Changing Advisor Checks](ref:changeadvisorchecks) will help you automate Advisor checks, i.e.:
- Enable/Disable Advisor Checks
- Change Advisor Check execution interval
13 changes: 6 additions & 7 deletions docs/api/backups/list-locations.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,18 @@
title: List Locations
slug: listlocations
excerpt: ListLocations returns a list of all backup locations.
category: 66eb06589a42ac3f7ee6dee2
categorySlug: backup-api
---

The following API call will list all the available backup locations:

```shell
curl --insecure -X POST \
-H 'Authorization: Basic YWRtaW46YWRtaW4=' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--url https://127.0.0.1/v1/management/backup/Locations/List \
curl --insecure -X GET \
--header 'Authorization: Bearer XXXXX' \
--header 'Accept: application/json' \
--url https://127.0.0.1/v1/backups/locations
```

Please note that locations are good for storing any type of backup disregarding the technology or the database vendor. However, for a better organization of your file system storage, you'll probably want to create different locations based on a certain criteria. For example, it can be a department, a region, etc.

You will need the [authetication token](ref:authentication).
You require an authentication token, which is described [here](ref:authentication).
10 changes: 5 additions & 5 deletions docs/api/backups/overview.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Overview
slug: database-backups
category: 66eb06589a42ac3f7ee6dee2
categorySlug: backup-api
order: 0
---

Expand All @@ -16,9 +16,9 @@ To be able to make a backup, you should start by [preparing a backup location](h

Here a few other references to :

- [Make a backup](startbackup)
- [Restore the database from a backup](restorebackup)
- [List restore history items](listrestorehistory)
- [List available backup locations](listlocations)
- [Make a backup](ref:startbackup)
- [Restore the database from a backup](ref:restorebackup)
- [List restore history items](ref:listrestores)
- [List available backup locations](ref:listlocations)

Read [more](https://docs.percona.com/percona-monitoring-and-management/get-started/backup/index.html).
15 changes: 7 additions & 8 deletions docs/api/backups/restore-backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,22 @@
title: Restore from a backup
slug: restorebackup
excerpt: This endpoint allows to restore a database from a previously made backup.
category: 66eb06589a42ac3f7ee6dee2
categorySlug: backup-api
---

PMM can backup the monitored services.
PMM can restore a service (database) from a backup.

This section describes making ad-hoc backups from a service.
This section describes restoring a service from a backup taken before.

### Restoring From a Backup

Here is an example of an API call to restore from a backup:

```shell
curl --insecure -X POST -H 'Authorization: Bearer XXXXX' \
--request POST \
--url https://127.0.0.1/v1/management/backup/Backups/Restore \
--header 'Accept: application/json' \
curl --insecure -X POST \
--header 'Authorization: Bearer XXXXX' \
--header 'Content-Type: application/json' \
--url https://127.0.0.1/v1/backups/restores:start \
--data '
{
"service_id": "40499c38-522d-4ed1-ab3f-8a099684f46d",
Expand All @@ -32,7 +31,7 @@ You require an authentication token, which is described [here](ref:authenticatio

Also, you require the [service_id](ref:listservices) and [location_id](ref:listlocations).

You can defined a `name` and a `description` for each backup. You can also configure `retry_interval` and `retries` if required.
You can define a `name` and a `description` for each backup. You can also configure `retry_interval` and the number of `retries` if required.

### Error messages

Expand Down
9 changes: 4 additions & 5 deletions docs/api/backups/start-backup.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: Make a backup
slug: startbackup
excerpt: This endpoint allows to make an unscheduled, or ad-hoc, backup of a given service.
category: 66eb06589a42ac3f7ee6dee2
categorySlug: backup-api
---

PMM can backup the monitored services.
Expand All @@ -14,11 +14,10 @@ This section describes how to make an ad-hoc backup of a service.
Here is an example of an API call to create a backup:

```shell
curl --insecure -X POST -H 'Authorization: Bearer XXXXX' \
--request POST \
--url https://127.0.0.1/v1/management/backup/Backups/Start \
--header 'Accept: application/json' \
curl --insecure -X POST \
--header 'Authorization: Bearer XXXXX' \
--header 'Content-Type: application/json' \
--url https://127.0.0.1/v1/backups:start \
--data '
{
"service_id": "2c756c17-e4cd-4180-a3d4-d7a3fe1e4816",
Expand Down
22 changes: 10 additions & 12 deletions docs/api/inventory/add-agent.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Add an Agent
slug: addagent
category: 66eb0600d159ac004f5fe06d
categorySlug: inventory-api
---

## Add an Agent
Expand All @@ -18,11 +18,10 @@ Here's how to add an Agent of type `mysql` using the old and new API calls.

```shell
curl --insecure -X POST \
-H 'Authorization: Basic YWRtaW46YWRtaW4=' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--url https://127.0.0.1/v1/inventory/Agents/MySQLdExporter \
--data '
--header 'Authorization: Bearer XXXXX' \
--header 'Content-Type: application/json' \
--url https://127.0.0.1/v1/inventory/Agents/MySQLdExporter \
--data '
{
"pmm_agent_id": "pmm-server",
"service_id": "13519ec9-eedc-4d21-868c-582e146e1d0e",
Expand All @@ -43,11 +42,10 @@ curl --insecure -X POST \

```shell
curl --insecure -X POST \
-H 'Authorization: Basic YWRtaW46YWRtaW4=' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--url https://127.0.0.1/v1/inventory/Agents/Add \
--data '
--header 'Authorization: Bearer XXXXX' \
--header 'Content-Type: application/json' \
--url https://127.0.0.1/v1/inventory/agents \
--data '
{
"mysqld_exporter": {
"pmm_agent_id": "pmm-server",
Expand Down Expand Up @@ -83,4 +81,4 @@ You can choose from the following Agent types:
- qan_postgresql_pgstatements_agent
- qan_postgresql_pgstatmonitor_agent

To get the authentication token, check [the Authentication page](ref:authentication).
To get the authentication token, check [Authentication](ref:authentication).
22 changes: 10 additions & 12 deletions docs/api/inventory/add-node.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Add a Node
slug: addnode
category: 66eb0600d159ac004f5fe06d
categorySlug: inventory-api
---

## Add a Node
Expand All @@ -18,11 +18,10 @@ Here's how to add a Node of type `generic` using the old and new API calls.

```shell
curl --insecure -X POST \
-H 'Authorization: Basic YWRtaW46YWRtaW4=' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--url https://127.0.0.1/v1/inventory/Nodes/AddGeneric \
--data '
--header 'Authorization: Bearer XXXXX' \
--header 'Content-Type: application/json' \
--url https://127.0.0.1/v1/inventory/Nodes/AddGeneric \
--data '
{
"node_name": "mysql-sales-db-prod-1",
"region": "us-east-1",
Expand All @@ -40,11 +39,10 @@ curl --insecure -X POST \

```shell
curl --insecure -X POST \
-H 'Authorization: Basic YWRtaW46YWRtaW4=' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--url https://127.0.0.1/v1/inventory/Nodes/Add \
--data '
--header 'Authorization: Bearer XXXXX' \
--header 'Content-Type: application/json' \
--url https://127.0.0.1/v1/inventory/nodes \
--data '
{
"generic": {
"node_name": "mysql-sales-db-prod-1",
Expand All @@ -68,4 +66,4 @@ You can choose from the following Node types:
- remote_rds
- remote_azure

To get the authentication token, check [the Authentication page](ref:authentication).
To get the authentication token, check [Authentication](ref:authentication).
23 changes: 11 additions & 12 deletions docs/api/inventory/add-service.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
---
title: Add a Service
slug: addservice
category: 66eb0600d159ac004f5fe06d
categorySlug: inventory-api
---

## Add a Service
Expand All @@ -18,11 +18,11 @@ Here's how to add a Node of type `mysql` using the old and the new API calls:

```shell
curl --insecure -X POST \
-H 'Authorization: Basic YWRtaW46YWRtaW4=' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--url https://127.0.0.1/v1/inventory/Services/AddMySQL \
--data '
--header 'Authorization: Bearer XXXXX' \
--header 'Accept: application/json' \
--header 'Content-Type: application/json' \
--url https://127.0.0.1/v1/inventory/Services/AddMySQL \
--data '
{
"service_name": "mysql-sales-db-prod-1",
"node_id": "pmm-server",
Expand All @@ -42,11 +42,10 @@ curl --insecure -X POST \

```shell
curl --insecure -X POST \
-H 'Authorization: Basic YWRtaW46YWRtaW4=' \
-H 'Accept: application/json' \
-H 'Content-Type: application/json' \
--url https://127.0.0.1/v1/inventory/Services/Add \
--data '
--header 'Authorization: Bearer XXXXX' \
--header 'Content-Type: application/json' \
--url https://127.0.0.1/v1/inventory/services \
--data '
{
"mysql": {
"service_name": "mysql-sales-db-prod-1",
Expand All @@ -73,4 +72,4 @@ You can choose from the following Service types:
- haproxy
- external

To get the authentication token, check [the Authentication page](ref:authentication).
To get the authentication token, check [Authentication](ref:authentication).
Loading

0 comments on commit 3e2bf0c

Please sign in to comment.