apigeetool
This is a tool for administering Apigee Edge things, including
- deploying and undeploying API proxies or sharedflows
- listing, creating, updating, or deleting products, caches, KVMs, developers, and apps
- and other stuff
This is not an official Google product
This tool and the library included here is not an official Google product.
Support is available on a best-effort basis via github or the community site.
Pull requests are welcomed.
This tool does not support Apigee X or hybrid
This tool works with Apigee Edge. It does not work with Apigee X or hybrid.
For a similar tool that works with X or hybrid, see here.
Contents
Installation
apigeetool is a Node.js module and you can install it using npm:
npm install -g apigeetool
NOTE: The -g option places the apigeetool command in your PATH. On "*nix"-based machines, sudo may be required with the -g option. If you do not use -g, then you need to add the apigeetool command to your PATH manually. Typically, the -g option places modules in: /usr/local/lib/node_modules/apigeetool-node on *nix-based machines.
What you need to know about apigeetool
You must have an account on Apigee Edge to perform any apigeetool functions. These functions include:
- deploying an API proxy or shared flow to Edge,
- undeploying an API proxy or shared flow from Edge,
- listing deployed API proxies or shared flows on Edge,
- retrieving deployed proxies or shared flows from Edge,
- deleting proxy or shared flow definitions from Edge, and
- create or delete an API product in Edge
- create or delete a Developer in Edge
- create or delete a Developer Application in Edge
- create or delete a Cache resource in Edge
- create, retrieve or delete a KVM Map in Edge
- create, retrieve or delete a KVM Entry in Edge
- attach, detach, or get a FlowHook
- create, get, delete, list Target Servers
- create, get, delete, List Roles
- get, set Role Permisions
- assign, remove, verify Users for a Role
- list all Users in a Role
Obviously, this tool is only useful if you are familiar with basic concepts and features of Apigee Edge such as API proxies, organizations, environments, products, and so on.
For more information, refer to the Apigee Edge docs.
Common Parameters
The following parameters are available on all of the commands supported by
this tool:
--baseuri -L
(optional) The base URI for you organization on Apigee Edge. The default is the base URI for Apigee cloud deployments is api.enterprise.apigee.com. For on-premise deployments, the base URL may be different.
--header -H
(optional) Adds a header to the API call. Format is header:value. This option may be used multiple times if more than one header is needed.
--cafile -c
(optional) The names of one of more PEM files that represent trusted certificate authorities.
Multiple file names may be comma-separated. Use this to communicate with an installation
of Apigee Edge that uses a custom certificate for API calls.
--keyfile -K
(optional) The name of the PEM file that represents the private key in a mutual auth connection.
--certfile -C
(optional) The name of the PEM file that represents the certificate in a mutual auth connection.
--debug -D
(optional) Prints additional information about the deployment, including router and message processor IDs.
--help -h
(optional) Displays help on this command.
--insecure -k
(optional) Do not validate the TLS certificate of the HTTPS target for API calls.
Use this to communicate with an installation of Apigee Edge that does not use a
trusted TLS certificate.
--asynclimit -a
(optional) Limit for the maximum number of operations performed concurrently.
Currently this only affects file uploads in the deployNodeApp command. Defaults to 4.
--json -j
(optional) Formats the command's response as a JSON object.
--organization -o
(required) The name of the organization to deploy to. May be set as an environment variable APIGEE_ORGANIZATION.
--password -p
(required) Your Apigee account password. May be set as an environment variable APIGEE_PASSWORD.
--username -u
(required) Your Apigee account username. May be set as an environment variable APIGEE_USERNAME.
--token -t
(optional) Your Apigee access token. Use this in lieu of -u / -p
--netrc -N
(optional) Use this in lieu of -u / -p, to tell apigeetool to retrieve credentials from your .netrc file.
--verbose -V
(optional) Prints additional information as the deployment proceeds.
Command reference and examples
deployNodeApp
Deploys a Node.js app to Apigee Edge as an API proxy. With your Node.js app deployed to Edge, you can take advantage of Edge features like security, quotas, caching, analytics, trace tool, and more.
Examples
Deploys a Node.js app to Apigee Edge.
apigeetool deployNodeApp -u sdoe@apigee.com -o sdoe -e test -n 'Test Node App 2' -d . -m app.js -b /node2
Deploys a Node.js app to both the default (HTTP) and secure (HTTPS) virtual hosts.
apigeetool deployNodeApp -u sdoe@apigee.com -o sdoe -e test -n 'Test Node App 2' -d . -m app.js -b /node2 -v default,secure
Required parameters
The following parameters are required. However, if any are left unspecified
on the command line, and if apigeetool is running in an interactive shell,
then apigeetool will prompt for them.
For example, if you do not specify a password using "-p", apigeetool will
prompt for the password on the command line.
See Common Parameters for a list of additional parameters, including
the "-u" and "-p" parameters for username and password, and the "-o" parameter
for organization name, all of which are required.
--environments -e
(required) The name(s) of the environment(s) to deploy to (comma-delimited).
Optional parameters
--api -n
(optional) The name of the API proxy. The name of the API proxy must be unique within an organization. The characters you are allowed to use in the name are restricted to the following: A-Z0-9._\-$ %. If not specified, will attempt to use name from package.json.
--base-path -b
(optional) The base path of the API proxy. For example, for this API proxy, the base path is /example-proxy: http://myorg-test.apigee.net/example-proxy/resource1.
--directory -d
(optional) The path to the root directory of the API proxy on your local system. Will attempt to use current directory is none is specified.
--import-only -i
(optional) Imports the API proxy to Apigee Edge but does not deploy it.
--main -m
(optional) The Node.js file you want to be the main file. If not specified, will attempt to use main from package.json.
--preserve-policies -P
(optional) If specified, the highest revision of the existing proxy will be downloaded and the node code in your directory will be overlayed upon it to create a resulting proxy that contains both any existing policies and the node code in the directory. If there is no existing revision, this option will have no effect.
--resolve-modules -R
(optional) If the API proxy includes Node.js modules (e.g., in a node_modules directory), this option updates them on Apigee Edge without uploading them from your system. Basically, it's like running "npm install" on Apigee Edge in the root directory of the API proxy bundle.
--production
(optional) Indicates if Apigee Edge should use the --production flag during npm install. Defaults to true, example of disabling the flag would be --production false.
--upload-modules -U
(optional) If specified, uploads Node.js modules from your system to Apigee Edge rather than resolving the modules directly on Apigee Edge (the default behavior).
--virtualhosts -v
(optional) A comma-separated list of virtual hosts that the deployed app will use. The two most common options are default and secure. The default option is always HTTP and secure is always HTTPS. By default, apigeetool deployNodeApp uses default,secure.
--bundled-dependencies
(optional) If specified, the source code will be uploaded with its bundledDependencies as defined in the package.json.
--wait-after-import -W
(optional) Number of seconds to delay before deploying node.js proxy.
deployhostedtarget
Deploys a Hosted Target to Apigee Edge as an API proxy. With your Hosted Target deployed to Edge, you can take advantage of Edge features like security, quotas, caching, analytics, trace tool, and more.
Examples
Deploys a Node.js app as a Hosted Target to Apigee Edge.
apigeetool deployhostedtarget -u sdoe@apigee.com -o sdoe -e test -n 'test-node-app-2' -b /node2
Deploys a Node.js app as a Hosted Target to both the default (HTTP) and secure (HTTPS) virtual hosts.
apigeetool deployhostedtarget -u sdoe@apigee.com -o sdoe -e test -n 'test-node-app-2' -b /node2 -v default,secure
Required parameters
The following parameters are required. However, if any are left unspecified
on the command line, and if apigeetool is running in an interactive shell,
then apigeetool will prompt for them.
For example, if you do not specify a password using "-p", apigeetool will
prompt for the password on the command line.
See Common Parameters for a list of additional parameters, including
the "-u" and "-p" parameters for username and password, and the "-o" parameter
for organization name, all of which are required.
--api -n
The name of the API proxy. The name of the API proxy must be unique within an organization. The characters you are allowed to use in the name are restricted to the following: a-z0-9._\-$ %.
--environments -e
(required) The name(s) of the environment(s) to deploy to (comma-delimited).
Optional parameters
--base-path -b
(optional) The base path of the API proxy. For example, for this API proxy, the base path is /example-proxy: http://myorg-test.apigee.net/example-proxy/resource1.
--directory -d
(optional) The path to the root directory of the API proxy on your local system. Will attempt to use current directory is none is specified.
--import-only -i
(optional) Imports the API proxy to Apigee Edge but does not deploy it.
--preserve-policies -P
(optional) If specified, the highest revision of the existing proxy will be downloaded and the source code in your directory will be overlayed upon it to create a resulting proxy that contains both any existing policies and the source code in the directory. If there is no existing revision, this option will have no effect.
--virtualhosts -v
(optional) A comma-separated list of virtual hosts that the deployed app will use. The two most common options are default and secure. The default option is always HTTP and secure is always HTTPS. By default, apigeetool deployhostedtarget uses default,secure.
--bundled-dependencies
(optional) If specified, the source code will be uploaded with its bundledDependencies as defined in the package.json.
deployProxy