Coder Social home page Coder Social logo

apigeetool-node's Introduction

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 [email protected] -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 [email protected] -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 [email protected] -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 [email protected] -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

Deploys an API proxy to Apigee Edge. If the proxy is currently deployed, it will be undeployed first, and the newly deployed proxy's revision number is incremented.

Example

Deploys an API proxy called example-proxy to Apigee Edge. Per the -d flag, the command is executed in the root directory of the proxy bundle.

apigeetool deployproxy  -u [email protected] -o sdoe  -e test -n example-proxy -d .

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.

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 (required) The name of the API proxy. Note: 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.

--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 on Apigee Edge in the root directory of the API proxy bundle.

--upload-modules -U (optional) If specified, uploads Node.js modules from your system to Apigee Edge.

--bundled-dependencies (optional) If specified, the node & hosted resources will be uploaded with their bundledDependencies as defined in their respective package.json files.

--wait-after-import -W
(optional) Number of seconds to delay before deploying node.js proxy.

deployExistingRevision

Deploys an existing API proxy revision to Apigee Edge. If a different revision is already deployed to the targeted environments, it will be undeployed and replaced with the requested revision.

Example

Deploys an existing API proxy revision called example-proxy to Apigee Edge.

apigeetool deployExistingRevision  -u [email protected] -o sdoe  -e test -n example-proxy -r 1

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.

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
(required) The name of the API proxy. Note: 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).

--revision -r (required) The existing revision of the proxy to be deployed.

undeploy

Undeploys a named API proxy or Node.js app deployed on Apigee Edge.

Example

Undeploy the proxy named "example-proxy".

apigeetool undeploy -u [email protected] -o sdoe  -n example-proxy -e test -D

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.

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 (required) The name of the API proxy or app to undeploy.

--environment -e (required) The environment on Apigee Edge where the API proxy or app is currently deployed.

Optional parameters

--revision -r (optional) Specify the revision number of the API proxy to undeploy.

listdeployments

Lists the API proxies deployed on Apigee Edge for the specified organization. Lets you filter the result by API proxy name or environment.

Examples

List all API proxies in an organization:

$ apigeetool listdeployments -u [email protected] -o sdoe -e test`

List API proxies named "example-proxy":

$ apigeetool listdeployments -u [email protected] -o sdoe -n example-proxy

Required parameters

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.

Required, mutually exclusive parameters

--api -n (You must specify either api or environment in this command) The name of the API proxy to list.

--environment -e (You must specify either api or environment in this command) The environment for which you want to list deployments. When -e is specified, the command lists all deployed proxies in the environment.

Optional parameters

--long -l (optional) Returns additional information about the API proxy or Node.js app, including the URL to use as the base path for each one.

--revision -r (optional) Filters the list by the specified revision number.

fetchproxy

Fetches a deployed API proxy or Node.js application from Apigee Edge. The result will be a ZIP file that contains the contents of the entire proxy.

Regardless of whether "deployproxy" or "deploynodeapp" is used to deploy the proxy or app, the result of "fetchproxy" will always be a ZIP file that represents an API proxy. The resulting proxy may be "unzipped" and re-deployed using "deployproxy."

Example

Fetch the deployed proxy named "example-proxy".

apigeetool fetchproxy -u [email protected] -o sdoe -n example-proxy -r 1

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.

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 (required) The name of the API proxy or app to undeploy.

--revision -r (required) Specifies the revision to retrieve.

Optional parameters

--file -f (optional) The name of the file to write as the result. If not specified, then the file name will be the same as the name passed to the "name" parameter.

delete

Delete all revisions of a proxy from Apigee Edge.

It is an error to delete a proxy that still has deployed revisions. Revisions must be undeployed using "undeploy" before this command may be used.

Example

Delete the proxy named "example-proxy".

apigeetool delete -u [email protected] -o sdoe -n example-proxy

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.

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 (required) The name of the API proxy or app to undeploy.

getlogs

Retrieve the last set of log records from a Node.js application or Hosted Target deployed to Apigee Edge.

The resulting log files will be written directly to standard output. Each is prefixed with:

  • A timestamp, in UTC by default
  • An indication of whether the log record came from standard output or standard error
  • A unique identifier of the server where the log was generated.

Since Apigee Edge, by default, deploys each Node.js application on at least two different servers, most applications will see at least two sets of logs. These are sorted in time stamp order.

The log records from this command come from a cache inside Apigee Edge that retains the last 500 lines of log output from each server. The cache is a circular buffer, so older messages will be discarded when it fills up.

By default, the last set of log records will be pulled and written to standard output. However, if the "-f" option is used, then "apigeetool" will poll Edge for new log records and append them to standard output, in the manner of "tail -f". (By default, the tool polls every five seconds).

For example, a set of log records might look like this:

[2014-11-05T01:30:01.530Z nodejs/stderr svr.362] *** Starting script
[2014-11-05T01:30:09.182Z nodejs/stderr svr.362] 2014-11-05T01:30:09.181Z - debug: 1/4. this is a debug log
[2014-11-05T01:30:09.186Z nodejs/stdout svr.362] 2014-11-05T01:30:09.186Z - info: 2/4. this is an info log
[2014-11-05T01:30:09.187Z nodejs/stdout svr.362] 2014-11-05T01:30:09.187Z - warn: 3/4. this is a warning log
[2014-11-05T01:30:09.188Z nodejs/stderr svr.362] 2014-11-05T01:30:09.188Z - error: 4/4. this is an error log
[2014-11-05T01:48:21.419Z nodejs/stderr svr.828] *** Starting script
[2014-11-05T01:48:28.637Z nodejs/stderr svr.828] js-bson: Failed to load c++ bson extension, using pure JS version
[2014-11-05T01:48:29.801Z nodejs/stderr svr.828] 2014-11-05T01:48:29.800Z - debug: 1/4. this is a debug log
[2014-11-05T01:48:29.804Z nodejs/stdout svr.828] 2014-11-05T01:48:29.804Z - info: 2/4. this is an info log
[2014-11-05T01:48:29.805Z nodejs/stdout svr.828] 2014-11-05T01:48:29.805Z - warn: 3/4. this is a warning log
[2014-11-05T01:48:29.806Z nodejs/stderr svr.828] 2014-11-05T01:48:29.806Z - error: 4/4. this is an error log

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.

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 (required) The name of the deployed app to get logs from.

--environment -e (required) The environment on Apigee Edge where the app is currently deployed.

Optional Parameters

--streaming -f (optional) If specified, do not exit, but instead poll Apigee Edge for new log records and write them to standard output in the manner of "tail -f."

--timezone -z (optional) If specified, use the time zone to format the timestamps on the log records. If not specified, then the default is UTC. The timestamp name should be a name such as "PST."

--hosted-build (optional) If specified will attempt to get the build logs for a deployed Hosted Target.

--hosted-runtime (optional) If specified will attempt to get the runtime logs for a deployed Hosted Target.

deploySharedflow

Deploys a sharedFlow to Apigee Edge. If the sharedFlow is currently deployed, it will be undeployed first, and the newly deployed sharedflow's revision number is incremented.

Example

Deploys a SharedFlow called example-sf to Apigee Edge. Per the -d flag, the command is executed in the root directory of the sharedflow bundle.

apigeetool deploySharedflow  -u [email protected] -o sdoe  -e test -n example-sf -d .

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.

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.

--name -n (required) The name of the SharedFlow. Note: The name of the SharedFlow 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

--directory -d (optional) The path to the root directory of the sharedflow on your local system. Will attempt to use current directory is none is specified.

--import-only -i (optional) Imports the sharedflow to Apigee Edge but does not deploy it.

undeploySharedflow

Undeploys a SharedFlow deployed on Apigee Edge.

Example

Undeploy the proxy named "example-sf".

apigeetool undeploySharedflow -u [email protected] -o sdoe  -n example-sf -e test -D

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.

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.

--name -n (required) The name of the sharedflow to undeploy.

--environment -e (required) The environment on Apigee Edge where the sharedflow is currently deployed.

Optional parameters

--revision -r (optional) Specify the revision number of the sharedflow to undeploy.

listSharedflows

List shared flows

Example

apigeetool listSharedflows -t $TOKEN -o $ORG

listSharedflowDeployments

Lists the sharedflows deployed on Apigee Edge for the specified organization. Lets you filter the result by API proxy name or environment.

Examples

List all Sharedflows in an organization:

$ apigeetool listSharedflowDeployments -u [email protected] -o sdoe -e test

List Sharedflows named "example-sf":

$ apigeetool listSharedflowDeployments -u [email protected] -o sdoe -n example-sf

Required parameters

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.

Required, mutually exclusive parameters

--name -n (You must specify either name or environment in this command) The name of the Sharedflow to list.

--environment -e (You must specify either name or environment in this command) The environment for which you want to list deployments. When -e is specified, the command lists all deployed proxies in the environment.

Optional parameters

--revision -r (optional) Filters the list by the specified revision number.

fetchSharedFlow

Fetches a sharedFlow from Apigee Edge. The result will be a ZIP file that contains the contents of the entire sharedflow.The resulting ZIP file may be "unzipped" and re-deployed using "deploySharedflow."

Example

Fetch the deployed proxy named "example-proxy".

apigeetool fetchSharedflow -u [email protected] -o sdoe -n example-proxy -r 1

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.

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.

--name -n (required) The name of the sharedflow or app to undeploy.

--revision -r (required) Specifies the revision to retrieve.

Optional parameters

--file -f (optional) The name of the file to write as the result. If not specified, then the file name will be the same as the name passed to the "name" parameter.

deleteSharedflow

Delete all revisions of a sharedflow from Apigee Edge.

It is an error to delete a proxy that still has deployed revisions. Revisions must be undeployed using "undeploySharedflow" before this command may be used.

Example

Delete the proxy named "example-sf".

apigeetool deleteSharedflow -u [email protected] -o sdoe -n example-sf

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.

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.

--name -n (required) The name of the API proxy or app to undeploy.

KVM Operations

The following commands support the varying scoped of the Apigee KVM.

When just the --organization option is present, the operation will correspond to the Organization-scoped KVM.

When the --organization and --environment options are present, the operation will correspond to the Environment-scoped KVM.

When the --organization and --api options are present, the operation will correspond to the API-scoped KVM.

createKVMmap

Creates a map in the Apigee KVM with the given name.

Example

Create KVM map named "test-map"

apigeetool createKVMmap -u [email protected] -o sdoe -e test --mapName test-map

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.

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.

--mapName (required) The name of the map to be created.

Optional parameters

--environment -e (optional) The environment to target for an Environment-scoped KVM operation.

--api -n (optional) The API to target for an API-scoped KVM operation.

--encrypted (optional) Create a encrypted KVM Map.

addEntryToKVM

Adds an entry of name:value to the named map in the Apigee KVM.

Example

Add entry to KVM with name "test1" and value "value1"

apigeetool addEntryToKVM -u [email protected] -o sdoe -e test --mapName test-map --entryName test1 --entryValue value1

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.

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.

--mapName (required) The name of the map the entry will belong to.

--entryName (required) The name of the entry to be created.

--entryValue (required) The value of the entry to be created.

Optional parameters

--environment -e (optional) The environment to target for an Environment-scoped KVM operation.

--api -n (optional) The API to target for an API-scoped KVM operation.

updateKVMEntry

Updates an entry of name:value to the named map in the Apigee KVM.

Example

Update entry to KVM with name "test1" and value "value1"

apigeetool updateKVMentry -u [email protected] -o sdoe -e test --mapName test-map --entryName test1 --entryValue value1

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.

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.

--mapName (required) The name of the map the entry will belong to.

--entryName (required) The name of the entry to be created.

--entryValue (required) The value of the entry to be created.

--environment -e (optional) The environment to target for an Environment-scoped KVM operation.

getKVMmap

Retrieves an entire KVM map with all of its entries, by name.

Example

Get map named "test-map".

apigeetool getKVMmap -u [email protected] -o sdoe -e test --mapName test-map

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.

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.

--mapName (required) The name of the map to be retrieved.

Optional parameters

--environment -e (optional) The environment to target for an Environment-scoped KVM operation.

--api -n (optional) The API to target for an API-scoped KVM operation.

getKVMentry

Retrieve an unencrypted KVM entry from an Apigee KVM map, by name.

Example

Retrieve the KVM entry named "test1" in the map "test-map".

apigeetool getKVMentry -u [email protected] -o sdoe -e test --mapName test-map --entryName test1

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.

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.

--mapName (required) The name of the map that the entry belongs to.

--entryName (required) The name of the entry to be retrieved.

Optional parameters

--environment -e (optional) The environment to target for an Environment-scoped KVM operation.

--api -n (optional) The API to target for an API-scoped KVM operation.

deleteKVMmap

Deletes an entire map from the Apigee KVM along with all of its entries.

Example

Delete map named "test-map".

apigeetool deleteKVMmap -u [email protected] -o sdoe -e test --mapName test-map

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.

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.

--mapName (required) The name of the map to be deleted.

Optional parameters

--environment -e (optional) The environment to target for an Environment-scoped KVM operation.

--api -n (optional) The API to target for an API-scoped KVM operation.

deleteKVMentry

Deletes a single entry by name from an Apigee KVM map.

Example

Delete entry named "test1" from the map named "test-map".

apigeetool deleteKVMmmap -u [email protected] -o sdoe -e test --mapName test-map --entryName test1

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.

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.

--mapName (required) The name of the map that the entry belongs to.

--entryName (required) The name of the entry to be deleted.

Optional parameters

--environment -e (optional) The environment to target for an Environment-scoped KVM operation.

--api -n (optional) The API to target for an API-scoped KVM operation.

Cache Operations

createcache

Creates a Cache with the given name.

Example

Create Cache map named "test-cache"

apigeetool createcache -u [email protected] -o sdoe -e test -z test-cache 

Create Cache map named "test-cache" (with description and expiry)

apigeetool createcache -u [email protected] -o sdoe -e test -z test-cache --description "sample key" --cacheExpiryInSecs 40000    

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.

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.

-z (required) The name of the cache to be created.

--environment -e (required) The environment to target.

--description (optional) The description of the cache to be created.

--cacheExpiryByDate (optional) Date by which the cache will expire. Date format must be mm-dd-yyyy.

--cacheExpiryInSecs (optional) Duration in seconds by which the cache will expire.

Target Server Operations

createTargetServer

Creates a Target Server with the given name.

Example

Create Target Server named "test-target" with SSL enabled.

apigeetool createTargetServer -N -o $ORG -e $ENV --targetServerName test-target --targetHost httpbin.org --targetPort 443 --targetSSL true

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.

See Common Parameters for a list of additional parameters, including the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

--organization -o (required) The organization to target.
--environment -e (required) The environment to target.
--targetServerName (required) The name of the Target Server to be created.
--targetHost (required) The hostname of the target.
--targetPort (required) The port number of the target.
--targetSSL (optional) Whether or not SSL is configured, defaults to none.
--targetEnabled (optional) Whether or not the Target Server itself is enabled, defaults to true.

updateTargetServer

Update a Target Server with the given name.

Examples

Update Target Server named "test-target" with SSL enabled.

apigeetool updateTargetServer -N -o $ORG -e $ENV --targetServerName test-target --targetHost httpbin.org --targetPort 443 --targetSSL true

Disable the Target Server named "test-target"

apigeetool updateTargetServer -N -o $ORG -e $ENV --targetServerName test-target --targetEnabled false

Enable the Target Server named "test-target"

apigeetool updateTargetServer -N -o $ORG -e $ENV --targetServerName test-target --targetEnabled true

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.

See Common Parameters for a list of additional parameters, including the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

--organization -o (required) The organization to target.
--environment -e (required) The environment to target.
--targetServerName (required) The name of the Target Server to be created.
--targetHost (optional) The hostname of the target.
--targetPort (optional) The port number of the target.
--targetSSL (optional) Whether or not SSL is configured, defaults to none.
--targetEnabled (optional) Whether or not the Target Server itself is enabled, defaults to true.

deleteTargetServer

Deletes a Target Server with the given name.

Example

Delete Target Server named "test-target".

apigeetool deleteTargetServer -N -o $ORG -e $ENV --targetServerName test-target

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.

See Common Parameters for a list of additional parameters, including the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

--organization -o (required) The organization to target.
--environment -e (required) The environment to target.
--targetServerName (required) The name of the Target Server to be deleted.

getTargetServer

Get details for a Target Server with the given name.

Example

Get Target Server named "test-target".

apigeetool getTargetServer -N -o $ORG -e $ENV --targetServerName test-target

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.

See Common Parameters for a list of additional parameters, including the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

--organization -o (required) The organization to target.
--environment -e (required) The environment to target.
--targetServerName (required) The name of the Target Server to be deleted.

listTargetServers

List Target Servers in a given environment.

Example

List Target Servers.

apigeetool listTargetServers -N -o $ORG -e $ENV

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.

See Common Parameters for a list of additional parameters, including the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

--organization -o (required) The organization to target.
--environment -e (required) The environment to target.

FlowHook Operations

Operations on the pre-defined FlowHook names:

  • PreProxyFlowHook
  • PreTargetFlowHook
  • PostTargetFlowHook
  • PostProxyFlowHook

attachFlowHook

Attach a deployed SharedFlow to one of the [named FlowHooks](#FlowHook Operations).

Example

Attach SharedFlow "GetLogValues" to "PreProxyFlowHook".

apigeetool attachFlowHook -N -o $ORG -e $ENV --flowHookName PreProxyFlowHook --sharedFlowName GetLogValues

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.

See Common Parameters for a list of additional parameters, including the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

--organization -o (required) The organization to target.
--environment -e (required) The environment to target.
--flowHookName (required) The pre-defined name of the FlowHook.
--sharedFlowName (required) The name of a deployed SharedFlow.

detachFlowHook

Detach a SharedFlow from one of the [named FlowHooks](#FlowHook Operations).

Example

Detach "PreProxyFlowHook".

apigeetool detachFlowHook -N -o $ORG -e $ENV --flowHookName PreProxyFlowHook

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.

See Common Parameters for a list of additional parameters, including the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

--organization -o (required) The organization to target.
--environment -e (required) The environment to target.
--flowHookName (required) The pre-defined name of the FlowHook.

getFlowHook

Get the SharedFlow currently attached to one of the [named FlowHooks](#FlowHook Operations).

Example

Detach "PreProxyFlowHook".

apigeetool getFlowHook -N -o $ORG -e $ENV --flowHookName PreProxyFlowHook

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.

See Common Parameters for a list of additional parameters, including the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

--organization -o (required) The organization to target.
--environment -e (required) The environment to target.
--flowHookName (required) The pre-defined name of the FlowHook.

Roles and Permissions Operations

Operations on Roles, Permissions and User assignment. The general flow is:

  • Create a role
  • Assign Permissions to the Role
  • Assign the Role to a User

createRole

Create a role.

Example

Create role "AllowGetUserRoles".

apigeetool createRole -N -o $ORG --roleName AllowGetUserRoles

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.

See Common Parameters for a list of additional parameters, including the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

--organization -o (required) The organization to target.
--roleName (required) The name for the role.

getRole

Get a role.

Example

Get role "AllowGetUserRoles".

apigeetool getRole -N -o $ORG --roleName AllowGetUserRoles

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.

See Common Parameters for a list of additional parameters, including the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

--organization -o (required) The organization to target.
--roleName (required) The name for the role.

deleteRole

Delete a role.

Example

Delete role "AllowGetUserRoles".

apigeetool deleteRole -N -o $ORG --roleName AllowGetUserRoles

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.

See Common Parameters for a list of additional parameters, including the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

--organization -o (required) The organization to target.
--roleName (required) The name for the role.

listProxies

List proxies

Example

apigeetool listProxies -t $TOKEN -o $ORG

listRoles

List roles.

Example

apigeetool listRoles -N -o $ORG

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.

See Common Parameters for a list of additional parameters, including the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

--organization -o (required) The organization to target.

setRolePermissions

Set Role Permissions for a Role.

Example

Set Permissions on Role "AllowGetUserRoles" to allow access to list Roles.

apigeetool setRolePermissions -N -o $ORG --roleName AllowGetUserRoles --permissions '[{"path":"/userroles","permissions":["get"]}]'

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.

See Common Parameters for a list of additional parameters, including the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

--organization -o (required) The organization to target.
--roleName (required) The name for the role.
--permissions Permissions array for path and verbs.

getRolePermissions

Get Role Permissions for a Role.

Example

Get Permissions on Role "AllowGetUserRoles".

apigeetool getRolePermissions -N -o $ORG --roleName AllowGetUserRoles

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.

See Common Parameters for a list of additional parameters, including the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

--organization -o (required) The organization to target.
--roleName (required) The name for the role.

assignUserRole

Assign existing User to a Role. NOTE: User must already exist in Edge.

Example

Assign "[email protected]" to Role "AllowGetUserRoles".

apigeetool assignUserRole -N -o $ORG --email "[email protected]" --roleName AllowGetUserRoles

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.

See Common Parameters for a list of additional parameters, including the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

--organization -o (required) The organization to target.
--email (required) Email for an existing User in Edge.
--roleName (required) The name for the role.

removeUserRole

Remove existing User from a Role.

Example

Remove "[email protected]" from Role "AllowGetUserRoles".

apigeetool removeUserRole -N -o $ORG --email "[email protected]" --roleName AllowGetUserRoles

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.

See Common Parameters for a list of additional parameters, including the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

--organization -o (required) The organization to target.
--email (required) Email for an existing User in Edge.
--roleName (required) The name for the role.

verifyUserRole

Verify User assigned to a Role.

Example

Verify "[email protected]" assigned to Role "AllowGetUserRoles".

apigeetool verifyUserRole -N -o $ORG --email "[email protected]" --roleName AllowGetUserRoles

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.

See Common Parameters for a list of additional parameters, including the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

--organization -o (required) The organization to target.
--email (required) Email for an existing User in Edge.
--roleName (required) The name for the role.

listRoleUsers

Get Users assigned to a Role.

Example

List Users assigned to Role "AllowGetUserRoles".

apigeetool listRoleUsers -N -o $ORG --roleName AllowGetUserRoles

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.

See Common Parameters for a list of additional parameters, including the "-u" and "-p" parameters for username and password or preferably -N for .netrc usage.

--organization -o (required) The organization to target.
--email (required) Email for an existing User in Edge.
--roleName (required) The name for the role.

SDK Reference

You could use apigeetool as an SDK to orchestrate tasks that you want to perform with Edge, for eg, deploying an api proxy or running tests etc.

Usage Example

var apigeetool = require('apigeetool')
var sdk = apigeetool.getPromiseSDK()
var opts = {
    organization: 'edge-org',
    username: 'edge-user',
    password: 'password',
    environments: 'environment',
}
opts.api = APIGEE_PROXY_NAME;
opts.directory = path.join(__dirname);

sdk.deployProxy(opts)
    .then(function(result){
        //deploy success
    },function(err){
        //deploy failed
    });

Create Developer

Creates a new Developer in Edge

Example

Create a developer.

    //see above for other required options
    opts.email = DEVELOPER_EMAIL
opts.firstName = 'Test'
opts.lastName = 'Test1'
opts.userName = 'runningFromTest123'
opts.attributes = [
    {
        name: "testAttribute",
        value: "newValue"
    }
]

sdk.createDeveloper(opts)
  .then(function(result){
    //developer created
  },function(err){
    //developer creation failed
  }) ;

Delete Developer

Delete a Developer in Edge

Example

    //see above for other required options
    opts.email = DEVELOPER_EMAIL

sdk.deleteDeveloper(opts)
  .then(function(result){
    //developer deleted
  },function(err){
    //developer delete failed
  }) ;

Create Product

Creates a new API Product in Edge

Example

opts.productName = APIGEE_PRODUCT_NAME
opts.productDesc = 'description'
opts.proxies = APIGEE_PROXY_NAME
opts.environments = 'test' //apigee env
opts.quota = '1', //quota amount
opts.quotaInterval = '1' //interval
opts.quotaTimeUnit = 'minute' //timeunit

sdk.createProduct(opts)
  .then(function(result){
    //product created
  },function(err){
    //product creation failed
  }) ;

Delete Product

Delete API Product in Edge

Example

opts.productName = APIGEE_PRODUCT_NAME

sdk.deleteProduct(opts)
  .then(function(result){
    //delete success
  },function(err){
    //delete failed
  }) ;

Create App

Create App in Edge

Example

  opts.name = APP_NAME
  opts.apiproducts = APIGEE_PRODUCT_NAME
  opts.email = DEVELOPER_EMAIL

  sdk.createApp(opts)
  .then(function(result){
    //create app done
  },function(err){
    //create app failed
  }) ;

Delete App

Delete App in Edge

Example

  opts.email = DEVELOPER_EMAIL
  opts.name = APP_NAME

  sdk.deleteApp(opts)
  .then(function(result){
    //delete app success
  },function(err){
    //delete app failed
  }) ;

Create App Key

Create App Key in Edge

Example

opts.key = APP_KEY;
opts.secret = APP_SECRET;
opts.developerId = DEVELOPER_EMAIL;
opts.appName = APP_NAME;
opts.apiProducts = PRODUCT_NAME;

sdk.createAppKey(opts)
.then(function(result){
  //create key/secret success
},function(err){
  //create key/secret failed
}) ;

Create Cache

Create Cache in Edge

Example

opts.cache = CACHE_RESOURCE_NAME;
sdk.createcache(opts)
.then(function(result){
    //cache create success
  },function(err){
    //cache create failed
  }) ;

Delete Cache

Delete Cache in Edge

Example

opts.cache = CACHE_RESOURCE_NAME;
sdk.deletecache(opts)
.then(function(result){
    //delete create success
  },function(err){
    //delete create failed
  }) ;

Some History

This module replaces the original "apigeetool" circa 2013, which was written in Python. It is also called "apigeetool" and resides here.

Running Remote Tests

To run tests that actually tickle and Apigee Edge organization, provide your Edge creds, org, env details in remotetest/testconfig.js similar to 'remotetest/testconfig-sample.js'

Contributing

See Contributing

apigeetool-node's People

Contributors

adammagaluk avatar artwise avatar davepickard1234 avatar deboraelkin2 avatar dibyom avatar dinochiesa avatar earth2marsh avatar gosunilgo avatar hiteshshahjee avatar kevinswiber avatar keyurkarnik avatar kidiyoor avatar kjshomper avatar kurtkanaskie avatar laughingbiscuit avatar msadasivam avatar msmol avatar mukundha avatar nickzoic avatar noahdietz avatar prabhatjha avatar riteshverma87 avatar robertalblas avatar siriscac avatar smolnikov avatar theganyo avatar whitlockjc avatar wwitman avatar wwoo avatar ypomortsev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

apigeetool-node's Issues

Error: Path /myproxy conflicts with existing deployment path for revision 13 of the APIProxy authorization in organization foo-organization

My CI tool just updated the npm package to 0.6.4 and now my deployments are broken because of the message

"Error: Path /myproxy conflicts with existing deployment path for revision 13 of the APIProxy authorization in foo-organization".

When I reverted back to 0.6.3 the deploy worked again, so there is something wrong with the version matching. It could well be that it is broken because of issue #54 . This was also broken for me, so I switched to the --api flag instead of -n.

The command that I ran:
apigeetool deployproxy -u ${bamboo_APIGEE_USERNAME} -p ${bamboo_APIGEE_PASSWORD} -o ${bamboo_APIGEE_ORGANIZATION} -e ${bamboo_APIGEE_ENVIRONMENT} --api $apiname -d .

Using deploynodeapp with -i throws error but successfully uploads the API.

$ apigeetool ... deploynodeapp -V -d . -e test -n mongo-nodejs1 -o merck -m api-mongo.js -b /v1/mongodb -i

API mongo-nodejs1 does not exist. Going to create revision 1
Creating revision 1 of API mongo-nodejs1
Uploading resource README.txt
Uploading resource api-mongo.js
Uploading resource node_modules.zip
Uploading resource package.json
Creating the target endpoint
Creating the proxy endpoint
Not deploying the proxy right now

TypeError: Cannot read property 'aPIProxy' of undefined
at Object.module.exports.parseDeploymentResult (/usr/local/lib/node_modules/apigeetool/lib/commands/parsedeployments.js:42:9)
at /usr/local/lib/node_modules/apigeetool/lib/commands/deploynodeapp.js:120:43
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:254:17
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:157:25
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:251:21
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:615:34
at deployProxy (/usr/local/lib/node_modules/apigeetool/lib/commands/deploynodeapp.js:449:5)
at async.series.deployResult (/usr/local/lib/node_modules/apigeetool/lib/commands/deploynodeapp.js:108:7)
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:610:21
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:249:17

Change virtualhost handling to default AND secure (by default)

Today when I create and deploy a proxy to Apigee through the UI, it uses both default and secure virtualhosts. Why is the behavior for apigeetool different? I would expect it to always use default and secure, though I could override that with a command line param if I wished.

--api alias -n broken

Throws Invalid arguments: Error: Unknown argument

Most likely caused by @DinoChiesa #37 as it's using the same alias

This caused our deployments to fail. We've had to work around this by using --api instead of -n.

Documentation is still showing -n as an alias of --api for deploynodeapp.

Can you please bump to a major version v1? This was a breaking change, but the version bump was done as a patch

cc @theganyo @mukundha

basepath specified in both proxy code and CLI causes deployment issues

(Originally reported by @antxxxx here: #25.)

When basepath is set in the proxy code - ie. if ProxyEndpoint/HTTPProxyConnection/BasePath is set and you pass basepath into apigeetool, you end up with a messed up deployment. When using this to deploy an already existing proxy, it created the new revision correctly, but when it did the deploy, it did not undeploy the old revision, so we ended up with two revisions deployed to the same environment.

To recreate this - create a new proxy with 2 revisions - both must have basepath set in the proxy
If you use the management api (which is what Apigeetool uses to deploy) ie - POST to https://api.enterprise.apigee.com/v1/organizations/{org_name}/environments/{env_name}/apis/{api_name}/revisions/{revision_number}/deployments
with body
action=deploy&override=true&delay=60&basepath=/v1/weather
Then you end up with both revisions showing as deployed.
If basepath is not set in the proxy, then passing basepath in the management api does work - although then the base bath does not show up on the web interface
If basepath is set in the proxy, then not passing basepath in the management api does work

Error: unexpected end of file

apigeetool deploynodeapp -o -e test -n -m index.js -b -v https_vhost -P

If I remove the parameter -P, the apiproxy uploads correctly, but I need to preserver-policies
Any help?

apigeetool deployproxy creates duplicate revisions

Using apigeetool 0.6.4 on windows 10 with node v4.6.1 yields interesting results when deployproxy is called:

multi-revision

I can reproduce this reliably and the new API version, while deployed, does not work until it is undeployed (which undeploys both versions) and redeployed.

The last messages from the deployproxy output are:

Final result: err = null for deployments = [
{
  "name":"yep*dev",
  "environment":"dev",
  "revision":8,
  "state":"deployed",
  "basePath":"/yep*-dev/v1",
  "uris":[
    "http://*dev.apigee.net/yep*-dev/v1/yep*-dev/v1",
    "https://*dev.apigee.net/yep*-dev/v1/yep*-dev/v1"
  ]
}]
"yep*-dev" Revision 8
  deployed
  environment = dev
  base path = /yep*-dev/v1
  URI = http://*-dev.apigee.net/yep*-dev/v1/yep*-dev/v1
  URI = https://*-dev.apigee.net/yep*-dev/v1/yep*-dev/v1

Please note that the API returns basePath twice in the URIs.

Re-deploying a Node.js proxy

We would like to use the agile approach of developing APIs. This means, we start small, with several features and then we constantly improve the API by adding more and more features.

In case of a Node.js base proxy, this means developing the API locally and repeatedly deploying it to Apigee. We use the deploynodeapp command of apigeetool. It is intended to be used for initial deployment. And this is actually our problem. If I deploy the Node.js app and add some Apigee policies to the proxy, next time I re-deploy the Node.js app, the policies get overwritten.

We need a way, how to repeatedly deploy a Node.js app without having to re-create all the policies we need. Or what is the proper way, how to do this?

I suppose I can use the deployproxy command, but first I need to zip all Node.js folders the way Apigee can consume them. Maybe there could be a parameter to the deployproxy command, which will make sure, that the ZIP files are created before the proxy is deployed.

The -n option does not work.

The -n option should be for specifying the "name" of the proxy. This option doesn't work anymore -- when I use "-n" in the command line, it is not recognized. Use of --api does work however. But, apigeetool isn't backward compatible for scripts that used "-n".

Also -- apigeetool -h shows two "-n" options (one for --api and one for --netrc). This should be cleaned up.

Per project configs

I wanted to query whether it would be possible to setup config files within our projects to specify common options such as base path etc which we could store in git.

This would make deployments much easier, and by requiring each person to have their username and password as a environment variable, it'd mitigate any leaking of sensitive data into git.

Obviously I could create a wrapper tool which performs this task and then simply builds up the command to execute, but it would be nicer for this functionality to be built into the tool itself.

Perhaps some sort of . rc file which can be automatically read if it exists, which sets default values such as baseuri etc, but can still be overridden directly in the command via the current flags.

I'm happy to open a PR implementing this, but file name and format need discussing first.

No access to 'context' variable

Hi, Im using A127 as my node.js template for Apigee Node app and im deploying it using apigeetool-node (deploynodeapp command).

Deployment is good but API is having an error("context is not defined") when I tried to use the 'context' variable. Im using it for getting a local variable from the KVM.
I've notice that apigeetool node is deploying under 'node' folder unlike when creating a javascript file, it is under jsc. When I try to create a JS script under jsc folder(using the UI) it has access to the 'context' variable.
Why is that so?

Broken in v0.10 and v0.12

/Users/adammagaluk/Software/Edge/apigeetool-node/node_modules/request/node_modules/hawk/node_modules/boom/lib/index.js:5
const Hoek = require('hoek');
^^^^^
SyntaxError: Use of const in strict mode.
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (/Users/adammagaluk/Software/Edge/apigeetool-node/node_modules/request/node_modules/hawk/lib/index.js:5:33)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

node proxy deployment create duplicate NPM modules

While deploying proxies having nodejs resource in opts['upload-modules'] = true; mode. Apigeetool creates multiple zips of different node_modules. eg node_modules_yaml.zip, node_modules_mustache.zip along with these it also creates node_modules.zip

node_modules.zip obviously has all the modules within hence we don't need node_modules_yaml.zip, node_modules_mustache.zip zips or need not create node_modules.zip and retain other zips.

Format of .netrc file is not documented

The new feature to read credentials from a .netrc file is potentially useful; however, the format of the .netrc file is not documented in the read me. What do the contents of this file look like, and is it placed in the home directory? Would a copy in the cwd override a home directory copy?

Deploy particular revison

Is there a way to use apigeetool to deploy a particular revision of the app to an environment? I know how to use deploynodeapp to deploy to an environment, but I would like to propagate an existing revision of the app from test to prod. Is that possible using apigeetool?

Deployment fails when a keystore or target server is added in the service callout policy

Deployment through the node tool fails during the validation of the policy schema when a keystore or target server is added to the service callout policy. When I create a zip of the same proxy bundle and upload it to management UI then it deploys fine.

Please find my keystore configuration in Service callout policy:

<HTTPTargetConnection>
  <URL>https://myURL.com</URL>
  <SSLInfo>
      <Enabled>true</Enabled>
      <ClientAuthEnabled>true</ClientAuthEnabled>
      <KeyStore>openiam_tls_keystore</KeyStore>
      <KeyAlias>openiam_tls_client_cert</KeyAlias>
  </SSLInfo>
</HTTPTargetConnection>

I tried to debug the issue and following is my understanding-

Apigee nodetool makes a post call to https://api.enterprise.apigee.com/v1/o//apis//revisions//policies with policy content in body and in response Apigee is throwing back the error:

"{\n  \"code\" : \"beans.OtherValidationError\",\n  \"message\" : \"Unexpected Validation Error null\",\n  \"contexts\" : [ ]\n}"

fetchproxy doesn't return control back to callback if success

request.get( { uri: uri, encoding: 'binary' }, function (err,res,body) {
    if (err) {
      cb(err);
    } else {
      if (opts.debug) {
        console.log ( 'Received: ' + res.statusCode + ' the following headers: ' + JSON.stringify(res.headers) );
      }
      if (res.statusCode !== 200) {
        cb(new Error(util.format('Received error %d when fetching proxy: %s',
                    res.statusCode, body)));
      } else {
        fs.writeFile(f, body, 'binary', function(err) {
            if (err) {
                console.log( "Failed to write file: " + f );
                console.log( "Error text: " + err );
            }
            else {
                console.log( 'Save file: ' + f );
            }
        });
      }
    }
  });

Ideally above code should call cb on success...

return cb(err);
//or
return cb(null);

apigeetool fails to upload proxy files (in some circumstances)

Hi all

We are using apigeetool to deploy our bundles via executing them from grunt shell.

We have 3 proxy files under /proxies folder:

  • admin.xml
  • default.xml
  • monitoring.xml

When using the latest version of apigeetool (0.6.1), we realised that none of the proxy files are imported into Apigee. Here is the full log:

Running "shell:deploy" (shell) task
deployproxy: {"debug":true,"verbose":true,"username":"email-address-for-deployment","password":{},"organization":"org-here","environments":"intg","api":"b2b-otaxml","directory":".","baseuri":"https://api.enterprise.apigee.com","asyncLimit":4}
Resolve NPM modules = false
Going to create revision 205 of API b2b-otaxml
Calling https://api.enterprise.apigee.com/v1/o/org-here/apis?action=import&validate=false&name=b2b-otaxml
Creating revision 205 of API b2b-otaxml
Uploading jsc resource AuthorizeIpAddress.js
Uploading jsc resource ConvertConfigurationToJson.js
Uploading jsc resource ExtractConfigurationVariables.js
Uploading jsc resource ExtractInvalidateCacheRequestVariables.js
Uploading jsc resource ModifyAvailabilityCacheResponse.js
Uploading jsc resource logglyDirect.js
Uploading node resource Gruntfile.js
Uploading node resource api/controllers/fitController.js
Uploading node resource api/controllers/statusController.js
Uploading node resource api/converters/availabilityConverter.js
Uploading node resource api/converters/cancellationConverter.js
Uploading node resource api/converters/fetchReservationConverter.js
Uploading node resource api/converters/reservationConverter.js
Uploading node resource api/handlers/invalidRequestHandler.js
Uploading node resource api/handlers/otaAvailabilityRequestHandler.js
Uploading node resource api/handlers/otaCancellationRequestHandler.js
Uploading node resource api/handlers/otaFetchReservationRequestHandler.js
Uploading node resource api/handlers/otaHandlers.js
Uploading node resource api/handlers/otaReservationHandler.js
Uploading node resource api/handlers/owsFetchReservationRequestHandler.js
Uploading node resource api/handlers/unacceptableRequestHandler.js
Uploading node resource api/helpers/cheerio.js
Uploading node resource api/helpers/config.js
Uploading node resource api/helpers/context.js
Uploading node resource api/helpers/librato.js
Uploading node resource api/helpers/logger.js
Uploading node resource api/helpers/loggly.js
Uploading node resource api/helpers/ows.js
Uploading node resource api/helpers/owsParams.js
Uploading node resource api/helpers/owsRequest.js
Uploading node resource api/helpers/resourceRequest.js
Uploading node resource api/helpers/template.js
Uploading node resource api/parsers/availabilityResponseParser.js
Uploading node resource api/parsers/cancellationResponseParser.js
Uploading node resource api/parsers/fetchReservationResponseParser.js
Uploading node resource api/parsers/fetchRoomResponseParser.js
Uploading node resource api/parsers/headerResponseParser.js
Uploading node resource api/parsers/otaAvailabilityRequestParser.js
Uploading node resource api/parsers/otaCancellationRequestParser.js
Uploading node resource api/parsers/otaFetchReservationRequestParser.js
Uploading node resource api/parsers/otaReservationRequestParser.js
Uploading node resource api/parsers/reservationResponseParser.js
Uploading node resource api/templates/availability.request.ows.xml
Uploading node resource api/templates/availability.response.ota.xml
Uploading node resource api/templates/cancellation.request.ows.xml
Uploading node resource api/templates/cancellation.response.ota.xml
Uploading node resource api/templates/fetch.reservation.request.ows.xml
Uploading node resource api/templates/fetch.reservation.response.ota.xml
Uploading node resource api/templates/fetchRoom.request.ows.xml
Uploading node resource api/templates/reservation.request.ows.xml
Uploading node resource api/templates/reservation.response.ota.xml
Uploading node resource api/validators/countryValidator.js
Uploading node resource api/validators/otaFetchReservationValidator.js
Uploading node resource app.js
Uploading node resource config/non-prod.json
Uploading node resource config/prod.json
Uploading node resource node_modules_apickli.zip
Uploading node resource node_modules_async.zip
Uploading node resource node_modules_builder-builder.zip
Uploading node resource node_modules_body-parser.zip
Uploading node resource node_modules_csvtojson.zip
Uploading node resource node_modules_del.zip
Uploading node resource node_modules_cheerio.zip
Uploading node resource node_modules_express.zip
Uploading node resource node_modules_i18n-iso-countries.zip
Uploading node resource node_modules_handlebars.zip
Uploading node resource node_modules_express-winston.zip
Uploading node resource node_modules_jstoxml.zip
Uploading node resource node_modules_librato-node.zip
Uploading node resource node_modules_mkdirp.zip
Uploading node resource node_modules_moment-range.zip
Uploading node resource node_modules_moment.zip
Uploading node resource node_modules_pretty-data.zip
Uploading node resource node_modules_nconf.zip
Uploading node resource node_modules_require-dir.zip
Uploading node resource node_modules_loggly.zip
Uploading node resource node_modules_shortid.zip
Uploading node resource node_modules_sinon.zip
Uploading node resource node_modules_underscore.zip
Uploading node resource node_modules_underscore.string.zip
Uploading node resource node_modules_winston.zip
Uploading node resource package.json
Uploading node resource node_modules_request.zip
Uploading node resource node_modules_winston-loggly.zip
Uploading policy AssignMessage.404.xml
Uploading policy AssignMessage.InvalidApiKeyForGivenResource.xml
Uploading policy AssignMessage.PutVariableValuesToResponseHeaders.xml
Uploading policy AssignMessage.ReturnStatusResponse.xml
Uploading policy AssignMessage.Set500ErrorVariables.xml
Uploading policy AssignMessage.SetApiKeyNotSuppliedErrorVariables.xml
Uploading policy AssignMessage.SetApigeeAuthenticationErrorVariables.xml
Uploading policy AssignMessage.SetDefaultContentType.xml
Uploading policy AssignMessage.SetIPAccessErrorVariables.xml
Uploading policy AssignMessage.SetInvalidApiKeyErrorVariables.xml
Uploading policy AssignMessage.SetQuotaErrorVariables.xml
Uploading policy AssignMessage.SetQuotaInfo.xml
Uploading policy AssignMessage.SetRequestorIdErrorVariables.xml
Uploading policy AssignMessage.SetSpikeErrorVariables.xml
Uploading policy AssignMessage.SetXmlValidationErrorVariables.xml
Uploading policy ExtractVariables.GetAvailabilityRequestVariables.xml
Uploading policy ExtractVariables.GetAvailabilityResponseVariables.xml
Uploading policy ExtractVariables.GetCancellationRequestVariables.xml
Uploading policy ExtractVariables.GetCancellationResponseVariables.xml
Uploading policy ExtractVariables.GetRequestMessageType.xml
Uploading policy ExtractVariables.GetReservationRequestVariables.xml
Uploading policy ExtractVariables.GetReservationResponseVariables.xml
Uploading policy InvalidateCache.AvailabilityResponse.xml
Uploading policy JavaScript.AuthorizeIpAddress.xml
Uploading policy JavaScript.ConvertConfigurationToJson.xml
Uploading policy JavaScript.ExtractConfigurationVariables.xml
Uploading policy JavaScript.ExtractInvalidateCacheRequestVariables.xml
Uploading policy JavaScript.ModifyAvailabilityCacheResponse.xml
Uploading policy JavaScript.SendToLoggly.xml
Uploading policy KeyValueMap.GetApiConfiguration.xml
Uploading policy LookupCache.GetApiConfiguration.xml
Uploading policy MessageValidation.Xml.xml
Uploading policy PopulateCache.ApiConfiguration.xml
Uploading policy Quota.HourlyApp.xml
Uploading policy RaiseFault.GoToFaultRules.xml
Uploading policy RaiseFault.Xml.xml
Uploading policy ResetQuota.HourlyApp.xml
Uploading policy ResponseCache.AvailabilityResponse.xml
Uploading policy ServiceCallout.AuthenticateToApigee.xml
Uploading policy SpikeArrest.Global.xml
Uploading policy StatisticsCollector.SetCustomData.xml
Uploading policy VerifyApiKey.ValidateAppId.xml
Uploading target default
Deploying revision 205 of b2b-otaxml to intg
Going to POST to https://api.enterprise.apigee.com/v1/o/org-here/e/intg/apis/b2b-otaxml/revisions/205/deployments
Going go send command action=deploy&override=true&delay=60
Deployment on intg result: "{\n  \"code\" : \"distribution.NoProxiesToDeploy\",\n  \"message\" : \"No proxies available in apiproxy b2b-otaxml and revision 205. At least one proxy required to deploy\",\n  \"contexts\" : [ ]\n}"
Error: No proxies available in apiproxy b2b-otaxml and revision 205. At least one proxy required to deploy
Error: No proxies available in apiproxy b2b-otaxml and revision 205. At least one proxy required to deploy
at Request._callback (/home/rof/.nvm/v0.10.36/lib/node_modules/apigeetool/lib/commands/deployproxy.js:652:12)
at Request.self.callback (/home/rof/.nvm/v0.10.36/lib/node_modules/apigeetool/node_modules/request/request.js:198:22)
at Request.emit (events.js:98:17)
at Request.<anonymous> (/home/rof/.nvm/v0.10.36/lib/node_modules/apigeetool/node_modules/request/request.js:1082:10)
at Request.emit (events.js:117:20)
at IncomingMessage.<anonymous> (/home/rof/.nvm/v0.10.36/lib/node_modules/apigeetool/node_modules/request/request.js:1009:12)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16
at process._tickCallback (node.js:442:13)
Warning: Command failed: Deployment on intg result: "{\n  \"code\" : \"distribution.NoProxiesToDeploy\",\n  \"message\" : \"No proxies available in apiproxy b2b-otaxml and revision 205. At least one proxy required to deploy\",\n  \"contexts\" : [ ]\n}"
Error: No proxies available in apiproxy b2b-otaxml and revision 205. At least one proxy required to deploy
Error: No proxies available in apiproxy b2b-otaxml and revision 205. At least one proxy required to deploy
at Request._callback (/home/rof/.nvm/v0.10.36/lib/node_modules/apigeetool/lib/commands/deployproxy.js:652:12)
at Request.self.callback (/home/rof/.nvm/v0.10.36/lib/node_modules/apigeetool/node_modules/request/request.js:198:22)
at Request.emit (events.js:98:17)
at Request.<anonymous> (/home/rof/.nvm/v0.10.36/lib/node_modules/apigeetool/node_modules/request/request.js:1082:10)
at Request.emit (events.js:117:20)
at IncomingMessage.<anonymous> (/home/rof/.nvm/v0.10.36/lib/node_modules/apigeetool/node_modules/request/request.js:1009:12)
at IncomingMessage.emit (events.js:117:20)
at _stream_readable.js:944:16
at process._tickCallback (node.js:442:13)
� Use --force to continue.

Have a look between these two lines - no proxy files:

Uploading target default
Deploying revision 205 of b2b-otaxml to intg

When I force our CI tool to revert to 0.5.4 of apigeetool, the whole build works fine (I haven't tried the versions in between):

Uploading target default
Uploading proxy admin
Uploading proxy default
Uploading proxy monitoring
Deploying revision 206 of b2b-otaxml to intg

Haven't had time to check the code myself yet.

Use configuration file instead of so many variables

Hi,

I would like to ask for a feature request.
Since it is too tedious to type everything in a single command like -o org -e environment
Also it is hard to maintain.
Can there be a file like '.apigee' where apigeetool node reads file for the options?
You may refer to AWS-cli, it can have many profiles with different environment setup.

deploynodeapp - remove requirement for main script in top-level directory

Please remove the requirement for the main script to reside in the top-level directory. This is unnecessary, and it forces me to adopt your directory structure for my app. For example, when i use -m .src/app.js, I get the following error:

Error: Main script file ./src/app.js must be in the top level directory

Here's how I worked around the problem:

  • Use -m app.js
  • Do a soft link as follows: ln -s .src/app.js app.js

Then everything works properly.

I consider this to be a defect. I don't want to use Apigee's directory structure, nor do I want it to influence my directory structure. Please remove the requirement that the main script must reside in the top-level directory structure. It will work just fine.

Please ignore devDependencies in deploynodeapp

I can't deploy on Apigee with my package.json "as is" with the -R option because the devDependencies that I use (e.g., gulp, etc.) are too large and exceeds the Proxy Bundle limit. As a workaround, I have to do the following:

  • Do npm install --production
  • Use the -U option

But this is still a defect. Please fix your deployment tool to use npm install --production. That way, you're just pulling in the dependencies from package.json, and everything works as expected.

Existing copy of a to be created zip file results in a 409 error

When running deployproxy on a proxy, it creates zipped copies of sub directories in the resources/node directory and uploads them. If there is already a file with that name in the directory (say you are editing an export), then it will upload both of them and error with a 409.

This should either be caught earlier, or the zip should be favored or ignored. At the very least, a specific error should be thrown.

New proxies created in Apigeetool are not automatically added to custom roles for edit

Background:
Create 2 users (user 1 and user 2) in custom role. The custom role has CREATE and VIEW abilities on all API proxies.

+Scenario 1 (this works as expected):+

  1. With user 1, create a new proxy in UI.
  2. Note that the new proxy is automatically added to the custom role in which the user belongs. The permissions include View, Edit and Delete, as well as Deploy on the new proxy.
  3. Now user 2 logs into UI and can edit the newly created proxy that was created by user 1.

+Scenario 2 (this fails)+

  1. With user 1, create a new proxy using Apigee tool (https://github.com/apigee/apigeetool-node#deployproxy)
  2. Note that you get a 403 forbidden back, but the proxy is still created. This is not the point of failure for this JIRA ticket (filed separately in APIRT-2122).
  3. Now user 2 logs into UI and CANNOT edit the newly created proxy that was created by user 1. The problem is that the new proxy is not automatically added to the custom role with the correct permissions (The permissions include View, Edit and Delete, as well as Deploy on the new proxy).

I think it is a bad user experience if the UI takes care of creating this entry in the custom role(prob via an additional MS API call), but Apigeetool does not. IMO these 2 tools should be at parity for this feature since both are officially supported by Apigee.

zip files and managing revisions

When deploying nodejs applications using apigeetool, all the folders are compressed (zipped) before they are deployed to Edge (the main script is not compressed). Generally speaking, I think it is a great idea when it comes to folders like node_modules. But the command compresses other folders also. for ex: when deploying an a127 project, it compresses the "controllers" folder. When this happens, I lose the ability to make the smallest of edits in Edge. Every edit made outside of Edge will result in a new revision. I wonder if it makes sense to have a file similar to a .npmignore that tells you what files/folders to not zip or perhaps only compress node_modules by default and leave everything else.

When running deployproxy with -i (just upload a new revision, don't deploy it), it works, but throws an error

When running deployproxy with -i (just upload a new revision, don't deploy it), it works, but throws an error (shown below). It seems to be still attempting to parse the deployment message, even though there isn't one.
+++++++++++++++++++++++++++++

Not deploying the proxy right now

TypeError: Cannot read property 'aPIProxy' of undefined
at Object.module.exports.parseDeploymentResult (/usr/local/lib/node_modules/apigeetool/lib/commands/parsedeployments.js:42:9)
at /usr/local/lib/node_modules/apigeetool/lib/commands/deployproxy.js:116:43
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:254:17
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:157:25
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:251:21
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:615:34
at deployProxy (/usr/local/lib/node_modules/apigeetool/lib/commands/deployproxy.js:576:5)
at async.series.deployResult (/usr/local/lib/node_modules/apigeetool/lib/commands/deployproxy.js:104:7)
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:610:21
at /usr/local/lib/node_modules/apigeetool/node_modules/async/lib/async.js:249:17

fetchproxy requires revision while docs says revision param is optional

As per the docs - the -r argument is optional for fetchproxy but when we try to run the command without the argument, it fails with the following error

$ apigeetool fetchproxy -u [email protected] -o saisarantest -n currency-v1

Error: org, api and revision must all be specified! {"username":"[email protected]","organization":"saisarantest","api":"currency-v1","interactive":true,"baseuri":"https://api.enterprise.apigee.com","asynclimit":4,"password":{}}

Favor package.json over -m for start script

package.json allows for defining the default start command (reference).

…
    "scripts": {
    "start": "node app.js"
    }
…

Keep the -m for the CLI to declare (or override) the main script to start, but if the declaration is in the package.json, Edge (or apigeetool) should use it.

deployproxy fails with a 500 error on large-ish proxy

I have a proxy which includes JWT creation (from https://github.com/apigee/iloveapis2015-jwt-jwe-jws) and thus includes some JARs, for a total of 2.7mb. When deploying this, it always fails with:

c:>apigeetool deployproxy -p password -u [email protected] -o organisation-name -n proxy-name -k -V -a 50 -i
...
Uploading java resource apigee-edge-callout-jwt-signed-1.0.6.jar
Uploading java resource json-smart-1.3.jar
Uploading java resource nimbus-jose-jwt-3.10.jar
Uploading java resource Utils-Callout.jar
...
Uploading policy VerifyAPIKey.xml
Error: Error uploading policy: 500
Error: Error uploading policy: 500
at Request._callback (C:..path..npm\node_modules\apigeetool\lib\commands\deployproxy.js:397:18)
at Request.self.callback (C:..path..npm\node_modules\apigeetool\node_modules\request\request.js:188:22)
at emitTwo (events.js:106:13)
at Request.emit (events.js:191:7)
at Request. (C:..path..npm\node_modules\apigeetool\node_modules\request\request.js:1171:10)
at emitOne (events.js:96:13)
at Request.emit (events.js:188:7)
at IncomingMessage. (C:..path..npm\node_modules\apigeetool\node_modules\request\request.js:1091:12)
at IncomingMessage.g (events.js:292:16)
at emitNone (events.js:91:20)

Uploading smaller proxies does work well.

Uploading a zip of the proxy via the Apigee UI works well (1-2 minutes).

Having looked at the Node source code, and tried uploading to a new proxy name, I'm expecting the uploader to make a zip file:

var zipBuf = ziputils.makeOneFileZip(ProxyBase, rootEntryName, rootDoc);

and upload that; however, it seems to upload the resources, policies, proxies and targets one by one.

Has anyone seen this behavior ?

Freddie Vander Elst

Error: unable to verify the first certificate

This isn't a defect in apigeetool, but I'm unable to use it behind my corporate firewall.
As long as I'm outside the firewall, apigeetool works properly.

I've tried the following, and no joy:

  • npm config set registry="http://registry.npmjs.org/"
  • npm config set strict-ssl false

Do you have any ideas for helping node get through/past the firewall?

Thanks.

Update to 'request' library breaks Apigeetool Node 0.10 compatibility

The recent update to Request (2.82.0) specifies "hawk": "~6.0.2" in its dependencies.

Request has marked 2.82.0 as compatible with "request": "^2.63.0" as specified by this project's package.json

The recent updates to Hawk will not work with Node < 4. The update makes Apigeetool incompatible with Node 0.10.32

running remotetests takes a looong time

The deploy proxy in remotetests steps takes about 50-60 seconds and sometimes timing out

Proposal
1 - use a simpler proxy with just express - there is no need to include node_modules if its just express, so the bundle size could become significantly smaller and deployment faster
2 - for non-nodejs test, we could use a simpler proxy that does not have nodejs resources - might fasten the tests

ApigeeTool is failing with non-cps orgs but passing in CPS orgs

Edge Cloud

I am able to recreate the issue

Error: KeyValueMap Operation CreateKeyValueMapEntry is not supported for the organization <org_name>

[CAN YOU REPRODUCE IN A TEST ORG?]
YES

[STEPS TO REPRODUCE]
Here is the snapshot. Where it passed are all CPS orgs and where it failed are non-CPS


phanim-macbookpro:~ phanim$ apigeetool addEntryToKVM -u -o <org_name_1> -e dev --mapName kvmap --entryName test1 --entryValue value1
Password: *********
Error: KeyValueMap Operation CreateKeyValueMapEntry is not supported for the organization <org_name>

phanim-macbookpro:~ phanim$ apigeetool addEntryToKVM -u -o <org_name_2> -e test --mapName testKVM --entryName phani_test_1 --entryValue value1
Password: *********
Error: KeyValueMap Operation CreateKeyValueMapEntry is not supported for the organization <org_name_2>

phanim-macbookpro:~ phanim$ apigeetool addEntryToKVM -u -o <org_name_3> -e test --mapName test --entryName phani_test_1 --entryValue value1
Password: *********
{"name":"phani_test_1","value":"value1"}

phanim-macbookpro:~ phanim$ apigeetool addEntryToKVM -u -o <org_name_4> -e test --mapName test --entryName phani_test_1 --entryValue value1
Password: *********
{"name":"phani_test_1","value":"value1"}

phanim-macbookpro:~ phanim$ apigeetool addEntryToKVM -u -o <org_name_5> -e stage --mapName test --entryName phani_test_1 --entryValue value1
Password: *********
Error: KeyValueMap Operation CreateKeyValueMapEntry is not supported for the organization <org_name_5>


[ADDITIONAL DETAILS, LINKS TO LOGS, DUMPS, SCREENSHOTS, ETC]

I think, the apigeeTool is using CPS based API

Just looked into Apigee Tool code
https://github.com/apigee/apigeetool-node/blob/master/lib/commands/addEntryToKVM.js

The request URL that is being formed is
uri = util.format('%s/v1/o/%s/e/%s/keyvaluemaps/%s/entries', opts.baseuri, opts.organization, opts.environment, opts.mapName);

It is a CPS request so fails in non-CPS

Do we fix code in ApigeeTool?

CPS API :
https://apidocs.apigee.com/management/apis/post/organizations/%7Borg_name%7D/keyvaluemaps/%7Bmap_name%7D/entries

MFA Support

Is there any plan to add MFA support for apigeetool?

API errors not reported?

@theganyo or who else this concerns

It looks like the -V or --debug -D flags don't return errors from the API itself. Here's what I'm getting back:

Please report a bug if this causes problems.
Error: Error: Error uploading policy: 400
Error: Error uploading policy: 400
    at Request._callback (/usr/local/lib/node_modules/apigeetool/lib/commands/deployproxy.js:376:18)
    at Request.self.callback (/usr/local/lib/node_modules/apigeetool/node_modules/request/request.js:123:22)
    at emitTwo (events.js:87:13)
    at Request.emit (events.js:172:7)
    at Request.<anonymous> (/usr/local/lib/node_modules/apigeetool/node_modules/request/request.js:1047:14)
    at emitOne (events.js:82:20)
    at Request.emit (events.js:169:7)
    at IncomingMessage.<anonymous> (/usr/local/lib/node_modules/apigeetool/node_modules/request/request.js:998:12)
    at emitNone (events.js:72:20)
    at IncomingMessage.emit (events.js:166:7)

Is there an option I'm missing here? At first glance, the error messages don't seem to be printed out the console:

}, function(err, req, body) {
if (err) {
itemDone(err);
} else if ((req.statusCode === 200) || (req.statusCode === 201)) {
itemDone();
} else {
itemDone(new Error(util.format('Error uploading policy: %s',
req.statusCode)));
}

Though I haven't done a deep-dive into the code yet. Let me know how I can help. Thanks!

apigeetool when deploying a proxy doesn't support setting the virtualhosts as in deploying a nodeapp

We have our own instance of Apigee and when trying to deploy a node app we do the following:

apigeetool deploynodeapp -u [email protected] -o sdoe -e test -n 'Test Node App 2' -d . -m app.js -b /node2 -v 'default,secure'

But this same option is not available when deploying a proxy:

apigeetool deployproxy  -u [email protected] -o sdoe  -e test -n example-proxy -d .

you can't do this:

apigeetool deployproxy  -u [email protected] -o sdoe  -e test -n example-proxy -d . -v 'default,secure'

Any ideas how to overcome this without defining it into the XML code?
Thanks.

Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE when working with on premise SSL endpoint

We have our own instance of Apigee and when trying to use our SSL endpoint (base URL) with apigeetool, I get:

Error: UNABLE_TO_VERIFY_LEAF_SIGNATURE
    at SecurePair.<anonymous> (tls.js:1380:32)
    at SecurePair.emit (events.js:92:17)
    at SecurePair.maybeInitFinished (tls.js:979:10)
    at CleartextStream.read [as _read] (tls.js:471:13)
    at CleartextStream.Readable.read (_stream_readable.js:340:10)
    at EncryptedStream.write [as _write] (tls.js:368:25)
    at doWrite (_stream_writable.js:225:10)
    at writeOrBuffer (_stream_writable.js:215:5)
    at EncryptedStream.Writable.write (_stream_writable.js:182:11)
    at write (_stream_readable.js:601:24)

There should be a way, how to specify the certificate used for validation of the endpoint certificate.

Any ideas how this can be done?

Thanks.

Use same pattern for vhosts with environments

While you can specify multiple virtualhosts at once, like -v secure,default but you cannot specify multiple environments in this way. It would be handy to have the same pattern, so one could use -e test,prod to deploy to both proxies at once.

Add configuration to set commonly used values

It would be great if I could set my apigeetool config properties, like username and org so that I didn't have to supply them with every request. These might be configured using something like apigeetool config user [email protected] and would include a config listing.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.