| 563 | } |
| 564 | |
| 565 | protected validateHeaders( |
| 566 | { values, nulls }: NullableHeaders, |
| 567 | schemes: { bearerAuth?: boolean; adminAPIKeyAuth?: boolean } = { |
| 568 | bearerAuth: true, |
| 569 | adminAPIKeyAuth: true, |
| 570 | }, |
| 571 | ) { |
| 572 | if (values.get('authorization') || values.get('api-key')) { |
| 573 | return; |
| 574 | } |
| 575 | if (nulls.has('authorization') || nulls.has('api-key')) { |
| 576 | return; |
| 577 | } |
| 578 | |
| 579 | if (this._workloadIdentityAuth && schemes.bearerAuth) { |
| 580 | return; |
| 581 | } |
| 582 | |
| 583 | throw new Error( |
| 584 | 'Could not resolve authentication method. Expected either apiKey or adminAPIKey to be set. Or for one of the "Authorization" or "api-key" headers to be explicitly omitted', |
| 585 | ); |
| 586 | } |
| 587 | |
| 588 | protected async authHeaders( |
| 589 | opts: FinalRequestOptions, |