0.0
Low commit activity in last 3 years
A long-lived project that still receives updates
A Ruby client for OpenStack's Mistral <https://docs.openstack.org/mistral/latest/>.
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 0.14.2
~> 3.13.0
~> 1.62.1
~> 6.2
~> 3.23
~> 2.5.7
~> 13.0

Runtime

~> 0.21.0
 Project Readme

MistralClient

Build Status Gem Version

MistralClient provides a Ruby interface to a limited subset of the Mistral API.

Installation

Add this line to your application's Gemfile:

gem 'mistral_client'

And then execute:

$ bundle

Or install it yourself as:

$ gem install mistral_client

Usage

Instantiate a Client

The Mistral base URL is required:

client = MistralClient.new('https://mistral.local/v2')

If running Mistral with a self-signed certificate (e.g., during development), you can bypass certificate verification by specifying verify: false:

client = MistralClient.new('https://mistral.local/v2', verify: false)

You can also pass in other connection options in the same way you would with HTTParty:

client = MistralClient.new('https://mistral.local/v2', timeout: 20)

Environment Operations

Create an Environment

environment = client.environment(definition)

Delete an Environment

environment.delete!

Workflow Operations

Instantiate a Workflow

workflow = client.workflow(definition)

You can instantiate a workflow object using an existing Mistral workflow ID:

workflow = client.workflow(id: id)

or workflow name:

workflow = client.workflow(name: name)

Execute a Workflow

workflow.execute!

If your workflow uses an environment, you can specify the environment with the env keyword argument:

workflow.execute!(env: name)

Update a Workflow Execution

execution.patch(state: 'CANCELLED')

Update a Task

task.patch(state: 'RUNNING', reset: true)

Delete a Workflow

workflow.delete!

Validate a Workflow

client.workflow.valid?(definition)

You can also get validation error details:

client.workflow.validate(definition)

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

To Record New VCR Cassettes

Recording new cassettes is as simple as ensuring you have a Mistral server available at the LOCAL_MISTRAL_URL defined in spec/spec_helper.rb and running rake. To rerecord existing cassettes, simply remove the relevant cassettes from spec/cassettes and run rake.

Contributing

See CONTRIBUTING.

License

MistralClient is released under the BSD 3-Clause License.