Class: OCI::ManagementAgent::Models::DataSource
- Inherits:
-
Object
- Object
- OCI::ManagementAgent::Models::DataSource
- Defined in:
- lib/oci/management_agent/models/data_source.rb
Overview
A representation of a source configuration setup in the Management Agent.
This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class
Direct Known Subclasses
Constant Summary collapse
- TYPE_ENUM =
[ TYPE_KUBERNETES_CLUSTER = 'KUBERNETES_CLUSTER'.freeze, TYPE_PROMETHEUS_EMITTER = 'PROMETHEUS_EMITTER'.freeze, TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
- STATE_ENUM =
[ STATE_CREATING = 'CREATING'.freeze, STATE_UPDATING = 'UPDATING'.freeze, STATE_ACTIVE = 'ACTIVE'.freeze, STATE_INACTIVE = 'INACTIVE'.freeze, STATE_TERMINATED = 'TERMINATED'.freeze, STATE_DELETING = 'DELETING'.freeze, STATE_DELETED = 'DELETED'.freeze, STATE_FAILED = 'FAILED'.freeze, STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
Instance Attribute Summary collapse
-
#compartment_id ⇒ String
[Required] Compartment owning this DataSource.
-
#key ⇒ String
[Required] Identifier for DataSource.
-
#name ⇒ String
[Required] Unique name of the DataSource.
-
#state ⇒ String
[Required] State of the DataSource.
-
#time_created ⇒ DateTime
[Required] The time the DataSource was created.
-
#time_updated ⇒ DateTime
[Required] The time the DataSource data was last received.
-
#type ⇒ String
[Required] The type of the DataSource.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.get_subtype(object_hash) ⇒ Object
Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.
-
.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 = {}) ⇒ DataSource
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 = {}) ⇒ DataSource
Initializes the object
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 148 149 150 |
# File 'lib/oci/management_agent/models/data_source.rb', line 119 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.type = attributes[:'type'] if attributes[:'type'] self.name = attributes[:'name'] if attributes[:'name'] self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId'] raise 'You cannot provide both :compartmentId and :compartment_id' if attributes.key?(:'compartmentId') && attributes.key?(:'compartment_id') self.compartment_id = attributes[:'compartment_id'] if attributes[:'compartment_id'] self.state = attributes[:'state'] if attributes[:'state'] self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated'] raise 'You cannot provide both :timeCreated and :time_created' if attributes.key?(:'timeCreated') && attributes.key?(:'time_created') self.time_created = attributes[:'time_created'] if attributes[:'time_created'] self.time_updated = attributes[:'timeUpdated'] if attributes[:'timeUpdated'] raise 'You cannot provide both :timeUpdated and :time_updated' if attributes.key?(:'timeUpdated') && attributes.key?(:'time_updated') self.time_updated = attributes[:'time_updated'] if attributes[:'time_updated'] end |
Instance Attribute Details
#compartment_id ⇒ String
[Required] Compartment owning this DataSource.
46 47 48 |
# File 'lib/oci/management_agent/models/data_source.rb', line 46 def compartment_id @compartment_id end |
#key ⇒ String
[Required] Identifier for DataSource. This represents the type and name for the data source associated with the Management Agent.
34 35 36 |
# File 'lib/oci/management_agent/models/data_source.rb', line 34 def key @key end |
#name ⇒ String
[Required] Unique name of the DataSource.
42 43 44 |
# File 'lib/oci/management_agent/models/data_source.rb', line 42 def name @name end |
#state ⇒ String
[Required] State of the DataSource.
50 51 52 |
# File 'lib/oci/management_agent/models/data_source.rb', line 50 def state @state end |
#time_created ⇒ DateTime
[Required] The time the DataSource was created. An RFC3339 formatted datetime string
54 55 56 |
# File 'lib/oci/management_agent/models/data_source.rb', line 54 def time_created @time_created end |
#time_updated ⇒ DateTime
[Required] The time the DataSource data was last received. An RFC3339 formatted datetime string
58 59 60 |
# File 'lib/oci/management_agent/models/data_source.rb', line 58 def time_updated @time_updated end |
#type ⇒ String
[Required] The type of the DataSource.
38 39 40 |
# File 'lib/oci/management_agent/models/data_source.rb', line 38 def type @type end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
61 62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/oci/management_agent/models/data_source.rb', line 61 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'key': :'key', 'type': :'type', 'name': :'name', 'compartment_id': :'compartmentId', 'state': :'state', 'time_created': :'timeCreated', 'time_updated': :'timeUpdated' # rubocop:enable Style/SymbolLiteral } end |
.get_subtype(object_hash) ⇒ Object
Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.
95 96 97 98 99 100 101 102 103 |
# File 'lib/oci/management_agent/models/data_source.rb', line 95 def self.get_subtype(object_hash) type = object_hash[:'type'] # rubocop:disable Style/SymbolLiteral return 'OCI::ManagementAgent::Models::KubernetesClusterDataSource' if type == 'KUBERNETES_CLUSTER' return 'OCI::ManagementAgent::Models::PrometheusEmitterDataSource' if type == 'PROMETHEUS_EMITTER' # TODO: Log a warning when the subtype is not found. 'OCI::ManagementAgent::Models::DataSource' end |
.swagger_types ⇒ Object
Attribute type mapping.
76 77 78 79 80 81 82 83 84 85 86 87 88 |
# File 'lib/oci/management_agent/models/data_source.rb', line 76 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'key': :'String', 'type': :'String', 'name': :'String', 'compartment_id': :'String', 'state': :'String', 'time_created': :'DateTime', 'time_updated': :'DateTime' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
185 186 187 188 189 190 191 192 193 194 195 196 |
# File 'lib/oci/management_agent/models/data_source.rb', line 185 def ==(other) return true if equal?(other) self.class == other.class && key == other.key && type == other.type && name == other.name && compartment_id == other.compartment_id && state == other.state && time_created == other.time_created && time_updated == other.time_updated end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 |
# File 'lib/oci/management_agent/models/data_source.rb', line 221 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
201 202 203 |
# File 'lib/oci/management_agent/models/data_source.rb', line 201 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
210 211 212 |
# File 'lib/oci/management_agent/models/data_source.rb', line 210 def hash [key, type, name, compartment_id, state, time_created, time_updated].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
254 255 256 257 258 259 260 261 262 263 |
# File 'lib/oci/management_agent/models/data_source.rb', line 254 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
248 249 250 |
# File 'lib/oci/management_agent/models/data_source.rb', line 248 def to_s to_hash.to_s end |