oci

package
v0.1.3 Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2025 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultConfigPath = "~/.oci/config"
	DefaultProfile    = "DEFAULT"
)

Default values for OCI configuration

Variables

This section is empty.

Functions

This section is empty.

Types

type Factory

type Factory struct {
	// contains filtered or unexported fields
}

Factory creates OCI credentials

func NewFactory

func NewFactory(logger logging.Interface) *Factory

NewFactory creates a new OCI auth factory

func (*Factory) Create

func (f *Factory) Create(ctx context.Context, config auth.Config) (auth.Credentials, error)

Create creates OCI credentials based on config

func (*Factory) SupportedAuthTypes

func (f *Factory) SupportedAuthTypes() []auth.AuthType

SupportedAuthTypes returns supported OCI auth types

type OCICredentials

type OCICredentials struct {
	// contains filtered or unexported fields
}

OCICredentials implements auth.Credentials for OCI

func (*OCICredentials) GetConfigurationProvider

func (c *OCICredentials) GetConfigurationProvider() common.ConfigurationProvider

GetConfigurationProvider returns the underlying OCI configuration provider

func (*OCICredentials) GetRegion

func (c *OCICredentials) GetRegion() string

GetRegion returns the configured region

func (*OCICredentials) IsExpired

func (c *OCICredentials) IsExpired() bool

IsExpired checks if credentials are expired

func (*OCICredentials) Provider

func (c *OCICredentials) Provider() auth.Provider

Provider returns the provider type

func (*OCICredentials) Refresh

func (c *OCICredentials) Refresh(ctx context.Context) error

Refresh refreshes the credentials if needed

func (*OCICredentials) SignRequest

func (c *OCICredentials) SignRequest(ctx context.Context, req *http.Request) error

SignRequest signs an HTTP request with OCI auth headers

func (*OCICredentials) Token

func (c *OCICredentials) Token(ctx context.Context) (string, error)

Token returns an access token if applicable

func (*OCICredentials) Type

func (c *OCICredentials) Type() auth.AuthType

Type returns the authentication type

type OCIHTTPClient

type OCIHTTPClient struct {
	// contains filtered or unexported fields
}

OCIHTTPClient creates an HTTP client with OCI authentication

func NewOCIHTTPClient

func NewOCIHTTPClient(credentials *OCICredentials) *OCIHTTPClient

NewOCIHTTPClient creates a new HTTP client with OCI auth

func (*OCIHTTPClient) Do

func (c *OCIHTTPClient) Do(req *http.Request) (*http.Response, error)

Do executes an HTTP request with OCI authentication

type UserPrincipalConfig

type UserPrincipalConfig struct {
	// ConfigPath is the path to the OCI configuration file
	ConfigPath string `mapstructure:"config_path" json:"config_path"`

	// Profile is the profile name within the configuration file
	Profile string `mapstructure:"profile" json:"profile"`

	// UseSessionToken enables session token authentication
	UseSessionToken bool `mapstructure:"use_session_token" json:"use_session_token"`
}

UserPrincipalConfig encapsulates configuration for user principal authentication. This method uses API key-based authentication with OCI configuration files.

func (*UserPrincipalConfig) ApplyEnvironment

func (c *UserPrincipalConfig) ApplyEnvironment()

ApplyEnvironment applies environment variables and defaults to the configuration

func (UserPrincipalConfig) Validate

func (c UserPrincipalConfig) Validate() error

Validate validates the user principal configuration

Jump to

Keyboard shortcuts

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