Fetcher returns fetch.Interface defined by conf. If no configuration source is set, this method returns nil, nil.
(ctx context.Context, httpClientProvider httpclient.Provider)
| 461 | // Fetcher returns fetch.Interface defined by conf. |
| 462 | // If no configuration source is set, this method returns nil, nil. |
| 463 | func (c SenderClientCA) Fetcher(ctx context.Context, httpClientProvider httpclient.Provider) (fetch.Interface, error) { |
| 464 | switch c.Source { |
| 465 | case "directory": |
| 466 | return fetch.FromFilesystem(c.Directory), nil |
| 467 | case "url": |
| 468 | httpClient, err := httpClientProvider.HTTPClient(ctx, httpclient.WithCache(true)) |
| 469 | if err != nil { |
| 470 | return nil, err |
| 471 | } |
| 472 | return fetch.FromHTTP(httpClient, c.URL) |
| 473 | case "blob": |
| 474 | b, err := c.BlobConfig.Bucket(ctx, c.Blob.Bucket, httpClientProvider) |
| 475 | if err != nil { |
| 476 | return nil, err |
| 477 | } |
| 478 | return fetch.FromBucket(ctx, b, c.Blob.Path), nil |
| 479 | default: |
| 480 | return nil, nil |
| 481 | } |
| 482 | } |
| 483 | |
| 484 | // PacketBrokerInteropAuth respresents Packet Broker authentication configuration. |
| 485 | type PacketBrokerInteropAuth struct { |
nothing calls this directly
no test coverage detected