Class: OCI::Identity::Models::DynamicGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/oci/identity/models/dynamic_group.rb

Overview

A dynamic group defines a matching rule. Every bare metal or virtual machine instance is deployed with an instance certificate. The certificate contains metadata about the instance. This includes the instance OCID and the compartment OCID, along with a few other optional properties. When an API call is made using this instance certificate as the authenticator, the certificate can be matched to one or multiple dynamic groups. The instance can then get access to the API based on the permissions granted in policies written for the dynamic groups.

This works like regular user/group membership. But in that case, the membership is a static relationship, whereas in a dynamic group, the membership of an instance certificate to a dynamic group is determined during runtime. For more information, see [Managing Dynamic Groups](docs.cloud.oracle.com/Content/Identity/Tasks/managingdynamicgroups.htm).

Constant Summary collapse

LIFECYCLE_STATE_ENUM =

rubocop:disable Metrics/LineLength

[
  LIFECYCLE_STATE_CREATING = 'CREATING'.freeze,
  LIFECYCLE_STATE_ACTIVE = 'ACTIVE'.freeze,
  LIFECYCLE_STATE_INACTIVE = 'INACTIVE'.freeze,
  LIFECYCLE_STATE_DELETING = 'DELETING'.freeze,
  LIFECYCLE_STATE_DELETED = 'DELETED'.freeze,
  LIFECYCLE_STATE_UNKNOWN_ENUM_VALUE = 'UNKNOWN_ENUM_VALUE'.freeze
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ DynamicGroup

Initializes the object

Parameters:

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

    Model attributes in the form of hash

Options Hash (attributes):

  • :id (String)

    The value to assign to the #id property

  • :compartment_id (String)

    The value to assign to the #compartment_id property

  • :name (String)

    The value to assign to the #name property

  • :description (String)

    The value to assign to the #description property

  • :matching_rule (String)

    The value to assign to the #matching_rule property

  • :time_created (DateTime)

    The value to assign to the #time_created property

  • :lifecycle_state (String)

    The value to assign to the #lifecycle_state property

  • :inactive_status (Integer)

    The value to assign to the #inactive_status property



115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/oci/identity/models/dynamic_group.rb', line 115

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

  self.compartment_id = attributes[:'compartmentId'] if attributes[:'compartmentId']

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

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

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

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

  self.matching_rule = attributes[:'matchingRule'] if attributes[:'matchingRule']

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

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

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

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

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

  self.inactive_status = attributes[:'inactiveStatus'] if attributes[:'inactiveStatus']

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

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

Instance Attribute Details

#compartment_idString

[Required] The OCID of the tenancy containing the group.

Returns:

  • (String)


34
35
36
# File 'lib/oci/identity/models/dynamic_group.rb', line 34

def compartment_id
  @compartment_id
end

#descriptionString

[Required] The description you assign to the group. Does not have to be unique, and it’s changeable.

Returns:

  • (String)


44
45
46
# File 'lib/oci/identity/models/dynamic_group.rb', line 44

def description
  @description
end

#idString

[Required] The OCID of the group.

Returns:

  • (String)


30
31
32
# File 'lib/oci/identity/models/dynamic_group.rb', line 30

def id
  @id
end

#inactive_statusInteger

The detailed status of INACTIVE lifecycleState.

Returns:

  • (Integer)


67
68
69
# File 'lib/oci/identity/models/dynamic_group.rb', line 67

def inactive_status
  @inactive_status
end

#lifecycle_stateString

[Required] The group’s current state. After creating a group, make sure its ‘lifecycleState` changes from CREATING to ACTIVE before using it.

Returns:

  • (String)


63
64
65
# File 'lib/oci/identity/models/dynamic_group.rb', line 63

def lifecycle_state
  @lifecycle_state
end

#matching_ruleString

[Required] A rule string that defines which instance certificates will be matched. For syntax, see [Managing Dynamic Groups](docs.cloud.oracle.com/Content/Identity/Tasks/managingdynamicgroups.htm).

Returns:

  • (String)


50
51
52
# File 'lib/oci/identity/models/dynamic_group.rb', line 50

def matching_rule
  @matching_rule
end

#nameString

[Required] The name you assign to the group during creation. The name must be unique across all groups in the tenancy and cannot be changed.

Returns:

  • (String)


40
41
42
# File 'lib/oci/identity/models/dynamic_group.rb', line 40

def name
  @name
end

#time_createdDateTime

[Required] Date and time the group was created, in the format defined by RFC3339.

Example: ‘2016-08-25T21:10:29.600Z`

Returns:

  • (DateTime)


57
58
59
# File 'lib/oci/identity/models/dynamic_group.rb', line 57

def time_created
  @time_created
end

Class Method Details

.attribute_mapObject

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



70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/oci/identity/models/dynamic_group.rb', line 70

def self.attribute_map
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'id',
    'compartment_id': :'compartmentId',
    'name': :'name',
    'description': :'description',
    'matching_rule': :'matchingRule',
    'time_created': :'timeCreated',
    'lifecycle_state': :'lifecycleState',
    'inactive_status': :'inactiveStatus'
    # rubocop:enable Style/SymbolLiteral
  }
end

.swagger_typesObject

Attribute type mapping.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/oci/identity/models/dynamic_group.rb', line 86

def self.swagger_types
  {
    # rubocop:disable Style/SymbolLiteral
    'id': :'String',
    'compartment_id': :'String',
    'name': :'String',
    'description': :'String',
    'matching_rule': :'String',
    'time_created': :'DateTime',
    'lifecycle_state': :'String',
    'inactive_status': :'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



180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/oci/identity/models/dynamic_group.rb', line 180

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

  self.class == other.class &&
    id == other.id &&
    compartment_id == other.compartment_id &&
    name == other.name &&
    description == other.description &&
    matching_rule == other.matching_rule &&
    time_created == other.time_created &&
    lifecycle_state == other.lifecycle_state &&
    inactive_status == other.inactive_status
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



217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/oci/identity/models/dynamic_group.rb', line 217

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


197
198
199
# File 'lib/oci/identity/models/dynamic_group.rb', line 197

def eql?(other)
  self == other
end

#hashFixnum

Calculates hash code according to all attributes.

Returns:

  • (Fixnum)

    Hash code



206
207
208
# File 'lib/oci/identity/models/dynamic_group.rb', line 206

def hash
  [id, compartment_id, name, description, matching_rule, time_created, lifecycle_state, inactive_status].hash
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



250
251
252
253
254
255
256
257
258
259
# File 'lib/oci/identity/models/dynamic_group.rb', line 250

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



244
245
246
# File 'lib/oci/identity/models/dynamic_group.rb', line 244

def to_s
  to_hash.to_s
end