DEV Community

Cover image for If I know a Vault CLI command, how do I get its cURL Command?
πŸ¦„N BπŸ›‘
πŸ¦„N BπŸ›‘

Posted on

5 1

If I know a Vault CLI command, how do I get its cURL Command?

If you have a command like vault auth enable oidc, how do you know its corresponding API call? Like this:

vault auth disable -output-curl-string oidc

Here's an example:

$ vault auth enable oidc
Success! Enabled oidc auth method at: oidc/

$ vault auth disable oidc
Success! Disabled the auth method (if it existed) at: oidc/

$ vault auth enable -output-curl-string oidc
curl -X POST -H "X-Vault-Request: true" -H "X-Vault-Token: $(vault print token)"
 -d '{"type":"oidc","description":"","config":{"options":null,"default_lease_ttl
":"0s","max_lease_ttl":"0s","force_no_cache":false},"local":false,"seal_wrap":fa
lse,"external_entropy_access":false,"options":null}' http://127.0.0.1:8200/v1/sy
s/auth/oidc

$ vault auth disable -output-curl-string oidc
curl -X DELETE -H "X-Vault-Request: true" -H "X-Vault-Token: $(vault print token
)" http://127.0.0.1:8200/v1/sys/auth/oidc

Enter fullscreen mode Exit fullscreen mode

For more on the easy way to use the Vault API got get or generate "Secrets," I recommend this link:

https://www.slideshare.net/mitchp/vault-secrets-via-api-for-the-rest-of-us

Heroku

Simplify your DevOps and maximize your time.

Since 2007, Heroku has been the go-to platform for developers as it monitors uptime, performance, and infrastructure concerns, allowing you to focus on writing code.

Learn More

Top comments (0)

Billboard image

The Next Generation Developer Platform

Coherence is the first Platform-as-a-Service you can control. Unlike "black-box" platforms that are opinionated about the infra you can deploy, Coherence is powered by CNC, the open-source IaC framework, which offers limitless customization.

Learn more

πŸ‘‹ Kindness is contagious

Please leave a ❀️ or a friendly comment on this post if you found it helpful!

Okay