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

edge-cli

v1.1.0

Published

Apigee Edge Command Line Interface

Downloads

12

Readme

Apigee Edge Command-Line Interface

A CLI with support for features missing in the Edge UI like managing environment resource files and target servers as well as advanced proxy deployments. Useful for CI/CD and offline proxy development.

Reduces number of uploaded proxy revisions by comparing and reusing revisions by checksum.

Tested with Apigee Edge 4.16.05.00 (On-Premise).

Installation

npm install edge-cli -g

Usage

# Show help
edge help

# Show version
edge version

# Manage accounts on your machine
# Accounts are tuples of:
# (URL to management API, Username, Password, Organization, Environment)
#
# Do this once for every combination you're using
edge account list
edge account setup <account-name> # interactive mode, new or existing accounts
edge account setup <account-name> <url> <username> <password> <org> <env>
edge account set <account-name> url|username|password|org|env <value>
edge account delete <account-name>

# Config (including accounts) is written to .edge in your home directory
# You can select an alternate config file with -c or --config
edge <command> -c /my/.edge
edge <command> --config /my/.edge

# Most commands require an apigee edge account
# Specify the account name with -a or --account
edge <command> -a <account>
edge <command> --account <account>

# Manage resources
# <source> is a path to a resource file
edge resource list
edge resource get <type>/<name>
edge resource deploy <source> <type>/<name>
edge resource delete <type>/<name>

# Manage target servers
# <source> is a path to a xml or json target server
edge targetServer list
edge targetServer get <name>
edge targetServer deploy <source> <name>
edge targetServer delete <name>

# Manage proxies
# <source> is a path to a proxy bundle directory (edge-cli will zip for you)
# <name> is the API proxy name

# Validate proxy
edge proxy validate <source> <name>

# Deploy new or existing revision
# Before that, undeploy existing revision(s) and upload <source> as new revision
# OR skip upload if any existing revision is identical via checksum
edge proxy deploy <source> <name>

# Undeploy existing revision(s)
edge proxy undeploy <name>

# Overwrite <revision> with <source>
# Upload is skipped if the revision is identical via checksum
# Useful for development:
# Pick a development revision number and only update that
edge proxy updateRevision <source> <name> <revision>

# Deploy specific revision
edge proxy deployRevision <name> <revision>

# Completely remove a proxy
edge proxy remove <name>

# Generate an API policy from a Swagger file
# The policy stores the Swagger data in the "api" variable
# In a proxy response flow, the policy also writes the Swagger JSON to the response body
# - <target>/policies/api.xml
# - <target>/resources/jsc/api.js
# <swagger> defaults to "swagger.yaml"
# <target> defaults to "apiproxy"
edge generate apiPolicy <swagger> <target>

#
# Manage products
#

# List the names of all products
edge product list

# Get the details of a product
edge product get <name>

# Create or update a product.
# The name of the product to be created or updated will be determined
# from the attribute 'name' in the source.
# The source must conform to the format defined in
# http://docs.apigee.com/management/apis/post/organizations/%7Borg_name%7D/apiproducts
edge product deploy <source>

Examples

# Basic configuration
edge account setup test # interactively setup a "test" account
edge account setup test http://apiproxy-admin-test:8080 [email protected] secret md dev

# Deploy a proxy
# Deployment is idempotent; revisions are compared and reused by checksum
edge proxy deploy apiproxy myproxy -a dev
edge proxy deploy apiproxy myproxy -a dev # no changes if proxy is not changed

# List target servers of organization 'md' and environment 'dev'
edge targetServer list -a dev

# Deploy a target server
edge targetServer deploy myTargetServer.json MY_TARGET_SERVER -a dev

# with myTargetServer.json being
# {
#   "host" : "xxxx",
#   "isEnabled" : false,
#   "name" : "MY_TARGET_SERVER",
#   "port" : 9000
# }

# xml works as well
# <TargetServer name="MY_TARGET_SERVER">
#   <Host>xxxx</Host>
#   <Port>9000</Port>
#   <IsEnabled>false</IsEnabled>
# </TargetServer>

See Load balancing across backend servers (Apigee) for details on target servers.

Tests

To run tests you need a real (dev) account set up using edge account setup .... You have to export ACCOUNT and URL (the base URL of the Edge environment) when running the tests, for example:

ACCOUNT=dev URL=http://api-dev.foo.bar npm test

Note: The tests compute checksums over their fixtures which are only valid if all files in test/apiproxy are LF-based. Use git config core.autocrlf input to pull LFs correctly.