Class: Legion::Extensions::Llm::Inventory::ProbeToken
- Inherits:
-
Data
- Object
- Data
- Legion::Extensions::Llm::Inventory::ProbeToken
- Defined in:
- lib/legion/extensions/llm/inventory/probe_token.rb
Overview
A single-use safe-readiness probe token. Carries no secret. See 11.2.
Instance Attribute Summary collapse
-
#instance_key ⇒ Object
readonly
Returns the value of attribute instance_key.
-
#publisher_token_id ⇒ Object
readonly
Returns the value of attribute publisher_token_id.
-
#started_at ⇒ Object
readonly
Returns the value of attribute started_at.
-
#started_availability_revision ⇒ Object
readonly
Returns the value of attribute started_availability_revision.
-
#token_id ⇒ Object
readonly
Returns the value of attribute token_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(token_id:, instance_key:, publisher_token_id:, started_availability_revision:, started_at:) ⇒ ProbeToken
constructor
A new instance of ProbeToken.
Constructor Details
#initialize(token_id:, instance_key:, publisher_token_id:, started_availability_revision:, started_at:) ⇒ ProbeToken
Returns a new instance of ProbeToken.
98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/legion/extensions/llm/inventory/probe_token.rb', line 98 def initialize(token_id:, instance_key:, publisher_token_id:, started_availability_revision:, started_at:) raise Errors::ValidationError, 'instance_key must be an InstanceKey' unless instance_key.is_a?(Identity::InstanceKey) raise Errors::ValidationError, 'token_id must be a probe:v1: String' unless token_id.to_s.start_with?('probe:v1:') raise Errors::ValidationError, 'publisher_token_id must be a ptok:v1: String' unless publisher_token_id.is_a?(::String) && publisher_token_id.start_with?('ptok:v1:') unless started_availability_revision.is_a?(::Integer) && !started_availability_revision.negative? raise Errors::ValidationError, 'started_availability_revision must be a nonnegative Integer' end raise Errors::ValidationError, 'started_at must be a Time' unless started_at.is_a?(::Time) super( token_id: token_id.dup.freeze, instance_key: instance_key, publisher_token_id: publisher_token_id.dup.freeze, started_availability_revision: started_availability_revision, started_at: started_at.dup.freeze ) end |
Instance Attribute Details
#instance_key ⇒ Object (readonly)
Returns the value of attribute instance_key
89 90 91 |
# File 'lib/legion/extensions/llm/inventory/probe_token.rb', line 89 def instance_key @instance_key end |
#publisher_token_id ⇒ Object (readonly)
Returns the value of attribute publisher_token_id
89 90 91 |
# File 'lib/legion/extensions/llm/inventory/probe_token.rb', line 89 def publisher_token_id @publisher_token_id end |
#started_at ⇒ Object (readonly)
Returns the value of attribute started_at
89 90 91 |
# File 'lib/legion/extensions/llm/inventory/probe_token.rb', line 89 def started_at @started_at end |
#started_availability_revision ⇒ Object (readonly)
Returns the value of attribute started_availability_revision
89 90 91 |
# File 'lib/legion/extensions/llm/inventory/probe_token.rb', line 89 def started_availability_revision @started_availability_revision end |
#token_id ⇒ Object (readonly)
Returns the value of attribute token_id
89 90 91 |
# File 'lib/legion/extensions/llm/inventory/probe_token.rb', line 89 def token_id @token_id end |
Class Method Details
.issue(instance_key:, publisher_token_id:, started_availability_revision:, started_at:) ⇒ Object
90 91 92 93 94 95 96 |
# File 'lib/legion/extensions/llm/inventory/probe_token.rb', line 90 def self.issue(instance_key:, publisher_token_id:, started_availability_revision:, started_at:) new( token_id: "probe:v1:#{::SecureRandom.uuid}", instance_key: instance_key, publisher_token_id: publisher_token_id, started_availability_revision: started_availability_revision, started_at: started_at ) end |