Class: OCI::Audit::Models::AuditEvent
- Inherits:
-
Object
- Object
- OCI::Audit::Models::AuditEvent
- Defined in:
- lib/oci/audit/models/audit_event.rb
Overview
All the attributes of an audit event. For more information, see [Viewing Audit Log Events](docs.cloud.oracle.com/iaas/Content/Audit/Tasks/viewinglogevents.htm).
Instance Attribute Summary collapse
-
#cloud_events_version ⇒ String
[Required] The version of the CloudEvents specification.
-
#content_type ⇒ String
[Required] The content type of the data contained in
data. -
#data ⇒ OCI::Audit::Models::Data
This attribute is required.
-
#event_id ⇒ String
[Required] The GUID of the event.
-
#event_time ⇒ DateTime
[Required] The time the event occurred, expressed in [RFC 3339](tools.ietf.org/html/rfc3339) timestamp format.
-
#event_type ⇒ String
[Required] The type of event that happened.
-
#event_type_version ⇒ String
[Required] The version of the event type.
-
#source ⇒ String
[Required] The source of the event.
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 = {}) ⇒ AuditEvent
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 = {}) ⇒ AuditEvent
Initializes the object
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 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/oci/audit/models/audit_event.rb', line 117 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.event_type = attributes[:'eventType'] if attributes[:'eventType'] raise 'You cannot provide both :eventType and :event_type' if attributes.key?(:'eventType') && attributes.key?(:'event_type') self.event_type = attributes[:'event_type'] if attributes[:'event_type'] self.cloud_events_version = attributes[:'cloudEventsVersion'] if attributes[:'cloudEventsVersion'] raise 'You cannot provide both :cloudEventsVersion and :cloud_events_version' if attributes.key?(:'cloudEventsVersion') && attributes.key?(:'cloud_events_version') self.cloud_events_version = attributes[:'cloud_events_version'] if attributes[:'cloud_events_version'] self.event_type_version = attributes[:'eventTypeVersion'] if attributes[:'eventTypeVersion'] raise 'You cannot provide both :eventTypeVersion and :event_type_version' if attributes.key?(:'eventTypeVersion') && attributes.key?(:'event_type_version') self.event_type_version = attributes[:'event_type_version'] if attributes[:'event_type_version'] self.source = attributes[:'source'] if attributes[:'source'] self.event_id = attributes[:'eventId'] if attributes[:'eventId'] raise 'You cannot provide both :eventId and :event_id' if attributes.key?(:'eventId') && attributes.key?(:'event_id') self.event_id = attributes[:'event_id'] if attributes[:'event_id'] self.event_time = attributes[:'eventTime'] if attributes[:'eventTime'] raise 'You cannot provide both :eventTime and :event_time' if attributes.key?(:'eventTime') && attributes.key?(:'event_time') self.event_time = attributes[:'event_time'] if attributes[:'event_time'] self.content_type = attributes[:'contentType'] if attributes[:'contentType'] raise 'You cannot provide both :contentType and :content_type' if attributes.key?(:'contentType') && attributes.key?(:'content_type') self.content_type = attributes[:'content_type'] if attributes[:'content_type'] self.data = attributes[:'data'] if attributes[:'data'] end |
Instance Attribute Details
#cloud_events_version ⇒ String
[Required] The version of the CloudEvents specification. The structure of the envelope follows the [CloudEvents](github.com/cloudevents/spec) industry standard format hosted by the [Cloud Native Computing Foundation ( CNCF)](www.cncf.io/).
Audit uses version 0.1 specification of the CloudEvents event envelope.
Example: 0.1
31 32 33 |
# File 'lib/oci/audit/models/audit_event.rb', line 31 def cloud_events_version @cloud_events_version end |
#content_type ⇒ String
[Required] The content type of the data contained in data.
Example: application/json
65 66 67 |
# File 'lib/oci/audit/models/audit_event.rb', line 65 def content_type @content_type end |
#data ⇒ OCI::Audit::Models::Data
This attribute is required.
69 70 71 |
# File 'lib/oci/audit/models/audit_event.rb', line 69 def data @data end |
#event_id ⇒ String
[Required] The GUID of the event.
51 52 53 |
# File 'lib/oci/audit/models/audit_event.rb', line 51 def event_id @event_id end |
#event_time ⇒ DateTime
[Required] The time the event occurred, expressed in [RFC 3339](tools.ietf.org/html/rfc3339) timestamp format.
Example: 2019-09-18T00:10:59.252Z
58 59 60 |
# File 'lib/oci/audit/models/audit_event.rb', line 58 def event_time @event_time end |
#event_type ⇒ String
[Required] The type of event that happened.
The service that produces the event can also add, remove, or change the meaning of a field. A service implementing these type changes would publish a new version of an eventType and revise the eventTypeVersion field.
Example: com.oraclecloud.ComputeApi.GetInstance
20 21 22 |
# File 'lib/oci/audit/models/audit_event.rb', line 20 def event_type @event_type end |
#event_type_version ⇒ String
[Required] The version of the event type. This version applies to the payload of the event, not the envelope. Use cloudEventsVersion to determine the version of the envelope.
Example: 2.0
39 40 41 |
# File 'lib/oci/audit/models/audit_event.rb', line 39 def event_type_version @event_type_version end |
#source ⇒ String
[Required] The source of the event.
Example: ComputeApi
46 47 48 |
# File 'lib/oci/audit/models/audit_event.rb', line 46 def source @source end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
72 73 74 75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/oci/audit/models/audit_event.rb', line 72 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'event_type': :'eventType', 'cloud_events_version': :'cloudEventsVersion', 'event_type_version': :'eventTypeVersion', 'source': :'source', 'event_id': :'eventId', 'event_time': :'eventTime', 'content_type': :'contentType', 'data': :'data' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 |
# File 'lib/oci/audit/models/audit_event.rb', line 88 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'event_type': :'String', 'cloud_events_version': :'String', 'event_type_version': :'String', 'source': :'String', 'event_id': :'String', 'event_time': :'DateTime', 'content_type': :'String', 'data': :'OCI::Audit::Models::Data' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
171 172 173 174 175 176 177 178 179 180 181 182 183 |
# File 'lib/oci/audit/models/audit_event.rb', line 171 def ==(other) return true if equal?(other) self.class == other.class && event_type == other.event_type && cloud_events_version == other.cloud_events_version && event_type_version == other.event_type_version && source == other.source && event_id == other.event_id && event_time == other.event_time && content_type == other.content_type && data == other.data end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 |
# File 'lib/oci/audit/models/audit_event.rb', line 208 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
188 189 190 |
# File 'lib/oci/audit/models/audit_event.rb', line 188 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
197 198 199 |
# File 'lib/oci/audit/models/audit_event.rb', line 197 def hash [event_type, cloud_events_version, event_type_version, source, event_id, event_time, content_type, data].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
241 242 243 244 245 246 247 248 249 250 |
# File 'lib/oci/audit/models/audit_event.rb', line 241 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
235 236 237 |
# File 'lib/oci/audit/models/audit_event.rb', line 235 def to_s to_hash.to_s end |