Class: Arcp::Credentials::InMemoryProvisioner
- Inherits:
-
Object
- Object
- Arcp::Credentials::InMemoryProvisioner
- Includes:
- Arcp::CredentialProvisioner
- Defined in:
- lib/arcp/credential_provisioner.rb
Instance Attribute Summary collapse
-
#issued ⇒ Object
readonly
Returns the value of attribute issued.
-
#revoked ⇒ Object
readonly
Returns the value of attribute revoked.
Instance Method Summary collapse
-
#initialize(endpoint: 'https://gateway.test/v1', profile: 'openai') ⇒ InMemoryProvisioner
constructor
A new instance of InMemoryProvisioner.
- #issue(lease:, job_id:, agent:, principal_id:) ⇒ Object
- #revoke(credential_id:) ⇒ Object
Constructor Details
#initialize(endpoint: 'https://gateway.test/v1', profile: 'openai') ⇒ InMemoryProvisioner
Returns a new instance of InMemoryProvisioner.
40 41 42 43 44 45 |
# File 'lib/arcp/credential_provisioner.rb', line 40 def initialize(endpoint: 'https://gateway.test/v1', profile: 'openai') @endpoint = endpoint @profile = profile @issued = [] @revoked = [] end |
Instance Attribute Details
#issued ⇒ Object (readonly)
Returns the value of attribute issued.
38 39 40 |
# File 'lib/arcp/credential_provisioner.rb', line 38 def issued @issued end |
#revoked ⇒ Object (readonly)
Returns the value of attribute revoked.
38 39 40 |
# File 'lib/arcp/credential_provisioner.rb', line 38 def revoked @revoked end |
Instance Method Details
#issue(lease:, job_id:, agent:, principal_id:) ⇒ Object
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/arcp/credential_provisioner.rb', line 47 def issue(lease:, job_id:, agent:, principal_id:) credential = Arcp::Credential.new( id: "cred_#{job_id}_0", scheme: Arcp::Credential::SCHEME_BEARER, value: "sk-test-#{job_id}", endpoint: @endpoint, profile: @profile, constraints: constraints_for(lease) ) @issued << { credential: credential, job_id: job_id, agent: agent, principal_id: principal_id } [credential] end |
#revoke(credential_id:) ⇒ Object
65 66 67 68 |
# File 'lib/arcp/credential_provisioner.rb', line 65 def revoke(credential_id:) @revoked << credential_id nil end |