Class: OCI::ObjectStorage::Models::ObjectLifecycleRule
- Inherits:
-
Object
- Object
- OCI::ObjectStorage::Models::ObjectLifecycleRule
- Defined in:
- lib/oci/object_storage/models/object_lifecycle_rule.rb
Overview
To use any of the API operations, you must be authorized in an IAM policy. If you are not authorized, talk to an administrator. If you are an administrator who needs to write policies to give users access, see [Getting Started with Policies](docs.cloud.oracle.com/Content/Identity/Concepts/policygetstarted.htm).
Constant Summary collapse
- TIME_UNIT_ENUM =
rubocop:disable Metrics/LineLength
[ TIME_UNIT_DAYS = 'DAYS'.freeze, TIME_UNIT_YEARS = 'YEARS'.freeze, TIME_UNIT_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
Instance Attribute Summary collapse
-
#action ⇒ String
[Required] The action of the object lifecycle policy rule.
-
#is_enabled ⇒ BOOLEAN
[Required] A boolean that determines whether this rule is currently enabled.
-
#name ⇒ String
[Required] The name of the lifecycle rule to be applied.
-
#object_name_filter ⇒ OCI::ObjectStorage::Models::ObjectNameFilter
A filter limiting object names that the rule will apply to.
-
#time_amount ⇒ Integer
[Required] Specifies the age of objects to apply the rule to.
-
#time_unit ⇒ String
[Required] The unit that should be used to interpret timeAmount.
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 = {}) ⇒ ObjectLifecycleRule
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 = {}) ⇒ ObjectLifecycleRule
Initializes the object
91 92 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/object_storage/models/object_lifecycle_rule.rb', line 91 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.name = attributes[:'name'] if attributes[:'name'] self.action = attributes[:'action'] if attributes[:'action'] self.time_amount = attributes[:'timeAmount'] if attributes[:'timeAmount'] raise 'You cannot provide both :timeAmount and :time_amount' if attributes.key?(:'timeAmount') && attributes.key?(:'time_amount') self.time_amount = attributes[:'time_amount'] if attributes[:'time_amount'] self.time_unit = attributes[:'timeUnit'] if attributes[:'timeUnit'] raise 'You cannot provide both :timeUnit and :time_unit' if attributes.key?(:'timeUnit') && attributes.key?(:'time_unit') self.time_unit = attributes[:'time_unit'] if attributes[:'time_unit'] self.is_enabled = attributes[:'isEnabled'] unless attributes[:'isEnabled'].nil? raise 'You cannot provide both :isEnabled and :is_enabled' if attributes.key?(:'isEnabled') && attributes.key?(:'is_enabled') self.is_enabled = attributes[:'is_enabled'] unless attributes[:'is_enabled'].nil? self.object_name_filter = attributes[:'objectNameFilter'] if attributes[:'objectNameFilter'] raise 'You cannot provide both :objectNameFilter and :object_name_filter' if attributes.key?(:'objectNameFilter') && attributes.key?(:'object_name_filter') self.object_name_filter = attributes[:'object_name_filter'] if attributes[:'object_name_filter'] end |
Instance Attribute Details
#action ⇒ String
[Required] The action of the object lifecycle policy rule. Rules using the action ‘ARCHIVE’ move objects into the [Archive Storage tier](docs.cloud.oracle.com/Content/Archive/Concepts/archivestorageoverview.htm). Rules using the action ‘DELETE’ permanently delete objects from buckets. ‘ARCHIVE’ and ‘DELETE’ are the only two supported actions at this time.
29 30 31 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 29 def action @action end |
#is_enabled ⇒ BOOLEAN
[Required] A boolean that determines whether this rule is currently enabled.
45 46 47 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 45 def is_enabled @is_enabled end |
#name ⇒ String
[Required] The name of the lifecycle rule to be applied.
21 22 23 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 21 def name @name end |
#object_name_filter ⇒ OCI::ObjectStorage::Models::ObjectNameFilter
A filter limiting object names that the rule will apply to.
49 50 51 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 49 def object_name_filter @object_name_filter end |
#time_amount ⇒ Integer
[Required] Specifies the age of objects to apply the rule to. The timeAmount is interpreted in units defined by the timeUnit parameter, and is calculated in relation to each object’s Last-Modified time.
35 36 37 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 35 def time_amount @time_amount end |
#time_unit ⇒ String
[Required] The unit that should be used to interpret timeAmount. Days are defined as starting and ending at midnight UTC. Years are defined as 365.2425 days long and likewise round up to the next midnight UTC.
41 42 43 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 41 def time_unit @time_unit end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 52 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'name': :'name', 'action': :'action', 'time_amount': :'timeAmount', 'time_unit': :'timeUnit', 'is_enabled': :'isEnabled', 'object_name_filter': :'objectNameFilter' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 66 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'name': :'String', 'action': :'String', 'time_amount': :'Integer', 'time_unit': :'String', 'is_enabled': :'BOOLEAN', 'object_name_filter': :'OCI::ObjectStorage::Models::ObjectNameFilter' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
148 149 150 151 152 153 154 155 156 157 158 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 148 def ==(other) return true if equal?(other) self.class == other.class && name == other.name && action == other.action && time_amount == other.time_amount && time_unit == other.time_unit && is_enabled == other.is_enabled && object_name_filter == other.object_name_filter end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
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/object_storage/models/object_lifecycle_rule.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
163 164 165 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 163 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
172 173 174 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 172 def hash [name, action, time_amount, time_unit, is_enabled, object_name_filter].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
216 217 218 219 220 221 222 223 224 225 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.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_s ⇒ String
Returns the string representation of the object
210 211 212 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 210 def to_s to_hash.to_s end |