ibmcloud

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jun 14, 2023 License: AGPL-3.0 Imports: 28 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) 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) List

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

List implements chunk.ObjectClient.

func (*COSObjectClient) PutObject

func (c *COSObjectClient) PutObject(ctx context.Context, objectKey string, object io.ReadSeeker) 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