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_BOOLEAN = 'BOOLEAN'.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



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
189
190
# File 'lib/oci/oda/models/parameter_definition.rb', line 133

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)


49
50
51
# File 'lib/oci/oda/models/parameter_definition.rb', line 49

def default_value
  @default_value
end

#descriptionString

Description of the parameter.

Returns:

  • (String)


37
38
39
# File 'lib/oci/oda/models/parameter_definition.rb', line 37

def description
  @description
end

#directionString

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

Returns:

  • (String)


65
66
67
# File 'lib/oci/oda/models/parameter_definition.rb', line 65

def direction
  @direction
end

#is_requiredBOOLEAN

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

Returns:

  • (BOOLEAN)


41
42
43
# File 'lib/oci/oda/models/parameter_definition.rb', line 41

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)


45
46
47
# File 'lib/oci/oda/models/parameter_definition.rb', line 45

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)


57
58
59
# File 'lib/oci/oda/models/parameter_definition.rb', line 57

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)


53
54
55
# File 'lib/oci/oda/models/parameter_definition.rb', line 53

def min_length
  @min_length
end

#nameString

[Required] The name of the parameter

Returns:

  • (String)


29
30
31
# File 'lib/oci/oda/models/parameter_definition.rb', line 29

def name
  @name
end

#patternString

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

Returns:

  • (String)


61
62
63
# File 'lib/oci/oda/models/parameter_definition.rb', line 61

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)


73
74
75
# File 'lib/oci/oda/models/parameter_definition.rb', line 73

def 
  @resource_type_metadata
end

#typeString

[Required] Enumerated parameter type.

Returns:

  • (String)


33
34
35
# File 'lib/oci/oda/models/parameter_definition.rb', line 33

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)


69
70
71
# File 'lib/oci/oda/models/parameter_definition.rb', line 69

def ui_placement_hint
  @ui_placement_hint
end

Class Method Details

.attribute_mapObject

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



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

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.



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

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



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

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



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

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


246
247
248
# File 'lib/oci/oda/models/parameter_definition.rb', line 246

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



255
256
257
# File 'lib/oci/oda/models/parameter_definition.rb', line 255

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



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

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



293
294
295
# File 'lib/oci/oda/models/parameter_definition.rb', line 293

def to_s
  to_hash.to_s
end