Skip to content

Support Rate Limits during Client Key Creation #12657

@nessex

Description

@nessex

Summary

Currently, you can Update a client key with a rate limit via the API. I'm hoping there will be a way to set the rate limit at key creation as well. As far as I'm aware (tested using cURL) this doesn't currently work.

Motivation

Hopefully a minor change. This will make it easier for us to set up new projects via the API / terraform.

Additional Context

API call that needs to be updated: https://docs.sentry.io/api/projects/post-project-keys/
Example request which I'm hoping will work (matches structure of working Update call):

export TOKEN=
export SENTRY_ORGANIZATION_ID=
export SENTRY_PROJECT_ID=

# Create a new Client Key with a ratelimit block in the request
curl -X POST -d '{"name": "Test RateLimit", "rateLimit": { "count": 1000, "window": 86400 }}' -vvv -H 'Content-Type: application/json' -H "Authorization: Bearer ${TOKEN}" https://sentry.io/api/0/projects/${SENTRY_ORGANIZATION_ID}/${SENTRY_PROJECT_ID}/keys/

# Verify that there is no ratelimit set
curl -vvv -H "Authorization: Bearer ${TOKEN}" "https://sentry.io/api/0/projects/${SENTRY_ORGANIZATION_ID}/${SENTRY_PROJECT_ID}/keys/"

I'm trying to manage Client Keys via Terraform. I've worked around the issue with a small hack. If I find time, I'll look into adding support for this myself.
Hack required to get rate limits on key creation

Update for Golang API library
Update for terraform provider

Metadata

Metadata

Assignees

No one assigned
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions