Class: OCI::DataSafe::Models::FormatEntry

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/data_safe/models/format_entry.rb

Overview

A format entry is part of a masking format and defines the logic to mask data. A format entry can be a basic masking format such as Random Number, or it can be a library masking format. If a masking format has more than one format entries, the combined output of all the format entries is used for masking.

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

Constant Summary collapse

TYPE_ENUM =
[
  TYPE_DELETE_ROWS = 'DELETE_ROWS'.freeze,
  TYPE_DETERMINISTIC_SUBSTITUTION = 'DETERMINISTIC_SUBSTITUTION'.freeze,
  TYPE_DETERMINISTIC_ENCRYPTION = 'DETERMINISTIC_ENCRYPTION'.freeze,
  TYPE_DETERMINISTIC_ENCRYPTION_DATE = 'DETERMINISTIC_ENCRYPTION_DATE'.freeze,
  TYPE_FIXED_NUMBER = 'FIXED_NUMBER'.freeze,
  TYPE_FIXED_STRING = 'FIXED_STRING'.freeze,
  TYPE_LIBRARY_MASKING_FORMAT = 'LIBRARY_MASKING_FORMAT'.freeze,
  TYPE_NULL_VALUE = 'NULL_VALUE'.freeze,
  TYPE_PATTERN = 'PATTERN'.freeze,
  TYPE_POST_PROCESSING_FUNCTION = 'POST_PROCESSING_FUNCTION'.freeze,
  TYPE_PRESERVE_ORIGINAL_DATA = 'PRESERVE_ORIGINAL_DATA'.freeze,
  TYPE_RANDOM_DATE = 'RANDOM_DATE'.freeze,
  TYPE_RANDOM_DECIMAL_NUMBER = 'RANDOM_DECIMAL_NUMBER'.freeze,
  TYPE_RANDOM_DIGITS = 'RANDOM_DIGITS'.freeze,
  TYPE_RANDOM_LIST = 'RANDOM_LIST'.freeze,
  TYPE_RANDOM_NUMBER = 'RANDOM_NUMBER'.freeze,
  TYPE_RANDOM_STRING = 'RANDOM_STRING'.freeze,
  TYPE_RANDOM_SUBSTITUTION = 'RANDOM_SUBSTITUTION'.freeze,
  TYPE_REGULAR_EXPRESSION = 'REGULAR_EXPRESSION'.freeze,
  TYPE_SHUFFLE = 'SHUFFLE'.freeze,
  TYPE_SQL_EXPRESSION = 'SQL_EXPRESSION'.freeze,
  TYPE_SUBSTRING = 'SUBSTRING'.freeze,
  TYPE_TRUNCATE_TABLE = 'TRUNCATE_TABLE'.freeze,
  TYPE_USER_DEFINED_FUNCTION = 'USER_DEFINED_FUNCTION'.freeze,
  TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ FormatEntry

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash

Options Hash (attributes):

  • :type (String)

    The value to assign to the #type property

  • :description (String)

    The value to assign to the #description property



119
120
121
122
123
124
125
126
127
128
# File 'lib/oci/data_safe/models/format_entry.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.type = attributes[:'type'] if attributes[:'type']

  self.description = attributes[:'description'] if attributes[:'description']
end

Instance Attribute Details

#descriptionString

The description of the format entry.

Returns:

  • (String)


51
52
53
# File 'lib/oci/data_safe/models/format_entry.rb', line 51

def description
  @description
end

#typeString

[Required] The type of the format entry.

Returns:

  • (String)


47
48
49
# File 'lib/oci/data_safe/models/format_entry.rb', line 47

def type
  @type
end

Class Method Details

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



54
55
56
57
58
59
60
61
# File 'lib/oci/data_safe/models/format_entry.rb', line 54

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'type': :'type',
    'description': :'description'
    # 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.



78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
# File 'lib/oci/data_safe/models/format_entry.rb', line 78

def self.get_subtype(object_hash)
  type = object_hash[:'type'] # rubocop:disable Style/SymbolLiteral

  return 'OCI::DataSafe::Models::RandomStringFormatEntry' if type == 'RANDOM_STRING'
  return 'OCI::DataSafe::Models::DeterministicSubstitutionFormatEntry' if type == 'DETERMINISTIC_SUBSTITUTION'
  return 'OCI::DataSafe::Models::DeterministicEncryptionFormatEntry' if type == 'DETERMINISTIC_ENCRYPTION'
  return 'OCI::DataSafe::Models::RandomDecimalNumberFormatEntry' if type == 'RANDOM_DECIMAL_NUMBER'
  return 'OCI::DataSafe::Models::RandomSubstitutionFormatEntry' if type == 'RANDOM_SUBSTITUTION'
  return 'OCI::DataSafe::Models::PPFFormatEntry' if type == 'POST_PROCESSING_FUNCTION'
  return 'OCI::DataSafe::Models::NullValueFormatEntry' if type == 'NULL_VALUE'
  return 'OCI::DataSafe::Models::FixedNumberFormatEntry' if type == 'FIXED_NUMBER'
  return 'OCI::DataSafe::Models::RegularExpressionFormatEntry' if type == 'REGULAR_EXPRESSION'
  return 'OCI::DataSafe::Models::UDFFormatEntry' if type == 'USER_DEFINED_FUNCTION'
  return 'OCI::DataSafe::Models::ShuffleFormatEntry' if type == 'SHUFFLE'
  return 'OCI::DataSafe::Models::FixedStringFormatEntry' if type == 'FIXED_STRING'
  return 'OCI::DataSafe::Models::TruncateTableFormatEntry' if type == 'TRUNCATE_TABLE'
  return 'OCI::DataSafe::Models::LibraryMaskingFormatEntry' if type == 'LIBRARY_MASKING_FORMAT'
  return 'OCI::DataSafe::Models::SQLExpressionFormatEntry' if type == 'SQL_EXPRESSION'
  return 'OCI::DataSafe::Models::DeterministicEncryptionDateFormatEntry' if type == 'DETERMINISTIC_ENCRYPTION_DATE'
  return 'OCI::DataSafe::Models::RandomDigitsFormatEntry' if type == 'RANDOM_DIGITS'
  return 'OCI::DataSafe::Models::DeleteRowsFormatEntry' if type == 'DELETE_ROWS'
  return 'OCI::DataSafe::Models::SubstringFormatEntry' if type == 'SUBSTRING'
  return 'OCI::DataSafe::Models::PatternFormatEntry' if type == 'PATTERN'
  return 'OCI::DataSafe::Models::RandomNumberFormatEntry' if type == 'RANDOM_NUMBER'
  return 'OCI::DataSafe::Models::PreserveOriginalDataFormatEntry' if type == 'PRESERVE_ORIGINAL_DATA'
  return 'OCI::DataSafe::Models::RandomDateFormatEntry' if type == 'RANDOM_DATE'
  return 'OCI::DataSafe::Models::RandomListFormatEntry' if type == 'RANDOM_LIST'

  # TODO: Log a warning when the subtype is not found.
  'OCI::DataSafe::Models::FormatEntry'
end

.swagger_typesObject

Attribute type mapping.



64
65
66
67
68
69
70
71
# File 'lib/oci/data_safe/models/format_entry.rb', line 64

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'type': :'String',
    'description': :'String'
    # rubocop:enable Style/SymbolLiteral
  }
end

Instance Method Details

#==(other) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • other (Object)

    the other object to be compared



150
151
152
153
154
155
156
# File 'lib/oci/data_safe/models/format_entry.rb', line 150

def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    type == other.type &&
    description == other.description
end

#build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# File 'lib/oci/data_safe/models/format_entry.rb', line 181

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

Parameters:

  • other (Object)

    the other object to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


161
162
163
# File 'lib/oci/data_safe/models/format_entry.rb', line 161

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



170
171
172
# File 'lib/oci/data_safe/models/format_entry.rb', line 170

def hash
  [type, description].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



214
215
216
217
218
219
220
221
222
223
# File 'lib/oci/data_safe/models/format_entry.rb', line 214

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_sString

Returns the string representation of the object

Returns:

  • (String)

    String presentation of the object



208
209
210
# File 'lib/oci/data_safe/models/format_entry.rb', line 208

def to_s
  to_hash.to_s
end