Class: OCI::DataSafe::Models::PolicyCondition
- Inherits:
-
Object
- Object
- OCI::DataSafe::Models::PolicyCondition
- Defined in:
- lib/oci/data_safe/models/policy_condition.rb
Overview
The audit policy provisioning conditions. 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
AllUserCondition, AttributeSetCondition, RoleCondition, UserCondition
Constant Summary collapse
- ENTITY_SELECTION_ENUM =
[ ENTITY_SELECTION_INCLUDE = 'INCLUDE'.freeze, ENTITY_SELECTION_EXCLUDE = 'EXCLUDE'.freeze, ENTITY_SELECTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
- ENTITY_TYPE_ENUM =
[ ENTITY_TYPE_USER = 'USER'.freeze, ENTITY_TYPE_ROLE = 'ROLE'.freeze, ENTITY_TYPE_ALL_USERS = 'ALL_USERS'.freeze, ENTITY_TYPE_ATTRIBUTE_SET = 'ATTRIBUTE_SET'.freeze, ENTITY_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
- OPERATION_STATUS_ENUM =
[ OPERATION_STATUS_SUCCESS = 'SUCCESS'.freeze, OPERATION_STATUS_FAILURE = 'FAILURE'.freeze, OPERATION_STATUS_BOTH = 'BOTH'.freeze, OPERATION_STATUS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
Instance Attribute Summary collapse
-
#entity_selection ⇒ String
[Required] Specifies whether to include or exclude the specified users or roles.
-
#entity_type ⇒ String
[Required] The type of users or roles that the unified audit policy is applied to.
-
#operation_status ⇒ String
[Required] The operation status that the policy must be enabled for.
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 = {}) ⇒ PolicyCondition
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 = {}) ⇒ PolicyCondition
Initializes the object
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 |
# File 'lib/oci/data_safe/models/policy_condition.rb', line 95 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.entity_selection = attributes[:'entitySelection'] if attributes[:'entitySelection'] raise 'You cannot provide both :entitySelection and :entity_selection' if attributes.key?(:'entitySelection') && attributes.key?(:'entity_selection') self.entity_selection = attributes[:'entity_selection'] if attributes[:'entity_selection'] self.entity_type = attributes[:'entityType'] if attributes[:'entityType'] raise 'You cannot provide both :entityType and :entity_type' if attributes.key?(:'entityType') && attributes.key?(:'entity_type') self.entity_type = attributes[:'entity_type'] if attributes[:'entity_type'] self.operation_status = attributes[:'operationStatus'] if attributes[:'operationStatus'] raise 'You cannot provide both :operationStatus and :operation_status' if attributes.key?(:'operationStatus') && attributes.key?(:'operation_status') self.operation_status = attributes[:'operation_status'] if attributes[:'operation_status'] end |
Instance Attribute Details
#entity_selection ⇒ String
[Required] Specifies whether to include or exclude the specified users or roles.
36 37 38 |
# File 'lib/oci/data_safe/models/policy_condition.rb', line 36 def entity_selection @entity_selection end |
#entity_type ⇒ String
[Required] The type of users or roles that the unified audit policy is applied to.
40 41 42 |
# File 'lib/oci/data_safe/models/policy_condition.rb', line 40 def entity_type @entity_type end |
#operation_status ⇒ String
[Required] The operation status that the policy must be enabled for.
44 45 46 |
# File 'lib/oci/data_safe/models/policy_condition.rb', line 44 def operation_status @operation_status end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
47 48 49 50 51 52 53 54 55 |
# File 'lib/oci/data_safe/models/policy_condition.rb', line 47 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'entity_selection': :'entitySelection', 'entity_type': :'entityType', 'operation_status': :'operationStatus' # 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.
73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/oci/data_safe/models/policy_condition.rb', line 73 def self.get_subtype(object_hash) type = object_hash[:'entityType'] # rubocop:disable Style/SymbolLiteral return 'OCI::DataSafe::Models::AttributeSetCondition' if type == 'ATTRIBUTE_SET' return 'OCI::DataSafe::Models::UserCondition' if type == 'USER' return 'OCI::DataSafe::Models::RoleCondition' if type == 'ROLE' return 'OCI::DataSafe::Models::AllUserCondition' if type == 'ALL_USERS' # TODO: Log a warning when the subtype is not found. 'OCI::DataSafe::Models::PolicyCondition' end |
.swagger_types ⇒ Object
Attribute type mapping.
58 59 60 61 62 63 64 65 66 |
# File 'lib/oci/data_safe/models/policy_condition.rb', line 58 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'entity_selection': :'String', 'entity_type': :'String', 'operation_status': :'String' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
166 167 168 169 170 171 172 173 |
# File 'lib/oci/data_safe/models/policy_condition.rb', line 166 def ==(other) return true if equal?(other) self.class == other.class && entity_selection == other.entity_selection && entity_type == other.entity_type && operation_status == other.operation_status end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 |
# File 'lib/oci/data_safe/models/policy_condition.rb', line 198 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
178 179 180 |
# File 'lib/oci/data_safe/models/policy_condition.rb', line 178 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
187 188 189 |
# File 'lib/oci/data_safe/models/policy_condition.rb', line 187 def hash [entity_selection, entity_type, operation_status].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
231 232 233 234 235 236 237 238 239 240 |
# File 'lib/oci/data_safe/models/policy_condition.rb', line 231 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
225 226 227 |
# File 'lib/oci/data_safe/models/policy_condition.rb', line 225 def to_s to_hash.to_s end |