# TiloRes CLI

TiloRes CLI is the tool to create and manage your TiloRes project and instance.

# Installation

TiloRes CLI requires go to be installed. Follow the official documentation if you don't have go installed: https://golang.org/doc/install

Verify your go installation afterwards by running

go version

Afterwards, install and verify the TiloRes CLI:

go install github.com/tilotech/tilores-cli@latest
tilores-cli version

# Commands

The following commands can be used with the TiloRes CLI.

# deploy

Deploys an instance of TiloRes into your own AWS account.

You can only deploy if you have a valid license and your AWS account has been registered by our service team (service@tilotech.io).

You must have valid credentials for your AWS account configured either via environment variables or via a credentials file. For security reasons, we do not offer flags for providing the credentials. If you are using a credentials file, you can optionally specify a profile using the --profile flag.

# Example Usage

tilores-cli deploy --region eu-west-1

# Flags

--profile: Specify the AWS profile to use.

--region: Specify the AWS region into which to deploy. Must be one of the official AWS region codes, e.g. us-east-1 for North Virginia or eu-west-1 for Ireland.

--workspace: Specify the deployment workspace/environment to deploy. e.g. production, development

# deploy fake-api

Deploys the Fake-API into your own AWS account.

Use this to verify your API schema or to setup a simple test system with a functional, but faked, API. You can also use this if you don't have a valid license yet to try out if our flexible API supports your use case.

You must have valid AWS credentials configured to use this command.

# Example Usage

tilores-cli deploy fake-api --region eu-west-1

# Flags

--profile: Specify the AWS profile to use.

--region: Specify the AWS region into which to deploy. Must be one of the official AWS region codes, e.g. us-east-1 for North Virginia or eu-west-1 for Ireland.

# destroy

Removes your instance of TiloRes and all of its data from your AWS account.

You must have valid AWS credentials configured to use this command.

# Example Usage

tilores-cli destroy --region eu-west-1

# Flags

--profile: Specify the AWS profile to use.

--region: Specify the AWS region in which your TiloRes instance is deployed.

--workspace: Specify the deployment workspace/environment to destroy. e.g. production, development

# destroy fake-api

Removes the Fake-API from your AWS account.

You must have valid AWS credentials configured to use this command.

# Example Usage

tilores-cli destroy fake-api --region eu-west-1

# Flags

--profile: Specify the AWS profile to use.

--region: Specify the AWS region in which the Fake-API is deployed.

# erase

Erases all data from the TiloRes instance in your AWS account.

You must have valid AWS credentials configured to use this command.

# Example Usage

tilores-cli erase --region eu-west-1

# Flags

--profile: Specify the AWS profile to use.

--region: Specify the AWS region in which your TiloRes instance is deployed.

--workspace: Specify the deployment workspace/environment to erase data from. e.g. production, development

# init

Initializes a new TiloRes project with all the required files and dependencies.

# Example Usage

tilores-cli init

or

tilores-cli init my-project-folder

# Flags

--deploy-prefix: The initial prefix for resources created during the deploy phase, defaults to a random eight character string and can be changed later in the generated files.

--dispatcher-version: The version of the fake dispatcher plugin used for local runs. By default it will use the latest available version.

--module-path or -m: The go module path for the generated go.mod file, defaults to the project folder name. It is best practice in go to use your repository path, e.g. github.com/foocompany/fooproject.

# rules simulate

Simulates the rules in rule-config.json and tries to match the provided records.

Reads the rule configuration from ./rule-config.json file.

Reads both records to match as json from standard input.

# Example Usage

cat records.json | tilores-cli rules simulate

Where records.json contains the following:

{
  "recordA": {
    "myCustomField": "same value"
  },
  "recordB": {
    "myCustomField": "same value"
  }
}

# Flags

--json or -j: Shows output as JSON

# rules test

Tests the rules in rule-config.json and checks if results match the expectations.

Reads the rule configuration from ./rule-config.json file.

Test cases are read from ./test/rules/*.json where each file represents a test case and includes a pair of records and an expectation.

Each expectation is a list of rule sets with their expected satisfied and unsatisfied rules.

# Example Usage

tilores-cli rules test

Where ./test/rules/case1.json contains the following:

{
  "recordA": {
    "myCustomField": "same value"
  },
  "recordB": {
    "myCustomField": "same value"
  },
  "expectation": {
    "ruleSets": [
      {
        "ruleSetID": "index",
        "satisfiedRules": [
          "R1EXACT"
        ],
        "unsatisfiedRules": [
          "R2OTHER"
        ]
      }
    ]
  }
}

# run

Starts a local webserver and a simple UI for testing the Fake-API without the need to deploy it into AWS.

# Example Usage

tilores-cli init

# Flags

--port or -p: The port where the server runs on localhost (default 8080).

# upgrade

Upgrades TiloRes to the latest version. If the upgrade encounters any files that need to be updated, but were changed by the user, it will automatically create a backup of the old file. It is highly recommended to compare the differences and adjust the new file accordingly.

# Example Usage

tilores-cli upgrade

# version

Prints the version information of the TiloRes CLI.

# Example Usage

tilores-cli version