Class: OCI::Identity::Models::StandardTagDefinitionTemplate

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/identity/models/standard_tag_definition_template.rb

Overview

The template of the tag definition. This object includes necessary details to create the provided standard tag definition.

Constant Summary collapse

TYPE_ENUM =
[
  TYPE_ENUM_VALUE = 'ENUM'.freeze,
  TYPE_STRING = 'STRING'.freeze,
  TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
ENUM_MUTABILITY_ENUM =
[
  ENUM_MUTABILITY_IMMUTABLE = 'IMMUTABLE'.freeze,
  ENUM_MUTABILITY_MUTABLE = 'MUTABLE'.freeze,
  ENUM_MUTABILITY_APPENDABLE = 'APPENDABLE'.freeze,
  ENUM_MUTABILITY_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ StandardTagDefinitionTemplate

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :description (String)

    The value to assign to the #description property

  • :tag_definition_name (String)

    The value to assign to the #tag_definition_name property

  • :type (String)

    The value to assign to the #type property

  • :possible_values (Array<String>)

    The value to assign to the #possible_values property

  • :is_cost_tracking (BOOLEAN)

    The value to assign to the #is_cost_tracking property

  • :enum_mutability (String)

    The value to assign to the #enum_mutability property



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
# File 'lib/oci/identity/models/standard_tag_definition_template.rb', line 89

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

  self.tag_definition_name = attributes[:'tagDefinitionName'] if attributes[:'tagDefinitionName']

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

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

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

  self.possible_values = attributes[:'possibleValues'] if attributes[:'possibleValues']

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

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

  self.is_cost_tracking = attributes[:'isCostTracking'] unless attributes[:'isCostTracking'].nil?

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

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

  self.enum_mutability = attributes[:'enumMutability'] if attributes[:'enumMutability']

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

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

Instance Attribute Details

#descriptionString

[Required] The default description of the tag namespace that users can use to create the tag definition

Returns:

  • (String)


27
28
29
# File 'lib/oci/identity/models/standard_tag_definition_template.rb', line 27

def description
  @description
end

#enum_mutabilityString

The mutability of the possible values list for enum tags. This will default to IMMUTABLE for string value tags

Returns:

  • (String)


47
48
49
# File 'lib/oci/identity/models/standard_tag_definition_template.rb', line 47

def enum_mutability
  @enum_mutability
end

#is_cost_trackingBOOLEAN

[Required] Is the tag a cost tracking tag. Default will be false as cost tracking tags have been deprecated

Returns:

  • (BOOLEAN)


43
44
45
# File 'lib/oci/identity/models/standard_tag_definition_template.rb', line 43

def is_cost_tracking
  @is_cost_tracking
end

#possible_valuesArray<String>

List of possible values. An optional parameter that will be present if the type of definition is enum.

Returns:

  • (Array<String>)


39
40
41
# File 'lib/oci/identity/models/standard_tag_definition_template.rb', line 39

def possible_values
  @possible_values
end

#tag_definition_nameString

[Required] The name of this standard tag definition

Returns:

  • (String)


31
32
33
# File 'lib/oci/identity/models/standard_tag_definition_template.rb', line 31

def tag_definition_name
  @tag_definition_name
end

#typeString

[Required] The type of tag definition. Enum or string.

Returns:

  • (String)


35
36
37
# File 'lib/oci/identity/models/standard_tag_definition_template.rb', line 35

def type
  @type
end

Class Method Details

.attribute_mapObject

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



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/oci/identity/models/standard_tag_definition_template.rb', line 50

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'description': :'description',
    'tag_definition_name': :'tagDefinitionName',
    'type': :'type',
    'possible_values': :'possibleValues',
    'is_cost_tracking': :'isCostTracking',
    'enum_mutability': :'enumMutability'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



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

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'description': :'String',
    'tag_definition_name': :'String',
    'type': :'String',
    'possible_values': :'Array<String>',
    'is_cost_tracking': :'BOOLEAN',
    'enum_mutability': :'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



157
158
159
160
161
162
163
164
165
166
167
# File 'lib/oci/identity/models/standard_tag_definition_template.rb', line 157

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

  self.class == other.class &&
    description == other.description &&
    tag_definition_name == other.tag_definition_name &&
    type == other.type &&
    possible_values == other.possible_values &&
    is_cost_tracking == other.is_cost_tracking &&
    enum_mutability == other.enum_mutability
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



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

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


172
173
174
# File 'lib/oci/identity/models/standard_tag_definition_template.rb', line 172

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



181
182
183
# File 'lib/oci/identity/models/standard_tag_definition_template.rb', line 181

def hash
  [description, tag_definition_name, type, possible_values, is_cost_tracking, enum_mutability].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



225
226
227
228
229
230
231
232
233
234
# File 'lib/oci/identity/models/standard_tag_definition_template.rb', line 225

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



219
220
221
# File 'lib/oci/identity/models/standard_tag_definition_template.rb', line 219

def to_s
  to_hash.to_s
end