Skip to content
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

(DOCSP-46656) Adds handwritten command for atlas api. #838

Merged
merged 4 commits into from
Feb 7, 2025

Conversation

erabil-mdb
Copy link
Collaborator

@erabil-mdb erabil-mdb commented Jan 22, 2025

Self-Review Checklist

  • Check that the submodule pulled in the right changes (if applicable).
  • Define taxonomy values at top of page.
  • Add genre facets (tutorial or reference), as in this example PR.
  • Add programmingLanguage (if necessary).
  • Add meta keywords (if necessary).
  • Resolve any new warnings or errors in the build.
  • Proofread for spelling and grammatical errors.
  • Check staging for rendering issues.
  • Confirm links are working.

Copy link

netlify bot commented Jan 22, 2025

Deploy Preview for docs-atlas-cli ready!

Name Link
🔨 Latest commit 20c38a5
🔍 Latest deploy log https://app.netlify.com/sites/docs-atlas-cli/deploys/6797af75f6f6fe0008049180
😎 Deploy Preview https://deploy-preview-838--docs-atlas-cli.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

.. code-block::
:caption: Command Syntax

atlas api <tag> <operationId> [options]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

While it's correct that we use <tag> and <operationId>, we use a camelCase version of these values.

This will mainly influence <tag>, afaik the current operationIds are already in camelCase.

Some examples:

  • Flex Clusters -> flexClusters
  • Monitoring and Logs -> monitoringAndLogs

I don't see this captured anywhere in this page yet.

the `API documentation <https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/>`__
|url| for the endpoint. It appears after ``#tag/``. For example, in
``https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Clusters/operation/listClusters``,
the tag is ``Clusters``.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Regarding my last comment about casing commands would live under atlas api clusters [operationId]


.. code-block:: shell

atlas api <tag> <operationId> --orgId <ORG_ID> --invoiceId <INVOICE_ID>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It might be helpful to mention that --orgId and --projectId are not required; they'll be taken from your profile when they're not set. (Unless they're not set on the profile, then they're needed, but they should be set in most cases)

- Type
- Required
- Description
* - ``--api-version``
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here api_version can be set as a property on your profile, if that's set then this value will be used when --api-version is not provided.

* - ``--format``
- string
- false
- Output format. Supported formats include ``json``, ``csv``, or a Go template.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The output format depends on the endpoint.

Most endpoints will output json, but there are some exceptions.

  • When an endpoint supports json, then you can provided json or a Go template as output.
  • When an endpoint supports json/csv you can provide all 3 options
  • There are also endpoints which output binary data, like logs (gzip). In that case --out becomes required.

The easiest ways to see what's supported is to:

  • check the content response type examples on the API docs example
  • run atlas api <tag> <operationId> --help

Copy link
Collaborator

@davidhou17 davidhou17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A few comments back to you!

:class: singlecol

Access all features of the `{+atlas-admin-api+} <https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/>`__
using the {+atlas-cli+} with the syntax: ``atlas api <tag> <operationId>``.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: ambiguous who is "using" the atlas-cli (could refer to the API)

Suggested change
using the {+atlas-cli+} with the syntax: ``atlas api <tag> <operationId>``.
by using the {+atlas-cli+} with the syntax: ``atlas api <tag> <operationId>``.

using the {+atlas-cli+} with the syntax: ``atlas api <tag> <operationId>``.

This experimental feature streamlines script development by letting you interact
directly with any {+atlas-admin-api+} endpoint using the {+atlas-cli+}.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
directly with any {+atlas-admin-api+} endpoint using the {+atlas-cli+}.
directly with any {+atlas-admin-api+} endpoint by using the {+atlas-cli+}.


atlas api <tag> <operationId> [options]

Arguments
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we should use a table for the arguments here, similar to other pages in the Atlas CLI docs

Copy link
Collaborator

@davidhou17 davidhou17 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM % couple nits for the table so it's easier to read!

Arguments
---------

.. list-table::
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: Can we improve the UX of this table by updating the widths and the spacing in the description?
i.e. expand name and type columns a bit longer so they don't wrap

Screenshot 2025-01-24 at 3 24 03 PM

Comment on lines 52 to 62
|url| for the endpoint. It appears after ``#tag/``, but you need to change to camelCase.
For example, in
``https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Monitoring-and-Logs``,
the tag is ``Monitoring-and-Logs``. In camelCase, it's ``monitoringAndLogs``.
* - <operationId>
- string
- true
- The identifier of the {+atlas-admin-api+} endpoint in :wikipedia:`camelCase <Camel_case>`.
To find the operationId, check the
`API documentation <https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/>`__
|url| for the endpoint. It appears after ``operation/``. For example, in
Copy link
Collaborator

@davidhou17 davidhou17 Jan 24, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think these descriptions could benefit from a space between the overview and the example to improve legibility.

Suggested change
|url| for the endpoint. It appears after ``#tag/``, but you need to change to camelCase.
For example, in
``https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Monitoring-and-Logs``,
the tag is ``Monitoring-and-Logs``. In camelCase, it's ``monitoringAndLogs``.
* - <operationId>
- string
- true
- The identifier of the {+atlas-admin-api+} endpoint in :wikipedia:`camelCase <Camel_case>`.
To find the operationId, check the
`API documentation <https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/>`__
|url| for the endpoint. It appears after ``operation/``. For example, in
|url| for the endpoint. It appears after ``#tag/``, but you need to change to camelCase.
For example, in
``https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/#tag/Monitoring-and-Logs``,
the tag is ``Monitoring-and-Logs``. In camelCase, it's ``monitoringAndLogs``.
* - <operationId>
- string
- true
- The identifier of the {+atlas-admin-api+} endpoint in :wikipedia:`camelCase <Camel_case>`.
To find the operationId, check the
`API documentation <https://www.mongodb.com/docs/atlas/reference/api-resources-spec/v2/>`__
|url| for the endpoint. It appears after ``operation/``.
For example, in

@@ -93,6 +93,7 @@ Related Commands
accessLists </command/atlas-accessLists>
accessLogs </command/atlas-accessLogs>
alerts </command/atlas-alerts>
api </command/atlas-api>
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This page is autogenerated, so this change will be overwritten at the next release. I don't think we can have this on this page due to our automation system unless they add it upstream.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jeroenvervaeke are you able to add this upstream? This is so the new page shows up in the left-hand table of contents.

@erabil-mdb erabil-mdb merged commit f53e6b4 into mongodb:master Feb 7, 2025
4 checks passed
@erabil-mdb erabil-mdb deleted the DOCSP-46656 branch February 7, 2025 18:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants