RubyShift is a Ruby client for OpenShift's REST API
Installing from rubygems:
gem install rubyshift
Via Gemfile:
gem 'rubyshift', github: 'gnurag/rubyshift'
Configuration example:
require 'rubyshift'
RubyShift.configure do |config|
config.endpoint = 'https://openshift.redhat.com/broker/rest'
config.access_token = '<secret-access-token>'
# Optional config options
config.httparty = { timeout: 90 }
end
Alternatively, instantiate a Client object and use:
client = RubyShift.client(endpoint: 'https://openshift.redhat.com/broker/rest', access_token: '<secret-access-token>', httparty: { timeout: 90 })
Usage example:
RubyShift.applications
# => []
RubyShift.application_create('myapp', domain_name: 'rubyshift', cartridges: 'ruby-2.0', scale: true, gear_size: 'small')
# => #<OpenStruct aliases=[], app_url="http://myapp-rubyshift.rhcloud.com/", auto_deploy=true,
build_job_url=nil, building_app=nil, building_with=nil, creation_time="2016-04-13T21:00:01Z",
deployment_branch="master", deployment_type="git", domain_id="rubyshift", embedded={"haproxy-1.4"=>{}},
framework="ruby-2.0", gear_count=1, gear_profile="small", git_url="ssh://[email protected]/~/git/myapp.git/",
ha=false, health_check_path="health", id="500000000000000000000001", initial_git_url=nil,
keep_deployments=1, name="myapp", scalable=true, ssh_url="ssh://[email protected]">
RubyShift.application('500000000000000000000001')
# => #<OpenStruct aliases=[], app_url="http://myapp-rubyshift.rhcloud.com/", auto_deploy=true,
build_job_url=nil, building_app=nil, building_with=nil, creation_time="2016-04-13T21:00:01Z",
deployment_branch="master", deployment_type="git", domain_id="rubyshift", embedded={"haproxy-1.4"=>{}},
framework="ruby-2.0", gear_count=1, gear_profile="small", git_url="ssh://[email protected]/~/git/myapp.git/",
ha=false, health_check_path="health", id="500000000000000000000001", initial_git_url=nil,
keep_deployments=1, name="myapp", scalable=true, ssh_url="ssh://[email protected]">
RubyShift.application_restart('500000000000000000000001')
# => #<OpenStruct aliases=[], app_url="http://myapp-rubyshift.rhcloud.com/", auto_deploy=true,
build_job_url=nil, building_app=nil, building_with=nil, creation_time="2016-04-13T21:00:01Z",
deployment_branch="master", deployment_type="git", domain_id="rubyshift", embedded={"haproxy-1.4"=>{}},
framework="ruby-2.0", gear_count=1, gear_profile="small", git_url="ssh://[email protected]/~/git/myapp.git/",
ha=false, health_check_path="health", id="500000000000000000000001", initial_git_url=nil,
keep_deployments=1, name="myapp", scalable=true, ssh_url="ssh://[email protected]">
RubyShift.application_delete('500000000000000000000001')
# => true
RubyShift is based on the excellent gitlab gem.