module Morpheus::Cli::RestCommand

RestCommand is a mixin for Morpheus::Cli command classes. Provides basic CRUD commands: list, get, add, update, remove Currently the command class must also include Morpheus::Cli::CliCommand The command class can define a few variables to dictate what the resource is called and the the api interface used to fetch the records. The command class or helper must also provide several methods to provide the default behavior. In the example below, the command (helper) defines the following methods:

* load_balancer_object_key() - Key name of object returned by the "get" api endpoint.
* load_balancer_list_key() - Key name of array of records returned by the "list" api endpoint.
* load_balancer_column_definitions() - Column definitions for the "get" command display output.
* load_balancer_list_column_definitions() - Column definitions for the "list" command display output.

Example of a RestCommand for ‘morpheus load-balancers`.

class Morpheus::Cli::LoadBalancers

include Morpheus::Cli::CliCommand
include Morpheus::Cli::RestCommand
include Morpheus::Cli::LoadBalancersHelper

# All of the example settings below are redundant
# and would be the default values if not set.
set_rest_name :load_balancers
set_rest_label "Load Balancer"
set_rest_label_plural "Load Balancers"
set_rest_object_key "load_balancer"
set_rest_has_type true
set_rest_type "load_balancer_types"
register_interfaces :load_balancers, :load_balancer_types

end