ibmcloud

package
v3.2.0 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2024 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewTrustedProfileCredentials

func NewTrustedProfileCredentials(authEndpoint, trustedProfileName,
	trustedProfileID, crTokenFilePath string) *credentials.Credentials

NewTrustedProfileCredentials a constructor for IBM IAM that uses IAM Trusted Profile credentials passed in

Types

type COSConfig

type COSConfig struct {
	ForcePathStyle     bool           `yaml:"forcepathstyle"`
	BucketNames        string         `yaml:"bucketnames"`
	Endpoint           string         `yaml:"endpoint"`
	Region             string         `yaml:"region"`
	AccessKeyID        string         `yaml:"access_key_id"`
	SecretAccessKey    flagext.Secret `yaml:"secret_access_key"`
	HTTPConfig         HTTPConfig     `yaml:"http_config"`
	BackoffConfig      backoff.Config `yaml:"backoff_config" doc:"description=Configures back off when cos get Object."`
	APIKey             flagext.Secret `yaml:"api_key"`
	ServiceInstanceID  string         `yaml:"service_instance_id"`
	AuthEndpoint       string         `yaml:"auth_endpoint"`
	CRTokenFilePath    string         `yaml:"cr_token_file_path"`
	TrustedProfileName string         `yaml:"trusted_profile_name"`
	TrustedProfileID   string         `yaml:"trusted_profile_id"`
}

COSConfig specifies config for storing chunks on IBM cos.

func (*COSConfig) RegisterFlags

func (cfg *COSConfig) RegisterFlags(f *flag.FlagSet)

RegisterFlags adds the flags required to config this to the given FlagSet

func (*COSConfig) RegisterFlagsWithPrefix

func (cfg *COSConfig) RegisterFlagsWithPrefix(prefix string, f *flag.FlagSet)

RegisterFlagsWithPrefix adds the flags required to config this to the given FlagSet with a specified prefix

type COSObjectClient

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

func NewCOSObjectClient

func NewCOSObjectClient(cfg COSConfig, hedgingCfg hedging.Config) (*COSObjectClient, error)

NewCOSObjectClient makes a new COS backed ObjectClient.

func (*COSObjectClient) DeleteObject

func (c *COSObjectClient) DeleteObject(ctx context.Context, objectKey string) error

DeleteObject deletes the specified objectKey from the appropriate S3 bucket

func (*COSObjectClient) GetObject

func (c *COSObjectClient) GetObject(ctx context.Context, objectKey string) (io.ReadCloser, int64, error)

GetObject returns a reader and the size for the specified object key from the configured S3 bucket.

func (*COSObjectClient) GetObjectRange added in v3.2.0

func (c *COSObjectClient) GetObjectRange(ctx context.Context, objectKey string, offset, length int64) (io.ReadCloser, error)

GetObject returns a reader and the size for the specified object key from the configured S3 bucket.

func (*COSObjectClient) IsObjectNotFoundErr

func (c *COSObjectClient) IsObjectNotFoundErr(err error) bool

IsObjectNotFoundErr returns true if error means that object is not found. Relevant to GetObject and DeleteObject operations.

func (*COSObjectClient) IsRetryableErr

func (c *COSObjectClient) IsRetryableErr(error) bool

TODO(dannyk): implement for client

func (*COSObjectClient) List

func (c *COSObjectClient) List(ctx context.Context, prefix, delimiter string) ([]client.StorageObject, []client.StorageCommonPrefix, error)

List implements chunk.ObjectClient.

func (*COSObjectClient) ObjectExists

func (c *COSObjectClient) ObjectExists(ctx context.Context, objectKey string) (bool, error)

func (*COSObjectClient) PutObject

func (c *COSObjectClient) PutObject(ctx context.Context, objectKey string, object io.Reader) error

PutObject into the store

func (*COSObjectClient) Stop

func (c *COSObjectClient) Stop()

Stop fulfills the chunk.ObjectClient interface

type HTTPConfig

type HTTPConfig struct {
	IdleConnTimeout       time.Duration `yaml:"idle_conn_timeout"`
	ResponseHeaderTimeout time.Duration `yaml:"response_header_timeout"`
}

HTTPConfig stores the http.Transport configuration

type InjectRequestMiddleware

type InjectRequestMiddleware func(next http.RoundTripper) http.RoundTripper

InjectRequestMiddleware gives users of this client the ability to make arbitrary changes to outgoing requests.

type TrustedProfileProvider

type TrustedProfileProvider struct {

	// Error
	ErrorStatus error
	// contains filtered or unexported fields
}

TrustedProfileProvider implements Provider interface from https://github.com/IBM/ibm-cos-sdk-go

func NewTrustedProfileProvider

func NewTrustedProfileProvider(providerName string, trustedProfileName,
	trustedProfileID, crTokenFilePath, authEndpoint string) *TrustedProfileProvider

NewTrustedProfileProvider creates custom IBM IAM Provider for Trusted Profile authentication

func (*TrustedProfileProvider) IsExpired

func (p *TrustedProfileProvider) IsExpired() bool

IsExpired should ideally check the token expiry but here we are skipping the expiry check since the token variable in authenticator is not an exported variable. The GetToken function in Retrieve method is checking whether the token is expired or not before making the call to the server.

func (*TrustedProfileProvider) IsValid

func (p *TrustedProfileProvider) IsValid() bool

IsValid validates the trusted profile provider

func (*TrustedProfileProvider) Retrieve

func (p *TrustedProfileProvider) Retrieve() (credentials.Value, error)

Retrieve returns the creadential values

Jump to

Keyboard shortcuts

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