Class: OCI::ContainerInstances::Models::ContainerCapabilities

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/container_instances/models/container_capabilities.rb

Overview

Linux Container capabilities to configure capabilities of container.

Constant Summary collapse

ADD_CAPABILITIES_ENUM =
[
  ADD_CAPABILITIES_CAP_CHOWN = 'CAP_CHOWN'.freeze,
  ADD_CAPABILITIES_CAP_DAC_OVERRIDE = 'CAP_DAC_OVERRIDE'.freeze,
  ADD_CAPABILITIES_CAP_FSETID = 'CAP_FSETID'.freeze,
  ADD_CAPABILITIES_CAP_FOWNER = 'CAP_FOWNER'.freeze,
  ADD_CAPABILITIES_CAP_MKNOD = 'CAP_MKNOD'.freeze,
  ADD_CAPABILITIES_CAP_NET_RAW = 'CAP_NET_RAW'.freeze,
  ADD_CAPABILITIES_CAP_SETGID = 'CAP_SETGID'.freeze,
  ADD_CAPABILITIES_CAP_SETUID = 'CAP_SETUID'.freeze,
  ADD_CAPABILITIES_CAP_SETFCAP = 'CAP_SETFCAP'.freeze,
  ADD_CAPABILITIES_CAP_SETPCAP = 'CAP_SETPCAP'.freeze,
  ADD_CAPABILITIES_CAP_NET_BIND_SERVICE = 'CAP_NET_BIND_SERVICE'.freeze,
  ADD_CAPABILITIES_CAP_SYS_CHROOT = 'CAP_SYS_CHROOT'.freeze,
  ADD_CAPABILITIES_CAP_KILL = 'CAP_KILL'.freeze,
  ADD_CAPABILITIES_CAP_AUDIT_WRITE = 'CAP_AUDIT_WRITE'.freeze,
  ADD_CAPABILITIES_ALL = 'ALL'.freeze,
  ADD_CAPABILITIES_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
DROP_CAPABILITIES_ENUM =
[
  DROP_CAPABILITIES_CAP_CHOWN = 'CAP_CHOWN'.freeze,
  DROP_CAPABILITIES_CAP_DAC_OVERRIDE = 'CAP_DAC_OVERRIDE'.freeze,
  DROP_CAPABILITIES_CAP_FSETID = 'CAP_FSETID'.freeze,
  DROP_CAPABILITIES_CAP_FOWNER = 'CAP_FOWNER'.freeze,
  DROP_CAPABILITIES_CAP_MKNOD = 'CAP_MKNOD'.freeze,
  DROP_CAPABILITIES_CAP_NET_RAW = 'CAP_NET_RAW'.freeze,
  DROP_CAPABILITIES_CAP_SETGID = 'CAP_SETGID'.freeze,
  DROP_CAPABILITIES_CAP_SETUID = 'CAP_SETUID'.freeze,
  DROP_CAPABILITIES_CAP_SETFCAP = 'CAP_SETFCAP'.freeze,
  DROP_CAPABILITIES_CAP_SETPCAP = 'CAP_SETPCAP'.freeze,
  DROP_CAPABILITIES_CAP_NET_BIND_SERVICE = 'CAP_NET_BIND_SERVICE'.freeze,
  DROP_CAPABILITIES_CAP_SYS_CHROOT = 'CAP_SYS_CHROOT'.freeze,
  DROP_CAPABILITIES_CAP_KILL = 'CAP_KILL'.freeze,
  DROP_CAPABILITIES_CAP_AUDIT_WRITE = 'CAP_AUDIT_WRITE'.freeze,
  DROP_CAPABILITIES_ALL = 'ALL'.freeze,
  DROP_CAPABILITIES_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ ContainerCapabilities

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :add_capabilities (Array<String>)

    The value to assign to the #add_capabilities property

  • :drop_capabilities (Array<String>)

    The value to assign to the #drop_capabilities property



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/oci/container_instances/models/container_capabilities.rb', line 89

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

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

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

  self.drop_capabilities = attributes[:'dropCapabilities'] if attributes[:'dropCapabilities']

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

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

Instance Attribute Details

#add_capabilitiesArray<String>

A list of additional configurable container capabilities.

Returns:

  • (Array<String>)


54
55
56
# File 'lib/oci/container_instances/models/container_capabilities.rb', line 54

def add_capabilities
  @add_capabilities
end

#drop_capabilitiesArray<String>

A list of container capabilities that can be dropped.

Returns:

  • (Array<String>)


59
60
61
# File 'lib/oci/container_instances/models/container_capabilities.rb', line 59

def drop_capabilities
  @drop_capabilities
end

Class Method Details

.attribute_mapObject

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



62
63
64
65
66
67
68
69
# File 'lib/oci/container_instances/models/container_capabilities.rb', line 62

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'add_capabilities': :'addCapabilities',
    'drop_capabilities': :'dropCapabilities'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



72
73
74
75
76
77
78
79
# File 'lib/oci/container_instances/models/container_capabilities.rb', line 72

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'add_capabilities': :'Array<String>',
    'drop_capabilities': :'Array<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



155
156
157
158
159
160
161
# File 'lib/oci/container_instances/models/container_capabilities.rb', line 155

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

  self.class == other.class &&
    add_capabilities == other.add_capabilities &&
    drop_capabilities == other.drop_capabilities
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



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

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


166
167
168
# File 'lib/oci/container_instances/models/container_capabilities.rb', line 166

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



175
176
177
# File 'lib/oci/container_instances/models/container_capabilities.rb', line 175

def hash
  [add_capabilities, drop_capabilities].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



219
220
221
222
223
224
225
226
227
228
# File 'lib/oci/container_instances/models/container_capabilities.rb', line 219

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



213
214
215
# File 'lib/oci/container_instances/models/container_capabilities.rb', line 213

def to_s
  to_hash.to_s
end