Skip to content

Commit d2d5c24

Browse files
authored
(DOCSP-26893) Adds page/section for automating processes (#136)
* (DOCSP-26893) Adds page/section for automating processes * Includes changes from copy review
1 parent f4c3f40 commit d2d5c24

File tree

6 files changed

+106
-20
lines changed

6 files changed

+106
-20
lines changed

snooty.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ intersphinx = [ "https://www.mongodb.com/docs/ops-manager/current/objects.inv",
1010
toc_landing_pages = [
1111
"/atlas-cli-changelog",
1212
"/atlas-cli-env-variables",
13+
"/atlas-cli-automate",
1314
"/atlas-cli-profiles",
1415
"/atlas-cli-quickstart",
1516
"/atlas-cli-tutorials",

source/atlas-cli-automate.txt

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
.. _atlas-cli-automate:
2+
3+
=========================================
4+
Automate Processes with the {+atlas-cli+}
5+
=========================================
6+
7+
.. default-domain:: mongodb
8+
9+
.. contents:: On this page
10+
:local:
11+
:backlinks: none
12+
:depth: 2
13+
:class: singlecol
14+
15+
To automate a process with the {+atlas-cli+} in a script, use
16+
the following resources and best practices as guidance.
17+
18+
To learn how to connect to the {+atlas-cli+} programmatically, see
19+
the :guilabel:`Programmatic User` tabs on :ref:`connect-atlas-cli`.
20+
21+
Resources for Automation with the {+atlas-cli+}
22+
-----------------------------------------------
23+
24+
.. list-table::
25+
:header-rows: 1
26+
:widths: 40 60
27+
28+
* - Resource
29+
- Objective
30+
31+
* - :ref:`atlas-cli-env-vars`
32+
- Set environment variables that you can define once and use
33+
across all of your scripts.
34+
35+
* - :ref:`go-template-output`
36+
- Use Go templates or |json| paths to customize the output from
37+
the {+atlas-cli+}. You can include the anticipated custom output in your scripts.
38+
39+
Best Practices for Automation with the {+atlas-cli+}
40+
----------------------------------------------------
41+
42+
Follow these best practices when you automate processes with the
43+
{+atlas-cli+}:
44+
45+
Base Your Script on the Version of the {+atlas-cli+} that You Run
46+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
47+
48+
When you create a script to automate processes, you should base the
49+
script on the version of the {+atlas-cli+} that you currently run.
50+
**Don't** build automatic upgrades for the {+atlas-cli+} into your
51+
script because new {+atlas-cli+} releases could introduce breaking
52+
changes, which could break your automated processes.
53+
54+
Instead, check release notes for deprecated features and
55+
breaking changes before you manually upgrade your version of the
56+
{+atlas-cli+}.
57+
58+
.. _atlas-cli-redirect-stderr:
59+
60+
Redirect ``stderr``
61+
~~~~~~~~~~~~~~~~~~~
62+
63+
The {+atlas-cli+} prints error messages and command deprecation
64+
warnings in the output for commands. These unanticipated error messages
65+
and warnings can cause issues for your automated processes that
66+
anticipate a specific output. To prevent issues, you can redirect
67+
``stderr`` to an output file in your script.
68+
69+
For example, the following command redirects the ``stderr`` output from
70+
a script called ``myScript.sh`` to a text file called ``error.txt``:
71+
72+
.. code-block::
73+
74+
myScript.sh 2> error.txt
75+
76+
In the previous example, all error messages and deprecation warnings
77+
are stored in ``error.txt`` and don't display in the output, so
78+
they don't disrupt your automated processes.
79+
80+
Command deprecation messages are similar to the following text:
81+
82+
.. code-block::
83+
84+
Command "describe" is deprecated, Please use atlas privateEndpoints aws interfaces describe <atlasPrivateEndpointId> [--privateEndpointId privateEndpointID] [--projectId projected]
85+
86+
Update Scripts Regularly
87+
~~~~~~~~~~~~~~~~~~~~~~~~
88+
89+
You should regularly update your scripts to discontinue use of
90+
deprecated commands because they will be removed in future releases.
91+
You can learn which commands are deprecated from the
92+
:ref:`atlas-cli-changelog`. If you
93+
:ref:`set up a redirect file for stderr <atlas-cli-redirect-stderr>`,
94+
you can also check that file for deprecation warnings.
95+
96+
.. toctree::
97+
:titlesonly:
98+
99+
/atlas-cli-env-variables
100+
/custom-output-cli

source/atlas-cli-changelog.txt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _atlas-cli-changelog:
2+
13
:noprevnext:
24

35
=======================

source/configure-optional-settings.txt

Lines changed: 0 additions & 17 deletions
This file was deleted.

source/connect-atlas-cli.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -229,7 +229,6 @@ different profile, see :ref:`<atlas-cli-profiles>`.
229229
.. toctree::
230230

231231
/atlas-cli-save-connection-settings
232-
/atlas-cli-env-variables
233232
/migrate-to-atlas-cli
234233

235234

source/index.txt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,9 +113,10 @@ Learn the {+atlas-cli+} commands and optimize your workflow with advanced tutori
113113
Overview </index>
114114
/install-atlas-cli
115115
/connect-atlas-cli
116-
/configure-optional-settings
117-
/atlas-cli-tutorials
118116
Atlas CLI Commands </command/atlas>
117+
/atlas-cli-automate
118+
/telemetry
119+
/atlas-cli-tutorials
119120
/reference
120121
/troubleshooting
121122
/atlas-cli-changelog

0 commit comments

Comments
 (0)