Versions in this module Expand all Collapse all v0 v0.18.2 Jun 9, 2023 Changes in this version + const SigningMethodES256 + const SigningMethodES384 + const SigningMethodES512 + const SigningMethodHS256 + const SigningMethodHS384 + const SigningMethodHS512 + const TypeBasic + const TypeHeaderQuery + const TypeJWT + const TypeOAuth2 + var ErrBasicAuthNotPopulated = errors.New("basic auth is not populated") + var ErrJWTNotPopulated = errors.New("jwt is not populated") + var ErrJWTNotSupported = errors.New("jwt is not supported for function") + var ErrOAuth2NotPopulated = errors.New("oauth2 is not populated") + var ErrTypeNotSupported = errors.New("credentials type not supported") + func NewTokenCLI(creds Credentials, state string) (token *oauth2.Token, err error) + type AuthCodeOptions []oauth2.AuthCodeOption + func (opts *AuthCodeOptions) Add(k, v string) + func (opts *AuthCodeOptions) AddMap(m map[string][]string) + type Credentials struct + Additional url.Values + Basic CredentialsBasicAuth + HeaderQuery CredentialsHeaderQuery + JWT CredentialsJWT + OAuth2 CredentialsOAuth2 + Service string + Subdomain string + Token *oauth2.Token + Type string + func NewCredentialsJSON(credsData, accessToken []byte) (Credentials, error) + func ReadCredentialsFromFile(credentialsSetFilename, accountKey string, inclAccountsOnError bool) (Credentials, error) + func (creds *Credentials) Inflate() error + func (creds *Credentials) NewClient(ctx context.Context) (*http.Client, error) + func (creds *Credentials) NewClientCLI(oauth2State string) (*http.Client, error) + func (creds *Credentials) NewSimpleClient(ctx context.Context) (*httpsimple.SimpleClient, error) + func (creds *Credentials) NewSimpleClientHTTP(httpClient *http.Client) (*httpsimple.SimpleClient, error) + func (creds *Credentials) NewToken() (*oauth2.Token, error) + func (creds *Credentials) NewTokenCLI(oauth2State string) (*oauth2.Token, error) + type CredentialsBasicAuth struct + AllowInsecure bool + Encoded string + Metadata map[string]string + Password string + ServerURL string + Username string + func (c *CredentialsBasicAuth) NewClient() (*http.Client, error) + func (c *CredentialsBasicAuth) NewSimpleClient() (httpsimple.SimpleClient, error) + type CredentialsHeaderQuery struct + AllowInsecure bool + Header http.Header + Query url.Values + ServerURL string + func (c *CredentialsHeaderQuery) NewClient() *http.Client + func (c *CredentialsHeaderQuery) NewSimpleClient() httpsimple.SimpleClient + type CredentialsJWT struct + Issuer string + PrivateKey string + SigningMethod string + func (jc *CredentialsJWT) StandardToken(tokenDuration time.Duration) (*jwt.Token, string, error) + type CredentialsOAuth2 struct + AccessTokenTTL int64 + AppName string + AppVersion string + ApplicationID string + AuthCodeExchangeOpts map[string][]string + AuthCodeOpts map[string][]string + ClientID string + ClientSecret string + Endpoint oauth2.Endpoint + GrantType string + JWT string + Metadata map[string]string + OAuthEndpointID string + PKCE bool + Password string + PasswordOpts map[string][]string + RedirectURL string + RefreshTokenTTL int64 + Scopes []string + ServerURL string + Token *oauth2.Token + Username string + func NewCredentialsOAuth2Env(envPrefix string) CredentialsOAuth2 + func ParseCredentialsOAuth2(b []byte) (CredentialsOAuth2, error) + func (oc *CredentialsOAuth2) AppNameAndVersion() string + func (oc *CredentialsOAuth2) AuthCodeURL(state string, opts map[string][]string) string + func (oc *CredentialsOAuth2) BasicAuthHeader() (string, error) + func (oc *CredentialsOAuth2) Config() oauth2.Config + func (oc *CredentialsOAuth2) ConfigClientCredentials() clientcredentials.Config + func (oc *CredentialsOAuth2) Exchange(ctx context.Context, code string, opts map[string][]string) (*oauth2.Token, error) + func (oc *CredentialsOAuth2) InflateURL(apiURLPath string) string + func (oc *CredentialsOAuth2) IsGrantType(grantType string) bool + func (oc *CredentialsOAuth2) MarshalJSON(prefix, indent string) ([]byte, error) + func (oc *CredentialsOAuth2) NewClient(ctx context.Context) (*http.Client, *oauth2.Token, error) + func (oc *CredentialsOAuth2) NewToken(ctx context.Context) (*oauth2.Token, error) + func (oc *CredentialsOAuth2) PasswordRequestBody() url.Values + func (oc *CredentialsOAuth2) RefreshToken(tok *oauth2.Token) (*oauth2.Token, []byte, error) + func (oc *CredentialsOAuth2) RefreshTokenSimple(refreshToken string) (*oauth2.Token, []byte, error) + type CredentialsSet struct + Credentials map[string]Credentials + func ReadFileCredentialsSet(credentialsSetFilename string, inflateEndpoints bool) (CredentialsSet, error) + func (set *CredentialsSet) Accounts() []string + func (set *CredentialsSet) GetClient(ctx context.Context, key string) (*http.Client, error) + func (set *CredentialsSet) Inflate() error + func (set *CredentialsSet) Keys() []string + func (set *CredentialsSet) WriteFile(filename, prefix, indent string, perm fs.FileMode) error + func (set CredentialsSet) Get(key string) (Credentials, error) + type Options struct + Account string + CLI []bool + CredsPath string + Token string + func (opts *Options) UseCLI() bool