Class: Eco::API::UseCases::GraphQL::Samples::Pages::Template::Deploy::Loop::Result

Inherits:
Struct
  • Object
show all
Defined in:
lib/eco/api/usecases/graphql/samples/pages/template/deploy/loop.rb

Overview

Aggregate outcome of one deploy→verify→monitor pass.

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#appliedObject

Returns the value of attribute applied

Returns:

  • (Object)

    the current value of applied



34
35
36
# File 'lib/eco/api/usecases/graphql/samples/pages/template/deploy/loop.rb', line 34

def applied
  @applied
end

#driftObject

Returns the value of attribute drift

Returns:

  • (Object)

    the current value of drift



34
35
36
# File 'lib/eco/api/usecases/graphql/samples/pages/template/deploy/loop.rb', line 34

def drift
  @drift
end

#sync_readinessObject

Returns the value of attribute sync_readiness

Returns:

  • (Object)

    the current value of sync_readiness



34
35
36
# File 'lib/eco/api/usecases/graphql/samples/pages/template/deploy/loop.rb', line 34

def sync_readiness
  @sync_readiness
end

#verdictObject

Returns the value of attribute verdict

Returns:

  • (Object)

    the current value of verdict



34
35
36
# File 'lib/eco/api/usecases/graphql/samples/pages/template/deploy/loop.rb', line 34

def verdict
  @verdict
end

Instance Method Details

#applied_ok?Boolean

Returns:

  • (Boolean)


40
41
42
# File 'lib/eco/api/usecases/graphql/samples/pages/template/deploy/loop.rb', line 40

def applied_ok?
  applied && applied.skipped_reason.nil?
end

#drift_ok?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/eco/api/usecases/graphql/samples/pages/template/deploy/loop.rb', line 44

def drift_ok?
  drift.nil? || drift.match?
end

#ok?Boolean

Overall gate: the apply was not blocked, the drift (if checked) matched, and verify passed.

Returns:

  • (Boolean)


36
37
38
# File 'lib/eco/api/usecases/graphql/samples/pages/template/deploy/loop.rb', line 36

def ok?
  applied_ok? && drift_ok? && verify_ok?
end

#reportObject



62
63
64
65
66
67
68
69
70
# File 'lib/eco/api/usecases/graphql/samples/pages/template/deploy/loop.rb', line 62

def report
  [
    "DEPLOY LOOP: #{ok? ? 'OK' : 'ATTENTION NEEDED'}",
    applied_line,
    drift&.report,
    verdict&.report,
    sync_readiness&.report
  ].compact.join("\n\n")
end

#to_hObject



52
53
54
55
56
57
58
59
60
# File 'lib/eco/api/usecases/graphql/samples/pages/template/deploy/loop.rb', line 52

def to_h
  {
    ok:             ok?,
    applied:        applied&.to_h,
    drift:          drift&.to_h,
    verdict:        verdict&.to_h,
    sync_readiness: sync_readiness&.to_h
  }.compact
end

#verify_ok?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/eco/api/usecases/graphql/samples/pages/template/deploy/loop.rb', line 48

def verify_ok?
  verdict.nil? || verdict.pass?
end