Espresso Logic has introduced a new administrators command line tool to create and maintain a project and project internals for a running REST Server. In the prior blog, we talked about the command line tool for making REST calls to resources in a running Espresso server. Understanding the administrative command line requires some knowledge of the underlying organization of the Espresso Logic meta model (schema) used internally to manage REST API, Database connections, Resources, Security, Business Logic, and Application definitions. Once you have your appliance, installation, or cloud server started you can either use the browser based Espresso logic Design Studio or the Node.js command line interface found on GitHub. The server is organized into projects and each project has a set of properties and services used to build, secure, and maintain REST endpoints.
Installation
$npm install espresso-admin-cli
Logon
Once you have installed the admin command line, you begin with a the logon credentials provided by Espresso Logic.
espressoadmin login <url> -u <user-name> -p <password> [-a <alias>]
Schema
The command line interface and the web design studio both provide service level interfaces to list, create, update, and delete various elements of a project. These elements are shown below in the schema and include authentication providers, users and roles, resources and business rules.
Command Line Services
The command line services provide a way to add, change, list, or remove various components of your Espresso Logic REST server.
$ espressoadmin --help Usage: espressoadmin [options] [command] Commands: login [options] <url> Login to an Espresso Logic server logout [options] [url] Logout from the current server, or a specific server use <alias> Use the specified server by default status Show the current server, and any defined server aliases database [options] <list|create|update|delete> Administer databases within a project. resource [options] <list> Administer resources within a project. rule [options] <list|create|delete> Administer rules within a project. authprovider <list> Administer authentication providers for an account. Options: -h, --help output usage information -V, --version output the version number
Project
A server may have one or more projects. The project is the container that is used for all of the remaining services. The entire content of a project can be imported or exported to a JSON file.
espressoadmin project create --project_name <name> --url_name <url_name> [--status <A|I>] [--comments <comments>] [--verbose]
Database Connections
Espresso Logic supports many database types. A Database connection is used to read the schema information and create RESTful endpoints for tables, views, and stored procedures (if supported by the database). See the GitHub page for details of supported database types. Each project has a main database (you can also integrate MongoDB databases, and use JavaScript to integrate other data sources). You can define multiple active databases,each with their own distinct prefix. Inactive databases may have prefix values that are not unique. When an inactive database is made active, any active database with the same prefix is made inactive. Multiple entries with the same prefix might be used for test, development, production environments. For more details on multi-database and relationship support see the online documentation pages.
espressoadmin database create --name <name> --user_name <db-user-name> --password <db-password> --url <db-url> --dbasetype <type> [--prefix <prefix>] [--catalog_name <catalog>] [--schema_name <schema>] [--port_num <port>] [--comments <comments>]
Rules and Events
Business rules are automatically invoked when a POST/PUT or DELETE is sent tot he REST server. The servers reactive logic engine will determine which derivations, validations and events to process in a multi-table transaction.
Rule Command Line
The command line interface allows the listing, creation, and management of different rule types. Rules (aka Live Logic) can be applied at the column attribute level (called derivations to perform sums, counts, formula, replication) and validations on table entity objects. Events can be added using JavaScript and applied at different points in the business logic transaction.
Usage: rule [options] <list|create|delete> Options: -h, --help output usage information --ruletype [type] The type of the rule, can be: sum,formula,validation,parentcopy --entity_name [prefix:table] The table, qualified with a prefix, for the rule --attribute_name [name] The name of the attribute whose value is computed by the rule. Required for sum, count, formula, minimum, maximum. --role_name [name] The role name - required for sum, count, minimum, maximum --clause [clause] The clause - required for sum, count, minimum, maximum --child_attribute [name] The name of the child attribute - required for sum, minimum, maximum --parent_attribute [name] The name of the parent attribute - required for parent copy --expression [code] The code for the rule - required for formula,events and validations --error_message [message] The error mesaage for the rule - required for validations --rule_name [name] Optional: a name for the rule. If not specified, a name will be generated. --comments [comments] Optional: a comment for the rule --active [true|false] Optional: whether the rule should be active, true by default --project_ident The ident of a project, if other than the current project --ident [ident] For delete, the ident of the rule to delete
Authentication Providers
All communication with the Espresso Logic server is done by API calls using JSON/REST. The authentication provider is the way to talk to an Espresso Logic server. User Authentication results in a new API key, which is passed on all subsequent requests, and associates a set of security roles that define what the API key is authorized to do. For details on adding custom authentication services such as Active Directory, LDAP, REST, SQL, or Stormpath see the documentation pages.
espressoadmin authprovider list
Logout
Use the logout command to end your working session.
espressoadmin logout [-a <alias>]
Summary
Espresso Logic provides a Node.js SDK for developers to work with REST endpoints as well as a Node.JS command line interface module in GitHub. This early version of the Node.JS admin command line does not have all the features and functions found in the web based design studio. The design studio itself is built on top of REST API calls to the meta schema. All of the services and features can be called directly from REST API services.