Class: OCI::DataScience::Models::ConfigurationPropertySchema

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/data_science/models/configuration_property_schema.rb

Overview

Schema for single configuration property

Constant Summary collapse

VALUE_TYPE_ENUM =
[
  VALUE_TYPE_STRING = 'STRING'.freeze,
  VALUE_TYPE_SECRET = 'SECRET'.freeze,
  VALUE_TYPE_VAULT_SECRET_ID = 'VAULT_SECRET_ID'.freeze,
  VALUE_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 = {}) ⇒ ConfigurationPropertySchema

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :key_name (String)

    The value to assign to the #key_name property

  • :value_type (String)

    The value to assign to the #value_type property

  • :description (String)

    The value to assign to the #description property

  • :is_mandatory (BOOLEAN)

    The value to assign to the #is_mandatory property

  • :default_value (String)

    The value to assign to the #default_value property

  • :validation_regexp (String)

    The value to assign to the #validation_regexp property

  • :sample_value (String)

    The value to assign to the #sample_value property



90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
# File 'lib/oci/data_science/models/configuration_property_schema.rb', line 90

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_name = attributes[:'keyName'] if attributes[:'keyName']

  raise 'You cannot provide both :keyName and :key_name' if attributes.key?(:'keyName') && attributes.key?(:'key_name')

  self.key_name = attributes[:'key_name'] if attributes[:'key_name']

  self.value_type = attributes[:'valueType'] if attributes[:'valueType']

  raise 'You cannot provide both :valueType and :value_type' if attributes.key?(:'valueType') && attributes.key?(:'value_type')

  self.value_type = attributes[:'value_type'] if attributes[:'value_type']

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

  self.is_mandatory = attributes[:'isMandatory'] unless attributes[:'isMandatory'].nil?

  raise 'You cannot provide both :isMandatory and :is_mandatory' if attributes.key?(:'isMandatory') && attributes.key?(:'is_mandatory')

  self.is_mandatory = attributes[:'is_mandatory'] unless attributes[:'is_mandatory'].nil?

  self.default_value = attributes[:'defaultValue'] if attributes[:'defaultValue']

  raise 'You cannot provide both :defaultValue and :default_value' if attributes.key?(:'defaultValue') && attributes.key?(:'default_value')

  self.default_value = attributes[:'default_value'] if attributes[:'default_value']

  self.validation_regexp = attributes[:'validationRegexp'] if attributes[:'validationRegexp']

  raise 'You cannot provide both :validationRegexp and :validation_regexp' if attributes.key?(:'validationRegexp') && attributes.key?(:'validation_regexp')

  self.validation_regexp = attributes[:'validation_regexp'] if attributes[:'validation_regexp']

  self.sample_value = attributes[:'sampleValue'] if attributes[:'sampleValue']

  raise 'You cannot provide both :sampleValue and :sample_value' if attributes.key?(:'sampleValue') && attributes.key?(:'sample_value')

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

Instance Attribute Details

#default_valueString

The default value for the optional configuration property (it must not be specified for mandatory configuration properties)

Returns:

  • (String)


37
38
39
# File 'lib/oci/data_science/models/configuration_property_schema.rb', line 37

def default_value
  @default_value
end

#descriptionString

[Required] Description of this configuration property

Returns:

  • (String)


29
30
31
# File 'lib/oci/data_science/models/configuration_property_schema.rb', line 29

def description
  @description
end

#is_mandatoryBOOLEAN

If the value is true this configuration property is mandatory and visa versa. If not specified configuration property is optional.

Returns:

  • (BOOLEAN)


33
34
35
# File 'lib/oci/data_science/models/configuration_property_schema.rb', line 33

def is_mandatory
  @is_mandatory
end

#key_nameString

[Required] Name of key (parameter name)

Returns:

  • (String)


21
22
23
# File 'lib/oci/data_science/models/configuration_property_schema.rb', line 21

def key_name
  @key_name
end

#sample_valueString

[Required] Sample property value (it must match validationRegexp if it is specified)

Returns:

  • (String)


45
46
47
# File 'lib/oci/data_science/models/configuration_property_schema.rb', line 45

def sample_value
  @sample_value
end

#validation_regexpString

A regular expression will be used for the validation of property value.

Returns:

  • (String)


41
42
43
# File 'lib/oci/data_science/models/configuration_property_schema.rb', line 41

def validation_regexp
  @validation_regexp
end

#value_typeString

[Required] Type of value

Returns:

  • (String)


25
26
27
# File 'lib/oci/data_science/models/configuration_property_schema.rb', line 25

def value_type
  @value_type
end

Class Method Details

.attribute_mapObject

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



48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/oci/data_science/models/configuration_property_schema.rb', line 48

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'key_name': :'keyName',
    'value_type': :'valueType',
    'description': :'description',
    'is_mandatory': :'isMandatory',
    'default_value': :'defaultValue',
    'validation_regexp': :'validationRegexp',
    'sample_value': :'sampleValue'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/oci/data_science/models/configuration_property_schema.rb', line 63

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'key_name': :'String',
    'value_type': :'String',
    'description': :'String',
    'is_mandatory': :'BOOLEAN',
    'default_value': :'String',
    'validation_regexp': :'String',
    'sample_value': :'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



155
156
157
158
159
160
161
162
163
164
165
166
# File 'lib/oci/data_science/models/configuration_property_schema.rb', line 155

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

  self.class == other.class &&
    key_name == other.key_name &&
    value_type == other.value_type &&
    description == other.description &&
    is_mandatory == other.is_mandatory &&
    default_value == other.default_value &&
    validation_regexp == other.validation_regexp &&
    sample_value == other.sample_value
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



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
# File 'lib/oci/data_science/models/configuration_property_schema.rb', line 191

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


171
172
173
# File 'lib/oci/data_science/models/configuration_property_schema.rb', line 171

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



180
181
182
# File 'lib/oci/data_science/models/configuration_property_schema.rb', line 180

def hash
  [key_name, value_type, description, is_mandatory, default_value, validation_regexp, sample_value].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



224
225
226
227
228
229
230
231
232
233
# File 'lib/oci/data_science/models/configuration_property_schema.rb', line 224

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



218
219
220
# File 'lib/oci/data_science/models/configuration_property_schema.rb', line 218

def to_s
  to_hash.to_s
end