googleapis / googleapis/ruby-core-libraries

REST ServiceStub should pass &block through to ClientStub.new to enable Faraday connection customization

Aperta
#57 0 commenti 0 reazioni 1 assegnatario Rivendicata da @aandreassa Vedi su GitHub
Lingua principale
Ruby
Stelle
14
Fork
12
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

`Gapic::Rest::ClientStub#initialize` already yields the Faraday connection after setup:

```ruby
# gapic-common/lib/gapic/rest/client_stub.rb:94
yield @connection if block_given?
```

However, none of the auto-generated `ServiceStub` classes pass a block through when creating the `ClientStub`, so this hook is unreachable from the public API.

**Use case:** Configuring mTLS client certificates on the Faraday connection for services that require mutual TLS authentication (e.g., connecting to an API gateway that validates client certs).

```ruby
# What we'd like to do:
connection.ssl.client_cert = OpenSSL::X509::Certificate.new(cert_pem)
connection.ssl.client_key = OpenSSL::PKey::RSA.new(key_pem)
```

**Proposed fix:** Update the generator template for REST `ServiceStub#initialize` to accept and forward `&block` to `ClientStub.new`.

**Affected version:** `gapic-common` 1.0.0, `google-cloud-ai_platform-v1` 1.17.0

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.