Class: OCI::Waas::Models::CachingRuleSummary
- Inherits:
-
Object
- Object
- OCI::Waas::Models::CachingRuleSummary
- Defined in:
- lib/oci/waas/models/caching_rule_summary.rb
Overview
The caching rule settings.
Constant Summary collapse
- ACTION_ENUM =
[ ACTION_CACHE = 'CACHE'.freeze, ACTION_BYPASS_CACHE = 'BYPASS_CACHE'.freeze, ACTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
Instance Attribute Summary collapse
-
#action ⇒ String
[Required] The action to take when the criteria of a caching rule are met.
-
#caching_duration ⇒ String
The duration to cache content for the caching rule, specified in ISO 8601 extended format.
-
#client_caching_duration ⇒ String
The duration to cache content in the user’s browser, specified in ISO 8601 extended format.
-
#criteria ⇒ Array<OCI::Waas::Models::CachingRuleCriteria>
[Required] The array of the rule criteria with condition and value.
-
#is_client_caching_enabled ⇒ BOOLEAN
Enables or disables client caching.
-
#key ⇒ String
The unique key for the caching rule.
-
#name ⇒ String
[Required] The name of the caching rule.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ CachingRuleSummary
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ CachingRuleSummary
Initializes the object
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 |
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 93 def initialize(attributes = {}) return unless attributes.is_a?(Hash) # convert string to symbol for hash key attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v } self.key = attributes[:'key'] if attributes[:'key'] self.name = attributes[:'name'] if attributes[:'name'] self.action = attributes[:'action'] if attributes[:'action'] self.caching_duration = attributes[:'cachingDuration'] if attributes[:'cachingDuration'] raise 'You cannot provide both :cachingDuration and :caching_duration' if attributes.key?(:'cachingDuration') && attributes.key?(:'caching_duration') self.caching_duration = attributes[:'caching_duration'] if attributes[:'caching_duration'] self.is_client_caching_enabled = attributes[:'isClientCachingEnabled'] unless attributes[:'isClientCachingEnabled'].nil? raise 'You cannot provide both :isClientCachingEnabled and :is_client_caching_enabled' if attributes.key?(:'isClientCachingEnabled') && attributes.key?(:'is_client_caching_enabled') self.is_client_caching_enabled = attributes[:'is_client_caching_enabled'] unless attributes[:'is_client_caching_enabled'].nil? self.client_caching_duration = attributes[:'clientCachingDuration'] if attributes[:'clientCachingDuration'] raise 'You cannot provide both :clientCachingDuration and :client_caching_duration' if attributes.key?(:'clientCachingDuration') && attributes.key?(:'client_caching_duration') self.client_caching_duration = attributes[:'client_caching_duration'] if attributes[:'client_caching_duration'] self.criteria = attributes[:'criteria'] if attributes[:'criteria'] end |
Instance Attribute Details
#action ⇒ String
[Required] The action to take when the criteria of a caching rule are met.
-
CACHE: Caches requested content when the criteria of the rule are met.
-
BYPASS_CACHE: Allows requests to bypass the cache and be directed to the origin when the criteria of the rule is met.
29 30 31 |
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 29 def action @action end |
#caching_duration ⇒ String
The duration to cache content for the caching rule, specified in ISO 8601 extended format. Supported units: seconds, minutes, hours, days, weeks, months. The maximum value that can be set for any unit is ‘99`. Mixing of multiple units is not supported. Only applies when the `action` is set to `CACHE`. Example: `PT1H`
34 35 36 |
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 34 def caching_duration @caching_duration end |
#client_caching_duration ⇒ String
The duration to cache content in the user’s browser, specified in ISO 8601 extended format. Supported units: seconds, minutes, hours, days, weeks, months. The maximum value that can be set for any unit is ‘99`. Mixing of multiple units is not supported. Only applies when the `action` is set to `CACHE`. Example: `PT1H`
44 45 46 |
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 44 def client_caching_duration @client_caching_duration end |
#criteria ⇒ Array<OCI::Waas::Models::CachingRuleCriteria>
[Required] The array of the rule criteria with condition and value.
48 49 50 |
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 48 def criteria @criteria end |
#is_client_caching_enabled ⇒ BOOLEAN
Enables or disables client caching. Browsers use the ‘Cache-Control` header value for caching content locally in the browser. This setting overrides the addition of a `Cache-Control` header in responses.
39 40 41 |
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 39 def is_client_caching_enabled @is_client_caching_enabled end |
#key ⇒ String
The unique key for the caching rule.
18 19 20 |
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 18 def key @key end |
#name ⇒ String
[Required] The name of the caching rule.
22 23 24 |
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 22 def name @name end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 51 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'key': :'key', 'name': :'name', 'action': :'action', 'caching_duration': :'cachingDuration', 'is_client_caching_enabled': :'isClientCachingEnabled', 'client_caching_duration': :'clientCachingDuration', 'criteria': :'criteria' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
66 67 68 69 70 71 72 73 74 75 76 77 78 |
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 66 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'key': :'String', 'name': :'String', 'action': :'String', 'caching_duration': :'String', 'is_client_caching_enabled': :'BOOLEAN', 'client_caching_duration': :'String', 'criteria': :'Array<OCI::Waas::Models::CachingRuleCriteria>' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 146 def ==(other) return true if equal?(other) self.class == other.class && key == other.key && name == other.name && action == other.action && caching_duration == other.caching_duration && is_client_caching_enabled == other.is_client_caching_enabled && client_caching_duration == other.client_caching_duration && criteria == other.criteria end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 |
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 182 def build_from_hash(attributes) return nil unless attributes.is_a?(Hash) self.class.swagger_types.each_pair do |key, type| if type =~ /^Array<(.*)>/i # check to ensure the input is an array given that the the attribute # is documented as an array but the input is not if attributes[self.class.attribute_map[key]].is_a?(Array) public_method("#{key}=").call( attributes[self.class.attribute_map[key]] .map { |v| OCI::Internal::Util.convert_to_type(Regexp.last_match(1), v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? public_method("#{key}=").call( OCI::Internal::Util.convert_to_type(type, attributes[self.class.attribute_map[key]]) ) end # or else data not found in attributes(hash), not an issue as the data can be optional end self end |
#eql?(other) ⇒ Boolean
162 163 164 |
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 162 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
171 172 173 |
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 171 def hash [key, name, action, caching_duration, is_client_caching_enabled, client_caching_duration, criteria].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
215 216 217 218 219 220 221 222 223 224 |
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 215 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = public_method(attr).call next if value.nil? && !instance_variable_defined?("@#{attr}") hash[param] = _to_hash(value) end hash end |
#to_s ⇒ String
Returns the string representation of the object
209 210 211 |
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 209 def to_s to_hash.to_s end |