Class: OCI::Core::Models::VolumeBackupPolicyAssignment
- Inherits:
-
Object
- Object
- OCI::Core::Models::VolumeBackupPolicyAssignment
- Defined in:
- lib/oci/core/models/volume_backup_policy_assignment.rb
Overview
Specifies that a particular volume backup policy is assigned to an asset such as a volume.
Instance Attribute Summary collapse
-
#asset_id ⇒ String
[Required] The OCID of the asset (e.g. a volume) to which the policy has been assigned.
-
#id ⇒ String
[Required] The OCID of the volume backup policy assignment.
-
#policy_id ⇒ String
[Required] The OCID of the volume backup policy that has been assigned to an asset.
-
#time_created ⇒ DateTime
[Required] The date and time the volume backup policy assignment was created.
Instance Method Summary collapse
-
#==(other_object) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other_object) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ VolumeBackupPolicyAssignment
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 = {}) ⇒ VolumeBackupPolicyAssignment
Initializes the object
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 |
# File 'lib/oci/core/models/volume_backup_policy_assignment.rb', line 32 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} if attributes[:'assetId'] self.asset_id = attributes[:'assetId'] end raise 'You cannot provide both :assetId and :asset_id' if attributes.key?(:'assetId') && attributes.key?(:'asset_id') if attributes[:'asset_id'] self.asset_id = attributes[:'asset_id'] end if attributes[:'id'] self.id = attributes[:'id'] end if attributes[:'policyId'] self.policy_id = attributes[:'policyId'] end raise 'You cannot provide both :policyId and :policy_id' if attributes.key?(:'policyId') && attributes.key?(:'policy_id') if attributes[:'policy_id'] self.policy_id = attributes[:'policy_id'] end if attributes[:'timeCreated'] self.time_created = attributes[:'timeCreated'] end raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created') if attributes[:'time_created'] self.time_created = attributes[:'time_created'] end end |
Instance Attribute Details
#asset_id ⇒ String
[Required] The OCID of the asset (e.g. a volume) to which the policy has been assigned.
10 11 12 |
# File 'lib/oci/core/models/volume_backup_policy_assignment.rb', line 10 def asset_id @asset_id end |
#id ⇒ String
[Required] The OCID of the volume backup policy assignment.
14 15 16 |
# File 'lib/oci/core/models/volume_backup_policy_assignment.rb', line 14 def id @id end |
#policy_id ⇒ String
[Required] The OCID of the volume backup policy that has been assigned to an asset.
18 19 20 |
# File 'lib/oci/core/models/volume_backup_policy_assignment.rb', line 18 def policy_id @policy_id end |
#time_created ⇒ DateTime
[Required] The date and time the volume backup policy assignment was created. Format defined by RFC3339.
23 24 25 |
# File 'lib/oci/core/models/volume_backup_policy_assignment.rb', line 23 def time_created @time_created end |
Instance Method Details
#==(other_object) ⇒ Object
Checks equality by comparing each attribute.
76 77 78 79 80 81 82 83 |
# File 'lib/oci/core/models/volume_backup_policy_assignment.rb', line 76 def ==(other_object) return true if self.equal?(other_object) self.class == other_object.class && asset_id == other_object.asset_id && id == other_object.id && policy_id == other_object.policy_id && time_created == other_object.time_created end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/oci/core/models/volume_backup_policy_assignment.rb', line 100 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) self.public_method("#{key}=").call(attributes[self.class.attribute_map[key]].map{ |v| OCI::Internal::Util.convert_to_type($1, v) } ) end elsif !attributes[self.class.attribute_map[key]].nil? self.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_object) ⇒ Boolean
87 88 89 |
# File 'lib/oci/core/models/volume_backup_policy_assignment.rb', line 87 def eql?(other_object) self == other_object end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
93 94 95 |
# File 'lib/oci/core/models/volume_backup_policy_assignment.rb', line 93 def hash [asset_id, id, policy_id, time_created].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
125 126 127 128 129 130 131 132 133 |
# File 'lib/oci/core/models/volume_backup_policy_assignment.rb', line 125 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
119 120 121 |
# File 'lib/oci/core/models/volume_backup_policy_assignment.rb', line 119 def to_s to_hash.to_s end |