class GoApiClient::Api::Pipeline
Attributes
pipeline_cache[RW]
stage_cache[RW]
Public Class Methods
new(attributes = {})
click to toggle source
Calls superclass method
GoApiClient::Api::AbstractApi::new
# File lib/go_api_client/api/pipeline.rb, line 7 def initialize(attributes = {}) attributes = ({:pipeline_cache => {}, :stage_cache => {}}).merge(attributes) super(attributes) end
Public Instance Methods
pause(options = {})
click to toggle source
This API provides the ability to pause a pipeline.
# File lib/go_api_client/api/pipeline.rb, line 39 def pause(options = {}) options = ({:pause_uri => nil, :pipeline_name => nil}).merge(options) if options[:pause_uri] uri = options[:pause_uri] else raise 'Insufficient arguments' unless options[:pipeline_name] uri = "#{@base_uri}/api/pipelines/#{options[:pipeline_name]}/pause" end @http_fetcher.post!(uri) end
pipeline(options = {})
click to toggle source
# File lib/go_api_client/api/pipeline.rb, line 62 def pipeline(options = {}) options = ({:pipeline_uri => nil, :pipeline_name => nil, :pipeline_id => nil, :eager_parser => []}).merge(options) if options[:pipeline_uri] uri = options[:pipeline_uri] else raise 'Insufficient arguments' unless options[:pipeline_name] && options[:pipeline_id] uri = "#{@base_uri}/api/pipelines/#{options[:pipeline_name]}/#{options[:pipeline_id]}.xml" end pipeline = GoApiClient::Parsers::Pipeline.parse(Nokogiri::XML(@http_fetcher.get!(uri)).root) @pipeline_cache[GoApiClient::Domain::InternalCache.new(pipeline.self_uri, options)] ||= pipeline if options[:eager_parser] && options[:eager_parser].include?(:stage) stage_api = GoApiClient::Api::Stage.new({:base_uri => @base_uri, :http_fetcher => @http_fetcher, :pipeline_cache => @pipeline_cache, :stage_cache => @stage_cache}) pipeline.parsed_stages = pipeline.stages.collect do |stage_uri| stage = @stage_cache[GoApiClient::Domain::InternalCache.new(stage_uri, options)] || stage_api.stage(options.merge({:stage_uri => stage_uri})) @stage_cache[GoApiClient::Domain::InternalCache.new(stage_uri, options)] ||= stage stage end end pipeline end
release_lock(options = {})
click to toggle source
This API allows you to release a lock on a pipeline so that you can start up a new instance without having to wait for the earlier instance to finish.
# File lib/go_api_client/api/pipeline.rb, line 27 def release_lock(options = {}) options = ({:release_lock_uri => nil, :pipeline_name => nil}).merge(options) if options[:release_lock_uri] uri = options[:release_lock_uri] else raise 'Insufficient arguments' unless options[:pipeline_name] uri = "#{@base_uri}/api/pipelines/#{options[:pipeline_name]}/releaseLock" end @http_fetcher.post!(uri) end
schedule(options = {})
click to toggle source
Schedule a particular pipeline with the latest available materials.
# File lib/go_api_client/api/pipeline.rb, line 13 def schedule(options = {}) # options {:materials => nil, :variables => nil, :secure_variables => nil} options = ({:schedule_uri => nil, :pipeline_name => nil}).merge(options) if options[:schedule_uri] uri = options[:schedule_uri] else raise 'Insufficient arguments' unless options[:pipeline_name] uri = "#{@base_uri}/api/pipelines/#{options[:pipeline_name]}/schedule" end @http_fetcher.post!(uri) end
unpause(options={})
click to toggle source
This API provides the ability to unpause a pipeline.
# File lib/go_api_client/api/pipeline.rb, line 51 def unpause(options={}) options = ({:unpause_uri => nil, :pipeline_name => nil}).merge(options) if options[:unpause_uri] uri = options[:unpause_uri] else raise 'Insufficient arguments' unless options[:pipeline_name] uri = "#{@base_uri}/api/pipelines/#{options[:pipeline_name]}/unpause" end @http_fetcher.post!(uri) end