Class: OpenAI::Auth::X509WorkloadIdentity
- Inherits:
-
Object
- Object
- OpenAI::Auth::X509WorkloadIdentity
- Defined in:
- lib/openai/auth/x509_workload_identity.rb,
sig/openai/auth/x509_workload_identity.rbs
Overview
Immutable configuration for certificate-authenticated workload identity. Certificate and private-key ownership remain with the attested transport.
Instance Attribute Summary collapse
- #identity_provider_id ⇒ String readonly
- #refresh_buffer_seconds ⇒ Integer readonly
- #service_account_id ⇒ String readonly
-
#transport ⇒ OpenAI::Auth::X509Transport?
readonly
private
The internally guarded transport derived from the caller-owned native client.
Instance Method Summary collapse
-
#initialize(identity_provider_id: ENV["IDENTITY_PROVIDER_ID"], service_account_id: ENV["SERVICE_ACCOUNT_ID"], refresh_buffer_seconds: 1200, http_client: nil, proxy: :direct, api_origin: "https://mtls.api.openai.com") ⇒ X509WorkloadIdentity
constructor
A new instance of X509WorkloadIdentity.
-
#inspect ⇒ String
Avoid exposing provider or service-account identifiers in diagnostics.
Constructor Details
#initialize(identity_provider_id: ENV["IDENTITY_PROVIDER_ID"], service_account_id: ENV["SERVICE_ACCOUNT_ID"], refresh_buffer_seconds: 1200, http_client: nil, proxy: :direct, api_origin: "https://mtls.api.openai.com") ⇒ X509WorkloadIdentity
Returns a new instance of X509WorkloadIdentity.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/openai/auth/x509_workload_identity.rb', line 27 def initialize( identity_provider_id: ENV["IDENTITY_PROVIDER_ID"], service_account_id: ENV["SERVICE_ACCOUNT_ID"], refresh_buffer_seconds: 1200, http_client: nil, proxy: :direct, api_origin: "https://mtls.api.openai.com" ) @identity_provider_id = validate_identifier(identity_provider_id, "identity_provider_id").freeze @service_account_id = validate_identifier(service_account_id, "service_account_id").freeze @refresh_buffer_seconds = Integer(refresh_buffer_seconds) if @refresh_buffer_seconds.negative? raise ArgumentError, "refresh_buffer_seconds must be greater than or equal to zero" end if http_client.nil? && (proxy != :direct || api_origin != "https://mtls.api.openai.com") raise ArgumentError, "X.509 transport configuration requires http_client:" end @transport = unless http_client.nil? X509Transport.new( http_client: http_client, certificate_identity: :static, proxy: proxy, api_origin: api_origin ) end freeze end |
Instance Attribute Details
#identity_provider_id ⇒ String (readonly)
9 10 11 |
# File 'lib/openai/auth/x509_workload_identity.rb', line 9 def identity_provider_id @identity_provider_id end |
#refresh_buffer_seconds ⇒ Integer (readonly)
15 16 17 |
# File 'lib/openai/auth/x509_workload_identity.rb', line 15 def refresh_buffer_seconds @refresh_buffer_seconds end |
#service_account_id ⇒ String (readonly)
12 13 14 |
# File 'lib/openai/auth/x509_workload_identity.rb', line 12 def service_account_id @service_account_id end |
#transport ⇒ OpenAI::Auth::X509Transport? (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The internally guarded transport derived from the caller-owned native client.
21 22 23 |
# File 'lib/openai/auth/x509_workload_identity.rb', line 21 def transport @transport end |
Instance Method Details
#inspect ⇒ String
Avoid exposing provider or service-account identifiers in diagnostics.
61 62 63 |
# File 'lib/openai/auth/x509_workload_identity.rb', line 61 def inspect "#<#{self.class.name}:0x#{object_id.to_s(16)}>" end |