Class: RabbitMq::Plugin
- Inherits:
-
Shared::Resource
- Object
- Shared::Resource
- RabbitMq::Plugin
- Includes:
- Shared::Deletable
- Defined in:
- lib/vas/rabbitmq/plugins.rb
Overview
A plugin in a RabbitMQ instance
Instance Attribute Summary collapse
-
#name ⇒ String
readonly
The plugin’s name.
-
#version ⇒ String
readonly
The plugin’s version.
Attributes included from Shared::Deletable
Attributes inherited from Shared::Resource
Instance Method Summary collapse
-
#disable ⇒ void
Disables the plugin.
-
#enable ⇒ void
Enables the plugin.
-
#initialize(location, client) ⇒ Plugin
constructor
A new instance of Plugin.
-
#instance ⇒ Instance
The instance that contains the plugin.
-
#plugin_image ⇒ PluginImage
The plugin image, if any, that was used to create the plugin.
-
#state ⇒ String
The state of the plugin.
-
#to_s ⇒ String
A string representation of the plugin.
Methods included from Shared::Deletable
Constructor Details
#initialize(location, client) ⇒ Plugin
Returns a new instance of Plugin.
46 47 48 49 50 51 52 53 54 |
# File 'lib/vas/rabbitmq/plugins.rb', line 46 def initialize(location, client) super(location, client) @name = details['name'] @version = details['version'] @instance_location = Util::LinkUtils.get_link_href(details, 'group-instance') @state_location = Util::LinkUtils.get_link_href(details, 'state') end |
Instance Attribute Details
#name ⇒ String (readonly)
Returns the plugin’s name.
43 44 45 |
# File 'lib/vas/rabbitmq/plugins.rb', line 43 def name @name end |
#version ⇒ String (readonly)
Returns the plugin’s version.
40 41 42 |
# File 'lib/vas/rabbitmq/plugins.rb', line 40 def version @version end |
Instance Method Details
#disable ⇒ void
This method returns an undefined value.
Disables the plugin
85 86 87 |
# File 'lib/vas/rabbitmq/plugins.rb', line 85 def disable client.post(@state_location, {:status => 'DISABLED'}) end |
#enable ⇒ void
This method returns an undefined value.
Enables the plugin
78 79 80 |
# File 'lib/vas/rabbitmq/plugins.rb', line 78 def enable client.post(@state_location, {:status => 'ENABLED'}) end |
#instance ⇒ Instance
Returns the instance that contains the plugin.
66 67 68 |
# File 'lib/vas/rabbitmq/plugins.rb', line 66 def instance @instance ||= Instance.new(@instance_location, client) end |
#plugin_image ⇒ PluginImage
Returns the plugin image, if any, that was used to create the plugin.
57 58 59 60 61 62 63 |
# File 'lib/vas/rabbitmq/plugins.rb', line 57 def plugin_image if @plugin_image.nil? plugin_image_location = Util::LinkUtils.get_link_href(details, 'plugin-image') @plugin_image = PluginImage.new(plugin_image_location, client) unless plugin_image_location.nil? end @plugin_image end |
#state ⇒ String
Returns the state of the plugin.
71 72 73 |
# File 'lib/vas/rabbitmq/plugins.rb', line 71 def state client.get(@state_location)['status'] end |
#to_s ⇒ String
Returns a string representation of the plugin.
90 91 92 |
# File 'lib/vas/rabbitmq/plugins.rb', line 90 def to_s "#<#{self.class} name='#@name' version='#@version'>" end |