cdp

package
v0.5.10 Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 32 Imported by: 0

Documentation

Index

Constants

View Source
const (
	RegionUsWest1 = "us-west-1"
	RegionEu1     = "eu-1"
	RegionAp1     = "ap-1"
	RegionUsg1    = "usg-1"
)

exported 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"
)
View Source
const (

	// CdpProfileEnvVar is the environment variable to configure the CDP profile
	// Python client uses both CDP_PROFILE and CDP_DEFAULT_PROFILE
	// versus Java SDK uses CDP_DEFAULT_PROFILE
	CdpProfileEnvVar = "CDP_PROFILE"
)

Variables

This section is empty.

Functions

func IsDatabaseError added in v0.5.7

func IsDatabaseError(err *opdbmodels.Error, code string, message string) bool

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)

func NewOpdbClient added in v0.5.7

func NewOpdbClient(config *Config) (*opdbclient.Opdb, 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
	Opdb         *opdbclient.Opdb
	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 ClientTransport

type ClientTransport struct {
	Runtime *client.Runtime
}

func (*ClientTransport) Submit

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

type Config

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

func NewConfig

func NewConfig() *Config

func (*Config) GetAltusApiEndpoint

func (config *Config) GetAltusApiEndpoint() (string, error)

func (*Config) GetBaseApiPath

func (config *Config) GetBaseApiPath() string

func (*Config) GetCdpApiEndpoint

func (config *Config) GetCdpApiEndpoint() (string, error)

func (*Config) GetCdpConfigFile

func (config *Config) GetCdpConfigFile() (string, error)

func (*Config) GetCdpCredentialsFile

func (config *Config) GetCdpCredentialsFile() (string, error)

func (*Config) GetCdpProfile

func (config *Config) GetCdpProfile() (string, error)

func (*Config) GetCdpRegion

func (config *Config) GetCdpRegion() (string, error)

func (*Config) GetCredentials

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

func (*Config) GetEndpoint

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

func (*Config) GetLocalEnvironment

func (config *Config) GetLocalEnvironment() bool

func (*Config) GetUserAgentOrDefault

func (config *Config) GetUserAgentOrDefault() string

func (*Config) String

func (config *Config) String() string

func (*Config) WithAltusApiEndpointUrl

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

func (*Config) WithBaseApiPath

func (config *Config) WithBaseApiPath(baseApiPath string) *Config

func (*Config) WithCdpApiEndpointUrl

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

func (*Config) WithCdpRegion

func (config *Config) WithCdpRegion(cdpRegion string) *Config

func (*Config) WithClientApplicationName

func (config *Config) WithClientApplicationName(clientApplicationName 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

func (*Config) WithUserAgent

func (config *Config) WithUserAgent(userAgent string) *Config

func (*Config) WithVersion

func (config *Config) WithVersion(version 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 DelegatingRoundTripper

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

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 {
	DelegatingRoundTripper
	// contains filtered or unexported fields
}

func (*LoggingRoundTripper) RoundTrip

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

type RequestHeadersRoundTripper

type RequestHeadersRoundTripper struct {
	DelegatingRoundTripper
	// contains filtered or unexported fields
}

RequestHeadersRoundTripper sets the User-Agent and other custom headers see https://github.com/go-swagger/go-swagger/blob/701e7f3ee85df9d47fcf639dd7a279f7ab6d94d7/docs/faq/faq_client.md?plain=1#L28

func (*RequestHeadersRoundTripper) AddHeader

func (r *RequestHeadersRoundTripper) AddHeader(key, value string)

func (*RequestHeadersRoundTripper) RoundTrip

func (r *RequestHeadersRoundTripper) 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)

Jump to

Keyboard shortcuts

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