class OCI::Vault::Models::SecretVersion
The details of the secret version, excluding the contents of the secret.
Constants
- CONTENT_TYPE_ENUM
- STAGES_ENUM
Attributes
The content type of the secret version's secret contents. @return [String]
The name of the secret version. A name is unique across versions of a secret.
@return [String]
The OCID of the secret. @return [String]
A list of possible rotation states for the secret version. A secret version marked `CURRENT` is currently in use. A secret version marked `PENDING` is staged and available for use, but has not been applied on the target system and, therefore, has not been rotated into current, active use. The secret most recently uploaded to a vault is always marked `LATEST`. (The first version of a secret is always marked as both `CURRENT` and `LATEST`.) A secret version marked `PREVIOUS` is the secret version that was most recently marked `CURRENT`, before the last secret version rotation. A secret version marked `DEPRECATED` is neither current, pending, nor the previous one in use. Only secret versions marked `DEPRECATED` can be scheduled for deletion.
@return [Array<String>]
A optional property indicating when the secret version was created, expressed in [RFC 3339](tools.ietf.org/html/rfc3339) timestamp format. Example: `2019-04-03T21:10:29.600Z`
@return [DateTime]
An optional property indicating when the current secret version will expire, expressed in [RFC 3339](tools.ietf.org/html/rfc3339) timestamp format. Example: `2019-04-03T21:10:29.600Z`
@return [DateTime]
An optional property indicating when to delete the secret version, expressed in [RFC 3339](tools.ietf.org/html/rfc3339) timestamp format. Example: `2019-04-03T21:10:29.600Z`
@return [DateTime]
The version number of the secret. @return [Integer]
Public Class Methods
Attribute mapping from ruby-style variable name to JSON key.
# File lib/oci/vault/models/secret_version.rb, line 71 def self.attribute_map { # rubocop:disable Style/SymbolLiteral 'content_type': :'contentType', 'name': :'name', 'secret_id': :'secretId', 'stages': :'stages', 'time_created': :'timeCreated', 'time_of_deletion': :'timeOfDeletion', 'time_of_current_version_expiry': :'timeOfCurrentVersionExpiry', 'version_number': :'versionNumber' # rubocop:enable Style/SymbolLiteral } end
Initializes the object @param [Hash] attributes Model attributes in the form of hash @option attributes [String] :content_type The value to assign to the {#content_type} property @option attributes [String] :name The value to assign to the {#name} property @option attributes [String] :secret_id The value to assign to the {#secret_id} property @option attributes [Array<String>] :stages The value to assign to the {#stages} property @option attributes [DateTime] :time_created The value to assign to the {#time_created} property @option attributes [DateTime] :time_of_deletion The value to assign to the {#time_of_deletion} property @option attributes [DateTime] :time_of_current_version_expiry The value to assign to the {#time_of_current_version_expiry} property @option attributes [Integer] :version_number The value to assign to the {#version_number} property
# File lib/oci/vault/models/secret_version.rb, line 116 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.content_type = attributes[:'contentType'] if attributes[:'contentType'] raise 'You cannot provide both :contentType and :content_type' if attributes.key?(:'contentType') && attributes.key?(:'content_type') self.content_type = attributes[:'content_type'] if attributes[:'content_type'] self.name = attributes[:'name'] if attributes[:'name'] self.secret_id = attributes[:'secretId'] if attributes[:'secretId'] raise 'You cannot provide both :secretId and :secret_id' if attributes.key?(:'secretId') && attributes.key?(:'secret_id') self.secret_id = attributes[:'secret_id'] if attributes[:'secret_id'] self.stages = attributes[:'stages'] if attributes[:'stages'] 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.time_of_deletion = attributes[:'timeOfDeletion'] if attributes[:'timeOfDeletion'] raise 'You cannot provide both :timeOfDeletion and :time_of_deletion' if attributes.key?(:'timeOfDeletion') && attributes.key?(:'time_of_deletion') self.time_of_deletion = attributes[:'time_of_deletion'] if attributes[:'time_of_deletion'] self.time_of_current_version_expiry = attributes[:'timeOfCurrentVersionExpiry'] if attributes[:'timeOfCurrentVersionExpiry'] raise 'You cannot provide both :timeOfCurrentVersionExpiry and :time_of_current_version_expiry' if attributes.key?(:'timeOfCurrentVersionExpiry') && attributes.key?(:'time_of_current_version_expiry') self.time_of_current_version_expiry = attributes[:'time_of_current_version_expiry'] if attributes[:'time_of_current_version_expiry'] self.version_number = attributes[:'versionNumber'] if attributes[:'versionNumber'] raise 'You cannot provide both :versionNumber and :version_number' if attributes.key?(:'versionNumber') && attributes.key?(:'version_number') self.version_number = attributes[:'version_number'] if attributes[:'version_number'] end
Attribute type mapping.
# File lib/oci/vault/models/secret_version.rb, line 87 def self.swagger_types { # rubocop:disable Style/SymbolLiteral 'content_type': :'String', 'name': :'String', 'secret_id': :'String', 'stages': :'Array<String>', 'time_created': :'DateTime', 'time_of_deletion': :'DateTime', 'time_of_current_version_expiry': :'DateTime', 'version_number': :'Integer' # rubocop:enable Style/SymbolLiteral } end
Public Instance Methods
Checks equality by comparing each attribute. @param [Object] other the other object to be compared
# File lib/oci/vault/models/secret_version.rb, line 203 def ==(other) return true if equal?(other) self.class == other.class && content_type == other.content_type && name == other.name && secret_id == other.secret_id && stages == other.stages && time_created == other.time_created && time_of_deletion == other.time_of_deletion && time_of_current_version_expiry == other.time_of_current_version_expiry && version_number == other.version_number end
Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself
# File lib/oci/vault/models/secret_version.rb, line 240 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
Custom attribute writer method checking allowed values (enum). @param [Object] content_type
Object
to be assigned
# File lib/oci/vault/models/secret_version.rb, line 167 def content_type=(content_type) # rubocop:disable Style/ConditionalAssignment if content_type && !CONTENT_TYPE_ENUM.include?(content_type) OCI.logger.debug("Unknown value for 'content_type' [" + content_type + "]. Mapping to 'CONTENT_TYPE_UNKNOWN_ENUM_VALUE'") if OCI.logger @content_type = CONTENT_TYPE_UNKNOWN_ENUM_VALUE else @content_type = content_type end # rubocop:enable Style/ConditionalAssignment end
@see the `==` method @param [Object] other the other object to be compared
# File lib/oci/vault/models/secret_version.rb, line 220 def eql?(other) self == other end
Calculates hash code according to all attributes. @return [Fixnum] Hash code
# File lib/oci/vault/models/secret_version.rb, line 229 def hash [content_type, name, secret_id, stages, time_created, time_of_deletion, time_of_current_version_expiry, version_number].hash end
Custom attribute writer method checking allowed values (enum). @param [Object] stages Object
to be assigned
# File lib/oci/vault/models/secret_version.rb, line 180 def stages=(stages) # rubocop:disable Style/ConditionalAssignment if stages.nil? @stages = nil else @stages = stages.collect do |item| if STAGES_ENUM.include?(item) item else OCI.logger.debug("Unknown value for 'stages' [#{item}]. Mapping to 'STAGES_UNKNOWN_ENUM_VALUE'") if OCI.logger STAGES_UNKNOWN_ENUM_VALUE end end end # rubocop:enable Style/ConditionalAssignment end
Returns the object in the form of hash @return [Hash] Returns the object in the form of hash
# File lib/oci/vault/models/secret_version.rb, line 273 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
Returns the string representation of the object @return [String] String presentation of the object
# File lib/oci/vault/models/secret_version.rb, line 267 def to_s to_hash.to_s end
Private Instance Methods
Outputs non-array value in the form of hash For object, use to_hash. Otherwise, just return the value @param [Object] value Any valid value @return [Hash] Returns the value in the form of hash
# File lib/oci/vault/models/secret_version.rb, line 290 def _to_hash(value) if value.is_a?(Array) value.compact.map { |v| _to_hash(v) } elsif value.is_a?(Hash) {}.tap do |hash| value.each { |k, v| hash[k] = _to_hash(v) } end elsif value.respond_to? :to_hash value.to_hash else value end end