Tip
Find out about other secret types and the expected JSON format for them.
This documentation shows you how to create a database credentials
secret type, with a version matching this type, using the Secret Manager API.
To complete the actions presented below, you must have:
database credentials
secret type. Make sure that you replace $SECRET_KEY
and $SCW_PROJECT_ID
with your own values.
curl -q \-H "X-Auth-Token: $SECRET_KEY" \-H 'Content-Type: application/json' \-X POST \-d '{"name": "my-secret","project_id": "'$SCW_PROJECT_ID'","type": "database_credentials"}' \https://api.scaleway.com/secret-manager/v1beta1/regions/fr-par/secrets
echo '{"engine": "mysql","username": "username","password": "my-super-secure-password","host": "<instance host name/resolvable DNS name/IP address>","dbname": "my-database","port": "8080"}' | base64
ewogICAgImVuZ2luZSI6ICJteXNxbCIsCiAgICAidXNlcm5hbWUiOiAidXNlcm5hbWUiLAogICAgInBhc3N3b3JkIjogIm15LXN1cGVyLXNlY3VyZS1wYXNzd29yZCIsCiAgICAiaG9zdCI6ICI8aW5zdGFuY2UgaG9zdCBuYW1lL3Jlc29sdmFibGUgRE5TIG5hbWU+IgogICAgImRibmFtZSI6ICJteS1kYXRhYmFzZSIsCiAgICAicG9ydCI6ICI4MDgwIgp9
database_credentials
secret type. Make sure that you add your own values and that you paste the output from the step above in the data
field.
curl -q \-H "X-Auth-Token: $SECRET_KEY" \-H 'Content-Type: application/json' \-X POST \-d '{"data": "ewogICAgImVuZ2luZSI6ICJteXNxbCIsCiAgICAidXNlcm5hbWUiOiAidXNlcm5hbWUiLAogICAgInBhc3N3b3JkIjogIm15LXN1cGVyLXNlY3VyZS1wYXNzd29yZCIsCiAgICAiaG9zdCI6ICI8aW5zdGFuY2UgaG9zdCBuYW1lL3Jlc29sdmFibGUgRE5TIG5hbWU+IgogICAgImRibmFtZSI6ICJteS1kYXRhYmFzZSIsCiAgICAicG9ydCI6ICI4MDgwIgp9","description": "my-secret-description",}' \https://api.scaleway.com/secret-manager/v1beta1/regions/fr-par/secrets/{secret_id}/versions
Find out about other secret types and the expected JSON format for them.