Class: OCI::DataSafe::Models::GrantSummary

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/data_safe/models/grant_summary.rb

Overview

The summary of user grants.

Constant Summary collapse

PRIVILEGE_TYPE_ENUM =
[
  PRIVILEGE_TYPE_SYSTEM_PRIVILEGE = 'SYSTEM_PRIVILEGE'.freeze,
  PRIVILEGE_TYPE_OBJECT_PRIVILEGE = 'OBJECT_PRIVILEGE'.freeze,
  PRIVILEGE_TYPE_ADMIN_PRIVILEGE = 'ADMIN_PRIVILEGE'.freeze,
  PRIVILEGE_TYPE_ROLE = 'ROLE'.freeze,
  PRIVILEGE_TYPE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze
PRIVILEGE_CATEGORY_ENUM =
[
  PRIVILEGE_CATEGORY_CRITICAL = 'CRITICAL'.freeze,
  PRIVILEGE_CATEGORY_HIGH = 'HIGH'.freeze,
  PRIVILEGE_CATEGORY_MEDIUM = 'MEDIUM'.freeze,
  PRIVILEGE_CATEGORY_LOW = 'LOW'.freeze,
  PRIVILEGE_CATEGORY_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ GrantSummary

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :key (String)

    The value to assign to the #key property

  • :grant_name (String)

    The value to assign to the #grant_name property

  • :privilege_type (String)

    The value to assign to the #privilege_type property

  • :privilege_category (String)

    The value to assign to the #privilege_category property

  • :depth_level (Integer)

    The value to assign to the #depth_level property



88
89
90
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
# File 'lib/oci/data_safe/models/grant_summary.rb', line 88

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

  self.grant_name = attributes[:'grantName'] if attributes[:'grantName']

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

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

  self.privilege_type = attributes[:'privilegeType'] if attributes[:'privilegeType']

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

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

  self.privilege_category = attributes[:'privilegeCategory'] if attributes[:'privilegeCategory']

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

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

  self.depth_level = attributes[:'depthLevel'] if attributes[:'depthLevel']

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

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

Instance Attribute Details

#depth_levelInteger

The grant depth level of the indirect grant. An indirectly granted role/privilege is granted to the user through another role. The depth level indicates how deep a privilege is within the grant hierarchy.

Returns:

  • (Integer)


49
50
51
# File 'lib/oci/data_safe/models/grant_summary.rb', line 49

def depth_level
  @depth_level
end

#grant_nameString

The name of a user grant.

Returns:

  • (String)


34
35
36
# File 'lib/oci/data_safe/models/grant_summary.rb', line 34

def grant_name
  @grant_name
end

#keyString

[Required] The unique key of a user grant.

Returns:

  • (String)


30
31
32
# File 'lib/oci/data_safe/models/grant_summary.rb', line 30

def key
  @key
end

#privilege_categoryString

The privilege category.

Returns:

  • (String)


42
43
44
# File 'lib/oci/data_safe/models/grant_summary.rb', line 42

def privilege_category
  @privilege_category
end

#privilege_typeString

The type of a user grant.

Returns:

  • (String)


38
39
40
# File 'lib/oci/data_safe/models/grant_summary.rb', line 38

def privilege_type
  @privilege_type
end

Class Method Details

.attribute_mapObject

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



52
53
54
55
56
57
58
59
60
61
62
# File 'lib/oci/data_safe/models/grant_summary.rb', line 52

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'key': :'key',
    'grant_name': :'grantName',
    'privilege_type': :'privilegeType',
    'privilege_category': :'privilegeCategory',
    'depth_level': :'depthLevel'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



65
66
67
68
69
70
71
72
73
74
75
# File 'lib/oci/data_safe/models/grant_summary.rb', line 65

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'key': :'String',
    'grant_name': :'String',
    'privilege_type': :'String',
    'privilege_category': :'String',
    'depth_level': :'Integer'
    # 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



154
155
156
157
158
159
160
161
162
163
# File 'lib/oci/data_safe/models/grant_summary.rb', line 154

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

  self.class == other.class &&
    key == other.key &&
    grant_name == other.grant_name &&
    privilege_type == other.privilege_type &&
    privilege_category == other.privilege_category &&
    depth_level == other.depth_level
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/data_safe/models/grant_summary.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/data_safe/models/grant_summary.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/data_safe/models/grant_summary.rb', line 177

def hash
  [key, grant_name, privilege_type, privilege_category, depth_level].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/data_safe/models/grant_summary.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/data_safe/models/grant_summary.rb', line 215

def to_s
  to_hash.to_s
end