# CLI for Managing WSO2 Micro Integrator

## For WSO2 Micro Integrator 4.3.0

Command Line tool for managing WSO2 Micro Integrator

## Getting Started

- ### Running

  Select a generated archive suitable for your platform (Mac, Windows, Linux) and extract it to a desired location and `cd` into it.
  Then execute `mi` to start the application.

  > NOTE: Execute `./mi` if the working directory is the same where the executable resides

  > Add the location of extracted folder to your system's $PATH variable to access the executable from anywhere

  Execute `mi --help` for further instructions.

- ### Command Autocompletion (For Bash Only)

  Copy the file `mi_bash_completions.sh` to `/etc/bash_completion.d/` and source it with
  `source /etc/bash_completion.d/mi_bash_completions.sh` to enable bash auto-completion.

## Usage

         mi [command]

#### Global Flags

          --verbose
               Enable verbose logs (Provides more information on execution)
          --insecure, -k
              Allow connections to SSL sites without certs
          --help, -h
              Display information and example usage of a command

### Commands

- #### mi login [environment]

         Flags:
             Optional:
                 --username, -u
                 --password, -p
                 NOTE: user will be prompted to enter credentials if they are not provided with these flags
         Examples:
             mi login dev -u admin -p admin
             mi login dev -u admin
             mi login dev
             cat ~/.mypassword | mi login dev -u admin

- #### mi logout [environment]

         Examples:
             mi logout dev

- #### mi get apis [api-name]

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --format
            Examples:
                mi get apis -e dev
                mi get apis SampleAPI -e dev

- #### mi get composite-apps [app-name]

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --format
            Examples:
                mi get composite-apps -e dev
                mi get composite-apps SampleApp -e dev

- #### mi get connectors

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --format
            Examples:
                mi get connectors -e dev

- #### mi get data-services [dataservice-name]

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --format
            Examples:
                mi get data-services -e dev
                mi get data-services SampleDataService -e dev

- #### mi get endpoints [endpoint-name]

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --format
            Examples:
                mi get endpoints -e dev
                mi get endpoints SampleEndpoint -e dev

- #### mi get inbound-endpoints [inbound-name]

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --format
            Examples:
                mi get inbound-endpoints -e dev
                mi get inbound-endpoints SampleInboundEndpoint -e dev

- #### mi get local-entries [localentry-name]

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --format
            Examples:
                mi get local-entries -e dev
                mi get local-entries SampleLocalEntry -e dev

- #### mi get log-levels [logger-name]

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --format
            Examples:
                mi get log-levels org-apache-coyote -e dev

- #### mi get logs [file-name]

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --format
                    --path, -p
            Examples:
                mi get logs -e dev
                mi get logs wso2error.log -p ./logs -e dev

- #### mi get message-processors [messageprocessor-name]

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --format
            Examples:
                mi get message-processors -e dev
                mi get message-processors TestMessageProcessor -e dev

- #### mi get message-stores [messagestore-name]

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --format
            Examples:
                mi get message-stores -e dev
                mi get message-stores TestMessageStore -e dev

- #### mi get proxy-services [proxy-name]

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --format
            Examples:
                mi get proxy-services -e dev
                mi get proxy-services SampleProxy -e dev

- #### mi get sequences [sequence-name]

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --format
            Examples:
                mi get sequences -e dev
                mi get sequences SampleSequence -e dev

- #### mi get tasks [task-name]

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --format
            Examples:
                mi get tasks -e dev
                mi get tasks SampleTask -e dev

- #### mi get templates [template-type] [template-name]

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --format
            Examples:
                mi get templates -e dev
                mi get templates endpoint -e dev
                mi get templates endpoint SampleEPTemplate -e dev

- #### mi get transaction-counts [year] [month]

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --format
            Examples:
                mi get transaction-counts -e dev
                mi get transaction-counts 2020 06 -e dev

- #### mi get transaction-reports [start] [end]

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --format
                    --path, -p
            Examples:
                mi get transaction-reports 2020-01 2020-05 -e dev
                mi get transaction-reports 2020-05 2020-06 --path ./reports -e dev

- #### mi get users [user-name]

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --format
                    --role, -r
                    --pattern, -p
                    --domain, -d
            Examples:
                mi get users capp-tester -e dev
                mi get users capp-tester -r admin -e dev
                mi get users capp-tester -p mi -e dev
                mi get users capp-tester -d wso2.com -e dev

- #### mi get roles [role-name]

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --domain, -d
            Examples:
                mi get roles -e dev
                mi get roles tester -e dev
                mi get roles tester -d wso2.com -e dev

- #### mi add user [user-name]

            Flags:
                Required:
                    --environment, -e
            Examples:
                mi add user capp-tester -e dev

- #### mi add role [role-name]

            Flags:
                Required:
                    --environment, -e
            Examples:
                mi add role tester -e dev

- #### mi add log-level [logger-name] [class-name] [log-level]

            Flags:
                Required:
                    --environment, -e
            Examples:
                mi add log-level synapse-api org.apache.synapse.rest.API DEBUG -e dev

- #### mi update log-level [logger-name] [log-level]

            Flags:
                Required:
                    --environment, -e
            Examples:
                mi update log-level org-apache-coyote DEBUG -e dev

- #### mi update hashicorp-secret [secret-id]

            Flags:
                Required:
                    --environment, -e
            Examples:
                mi update hashicorp-secret secret_id -e dev

- #### mi update user [user-name]

            Flags:
                Required:
                    --environment, -e
            Examples:
                mi update user capp-tester -e dev

- #### mi delete user [user-name]

            Flags:
                Required:
                    --environment, -e
            Examples:
                mi delete user capp-developer -e dev

- #### mi delete role [role-name]

            Flags:
                Required:
                    --environment, -e
                Optional:
                    --domain, -d
            Examples:
                mi delete role capp-tester -e dev
                mi delete role capp-tester -d wso2.com -e dev

- #### mi activate endpoint [endpoint-name]

            Flags:
                Required:
                    --environment, -e
            Examples:
                mi activate endpoint TestEP -e dev

- #### mi activate proxy-service [proxy-name]

            Flags:
                Required:
                    --environment, -e
            Examples:
                mi activate proxy-service SampleProxy -e dev

- #### mi activate message-processor [messageprocessor-name]

            Flags:
                Required:
                    --environment, -e
            Examples:
                mi activate message-processor TestMessageProcessor -e dev

- #### mi deactivate endpoint [endpoint-name]

            Flags:
                Required:
                    --environment, -e
            Examples:
                mi deactivate endpoint TestEP -e dev

- #### mi deactivate proxy-service [proxy-name]

            Flags:
                Required:
                    --environment, -e
            Examples:
                mi deactivate proxy-service SampleProxy -e dev

- #### mi deactivate message-processor [messageprocessor-name]

            Flags:
                Required:
                    --environment, -e
            Examples:
                mi deactivate message-processor TestMessageProcessor -e dev