Class: SDM::Activity

Inherits:
Object
  • Object
show all
Defined in:
lib/models/porcelain.rb

Overview

An Activity is a record of an action taken against a strongDM deployment, e.g. a user creation, resource deletion, sso configuration change, etc.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(actor: nil, completed_at: nil, description: nil, entities: nil, id: nil, ip_address: nil, user_agent: nil, verb: nil) ⇒ Activity

Returns a new instance of Activity.



1486
1487
1488
1489
1490
1491
1492
1493
1494
1495
1496
1497
1498
1499
1500
1501
1502
1503
1504
# File 'lib/models/porcelain.rb', line 1486

def initialize(
  actor: nil,
  completed_at: nil,
  description: nil,
  entities: nil,
  id: nil,
  ip_address: nil,
  user_agent: nil,
  verb: nil
)
  @actor = actor == nil ? nil : actor
  @completed_at = completed_at == nil ? nil : completed_at
  @description = description == nil ? "" : description
  @entities = entities == nil ? [] : entities
  @id = id == nil ? "" : id
  @ip_address = ip_address == nil ? "" : ip_address
  @user_agent = user_agent == nil ? "" : user_agent
  @verb = verb == nil ? "" : verb
end

Instance Attribute Details

#actorObject

The account who executed this activity. If the actor later has a name or email change, that change is not reflected here. Actor is a snapshot of the executing account at the time an activity took place.



1467
1468
1469
# File 'lib/models/porcelain.rb', line 1467

def actor
  @actor
end

#completed_atObject

The time this activity took effect.



1469
1470
1471
# File 'lib/models/porcelain.rb', line 1469

def completed_at
  @completed_at
end

#descriptionObject

A humanized description of the activity.



1471
1472
1473
# File 'lib/models/porcelain.rb', line 1471

def description
  @description
end

#entitiesObject

The entities involved in this activity. These entities can be any first class entity in the strongDM system, eg. a user, a role, a node, an account grant. Not every activity affects explicit entities.



1475
1476
1477
# File 'lib/models/porcelain.rb', line 1475

def entities
  @entities
end

#idObject

Unique identifier of the Activity.



1477
1478
1479
# File 'lib/models/porcelain.rb', line 1477

def id
  @id
end

#ip_addressObject

The IP from which this action was taken.



1479
1480
1481
# File 'lib/models/porcelain.rb', line 1479

def ip_address
  @ip_address
end

#user_agentObject

The User Agent present when this request was executed. Generally a client type and version like strongdm-cli/55.66.77



1482
1483
1484
# File 'lib/models/porcelain.rb', line 1482

def user_agent
  @user_agent
end

#verbObject

The kind of activity which has taken place.



1484
1485
1486
# File 'lib/models/porcelain.rb', line 1484

def verb
  @verb
end

Instance Method Details

#to_json(options = {}) ⇒ Object



1506
1507
1508
1509
1510
1511
1512
# File 'lib/models/porcelain.rb', line 1506

def to_json(options = {})
  hash = {}
  self.instance_variables.each do |var|
    hash[var.id2name.delete_prefix("@")] = self.instance_variable_get var
  end
  hash.to_json
end