Class: OCI::Optimizer::Models::TargetTag
- Inherits:
-
Object
- Object
- OCI::Optimizer::Models::TargetTag
- Defined in:
- lib/oci/optimizer/models/target_tag.rb
Overview
A tag key definition used in the current profile override, including the tag namespace, tag key, tag value type, and tag values. Only defined tags are supported. For more information about tagging, see Tagging Overview
Constant Summary collapse
- TAG_VALUE_TYPE_ENUM =
[ TAG_VALUE_TYPE_VALUE = 'VALUE'.freeze, TAG_VALUE_TYPE_ANY = 'ANY'.freeze, TAG_VALUE_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze ].freeze
Instance Attribute Summary collapse
-
#tag_definition_name ⇒ String
[Required] The name you use to refer to the tag, also known as the tag key.
-
#tag_namespace_name ⇒ String
[Required] The name of the tag namespace.
-
#tag_value_type ⇒ String
[Required] Specifies which tag value types in the
tagValues
field result in overrides of the recommendation criteria. -
#tag_values ⇒ Array<String>
The list of tag values.
Class Method Summary collapse
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.swagger_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(other) ⇒ Object
Checks equality by comparing each attribute.
-
#build_from_hash(attributes) ⇒ Object
Builds the object from hash.
- #eql?(other) ⇒ Boolean
-
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ TargetTag
constructor
Initializes the object.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#to_s ⇒ String
Returns the string representation of the object.
Constructor Details
#initialize(attributes = {}) ⇒ TargetTag
Initializes the object
78 79 80 81 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 |
# File 'lib/oci/optimizer/models/target_tag.rb', line 78 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.tag_namespace_name = attributes[:'tagNamespaceName'] if attributes[:'tagNamespaceName'] raise 'You cannot provide both :tagNamespaceName and :tag_namespace_name' if attributes.key?(:'tagNamespaceName') && attributes.key?(:'tag_namespace_name') self.tag_namespace_name = attributes[:'tag_namespace_name'] if attributes[:'tag_namespace_name'] 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.tag_value_type = attributes[:'tagValueType'] if attributes[:'tagValueType'] raise 'You cannot provide both :tagValueType and :tag_value_type' if attributes.key?(:'tagValueType') && attributes.key?(:'tag_value_type') self.tag_value_type = attributes[:'tag_value_type'] if attributes[:'tag_value_type'] self.tag_values = attributes[:'tagValues'] if attributes[:'tagValues'] raise 'You cannot provide both :tagValues and :tag_values' if attributes.key?(:'tagValues') && attributes.key?(:'tag_values') self.tag_values = attributes[:'tag_values'] if attributes[:'tag_values'] end |
Instance Attribute Details
#tag_definition_name ⇒ String
[Required] The name you use to refer to the tag, also known as the tag key.
27 28 29 |
# File 'lib/oci/optimizer/models/target_tag.rb', line 27 def tag_definition_name @tag_definition_name end |
#tag_namespace_name ⇒ String
[Required] The name of the tag namespace.
23 24 25 |
# File 'lib/oci/optimizer/models/target_tag.rb', line 23 def tag_namespace_name @tag_namespace_name end |
#tag_value_type ⇒ String
[Required] Specifies which tag value types in the tagValues
field result in overrides of the recommendation criteria.
When the value for this field is ANY
, the tagValues
field should be empty, which enforces overrides to the recommendation for resources with any tag values attached to them.
When the value for this field value is VALUE
, the tagValues
field must include a specific value or list of values. Overrides to the recommendation criteria only occur for resources that match the values in the tagValues
fields.
38 39 40 |
# File 'lib/oci/optimizer/models/target_tag.rb', line 38 def tag_value_type @tag_value_type end |
#tag_values ⇒ Array<String>
The list of tag values. The tag value is the value that the user applying the tag adds to the tag key.
42 43 44 |
# File 'lib/oci/optimizer/models/target_tag.rb', line 42 def tag_values @tag_values end |
Class Method Details
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/oci/optimizer/models/target_tag.rb', line 45 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'tag_namespace_name': :'tagNamespaceName', 'tag_definition_name': :'tagDefinitionName', 'tag_value_type': :'tagValueType', 'tag_values': :'tagValues' # rubocop:enable Style/SymbolLiteral } end |
.swagger_types ⇒ Object
Attribute type mapping.
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/oci/optimizer/models/target_tag.rb', line 57 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'tag_namespace_name': :'String', 'tag_definition_name': :'String', 'tag_value_type': :'String', 'tag_values': :'Array<String>' # rubocop:enable Style/SymbolLiteral } end |
Instance Method Details
#==(other) ⇒ Object
Checks equality by comparing each attribute.
129 130 131 132 133 134 135 136 137 |
# File 'lib/oci/optimizer/models/target_tag.rb', line 129 def ==(other) return true if equal?(other) self.class == other.class && tag_namespace_name == other.tag_namespace_name && tag_definition_name == other.tag_definition_name && tag_value_type == other.tag_value_type && tag_values == other.tag_values end |
#build_from_hash(attributes) ⇒ Object
Builds the object from hash
162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 |
# File 'lib/oci/optimizer/models/target_tag.rb', line 162 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
142 143 144 |
# File 'lib/oci/optimizer/models/target_tag.rb', line 142 def eql?(other) self == other end |
#hash ⇒ Fixnum
Calculates hash code according to all attributes.
151 152 153 |
# File 'lib/oci/optimizer/models/target_tag.rb', line 151 def hash [tag_namespace_name, tag_definition_name, tag_value_type, tag_values].hash end |
#to_hash ⇒ Hash
Returns the object in the form of hash
195 196 197 198 199 200 201 202 203 204 |
# File 'lib/oci/optimizer/models/target_tag.rb', line 195 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_s ⇒ String
Returns the string representation of the object
189 190 191 |
# File 'lib/oci/optimizer/models/target_tag.rb', line 189 def to_s to_hash.to_s end |