Class: RabbitMq::Plugin

Inherits:
Shared::Resource show all
Defined in:
lib/vas/rabbitmq/plugins.rb

Overview

A plugin in a Rabbit instance

Instance Attribute Summary collapse

Attributes inherited from Shared::Resource

#location, #security

Instance Method Summary collapse

Constructor Details

#initialize(location, client) ⇒ Plugin

:nodoc:



43
44
45
46
47
48
49
50
51
# File 'lib/vas/rabbitmq/plugins.rb', line 43

def initialize(location, client) #:nodoc:
  super(location, client)
  
  @name = details['name']
  @version = details['version']
  @plugin_image_location = Util::LinkUtils.get_link_href(details, 'plugin-image')
  @instance_location = Util::LinkUtils.get_link_href(details, 'group-instance')
  @state_location = Util::LinkUtils.get_link_href(details, 'state')
end

Instance Attribute Details

#nameObject (readonly)

The plugin’s name



41
42
43
# File 'lib/vas/rabbitmq/plugins.rb', line 41

def name
  @name
end

#versionObject (readonly)

The plugin’s version



38
39
40
# File 'lib/vas/rabbitmq/plugins.rb', line 38

def version
  @version
end

Instance Method Details

#disableObject

Disables the plugin



76
77
78
# File 'lib/vas/rabbitmq/plugins.rb', line 76

def disable
  client.post(@state_location, { :status => 'DISABLED' })
end

#enableObject

Enables the plugin



71
72
73
# File 'lib/vas/rabbitmq/plugins.rb', line 71

def enable
  client.post(@state_location, { :status => 'ENABLED' })
end

#instanceObject

The instance that contains the plugin



61
62
63
# File 'lib/vas/rabbitmq/plugins.rb', line 61

def instance
  Instance.new(@instance_location, client)
end

#plugin_imageObject

The plugin image, if any, that was used to create the plugin



54
55
56
57
58
# File 'lib/vas/rabbitmq/plugins.rb', line 54

def plugin_image
  if (!@plugin_image_location.nil?)
    PluginImage.new(@plugin_image_location, client)
  end
end

#stateObject

The state of the plugin



66
67
68
# File 'lib/vas/rabbitmq/plugins.rb', line 66

def state
  client.get(@state_location)['status']
end

#to_sObject

:nodoc:



80
81
82
# File 'lib/vas/rabbitmq/plugins.rb', line 80

def to_s #:nodoc:
  "#<#{self.class} name='#@name' version='#@version'>"
end