Class: Azure::ServiceBus::Rule

Inherits:
Resource
  • Object
show all
Defined in:
lib/azure/service_bus/rule.rb

Instance Attribute Summary collapse

Attributes inherited from Resource

#author_name, #description, #id, #name, #published, #updated

Instance Method Summary collapse

Methods inherited from Resource

#get_props

Constructor Details

#initialize(name, options = {}) ⇒ Rule

Public: Initialize the rule.

Attributes

  • name - A String with the name of the rule.

  • options - The resource options Hash

Options

Accepted key/value pairs in options parameter are:

  • :filter - String. The rule filter.

  • :action - String. The rule action.



46
47
48
49
50
51
52
# File 'lib/azure/service_bus/rule.rb', line 46

def initialize(name, options = {})
  normalized_options = {}
  normalized_options["Filter"] = options[:filter] if options.has_key?(:filter)
  normalized_options["Action"] = options[:action] if options.has_key?(:action)

  super(name, normalized_options)
end

Instance Attribute Details

#subscriptionObject

Returns the value of attribute subscription.



31
32
33
# File 'lib/azure/service_bus/rule.rb', line 31

def subscription
  @subscription
end

#topicObject

Returns the value of attribute topic.



30
31
32
# File 'lib/azure/service_bus/rule.rb', line 30

def topic
  @topic
end

Instance Method Details

#actionObject

Action: String

The Action property references an instance of FilterAction. The following type of FilterAction are provided. Default is an instance of EmptyRuleAction.

SqlFilterAction - A type of FilterAction that is represented by SQL expression. For detailed information about
                  SqlFilterAction syntax, see SqlRuleAction.SqlExpression Property.

EmptyRuleAction - A type of FilterAction that represents an empty action.


82
83
84
# File 'lib/azure/service_bus/rule.rb', line 82

def action
  RuleAspect.from_hash(description['Action'])
end

#action=(val) ⇒ Object



86
87
88
# File 'lib/azure/service_bus/rule.rb', line 86

def action=(val)
  description['Action'] = val.to_hash
end

#filterObject

Filter: SqlFilter, TrueFilter /FalseFiilter, CorrelationFilter

The Filter property references an instance of Filter that is evaluated against a message. The following types of filters are provided:

SqlFilter - A type of Filter that is represented by SQL expression. For detailed information about SqlFilter
            syntax, see SqlFilter.SqlExpression Property.

TrueFilter/FalseFiilter - A handy shortcut for always returning true or false. They are a type of SqlFilter.

CorrelationFilter: A type of Filter that matches CorrelationId property of BrokeredMessage.


65
66
67
# File 'lib/azure/service_bus/rule.rb', line 65

def filter
  RuleAspect.from_hash(description['Filter'])
end

#filter=(val) ⇒ Object



69
70
71
# File 'lib/azure/service_bus/rule.rb', line 69

def filter=(val)
  description['Filter'] = val.to_hash
end

#ordered_propsObject



90
91
92
93
94
95
# File 'lib/azure/service_bus/rule.rb', line 90

def ordered_props
  [
    'Filter',
    'Action'
  ]
end