class DTK::Client::Operation::Service::Describe

Public Class Methods

actions_path_valid?(path) click to toggle source
# File lib/client/operation/service/describe.rb, line 38
def self.actions_path_valid?(path)
  prefix, suffix = (path||'').split('/')
  prefix.eql?('actions') && suffix && !suffix.empty?
end
execute(args = Args.new) click to toggle source
# File lib/client/operation/service/describe.rb, line 21
def self.execute(args = Args.new)
  wrap_operation(args) do |args|
    service_instance  = args.required(:service_instance)
    path              = args[:path]
    show_steps        = args[:show_steps]
    query_string_hash = QueryStringHash.new

    error_msg = 'Option --show-steps can only be used with actions path. The pattern must have form actions/ACTION-NAME.'
    raise Error, error_msg if show_steps && !actions_path_valid?(path)

    query_string_hash.merge!(path: path) if path
    query_string_hash.merge!(show_steps: show_steps) if show_steps
    response = rest_get "#{BaseRoute}/#{service_instance}/describe", query_string_hash
    response.set_render_as_table! if show_steps
    response
  end
end