class OCI::FileStorage::Models::ClientOptions

NFS export options applied to a specified set of clients. Only governs access through the associated export. Access to the same file system through a different export (on the same or different mount target) will be governed by that export's export options.

Constants

ACCESS_ENUM
IDENTITY_SQUASH_ENUM

Attributes

access[R]

Type of access to grant clients using the file system through this export. If unspecified defaults to `READ_ONLY`.

@return [String]

anonymous_gid[RW]

GID value to remap to when squashing a client GID (see identitySquash for more details.) If unspecified defaults to `65534`.

@return [Integer]

anonymous_uid[RW]

UID value to remap to when squashing a client UID (see identitySquash for more details.) If unspecified, defaults to `65534`.

@return [Integer]

identity_squash[R]

Used when clients accessing the file system through this export have their UID and GID remapped to 'anonymousUid' and 'anonymousGid'. If `ALL`, all users and groups are remapped; if `ROOT`, only the root user and group (UID/GID 0) are remapped; if `NONE`, no remapping is done. If unspecified, defaults to `ROOT`.

@return [String]

require_privileged_source_port[RW]

If `true`, clients accessing the file system through this export must connect from a privileged source port. If unspecified, defaults to `true`.

@return [BOOLEAN]

source[RW]

[Required] Clients these options should apply to. Must be a either single IPv4 address or single IPv4 CIDR block.

Note: Access will also be limited by any applicable VCN security rules and the ability to route IP packets to the mount target. Mount targets do not have Internet-routable IP addresses.

@return [String]

Public Class Methods

attribute_map() click to toggle source

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

# File lib/oci/file_storage/models/client_options.rb, line 77
def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'source': :'source',
    'require_privileged_source_port': :'requirePrivilegedSourcePort',
    'access': :'access',
    'identity_squash': :'identitySquash',
    'anonymous_uid': :'anonymousUid',
    'anonymous_gid': :'anonymousGid'
    # rubocop:enable Style/SymbolLiteral
  }
end
new(attributes = {}) click to toggle source

Initializes the object @param [Hash] attributes Model attributes in the form of hash @option attributes [String] :source The value to assign to the {#source} property @option attributes [BOOLEAN] :require_privileged_source_port The value to assign to the {#require_privileged_source_port} property @option attributes [String] :access The value to assign to the {#access} property @option attributes [String] :identity_squash The value to assign to the {#identity_squash} property @option attributes [Integer] :anonymous_uid The value to assign to the {#anonymous_uid} property @option attributes [Integer] :anonymous_gid The value to assign to the {#anonymous_gid} property

# File lib/oci/file_storage/models/client_options.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.source = attributes[:'source'] if attributes[:'source']

  self.require_privileged_source_port = attributes[:'requirePrivilegedSourcePort'] unless attributes[:'requirePrivilegedSourcePort'].nil?

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

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

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

  self.identity_squash = attributes[:'identitySquash'] if attributes[:'identitySquash']

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

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

  self.anonymous_uid = attributes[:'anonymousUid'] if attributes[:'anonymousUid']

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

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

  self.anonymous_gid = attributes[:'anonymousGid'] if attributes[:'anonymousGid']

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

  self.anonymous_gid = attributes[:'anonymous_gid'] if attributes[:'anonymous_gid']
end
swagger_types() click to toggle source

Attribute type mapping.

# File lib/oci/file_storage/models/client_options.rb, line 91
def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'source': :'String',
    'require_privileged_source_port': :'BOOLEAN',
    'access': :'String',
    'identity_squash': :'String',
    'anonymous_uid': :'Integer',
    'anonymous_gid': :'Integer'
    # rubocop:enable Style/SymbolLiteral
  }
end

Public Instance Methods

==(other) click to toggle source

Checks equality by comparing each attribute. @param [Object] other the other object to be compared

# File lib/oci/file_storage/models/client_options.rb, line 184
def ==(other)
  return true if equal?(other)

  self.class == other.class &&
    source == other.source &&
    require_privileged_source_port == other.require_privileged_source_port &&
    access == other.access &&
    identity_squash == other.identity_squash &&
    anonymous_uid == other.anonymous_uid &&
    anonymous_gid == other.anonymous_gid
end
access=(access) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] access Object to be assigned

# File lib/oci/file_storage/models/client_options.rb, line 155
def access=(access)
  # rubocop:disable Style/ConditionalAssignment
  if access && !ACCESS_ENUM.include?(access)
    OCI.logger.debug("Unknown value for 'access' [" + access + "]. Mapping to 'ACCESS_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @access = ACCESS_UNKNOWN_ENUM_VALUE
  else
    @access = access
  end
  # rubocop:enable Style/ConditionalAssignment
end
build_from_hash(attributes) click to toggle source

Builds the object from hash @param [Hash] attributes Model attributes in the form of hash @return [Object] Returns the model itself

# File lib/oci/file_storage/models/client_options.rb, line 219
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) click to toggle source

@see the `==` method @param [Object] other the other object to be compared

# File lib/oci/file_storage/models/client_options.rb, line 199
def eql?(other)
  self == other
end
hash() click to toggle source

Calculates hash code according to all attributes. @return [Fixnum] Hash code

# File lib/oci/file_storage/models/client_options.rb, line 208
def hash
  [source, require_privileged_source_port, access, identity_squash, anonymous_uid, anonymous_gid].hash
end
identity_squash=(identity_squash) click to toggle source

Custom attribute writer method checking allowed values (enum). @param [Object] identity_squash Object to be assigned

# File lib/oci/file_storage/models/client_options.rb, line 168
def identity_squash=(identity_squash)
  # rubocop:disable Style/ConditionalAssignment
  if identity_squash && !IDENTITY_SQUASH_ENUM.include?(identity_squash)
    OCI.logger.debug("Unknown value for 'identity_squash' [" + identity_squash + "]. Mapping to 'IDENTITY_SQUASH_UNKNOWN_ENUM_VALUE'") if OCI.logger
    @identity_squash = IDENTITY_SQUASH_UNKNOWN_ENUM_VALUE
  else
    @identity_squash = identity_squash
  end
  # rubocop:enable Style/ConditionalAssignment
end
to_hash() click to toggle source

Returns the object in the form of hash @return [Hash] Returns the object in the form of hash

# File lib/oci/file_storage/models/client_options.rb, line 252
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_s() click to toggle source

Returns the string representation of the object @return [String] String presentation of the object

# File lib/oci/file_storage/models/client_options.rb, line 246
def to_s
  to_hash.to_s
end

Private Instance Methods

_to_hash(value) click to toggle source

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/file_storage/models/client_options.rb, line 269
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