Class: OCI::GenerativeAiInference::Models::GuardrailVersion

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/generative_ai_inference/models/guardrail_version.rb

Overview

Details of a guardrail version.

Constant Summary collapse

STATE_ENUM =
[
  STATE_ACTIVE = 'ACTIVE'.freeze,
  STATE_PREVIEW = 'PREVIEW'.freeze,
  STATE_DEPRECATED = 'DEPRECATED'.freeze,
  STATE_RETIRED = 'RETIRED'.freeze,
  STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ GuardrailVersion

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :guardrail_version (String)

    The value to assign to the #guardrail_version property

  • :state (String)

    The value to assign to the #state property

  • :time_previewed (DateTime)

    The value to assign to the #time_previewed property

  • :time_activated (DateTime)

    The value to assign to the #time_activated property

  • :time_deprecated (DateTime)

    The value to assign to the #time_deprecated property

  • :time_retired (DateTime)

    The value to assign to the #time_retired property

  • :description (String)

    The value to assign to the #description property



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
123
124
125
126
127
128
129
130
# File 'lib/oci/generative_ai_inference/models/guardrail_version.rb', line 91

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

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

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

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

  self.time_previewed = attributes[:'timePreviewed'] if attributes[:'timePreviewed']

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

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

  self.time_activated = attributes[:'timeActivated'] if attributes[:'timeActivated']

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

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

  self.time_deprecated = attributes[:'timeDeprecated'] if attributes[:'timeDeprecated']

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

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

  self.time_retired = attributes[:'timeRetired'] if attributes[:'timeRetired']

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

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

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

Instance Attribute Details

#descriptionString

[Required] The description of the guardrail version.

Returns:

  • (String)


46
47
48
# File 'lib/oci/generative_ai_inference/models/guardrail_version.rb', line 46

def description
  @description
end

#guardrail_versionString

[Required] The guardrail system version string, e.g., "1.0.0"

Returns:

  • (String)


22
23
24
# File 'lib/oci/generative_ai_inference/models/guardrail_version.rb', line 22

def guardrail_version
  @guardrail_version
end

#stateString

[Required] The state of the guardrail version.

Returns:

  • (String)


26
27
28
# File 'lib/oci/generative_ai_inference/models/guardrail_version.rb', line 26

def state
  @state
end

#time_activatedDateTime

The activation date of the guardrail version.

Returns:

  • (DateTime)


34
35
36
# File 'lib/oci/generative_ai_inference/models/guardrail_version.rb', line 34

def time_activated
  @time_activated
end

#time_deprecatedDateTime

The deprecated date of the guardrail version.

Returns:

  • (DateTime)


38
39
40
# File 'lib/oci/generative_ai_inference/models/guardrail_version.rb', line 38

def time_deprecated
  @time_deprecated
end

#time_previewedDateTime

The preview date of the guardrail version.

Returns:

  • (DateTime)


30
31
32
# File 'lib/oci/generative_ai_inference/models/guardrail_version.rb', line 30

def time_previewed
  @time_previewed
end

#time_retiredDateTime

The retired date of the guardrail version.

Returns:

  • (DateTime)


42
43
44
# File 'lib/oci/generative_ai_inference/models/guardrail_version.rb', line 42

def time_retired
  @time_retired
end

Class Method Details

.attribute_mapObject

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



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

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'guardrail_version': :'guardrailVersion',
    'state': :'state',
    'time_previewed': :'timePreviewed',
    'time_activated': :'timeActivated',
    'time_deprecated': :'timeDeprecated',
    'time_retired': :'timeRetired',
    'description': :'description'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



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

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'guardrail_version': :'String',
    'state': :'String',
    'time_previewed': :'DateTime',
    'time_activated': :'DateTime',
    'time_deprecated': :'DateTime',
    'time_retired': :'DateTime',
    'description': :'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



152
153
154
155
156
157
158
159
160
161
162
163
# File 'lib/oci/generative_ai_inference/models/guardrail_version.rb', line 152

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

  self.class == other.class &&
    guardrail_version == other.guardrail_version &&
    state == other.state &&
    time_previewed == other.time_previewed &&
    time_activated == other.time_activated &&
    time_deprecated == other.time_deprecated &&
    time_retired == other.time_retired &&
    description == other.description
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



188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
# File 'lib/oci/generative_ai_inference/models/guardrail_version.rb', line 188

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


168
169
170
# File 'lib/oci/generative_ai_inference/models/guardrail_version.rb', line 168

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



177
178
179
# File 'lib/oci/generative_ai_inference/models/guardrail_version.rb', line 177

def hash
  [guardrail_version, state, time_previewed, time_activated, time_deprecated, time_retired, description].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



221
222
223
224
225
226
227
228
229
230
# File 'lib/oci/generative_ai_inference/models/guardrail_version.rb', line 221

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



215
216
217
# File 'lib/oci/generative_ai_inference/models/guardrail_version.rb', line 215

def to_s
  to_hash.to_s
end