npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

apigeecli

v0.5.2

Published

A command line tool to manage deployments in Apigee.

Downloads

167

Readme

Shoutpoint's Apigee CLI

Sometimes, managing your Apigee deployments are a little harder than it has to be.

This command line tool provides some convenient helpers to ease deployment tasks via Apigee's Management API.

#####Apigee -- http://www.apigee.com

API management, analytics, and security are at the heart of modern digital architecture. Apigee offers a complete solution for moving business to the digital world.


Installation

apigeecli is a Node.js module that you can install using npm:

npm install -g apigee

NOTE: The -g option places the apigeecli 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 apigeecli command to your PATH manually.

Hello, Apigee

Once apigeecli is installed, you can run this command to get a list of your proxies.

apigeecli list apis --auth username:password --org myorgname

Note: Be sure to replace username, password and myorgname with your settings.


Features


Common Parameters

--auth

Optional. Set your Apigee credentials if --Config or a global config file is not set.

-C --Config

Optional. Set the path to your configuration file. Ommit if a global config file is set.

--org

Optional. Set your Apigee organization if --Config or a global config file is not set.

--noPrompts

Optional. Some commands will prompt you for further actions. Set this flag to disable prompts.


Command reference and examples

List Resources (apis, developers, environments and files)

List the specified resource.

apigeecli list <resource>
  • resource - apis, developers, environments, files
Resource Details (apis, developers, environments and files)

Display the details of the specified resource.

apigeecli detail <resource> <id>
  • resource - apis, developers, environments
  • id - the api name, deveoler id, or environment name.
Upload Resource Files (Org and Env)

Upload a resource file to the organization- or environment-level.

apigeecli upload file <path> [<environment>] [--type <type>] [--update]
  • path - the path to the file to upload.
  • environment - the destination environment. Omit for org-level upload.
  • type - the file(s) type: jsc, java, py, node, wsdl, xsd, xsl. Default: jsc. Optional.
  • --update - include this flag to update an existing resource file.
Download Resource Files (Org and Env)

Download a resource file.

apigeecli download file <path> <name> [<environment>] [--type <type>] [--encoding <encoding>]
  • path - the path to save the file, without filename. "./" for root.
  • name - the resource file's name.
  • environment - the environment to find the file. Omit for org-level.
  • type - the file(s) type: jsc, java, py, node, wsdl, xsd, xsl. Default: jsc. Optional.
  • encoding - the encoding format of the saved file: utf8, binary. Default: utf8. Optional.
Delete a Resource File

Delete the specified resource file.

apigeecli delete file <name> [<environment>]
  • name - the resource file's name.
  • environment - the environment to find the file. Omit for org-level.
Delete Proxy Revisions

Delete one or more proxy revisions. Much easier then using the GUI.

apigeecli delete revisions <name> <revisions>
  • name - the name of the proxy.
  • revisions - the revisions to delete. Examples:
    • 1,2,3
    • 1-9
    • 1,3,5-8,10,12,14-20
Convert Proxy Revision from environment to environment

Convert a revision of a proxy from one environment to another via find and replace.

apigeecli convert <name> <revision> <src> <dest> [--map <path>] [--find <list1> --replace <list2> [--delim <char>]] [--outDir <dir>] [--noNewRev]
  • name - the name of the proxy to convert.
  • revision - the revision of the proxy.
  • src - the source environment name, the "find" map key.
  • dest - the destination environment, the "replace" map key.
  • path - the path to the mapping file. Optional.
  • list1 - a delimited list to search for. Optional. Used when no mapping file.
  • list2 - a delimited list to replace list1. Optional. Used when no mapping file.
  • char - the list delimiter for list1 and list2. Default: pipe (|). Optional.
  • dir - the directory to output the converted files. Optional. Omit to not save local files.
  • --noNewRev - stops the converted files from being saved as a new revision. Useful when used with --outDir.

Prompt Flow

Many commands will end with a prompt to drill down for more detail or to execute tasks. For example:

  • Get a list of your proxies.
  • Enter the number of a proxy.
  • See a list of revisions under the proxy.
  • Enter the number of a revision to convert.
  • Enter the source environment of the revision.
  • Enter the the destination environment.

The tool will run the convert task on the revision and save it as a new revision.

Note: disable prompts with the --noPrompts flag.


Configuring Your Apigee Credentials

apigeecli will look for your credentials in the following order:

  • In the command itself with --auth and --org.
  • In the root-level ./apigee_config.json config file.
  • In the global config file set with apigeecli config save -g.

You can CRUD your global app credentials with the following command.

apigeecli config save|delete|echo --org myOrg --auth username:password -g
Credentials File Example

You can manually set a JSON file named apigee_config.json with your credentials.

{
 "org": "MyOrganization",
 "auth": "username:password"
}

Apigee Environments Mapping File

You can setup a file that contains a list of strings to find and replace throughout your deployed proxies.

For example, running the command:

apigeecli convert proxyName 5 dev qa --map "map.json"

Will download the dev version of your proxyName proxy, find and replace the substrings in the map.json file, save it as a new revision, and deploy it under the qa environment.

Sample mapping file:

{
  "dev": [
    "dev.yourdomain.com",
    "s3.amazonaws.com/com.yourdomain.api-dev"
  ],

  "qa": [
    "qa.yourdomain.com",
    "s3.amazonaws.com/com.yourdomain.api-qa"
  ],

  "prod": [
    "prod.yourdomain.com",
    "s3.amazonaws.com/com.yourdomain.api"
  ]
}

Needless to say, be careful with the substrings you choose to find/replace. Use longer substrings to prevent inadvertant replaces from happening.


Copyright and license

Copyright (c) 2016, Shoutpoint, Inc.

Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted, provided that the above copyright notice and this permission notice appear in all copies.

THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.