Class: DataConnectivity::Models::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/data_connectivity/models/attribute.rb

Overview

Registry Attribute Object, to get connector details

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Attribute

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :name (String)

    The value to assign to the #name property

  • :is_sensitive (BOOLEAN)

    The value to assign to the #is_sensitive property

  • :is_mandatory (BOOLEAN)

    The value to assign to the #is_mandatory property

  • :is_generated (BOOLEAN)

    The value to assign to the #is_generated property

  • :is_base64_encoded (BOOLEAN)

    The value to assign to the #is_base64_encoded property

  • :valid_key_list (Array<String>)

    The value to assign to the #valid_key_list property

  • :attribute_type (String)

    The value to assign to the #attribute_type property



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
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/oci/data_connectivity/models/attribute.rb', line 82

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.name = attributes[:'name'] if attributes[:'name']

  self.is_sensitive = attributes[:'isSensitive'] unless attributes[:'isSensitive'].nil?

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

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

  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.is_generated = attributes[:'isGenerated'] unless attributes[:'isGenerated'].nil?

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

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

  self.is_base64_encoded = attributes[:'isBase64Encoded'] unless attributes[:'isBase64Encoded'].nil?

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

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

  self.valid_key_list = attributes[:'validKeyList'] if attributes[:'validKeyList']

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

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

  self.attribute_type = attributes[:'attributeType'] if attributes[:'attributeType']

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

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

Instance Attribute Details

#attribute_typeString

Attribute type details

Returns:

  • (String)


37
38
39
# File 'lib/oci/data_connectivity/models/attribute.rb', line 37

def attribute_type
  @attribute_type
end

#is_base64_encodedBOOLEAN

True if Attribute is encoded.

Returns:

  • (BOOLEAN)


29
30
31
# File 'lib/oci/data_connectivity/models/attribute.rb', line 29

def is_base64_encoded
  @is_base64_encoded
end

#is_generatedBOOLEAN

True if Attribute is generated.

Returns:

  • (BOOLEAN)


25
26
27
# File 'lib/oci/data_connectivity/models/attribute.rb', line 25

def is_generated
  @is_generated
end

#is_mandatoryBOOLEAN

True if Attribute is mandatory.

Returns:

  • (BOOLEAN)


21
22
23
# File 'lib/oci/data_connectivity/models/attribute.rb', line 21

def is_mandatory
  @is_mandatory
end

#is_sensitiveBOOLEAN

True if Attribute is sensitive.

Returns:

  • (BOOLEAN)


17
18
19
# File 'lib/oci/data_connectivity/models/attribute.rb', line 17

def is_sensitive
  @is_sensitive
end

#nameString

**[Required]** The name of of the Attribute.

Returns:

  • (String)


13
14
15
# File 'lib/oci/data_connectivity/models/attribute.rb', line 13

def name
  @name
end

#valid_key_listArray<String>

List of valid key list

Returns:

  • (Array<String>)


33
34
35
# File 'lib/oci/data_connectivity/models/attribute.rb', line 33

def valid_key_list
  @valid_key_list
end

Class Method Details

.attribute_mapObject

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



40
41
42
43
44
45
46
47
48
49
50
51
52
# File 'lib/oci/data_connectivity/models/attribute.rb', line 40

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'name',
    'is_sensitive': :'isSensitive',
    'is_mandatory': :'isMandatory',
    'is_generated': :'isGenerated',
    'is_base64_encoded': :'isBase64Encoded',
    'valid_key_list': :'validKeyList',
    'attribute_type': :'attributeType'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



55
56
57
58
59
60
61
62
63
64
65
66
67
# File 'lib/oci/data_connectivity/models/attribute.rb', line 55

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'String',
    'is_sensitive': :'BOOLEAN',
    'is_mandatory': :'BOOLEAN',
    'is_generated': :'BOOLEAN',
    'is_base64_encoded': :'BOOLEAN',
    'valid_key_list': :'Array<String>',
    'attribute_type': :'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



134
135
136
137
138
139
140
141
142
143
144
145
# File 'lib/oci/data_connectivity/models/attribute.rb', line 134

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

  self.class == other.class &&
    name == other.name &&
    is_sensitive == other.is_sensitive &&
    is_mandatory == other.is_mandatory &&
    is_generated == other.is_generated &&
    is_base64_encoded == other.is_base64_encoded &&
    valid_key_list == other.valid_key_list &&
    attribute_type == other.attribute_type
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



170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/oci/data_connectivity/models/attribute.rb', line 170

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


150
151
152
# File 'lib/oci/data_connectivity/models/attribute.rb', line 150

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



159
160
161
# File 'lib/oci/data_connectivity/models/attribute.rb', line 159

def hash
  [name, is_sensitive, is_mandatory, is_generated, is_base64_encoded, valid_key_list, attribute_type].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



203
204
205
206
207
208
209
210
211
212
# File 'lib/oci/data_connectivity/models/attribute.rb', line 203

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



197
198
199
# File 'lib/oci/data_connectivity/models/attribute.rb', line 197

def to_s
  to_hash.to_s
end