gcp

package
v0.32.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 20, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package gcp provides authenticated HTTP access to GCP APIs using Application Default Credentials. It is a shared foundation used by the Vertex AI inference provider and the GCF dispatch provisioner.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ExtractErrorMessage

func ExtractErrorMessage(body []byte) string

ExtractErrorMessage parses a GCP API error response and returns only the error message, avoiding leakage of sensitive metadata.

Types

type Client

type Client struct {
	QuotaProject string
	// contains filtered or unexported fields
}

Client provides authenticated HTTP access to GCP APIs using Application Default Credentials.

func NewClient

func NewClient() *Client

NewClient creates a new Client with default settings.

func NewClientWithHTTP

func NewClientWithHTTP(httpClient *http.Client) *Client

NewClientWithHTTP creates a Client that uses the given HTTP client and a static "test-token" for auth. Intended for unit tests that redirect GCP API calls to httptest servers.

func (*Client) AccessToken

func (c *Client) AccessToken(ctx context.Context) (string, error)

AccessToken obtains a GCP access token using Application Default Credentials.

func (*Client) DoRequest

func (c *Client) DoRequest(ctx context.Context, method, url, body string) (*http.Response, error)

DoRequest creates and executes an authenticated HTTP request.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL