Class: Serverspec::Type::RabbitmqVhostPolicy
- Inherits:
-
RabbitmqBase
- Object
- Base
- ApiBase
- RabbitmqBase
- Serverspec::Type::RabbitmqVhostPolicy
- Defined in:
- lib/serverspec_extra_types/types/rabbitmq_vhost_policy.rb
Instance Method Summary collapse
- #apply_to?(arg) ⇒ Boolean
- #exist? ⇒ Boolean
- #ha_mode ⇒ Object
- #ha_nodes ⇒ Object
- #ha_sync_mode ⇒ Object
- #has_ha_mode?(mode) ⇒ Boolean
- #has_ha_nodes?(count) ⇒ Boolean
- #has_ha_sync_mode?(mode) ⇒ Boolean
-
#initialize(name = nil, vhost = nil, options = {}) ⇒ RabbitmqVhostPolicy
constructor
A new instance of RabbitmqVhostPolicy.
- #inspection ⇒ Object
- #mirror_all? ⇒ Boolean
- #mirror_exchanges? ⇒ Boolean
- #mirror_queues? ⇒ Boolean
- #to_s ⇒ Object
- #url ⇒ Object
Methods inherited from RabbitmqBase
Methods inherited from ApiBase
Constructor Details
#initialize(name = nil, vhost = nil, options = {}) ⇒ RabbitmqVhostPolicy
Returns a new instance of RabbitmqVhostPolicy.
7 8 9 10 |
# File 'lib/serverspec_extra_types/types/rabbitmq_vhost_policy.rb', line 7 def initialize(name = nil, vhost = nil, = {}) super(name, ) @vhost = vhost end |
Instance Method Details
#apply_to?(arg) ⇒ Boolean
64 65 66 |
# File 'lib/serverspec_extra_types/types/rabbitmq_vhost_policy.rb', line 64 def apply_to?(arg) inspection['apply-to'] == arg end |
#exist? ⇒ Boolean
24 25 26 |
# File 'lib/serverspec_extra_types/types/rabbitmq_vhost_policy.rb', line 24 def exist? !inspection.nil? end |
#ha_mode ⇒ Object
32 33 34 |
# File 'lib/serverspec_extra_types/types/rabbitmq_vhost_policy.rb', line 32 def ha_mode inspection['definition']['ha-mode'] end |
#ha_nodes ⇒ Object
48 49 50 |
# File 'lib/serverspec_extra_types/types/rabbitmq_vhost_policy.rb', line 48 def ha_nodes inspection['definition']['ha-params'] end |
#ha_sync_mode ⇒ Object
40 41 42 |
# File 'lib/serverspec_extra_types/types/rabbitmq_vhost_policy.rb', line 40 def ha_sync_mode inspection['definition']['ha-sync-mode'] end |
#has_ha_mode?(mode) ⇒ Boolean
28 29 30 |
# File 'lib/serverspec_extra_types/types/rabbitmq_vhost_policy.rb', line 28 def has_ha_mode?(mode) inspection['definition']['ha-mode'] == mode end |
#has_ha_nodes?(count) ⇒ Boolean
44 45 46 |
# File 'lib/serverspec_extra_types/types/rabbitmq_vhost_policy.rb', line 44 def has_ha_nodes?(count) inspection['definition']['ha-params'].to_i == count.to_i end |
#has_ha_sync_mode?(mode) ⇒ Boolean
36 37 38 |
# File 'lib/serverspec_extra_types/types/rabbitmq_vhost_policy.rb', line 36 def has_ha_sync_mode?(mode) inspection['definition']['ha-sync-mode'] == mode end |
#inspection ⇒ Object
12 13 14 |
# File 'lib/serverspec_extra_types/types/rabbitmq_vhost_policy.rb', line 12 def inspection @inspection ||= ::MultiJson.load(get_inspection.stdout).find { |itm| itm['name'] == @name } end |
#mirror_all? ⇒ Boolean
52 53 54 |
# File 'lib/serverspec_extra_types/types/rabbitmq_vhost_policy.rb', line 52 def mirror_all? apply_to?('all') end |
#mirror_exchanges? ⇒ Boolean
60 61 62 |
# File 'lib/serverspec_extra_types/types/rabbitmq_vhost_policy.rb', line 60 def mirror_exchanges? apply_to?('exchanges') end |
#mirror_queues? ⇒ Boolean
56 57 58 |
# File 'lib/serverspec_extra_types/types/rabbitmq_vhost_policy.rb', line 56 def mirror_queues? apply_to?('queues') end |
#to_s ⇒ Object
16 17 18 |
# File 'lib/serverspec_extra_types/types/rabbitmq_vhost_policy.rb', line 16 def to_s "RabbitMQ policy '#{@name}' on vhost '#{@vhost}'" end |
#url ⇒ Object
20 21 22 |
# File 'lib/serverspec_extra_types/types/rabbitmq_vhost_policy.rb', line 20 def url "#{@url_base}/api/policies/#{@vhost}" end |