Class: OCI::Waas::Models::CachingRuleSummary

Inherits:
Object
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ CachingRuleSummary

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):



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
125
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 94

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

#actionString

[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.

Returns:

  • (String)


30
31
32
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 30

def action
  @action
end

#caching_durationString

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

Returns:

  • (String)


35
36
37
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 35

def caching_duration
  @caching_duration
end

#client_caching_durationString

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

Returns:

  • (String)


45
46
47
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 45

def client_caching_duration
  @client_caching_duration
end

#criteriaArray<OCI::Waas::Models::CachingRuleCriteria>

[Required] The array of the rule criteria with condition and value. The caching rule would be applied for the requests that matched any of the listed conditions.



49
50
51
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 49

def criteria
  @criteria
end

#is_client_caching_enabledBOOLEAN

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.

Returns:

  • (BOOLEAN)


40
41
42
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 40

def is_client_caching_enabled
  @is_client_caching_enabled
end

#keyString

The unique key for the caching rule.

Returns:

  • (String)


19
20
21
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 19

def key
  @key
end

#nameString

[Required] The name of the caching rule.

Returns:

  • (String)


23
24
25
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 23

def name
  @name
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 52

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_typesObject

Attribute type mapping.



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 67

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.

Parameters:

  • other (Object)

    the other object to be compared



147
148
149
150
151
152
153
154
155
156
157
158
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 147

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

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 183

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

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


163
164
165
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 163

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



172
173
174
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 172

def hash
  [key, name, action, caching_duration, is_client_caching_enabled, client_caching_duration, criteria].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



216
217
218
219
220
221
222
223
224
225
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 216

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



210
211
212
# File 'lib/oci/waas/models/caching_rule_summary.rb', line 210

def to_s
  to_hash.to_s
end