mirror of
https://github.com/pomerium/pomerium.git
synced 2025-05-02 03:46:29 +02:00
24 lines
607 B
Go
24 lines
607 B
Go
package bootstrap
|
|
|
|
import (
|
|
"context"
|
|
"fmt"
|
|
|
|
cluster_api "github.com/pomerium/zero-sdk/cluster"
|
|
)
|
|
|
|
// LoadBootstrapConfigFromAPI loads the bootstrap configuration from the cluster API.
|
|
func LoadBootstrapConfigFromAPI(
|
|
ctx context.Context,
|
|
client cluster_api.ClientWithResponsesInterface,
|
|
) (*cluster_api.BootstrapConfig, error) {
|
|
resp, err := client.GetClusterBootstrapConfigWithResponse(ctx)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("get: %w", err)
|
|
}
|
|
if resp.JSON200 == nil {
|
|
return nil, fmt.Errorf("unexpected response: %d/%v", resp.StatusCode(), resp.Status())
|
|
}
|
|
|
|
return resp.JSON200, nil
|
|
}
|