Class: Textus::Orchestration

Inherits:
Object
  • Object
show all
Defined in:
lib/textus/orchestration.rb

Defined Under Namespace

Classes: AuditQuery, DeleteKeyCommand, ListKeysQuery, MoveKeyCommand

Instance Method Summary collapse

Constructor Details

#initialize(list_keys:, move_key:, delete_key:, audit_entries:) ⇒ Orchestration

Returns a new instance of Orchestration.



8
9
10
11
12
13
# File 'lib/textus/orchestration.rb', line 8

def initialize(list_keys:, move_key:, delete_key:, audit_entries:)
  @list_keys = list_keys
  @move_key = move_key
  @delete_key = delete_key
  @audit_entries = audit_entries
end

Instance Method Details

#audit_entries(call:, seq_since: nil, key: nil, lane: nil, role: nil, verb: nil, since: nil, correlation_id: nil, limit: nil) ⇒ Object

rubocop:disable Metrics/ParameterLists



31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/textus/orchestration.rb', line 31

def audit_entries(call:, seq_since: nil, key: nil, lane: nil, role: nil, verb: nil, since: nil, correlation_id: nil, limit: nil)
  query = AuditQuery.new(
    seq_since: seq_since,
    key: key,
    lane: lane,
    role: role,
    verb: verb,
    since: since,
    correlation_id: correlation_id,
    limit: limit,
  )
  normalize(@audit_entries.call(query, call), key: "rows")
end

#delete_key(key:, call:, if_etag: nil) ⇒ Object



25
26
27
28
# File 'lib/textus/orchestration.rb', line 25

def delete_key(key:, call:, if_etag: nil)
  command = DeleteKeyCommand.new(key: key, if_etag: if_etag)
  normalize(@delete_key.call(command, call), key: "delete")
end

#list_keys(prefix:, lane:, call:) ⇒ Object



15
16
17
18
# File 'lib/textus/orchestration.rb', line 15

def list_keys(prefix:, lane:, call:)
  query = ListKeysQuery.new(prefix: prefix, lane: lane)
  normalize(@list_keys.call(query, call), key: "rows")
end

#move_key(old_key:, new_key:, call:, if_etag: nil, dry_run: false) ⇒ Object



20
21
22
23
# File 'lib/textus/orchestration.rb', line 20

def move_key(old_key:, new_key:, call:, if_etag: nil, dry_run: false)
  command = MoveKeyCommand.new(old_key: old_key, new_key: new_key, if_etag: if_etag, dry_run: dry_run)
  normalize(@move_key.call(command, call), key: "move")
end