in pkg/plugin/cloudlogging/client.go [69:91]
func NewClient(ctx context.Context, jsonCreds []byte) (*Client, error) {
client, err := logging.NewClient(ctx, option.WithCredentialsJSON(jsonCreds),
option.WithUserAgent("googlecloud-logging-datasource"))
if err != nil {
return nil, err
}
rClient, err := resourcemanager.NewService(ctx, option.WithCredentialsJSON(jsonCreds),
option.WithUserAgent("googlecloud-logging-datasource"))
if err != nil {
return nil, err
}
configClient, err := logging.NewConfigClient(ctx, option.WithCredentialsJSON(jsonCreds),
option.WithUserAgent("googlecloud-logging-datasource"))
if err != nil {
return nil, err
}
return &Client{
lClient: client,
rClient: rClient.Projects,
configClient: configClient,
}, nil
}