serviceclient

package
v2.0.46 Latest Latest
Warning

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

Go to latest
Published: Sep 2, 2026 License: Apache-2.0, Apache-2.0 Imports: 10 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package serviceclient builds HTTP clients for service-to-service requests.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPClient

func NewHTTPClient(ctx context.Context, base *http.Client, cfg ServiceConfig) (*http.Client, error)

NewHTTPClient returns an HTTP client configured for the service.

Types

type AuthConfig

type AuthConfig struct {
	Type             AuthType `json:"type" pflag:",Service authentication type"`
	IssuerURL        string   `json:"issuerUrl" pflag:",OAuth 2.0 authorization server issuer URL"`
	ClientID         string   `json:"clientId" pflag:",OAuth 2.0 client ID"`
	ClientSecret     string   `json:"clientSecret" pflag:",OAuth 2.0 client secret"`
	ClientSecretFile string   `json:"clientSecretFile" pflag:",File containing the OAuth 2.0 client secret"`
	Scopes           []string `json:"scopes" pflag:",OAuth 2.0 scopes to request"`
	Audience         string   `json:"audience" pflag:",OAuth 2.0 token audience"`
}

AuthConfig configures authentication for service requests.

type AuthType

type AuthType string

AuthType identifies the authentication mechanism used for service requests.

const (
	// AuthTypeNone disables authentication.
	AuthTypeNone AuthType = ""
	// AuthTypeOAuth2ClientCredentials uses the OAuth 2.0 client credentials grant.
	AuthTypeOAuth2ClientCredentials AuthType = "OAuth2ClientCredentials"
)

type ServiceConfig

type ServiceConfig struct {
	URL  string     `json:"url" pflag:",Service base URL"`
	Auth AuthConfig `json:"auth" pflag:",Service authentication"`
}

ServiceConfig describes a downstream service and how to authenticate to it.

Jump to

Keyboard shortcuts

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