cdp

package
v0.1.0-rc1 Latest Latest
Warning

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

Go to latest
Published: Jun 9, 2023 License: Apache-2.0 Imports: 29 Imported by: 0

Documentation

Index

Constants

View Source
const (

	// CdpAccessKeyIdEnvVar Name of environment variable holding the users CDP access key ID.
	CdpAccessKeyIdEnvVar = "CDP_ACCESS_KEY_ID"

	// CdpPrivateKeyEnvVar Name of environment variable holding the users CDP private key.
	CdpPrivateKeyEnvVar = "CDP_PRIVATE_KEY"
)

Variables

This section is empty.

Functions

func IsDatahubError

func IsDatahubError(err *datahubmodels.Error, code string, message string) bool

func IsDatalakeError

func IsDatalakeError(err *datalakemodels.Error, code string, message string) bool

func IsEnvironmentsError

func IsEnvironmentsError(err *environmentsmodels.Error, code string, message string) bool

func IsIamError

func IsIamError(err *iammodels.Error, code string, message string) bool

func IsMlError

func IsMlError(err *mlmodels.Error, code string, message string) bool

func NewDatahubClient

func NewDatahubClient(config *Config) (*datahubclient.Datahub, error)

func NewDatalakeClient

func NewDatalakeClient(config *Config) (*datalakeclient.Datalake, error)

func NewDwClient

func NewDwClient(config *Config) (*dwclient.Dw, error)

func NewEnvironmentsClient

func NewEnvironmentsClient(config *Config) (*environmentsclient.Environments, error)

func NewIamClient

func NewIamClient(config *Config) (*iamclient.Iam, error)

func NewMlClient

func NewMlClient(config *Config) (*mlclient.Ml, error)

Types

type ChainCredentialsProvider

type ChainCredentialsProvider struct {
	ProviderChain []CredentialsProvider
}

ChainCredentialsProvider returns CDP credentials by using a chain of credential providers in order.

func (*ChainCredentialsProvider) GetCredentials

func (p *ChainCredentialsProvider) GetCredentials() (*Credentials, error)

type Client

type Client struct {
	Environments *environmentsclient.Environments
	Datalake     *datalakeclient.Datalake
	Datahub      *datahubclient.Datahub
	Iam          *iamclient.Iam
	Ml           *mlclient.Ml
	Dw           *dwclient.Dw
	// contains filtered or unexported fields
}

func NewClient

func NewClient(config *Config) (*Client, error)

type Config

type Config struct {
	CdpApiEndpointUrl   string
	AltusApiEndpointUrl string
	Profile             string
	Credentials         *Credentials
	BaseApiPath         string
	ConfigFile          string
	CredentialsFile     string
	LocalEnvironment    bool
	Logger              Logger
	Context             context.Context
	// contains filtered or unexported fields
}

func NewConfig

func NewConfig() *Config

func (*Config) GetAltusApiEndpoint

func (config *Config) GetAltusApiEndpoint() string

func (*Config) GetCdpApiEndpoint

func (config *Config) GetCdpApiEndpoint() string

func (*Config) GetCdpConfigFile

func (config *Config) GetCdpConfigFile() string

func (*Config) GetCdpCredentialsFile

func (config *Config) GetCdpCredentialsFile() string

func (*Config) GetCdpProfile

func (config *Config) GetCdpProfile() string

func (*Config) GetCredentials

func (config *Config) GetCredentials() (*Credentials, error)

func (*Config) GetEndpoint

func (config *Config) GetEndpoint(serviceName string, isAltusService bool) string

func (*Config) GetLocalEnvironment

func (config *Config) GetLocalEnvironment() bool

func (*Config) String

func (config *Config) String() string

func (*Config) WithAltusApiEndpointUrl

func (config *Config) WithAltusApiEndpointUrl(altusApiEndpointUrl string) *Config

func (*Config) WithCdpApiEndpointUrl

func (config *Config) WithCdpApiEndpointUrl(cdpApiEndpointUrl string) *Config

func (*Config) WithConfigFile

func (config *Config) WithConfigFile(configFile string) *Config

func (*Config) WithContext

func (config *Config) WithContext(ctx context.Context) *Config

func (*Config) WithCredentials

func (config *Config) WithCredentials(credentials *Credentials) *Config

func (*Config) WithCredentialsFile

func (config *Config) WithCredentialsFile(credentialsFile string) *Config

func (*Config) WithLocalEnvironment

func (config *Config) WithLocalEnvironment(localEnvironment bool) *Config

func (*Config) WithLogger

func (config *Config) WithLogger(logger Logger) *Config

func (*Config) WithProfile

func (config *Config) WithProfile(profile string) *Config

type Credentials

type Credentials struct {
	AccessKeyId string
	PrivateKey  string
}

func (*Credentials) String

func (credentials *Credentials) String() string

type CredentialsProvider

type CredentialsProvider interface {
	GetCredentials() (*Credentials, error)
}

type DefaultLogger

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

func NewDefaultLogger

func NewDefaultLogger() *DefaultLogger

func (*DefaultLogger) Debugf

func (l *DefaultLogger) Debugf(_ context.Context, format string, args ...any)

func (*DefaultLogger) Errorf

func (l *DefaultLogger) Errorf(_ context.Context, format string, args ...any)

func (*DefaultLogger) Infof

func (l *DefaultLogger) Infof(_ context.Context, format string, args ...any)

func (*DefaultLogger) Warnf

func (l *DefaultLogger) Warnf(_ context.Context, format string, args ...any)

type EnvCredentialsProvider

type EnvCredentialsProvider struct {
}

EnvCredentialsProvider provides credentials from environment variables CDP_ACCESS_KEY_ID and CDP_PRIVATE_KEY

func (*EnvCredentialsProvider) GetCredentials

func (*EnvCredentialsProvider) GetCredentials() (*Credentials, error)

type FileCredentialsProvider

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

FileCredentialsProvider provides credentials by reading the profile and credentials from shared configuration and credentials files. By default, it uses ~/.cdp/config and ~/.cdp/credentials. These files are shared between CDP CLI and all CDP SDKs.

func NewFileCredentialsProvider

func NewFileCredentialsProvider(path string, profile string) *FileCredentialsProvider

func (*FileCredentialsProvider) GetCredentials

func (p *FileCredentialsProvider) GetCredentials() (*Credentials, error)

type Logger

type Logger interface {
	Errorf(ctx context.Context, format string, args ...any)
	Warnf(ctx context.Context, format string, args ...any)
	Infof(ctx context.Context, format string, args ...any)
	Debugf(ctx context.Context, format string, args ...any)
}

Logger is a simple interface so that SDK users can write their own logging adaptors

type LoggingRoundTripper

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

func (*LoggingRoundTripper) RoundTrip

func (t *LoggingRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

type StaticCredentialsProvider

type StaticCredentialsProvider struct {
	Credentials *Credentials
}

StaticCredentialsProvider provides credentials from pre-configured static Credentials

func (*StaticCredentialsProvider) GetCredentials

func (p *StaticCredentialsProvider) GetCredentials() (*Credentials, error)

type Transport

type Transport struct {
	Runtime *client.Runtime
}

func GetAPIKeyAuthTransport

func GetAPIKeyAuthTransport(ctx context.Context, logger Logger, credentials *Credentials, endpoint string, baseApiPath string, insecureSkipVerify bool) (*Transport, error)

func (*Transport) Submit

func (t *Transport) Submit(operation *runtime.ClientOperation) (interface{}, error)

Jump to

Keyboard shortcuts

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