Class: OCI::GenerativeAi::Models::Artifact

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/generative_ai/models/artifact.rb

Overview

Container/artifact configuration for the deployment. This class has direct subclasses. If you are using this class as input to a service operations then you should favor using a subclass over the base class

Direct Known Subclasses

SingleDockerArtifact

Constant Summary collapse

STATUS_ENUM =
[
  STATUS_ACTIVE = 'ACTIVE'.freeze,
  STATUS_INACTIVE = 'INACTIVE'.freeze,
  STATUS_UPDATING = 'UPDATING'.freeze,
  STATUS_FAILED = 'FAILED'.freeze,
  STATUS_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
ARTIFACT_TYPE_ENUM =
[
  ARTIFACT_TYPE_SIMPLE_DOCKER_ARTIFACT = 'SIMPLE_DOCKER_ARTIFACT'.freeze,
  ARTIFACT_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Artifact

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :id (String)

    The value to assign to the #id property

  • :time_created (DateTime)

    The value to assign to the #time_created property

  • :hosted_deployment_id (String)

    The value to assign to the #hosted_deployment_id property

  • :is_vulnerability_scan_required (BOOLEAN)

    The value to assign to the #is_vulnerability_scan_required property

  • :status (String)

    The value to assign to the #status property

  • :artifact_type (String)

    The value to assign to the #artifact_type property



106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
# File 'lib/oci/generative_ai/models/artifact.rb', line 106

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

  self.time_created = attributes[:'timeCreated'] if attributes[:'timeCreated']

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

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

  self.hosted_deployment_id = attributes[:'hostedDeploymentId'] if attributes[:'hostedDeploymentId']

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

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

  self.is_vulnerability_scan_required = attributes[:'isVulnerabilityScanRequired'] unless attributes[:'isVulnerabilityScanRequired'].nil?
  self.is_vulnerability_scan_required = false if is_vulnerability_scan_required.nil? && !attributes.key?(:'isVulnerabilityScanRequired') # rubocop:disable Style/StringLiterals

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

  self.is_vulnerability_scan_required = attributes[:'is_vulnerability_scan_required'] unless attributes[:'is_vulnerability_scan_required'].nil?
  self.is_vulnerability_scan_required = false if is_vulnerability_scan_required.nil? && !attributes.key?(:'isVulnerabilityScanRequired') && !attributes.key?(:'is_vulnerability_scan_required') # rubocop:disable Style/StringLiterals

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

  self.artifact_type = attributes[:'artifactType'] if attributes[:'artifactType']

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

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

Instance Attribute Details

#artifact_typeString

The type of the artifact.

Returns:

  • (String)


49
50
51
# File 'lib/oci/generative_ai/models/artifact.rb', line 49

def artifact_type
  @artifact_type
end

#hosted_deployment_idString

The OCID of the application.

Returns:

  • (String)


36
37
38
# File 'lib/oci/generative_ai/models/artifact.rb', line 36

def hosted_deployment_id
  @hosted_deployment_id
end

#idString

if put artifact to a table, the id is needed

Returns:

  • (String)


28
29
30
# File 'lib/oci/generative_ai/models/artifact.rb', line 28

def id
  @id
end

#is_vulnerability_scan_requiredBOOLEAN

Optional flag that requires an OCI Vulnerability Scanning Service compliance report for this artifact before it can become active. When not provided, the value defaults to false and the artifact is not blocked on a scan result.

Returns:

  • (BOOLEAN)


41
42
43
# File 'lib/oci/generative_ai/models/artifact.rb', line 41

def is_vulnerability_scan_required
  @is_vulnerability_scan_required
end

#statusString

The current status of the artifact.

Returns:

  • (String)


45
46
47
# File 'lib/oci/generative_ai/models/artifact.rb', line 45

def status
  @status
end

#time_createdDateTime

The date and time the artifact was created.

Returns:

  • (DateTime)


32
33
34
# File 'lib/oci/generative_ai/models/artifact.rb', line 32

def time_created
  @time_created
end

Class Method Details

.attribute_mapObject

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



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/oci/generative_ai/models/artifact.rb', line 52

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'time_created': :'timeCreated',
    'hosted_deployment_id': :'hostedDeploymentId',
    'is_vulnerability_scan_required': :'isVulnerabilityScanRequired',
    'status': :'status',
    'artifact_type': :'artifactType'
    # rubocop:enable Style/SymbolLiteral
  }
end

.get_subtype(object_hash) ⇒ Object

Given the hash representation of a subtype of this class, use the info in the hash to return the class of the subtype.



84
85
86
87
88
89
90
91
# File 'lib/oci/generative_ai/models/artifact.rb', line 84

def self.get_subtype(object_hash)
  type = object_hash[:'artifactType'] # rubocop:disable Style/SymbolLiteral

  return 'OCI::GenerativeAi::Models::SingleDockerArtifact' if type == 'SIMPLE_DOCKER_ARTIFACT'

  # TODO: Log a warning when the subtype is not found.
  'OCI::GenerativeAi::Models::Artifact'
end

.swagger_typesObject

Attribute type mapping.



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/oci/generative_ai/models/artifact.rb', line 66

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'time_created': :'DateTime',
    'hosted_deployment_id': :'String',
    'is_vulnerability_scan_required': :'BOOLEAN',
    'status': :'String',
    'artifact_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



176
177
178
179
180
181
182
183
184
185
186
# File 'lib/oci/generative_ai/models/artifact.rb', line 176

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

  self.class == other.class &&
    id == other.id &&
    time_created == other.time_created &&
    hosted_deployment_id == other.hosted_deployment_id &&
    is_vulnerability_scan_required == other.is_vulnerability_scan_required &&
    status == other.status &&
    artifact_type == other.artifact_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



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
# File 'lib/oci/generative_ai/models/artifact.rb', line 211

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


191
192
193
# File 'lib/oci/generative_ai/models/artifact.rb', line 191

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



200
201
202
# File 'lib/oci/generative_ai/models/artifact.rb', line 200

def hash
  [id, time_created, hosted_deployment_id, is_vulnerability_scan_required, status, artifact_type].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



244
245
246
247
248
249
250
251
252
253
# File 'lib/oci/generative_ai/models/artifact.rb', line 244

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



238
239
240
# File 'lib/oci/generative_ai/models/artifact.rb', line 238

def to_s
  to_hash.to_s
end