Class: OCI::Oda::Models::ParameterDefinition

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/oda/models/parameter_definition.rb

Overview

A parameter to a resource.

Constant Summary collapse

TYPE_ENUM =
[
  TYPE_STRING = 'STRING'.freeze,
  TYPE_URI = 'URI'.freeze,
  TYPE_URL = 'URL'.freeze,
  TYPE_NUMBER = 'NUMBER'.freeze,
  TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
DIRECTION_ENUM =
[
  DIRECTION_INPUT = 'INPUT'.freeze,
  DIRECTION_OUTPUT = 'OUTPUT'.freeze,
  DIRECTION_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ParameterDefinition

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

  • :type (String)

    The value to assign to the #type property

  • :description (String)

    The value to assign to the #description property

  • :is_required (BOOLEAN)

    The value to assign to the #is_required property

  • :is_sensitive (BOOLEAN)

    The value to assign to the #is_sensitive property

  • :default_value (String)

    The value to assign to the #default_value property

  • :min_length (Integer)

    The value to assign to the #min_length property

  • :max_length (Integer)

    The value to assign to the #max_length property

  • :pattern (String)

    The value to assign to the #pattern property

  • :direction (String)

    The value to assign to the #direction property

  • :ui_placement_hint (String)

    The value to assign to the #ui_placement_hint property

  • :resource_type_metadata (Object)

    The value to assign to the #resource_type_metadata property



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
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/oci/oda/models/parameter_definition.rb', line 131

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

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

  self.is_required = attributes[:'isRequired'] unless attributes[:'isRequired'].nil?

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

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

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

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

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

  self.max_length = attributes[:'maxLength'] if attributes[:'maxLength']

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

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

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

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

  self.ui_placement_hint = attributes[:'uiPlacementHint'] if attributes[:'uiPlacementHint']

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

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

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

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

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

Instance Attribute Details

#default_valueString

Default value for the parameter.

Returns:

  • (String)


47
48
49
# File 'lib/oci/oda/models/parameter_definition.rb', line 47

def default_value
  @default_value
end

#descriptionString

Description of the parameter.

Returns:

  • (String)


35
36
37
# File 'lib/oci/oda/models/parameter_definition.rb', line 35

def description
  @description
end

#directionString

Is this parameter an input parameter, output parameter, or both?

Returns:

  • (String)


63
64
65
# File 'lib/oci/oda/models/parameter_definition.rb', line 63

def direction
  @direction
end

#is_requiredBOOLEAN

Is this parameter required. Ignored for parameters with direction = OUTPUT.

Returns:

  • (BOOLEAN)


39
40
41
# File 'lib/oci/oda/models/parameter_definition.rb', line 39

def is_required
  @is_required
end

#is_sensitiveBOOLEAN

Is the data for this parameter sensitive (e.g. should the data be hidden in UI, encrypted if stored, etc.)

Returns:

  • (BOOLEAN)


43
44
45
# File 'lib/oci/oda/models/parameter_definition.rb', line 43

def is_sensitive
  @is_sensitive
end

#max_lengthInteger

Used for character string types such as STRING to constrain the length of the value

Returns:

  • (Integer)


55
56
57
# File 'lib/oci/oda/models/parameter_definition.rb', line 55

def max_length
  @max_length
end

#min_lengthInteger

Used for character string types such as STRING to constrain the length of the value

Returns:

  • (Integer)


51
52
53
# File 'lib/oci/oda/models/parameter_definition.rb', line 51

def min_length
  @min_length
end

#nameString

**[Required]** The name of the parameter

Returns:

  • (String)


27
28
29
# File 'lib/oci/oda/models/parameter_definition.rb', line 27

def name
  @name
end

#patternString

Regular expression used to validate the value of a string type such as STRING

Returns:

  • (String)


59
60
61
# File 'lib/oci/oda/models/parameter_definition.rb', line 59

def pattern
  @pattern
end

#resource_type_metadataObject

Any configuration needed to help the resource type process this parameter (e.g. link to manifest, etc.).

Returns:

  • (Object)


71
72
73
# File 'lib/oci/oda/models/parameter_definition.rb', line 71

def 
  @resource_type_metadata
end

#typeString

**[Required]** Enumerated parameter type.

Returns:

  • (String)


31
32
33
# File 'lib/oci/oda/models/parameter_definition.rb', line 31

def type
  @type
end

#ui_placement_hintString

A forward-slash-delimited 'path' in an imaginary hierarchy, at which this parameter's UI widgets should be placed

Returns:

  • (String)


67
68
69
# File 'lib/oci/oda/models/parameter_definition.rb', line 67

def ui_placement_hint
  @ui_placement_hint
end

Class Method Details

.attribute_mapObject

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



74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/oci/oda/models/parameter_definition.rb', line 74

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'name',
    'type': :'type',
    'description': :'description',
    'is_required': :'isRequired',
    'is_sensitive': :'isSensitive',
    'default_value': :'defaultValue',
    'min_length': :'minLength',
    'max_length': :'maxLength',
    'pattern': :'pattern',
    'direction': :'direction',
    'ui_placement_hint': :'uiPlacementHint',
    'resource_type_metadata': :'resourceTypeMetadata'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/oci/oda/models/parameter_definition.rb', line 94

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'name': :'String',
    'type': :'String',
    'description': :'String',
    'is_required': :'BOOLEAN',
    'is_sensitive': :'BOOLEAN',
    'default_value': :'String',
    'min_length': :'Integer',
    'max_length': :'Integer',
    'pattern': :'String',
    'direction': :'String',
    'ui_placement_hint': :'String',
    'resource_type_metadata': :'Object'
    # 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



223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/oci/oda/models/parameter_definition.rb', line 223

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

  self.class == other.class &&
    name == other.name &&
    type == other.type &&
    description == other.description &&
    is_required == other.is_required &&
    is_sensitive == other.is_sensitive &&
    default_value == other.default_value &&
    min_length == other.min_length &&
    max_length == other.max_length &&
    pattern == other.pattern &&
    direction == other.direction &&
    ui_placement_hint == other.ui_placement_hint &&
     == other.
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



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
# File 'lib/oci/oda/models/parameter_definition.rb', line 264

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


244
245
246
# File 'lib/oci/oda/models/parameter_definition.rb', line 244

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



253
254
255
# File 'lib/oci/oda/models/parameter_definition.rb', line 253

def hash
  [name, type, description, is_required, is_sensitive, default_value, min_length, max_length, pattern, direction, ui_placement_hint, ].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



297
298
299
300
301
302
303
304
305
306
# File 'lib/oci/oda/models/parameter_definition.rb', line 297

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



291
292
293
# File 'lib/oci/oda/models/parameter_definition.rb', line 291

def to_s
  to_hash.to_s
end