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.
Constant Summary collapse
- TIME_UNIT_ENUM =
[ 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
-
#target ⇒ String
The target of the object lifecycle policy rule.
-
#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
111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 111 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.target = attributes[:'target'] if attributes[:'target'] self.target = "objects" if target.nil? && !attributes.key?(:'target') # rubocop:disable Style/StringLiterals 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 from Standard and InfrequentAccess storage tiers into the Archive storage tier. Rules using the action 'INFREQUENT_ACCESS' move objects from Standard storage tier into the Infrequent Access Storage tier. Objects that are already in InfrequentAccess tier or in Archive tier are left untouched. Rules using the action 'DELETE' permanently delete objects from buckets. Rules using 'ABORT' abort the uncommitted multipart-uploads and permanently delete their parts from buckets.
47 48 49 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 47 def action @action end |
#is_enabled ⇒ BOOLEAN
[Required] A Boolean that determines whether this rule is currently enabled.
63 64 65 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 63 def is_enabled @is_enabled end |
#name ⇒ String
[Required] The name of the lifecycle rule to be applied.
23 24 25 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 23 def name @name end |
#object_name_filter ⇒ OCI::ObjectStorage::Models::ObjectNameFilter
66 67 68 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 66 def object_name_filter @object_name_filter end |
#target ⇒ String
The target of the object lifecycle policy rule. The values of target can be either "objects", "multipart-uploads" or "previous-object-versions". This field when declared as "objects" is used to specify ARCHIVE, INFREQUENT_ACCESS or DELETE rule for objects. This field when declared as "previous-object-versions" is used to specify ARCHIVE, INFREQUENT_ACCESS or DELETE rule for previous versions of existing objects. This field when declared as "multipart-uploads" is used to specify the ABORT (only) rule for uncommitted multipart-uploads.
35 36 37 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 35 def target @target 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.
53 54 55 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 53 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.
59 60 61 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 59 def time_unit @time_unit end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 69 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'name': :'name', 'target': :'target', '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.
84 85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 84 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'name': :'String', 'target': :'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.
169 170 171 172 173 174 175 176 177 178 179 180 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 169 def ==(other) return true if equal?(other) self.class == other.class && name == other.name && target == other.target && 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
205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 205 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
185 186 187 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 185 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
194 195 196 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 194 def hash [name, target, action, time_amount, time_unit, is_enabled, object_name_filter].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
238 239 240 241 242 243 244 245 246 247 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 238 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
232 233 234 |
# File 'lib/oci/object_storage/models/object_lifecycle_rule.rb', line 232 def to_s to_hash.to_s end |