-
Notifications
You must be signed in to change notification settings - Fork 136
DOCS-2955: Add Usage API doc for Calico Cloud #2837
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
ctauchen
wants to merge
4
commits into
tigera:main
Choose a base branch
from
ctauchen:cc-usage-api-docs-2955
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
087fba0
Add Usage API doc for Calico Cloud
ctauchen 9d4e352
Address review: fix Owner role bolding and Usage Metrics link casing
ctauchen 1ca5b08
Correct command language: console generates curl only
ctauchen 6615984
Drop tool-specific wording and ready-to-run intro line
ctauchen File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,43 @@ | ||
| --- | ||
| description: Create a read-only API key in the Calico Cloud web console and use it to call the Usage API to retrieve vCPU usage data programmatically. | ||
| --- | ||
|
|
||
| import IconUser from '/img/icons/user-icon.svg'; | ||
|
|
||
| # Access usage data programmatically | ||
|
|
||
| You can create a read-only API key in the web console and use it to call the $[prodname] Usage API. | ||
| The API returns the same vCPU usage and managed cluster data shown on the [Usage Metrics](usage-metrics.mdx) page, so you can pull it into your own capacity planning, FinOps, and license-compliance workflows instead of exporting it by hand. | ||
| API keys are read-only and scoped to your organization. | ||
|
|
||
| ## Prerequisites | ||
|
|
||
| * You are signed in to the web console as a user with the **Admin** and **Usage Metrics** roles, or with the **Owner** role. | ||
|
|
||
| ## Create an API key for usage metrics | ||
|
|
||
| 1. In the web console, click the user icon <IconUser width="20"/> **> Settings**. | ||
| 1. Under the **API Keys** tab, click **Generate new key**. | ||
| 1. Enter a description, choose a validity period, and then click **Create**. | ||
| 1. Copy or download the generated key and store it in a secure location. | ||
|
|
||
| :::important | ||
|
|
||
| The key is shown only once, at creation. You cannot retrieve it again after you close the dialog. | ||
|
|
||
| ::: | ||
|
|
||
| ## Call the Usage API | ||
|
|
||
| 1. On the **API Keys** tab, locate your key and click **Actions > Generate commands**. | ||
| 1. Select the command for the data you want: | ||
| * **Summary** — per-project vCPU totals and usage over time, across all projects. | ||
| * **Managed clusters** — per-cluster usage rows, with optional project filtering and CSV output. | ||
| * **Contracts** — your organization's contracts, including start and end dates, vCPU hours, package, and add-ons. | ||
| 1. Copy the generated command. | ||
| 1. In the command, replace `<your-secret>` with your API key, and set any query parameters, such as `startTime`, `endTime`, and `granularity`, for your query. | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @asincu Should we mention in docs that the daily granularity limit of 93 days? (~3 months) and for monthly granularity is 3 years (36 months)? |
||
| 1. Run the command. A successful call returns an HTTP `200` response with your usage data in JSON. | ||
|
|
||
| ## Additional information | ||
|
|
||
| * [Usage Metrics](usage-metrics.mdx) | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We will be changing description to name