Class: OCI::Vault::Models::SecretExpiryRule

Inherits:
SecretRule
  • Object
show all
Defined in:
lib/oci/vault/models/secret_expiry_rule.rb

Overview

A rule that helps enforce the expiration of a secret's contents.

Constant Summary

Constants inherited from SecretRule

OCI::Vault::Models::SecretRule::RULE_TYPE_ENUM

Instance Attribute Summary collapse

Attributes inherited from SecretRule

#rule_type

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from SecretRule

get_subtype

Constructor Details

#initialize(attributes = {}) ⇒ SecretExpiryRule

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):



69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
# File 'lib/oci/vault/models/secret_expiry_rule.rb', line 69

def initialize(attributes = {})
  return unless attributes.is_a?(Hash)

  attributes['ruleType'] = 'SECRET_EXPIRY_RULE'

  super(attributes)

  # convert string to symbol for hash key
  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }

  self.secret_version_expiry_interval = attributes[:'secretVersionExpiryInterval'] if attributes[:'secretVersionExpiryInterval']

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

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

  self.time_of_absolute_expiry = attributes[:'timeOfAbsoluteExpiry'] if attributes[:'timeOfAbsoluteExpiry']

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

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

  self.is_secret_content_retrieval_blocked_on_expiry = attributes[:'isSecretContentRetrievalBlockedOnExpiry'] unless attributes[:'isSecretContentRetrievalBlockedOnExpiry'].nil?

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

  self.is_secret_content_retrieval_blocked_on_expiry = attributes[:'is_secret_content_retrieval_blocked_on_expiry'] unless attributes[:'is_secret_content_retrieval_blocked_on_expiry'].nil?
end

Instance Attribute Details

#is_secret_content_retrieval_blocked_on_expiryBOOLEAN

A property indicating whether to block retrieval of the secret content, on expiry. The default is false. If the secret has already expired and you would like to retrieve the secret contents, you need to edit the secret rule to disable this property, to allow reading the secret content.

Returns:

  • (BOOLEAN)


34
35
36
# File 'lib/oci/vault/models/secret_expiry_rule.rb', line 34

def is_secret_content_retrieval_blocked_on_expiry
  @is_secret_content_retrieval_blocked_on_expiry
end

#secret_version_expiry_intervalString

A property indicating how long the secret contents will be considered valid, expressed in ISO 8601 format. The secret needs to be updated when the secret content expires. The timer resets after you update the secret contents. The minimum value is 1 day and the maximum value is 90 days for this property. Currently, only intervals expressed in days are supported. For example, pass P3D to have the secret version expire every 3 days.

Returns:

  • (String)


20
21
22
# File 'lib/oci/vault/models/secret_expiry_rule.rb', line 20

def secret_version_expiry_interval
  @secret_version_expiry_interval
end

#time_of_absolute_expiryDateTime

An optional property indicating the absolute time when this secret will expire, expressed in RFC 3339 timestamp format. The minimum number of days from current time is 1 day and the maximum number of days from current time is 365 days. Example: 2019-04-03T21:10:29.600Z

Returns:

  • (DateTime)


27
28
29
# File 'lib/oci/vault/models/secret_expiry_rule.rb', line 27

def time_of_absolute_expiry
  @time_of_absolute_expiry
end

Class Method Details

.attribute_mapObject

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



37
38
39
40
41
42
43
44
45
46
# File 'lib/oci/vault/models/secret_expiry_rule.rb', line 37

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'rule_type': :'ruleType',
    'secret_version_expiry_interval': :'secretVersionExpiryInterval',
    'time_of_absolute_expiry': :'timeOfAbsoluteExpiry',
    'is_secret_content_retrieval_blocked_on_expiry': :'isSecretContentRetrievalBlockedOnExpiry'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



49
50
51
52
53
54
55
56
57
58
# File 'lib/oci/vault/models/secret_expiry_rule.rb', line 49

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'rule_type': :'String',
    'secret_version_expiry_interval': :'String',
    'time_of_absolute_expiry': :'DateTime',
    'is_secret_content_retrieval_blocked_on_expiry': :'BOOLEAN'
    # 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



105
106
107
108
109
110
111
112
113
# File 'lib/oci/vault/models/secret_expiry_rule.rb', line 105

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

  self.class == other.class &&
    rule_type == other.rule_type &&
    secret_version_expiry_interval == other.secret_version_expiry_interval &&
    time_of_absolute_expiry == other.time_of_absolute_expiry &&
    is_secret_content_retrieval_blocked_on_expiry == other.is_secret_content_retrieval_blocked_on_expiry
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



138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/oci/vault/models/secret_expiry_rule.rb', line 138

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


118
119
120
# File 'lib/oci/vault/models/secret_expiry_rule.rb', line 118

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



127
128
129
# File 'lib/oci/vault/models/secret_expiry_rule.rb', line 127

def hash
  [rule_type, secret_version_expiry_interval, time_of_absolute_expiry, is_secret_content_retrieval_blocked_on_expiry].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



171
172
173
174
175
176
177
178
179
180
# File 'lib/oci/vault/models/secret_expiry_rule.rb', line 171

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



165
166
167
# File 'lib/oci/vault/models/secret_expiry_rule.rb', line 165

def to_s
  to_hash.to_s
end