Class: RabbitMq::Plugin
- Inherits:
-
Shared::Resource
- Object
- Shared::Resource
- RabbitMq::Plugin
- Defined in:
- lib/vas/rabbitmq/plugins.rb
Overview
A plugin in a RabbitMQ instance
Instance Attribute Summary collapse
-
#instance ⇒ Instance
readonly
The instance that contains the plugin.
-
#name ⇒ String
readonly
The plugin’s name.
-
#plugin_image ⇒ PluginImage
readonly
The plugin image, if any, that was used to create the plugin.
-
#version ⇒ String
readonly
The plugin’s version.
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.
-
#state ⇒ String
The state of the plugin.
-
#to_s ⇒ String
A string representation of the plugin.
Constructor Details
#initialize(location, client) ⇒ Plugin
Returns a new instance of Plugin.
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/vas/rabbitmq/plugins.rb', line 49 def initialize(location, client) super(location, client) @name = details['name'] @version = details['version'] @instance = Instance.new(Util::LinkUtils.get_link_href(details, 'group-instance'), client) @state_location = Util::LinkUtils.get_link_href(details, 'state') 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 |
Instance Attribute Details
#instance ⇒ Instance (readonly)
Returns the instance that contains the plugin.
43 44 45 |
# File 'lib/vas/rabbitmq/plugins.rb', line 43 def instance @instance end |
#name ⇒ String (readonly)
Returns the plugin’s name.
40 41 42 |
# File 'lib/vas/rabbitmq/plugins.rb', line 40 def name @name end |
#plugin_image ⇒ PluginImage (readonly)
Returns the plugin image, if any, that was used to create the plugin.
46 47 48 |
# File 'lib/vas/rabbitmq/plugins.rb', line 46 def plugin_image @plugin_image end |
#version ⇒ String (readonly)
Returns the plugin’s version.
37 38 39 |
# File 'lib/vas/rabbitmq/plugins.rb', line 37 def version @version end |
Instance Method Details
#disable ⇒ void
This method returns an undefined value.
Disables the plugin
76 77 78 |
# File 'lib/vas/rabbitmq/plugins.rb', line 76 def disable client.post(@state_location, { :status => 'DISABLED' }) end |
#enable ⇒ void
This method returns an undefined value.
Enables the plugin
69 70 71 |
# File 'lib/vas/rabbitmq/plugins.rb', line 69 def enable client.post(@state_location, { :status => 'ENABLED' }) end |
#state ⇒ String
Returns the state of the plugin.
62 63 64 |
# File 'lib/vas/rabbitmq/plugins.rb', line 62 def state client.get(@state_location)['status'] end |
#to_s ⇒ String
Returns a string representation of the plugin.
81 82 83 |
# File 'lib/vas/rabbitmq/plugins.rb', line 81 def to_s "#<#{self.class} name='#@name' version='#@version'>" end |