Class: OCI::VisualBuilder::Models::AttachmentDetails

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/visual_builder/models/attachment_details.rb

Overview

Description of an attachments for this instance

Constant Summary collapse

TARGET_ROLE_ENUM =
[
  TARGET_ROLE_PARENT = 'PARENT'.freeze,
  TARGET_ROLE_CHILD = 'CHILD'.freeze,
  TARGET_ROLE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ AttachmentDetails

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :target_role (String)

    The value to assign to the #target_role property

  • :is_implicit (BOOLEAN)

    The value to assign to the #is_implicit property

  • :target_id (String)

    The value to assign to the #target_id property

  • :target_instance_url (String)

    The value to assign to the #target_instance_url property

  • :target_service_type (String)

    The value to assign to the #target_service_type property



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
108
109
110
111
112
113
114
115
# File 'lib/oci/visual_builder/models/attachment_details.rb', line 80

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

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

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

  self.is_implicit = attributes[:'isImplicit'] unless attributes[:'isImplicit'].nil?

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

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

  self.target_id = attributes[:'targetId'] if attributes[:'targetId']

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

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

  self.target_instance_url = attributes[:'targetInstanceUrl'] if attributes[:'targetInstanceUrl']

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

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

  self.target_service_type = attributes[:'targetServiceType'] if attributes[:'targetServiceType']

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

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

Instance Attribute Details

#is_implicitBOOLEAN

[Required] * If role == PARENT, the attached instance was created by this service instance * If role == CHILD, this instance was created from attached instance on behalf of a user

Returns:

  • (BOOLEAN)


29
30
31
# File 'lib/oci/visual_builder/models/attachment_details.rb', line 29

def is_implicit
  @is_implicit
end

#target_idString

[Required] The OCID of the target instance (which could be any other OCI PaaS/SaaS resource), to which this instance is attached.

Returns:

  • (String)


33
34
35
# File 'lib/oci/visual_builder/models/attachment_details.rb', line 33

def target_id
  @target_id
end

#target_instance_urlString

[Required] The dataplane instance URL of the attached instance

Returns:

  • (String)


37
38
39
# File 'lib/oci/visual_builder/models/attachment_details.rb', line 37

def target_instance_url
  @target_instance_url
end

#target_roleString

[Required] The role of the target attachment. * PARENT - The target instance is the parent of this attachment. * CHILD - The target instance is the child of this attachment.

Returns:

  • (String)


23
24
25
# File 'lib/oci/visual_builder/models/attachment_details.rb', line 23

def target_role
  @target_role
end

#target_service_typeString

[Required] The type of the target instance, such as "FUSION".

Returns:

  • (String)


41
42
43
# File 'lib/oci/visual_builder/models/attachment_details.rb', line 41

def target_service_type
  @target_service_type
end

Class Method Details

.attribute_mapObject

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



44
45
46
47
48
49
50
51
52
53
54
# File 'lib/oci/visual_builder/models/attachment_details.rb', line 44

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'target_role': :'targetRole',
    'is_implicit': :'isImplicit',
    'target_id': :'targetId',
    'target_instance_url': :'targetInstanceUrl',
    'target_service_type': :'targetServiceType'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



57
58
59
60
61
62
63
64
65
66
67
# File 'lib/oci/visual_builder/models/attachment_details.rb', line 57

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'target_role': :'String',
    'is_implicit': :'BOOLEAN',
    'target_id': :'String',
    'target_instance_url': :'String',
    'target_service_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



137
138
139
140
141
142
143
144
145
146
# File 'lib/oci/visual_builder/models/attachment_details.rb', line 137

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

  self.class == other.class &&
    target_role == other.target_role &&
    is_implicit == other.is_implicit &&
    target_id == other.target_id &&
    target_instance_url == other.target_instance_url &&
    target_service_type == other.target_service_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



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

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


151
152
153
# File 'lib/oci/visual_builder/models/attachment_details.rb', line 151

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



160
161
162
# File 'lib/oci/visual_builder/models/attachment_details.rb', line 160

def hash
  [target_role, is_implicit, target_id, target_instance_url, target_service_type].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



204
205
206
207
208
209
210
211
212
213
# File 'lib/oci/visual_builder/models/attachment_details.rb', line 204

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



198
199
200
# File 'lib/oci/visual_builder/models/attachment_details.rb', line 198

def to_s
  to_hash.to_s
end