Class: DTK::Client::Operation::Module::DeleteFromRemote

Inherits:
DTK::Client::Operation::Module show all
Defined in:
lib/client/operation/module/delete_from_remote.rb

Constant Summary

Constants inherited from DTK::Client::Operation::Module

BaseRoute, MODULE_LOCK, OPERATIONS

Constants inherited from DTK::Client::Operation

TYPES

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from DTK::Client::Operation::ModuleServiceCommon::ClassMixin

#method_missing, #respond_to?

Methods included from Auxiliary

#hash_to_yaml, #snake_form, #snake_to_camel_case, #yaml_to_hash

Instance Attribute Details

#module_refObject (readonly)

Returns the value of attribute module_ref.



21
22
23
# File 'lib/client/operation/module/delete_from_remote.rb', line 21

def module_ref
  @module_ref
end

Class Method Details

.execute(args = Args.new) ⇒ Object



29
30
31
32
33
34
# File 'lib/client/operation/module/delete_from_remote.rb', line 29

def self.execute(args = Args.new)
  wrap_operation(args) do |args|
    module_ref  = args.required(:module_ref)
    new('dtkn', module_ref).delete_from_remote(:skip_prompt => args[:skip_prompt], :force => args[:force])
  end
end

Instance Method Details

#delete_from_remote(opts = {}) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/client/operation/module/delete_from_remote.rb', line 36

def delete_from_remote(opts = {})
  unless opts[:skip_prompt]
    module_ref_opts = { :namespace => module_ref.namespace }
    return unless Console.prompt_yes_no("Are you sure you want to delete module '#{DTK::Common::PrettyPrintForm.module_ref(module_ref.module_name, module_ref_opts)}' from dtk network?", :add_options => true)
  end

  module_info = {
    name:      module_ref.module_name,
    namespace: module_ref.namespace
  }
  DtkNetworkClient::Delete.run(module_info)

  nil
end