awslib

package
v0.0.0-...-19bd712 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	DefaultRegion    = "us-east-1"
	DefaultGovRegion = "us-gov-east-1"
	GlobalRegion     = "global"
)

Variables

View Source
var ErrClientNotFound = errors.New("aws client not found")

Functions

func GetClient

func GetClient[T any](region *string, list map[string]T) (T, error)

func GetDefaultClient

func GetDefaultClient[T any](list map[string]T) (T, error)

func MultiRegionFetch

func MultiRegionFetch[T any, K any](ctx context.Context, set map[string]T, fetcher func(ctx context.Context, region string, client T) (K, error)) ([]K, error)

MultiRegionFetch retrieves resources from multiple regions concurrently using the provided fetcher function.

Types

type AccountProvider

type AccountProvider struct{}

func (AccountProvider) ListAccounts

func (a AccountProvider) ListAccounts(ctx context.Context, log *logp.Logger, cfg aws.Config) ([]cloud.Identity, error)

type AccountProviderAPI

type AccountProviderAPI interface {
	ListAccounts(ctx context.Context, log *logp.Logger, cfg aws.Config) ([]cloud.Identity, error)
}

type AwsResource

type AwsResource interface {
	GetResourceArn() string
	GetResourceName() string
	GetResourceType() string
	GetRegion() string
}

type ConfigProvider

type ConfigProvider struct {
	MetadataProvider MetadataProvider
}

func (ConfigProvider) InitializeAWSConfig

func (p ConfigProvider) InitializeAWSConfig(ctx context.Context, cfg aws.ConfigAWS) (*awssdk.Config, error)

type ConfigProviderAPI

type ConfigProviderAPI interface {
	InitializeAWSConfig(ctx context.Context, cfg aws.ConfigAWS) (*awssdk.Config, error)
}

type CrossRegionFactory

type CrossRegionFactory[T any] interface {
	NewMultiRegionClients(selector RegionsSelector, cfg aws.Config, factory func(cfg aws.Config) T, log *logp.Logger) CrossRegionFetcher[T]
}

type CrossRegionFetcher

type CrossRegionFetcher[T any] interface {
	GetMultiRegionsClientMap() map[string]T
}

type EKSClusterNameProvider

type EKSClusterNameProvider struct{}

func (EKSClusterNameProvider) GetClusterName

func (provider EKSClusterNameProvider) GetClusterName(ctx context.Context, cfg aws.Config, instanceId string) (string, error)

type EKSClusterNameProviderAPI

type EKSClusterNameProviderAPI interface {
	GetClusterName(ctx context.Context, cfg aws.Config, instanceId string) (string, error)
}

type Ec2MetadataProvider

type Ec2MetadataProvider struct{}

func (Ec2MetadataProvider) GetMetadata

func (provider Ec2MetadataProvider) GetMetadata(ctx context.Context, cfg aws.Config) (*Ec2Metadata, error)

type IdentityProvider

type IdentityProvider struct {
	Logger *logp.Logger
}

func (IdentityProvider) GetIdentity

func (p IdentityProvider) GetIdentity(ctx context.Context, cfg aws.Config) (*cloud.Identity, error)

GetIdentity returns AWS identity information

type IdentityProviderGetter

type IdentityProviderGetter interface {
	GetIdentity(ctx context.Context, cfg aws.Config) (*cloud.Identity, error)
}

type MetadataProvider

type MetadataProvider interface {
	GetMetadata(ctx context.Context, cfg aws.Config) (*Ec2Metadata, error)
}

type MockAccountProviderAPI

type MockAccountProviderAPI struct {
	mock.Mock
}

MockAccountProviderAPI is an autogenerated mock type for the AccountProviderAPI type

func NewMockAccountProviderAPI

func NewMockAccountProviderAPI(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockAccountProviderAPI

NewMockAccountProviderAPI creates a new instance of MockAccountProviderAPI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockAccountProviderAPI) EXPECT

func (*MockAccountProviderAPI) ListAccounts

func (_m *MockAccountProviderAPI) ListAccounts(ctx context.Context, log *logp.Logger, cfg aws.Config) ([]cloud.Identity, error)

ListAccounts provides a mock function with given fields: ctx, log, cfg

type MockAccountProviderAPI_Expecter

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

func (*MockAccountProviderAPI_Expecter) ListAccounts

func (_e *MockAccountProviderAPI_Expecter) ListAccounts(ctx interface{}, log interface{}, cfg interface{}) *MockAccountProviderAPI_ListAccounts_Call

ListAccounts is a helper method to define mock.On call

  • ctx context.Context
  • log *logp.Logger
  • cfg aws.Config

type MockAccountProviderAPI_ListAccounts_Call

type MockAccountProviderAPI_ListAccounts_Call struct {
	*mock.Call
}

MockAccountProviderAPI_ListAccounts_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'ListAccounts'

func (*MockAccountProviderAPI_ListAccounts_Call) Return

func (*MockAccountProviderAPI_ListAccounts_Call) Run

func (*MockAccountProviderAPI_ListAccounts_Call) RunAndReturn

type MockAwsResource

type MockAwsResource struct {
	mock.Mock
}

MockAwsResource is an autogenerated mock type for the AwsResource type

func NewMockAwsResource

func NewMockAwsResource(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockAwsResource

NewMockAwsResource creates a new instance of MockAwsResource. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockAwsResource) EXPECT

func (*MockAwsResource) GetRegion

func (_m *MockAwsResource) GetRegion() string

GetRegion provides a mock function with given fields:

func (*MockAwsResource) GetResourceArn

func (_m *MockAwsResource) GetResourceArn() string

GetResourceArn provides a mock function with given fields:

func (*MockAwsResource) GetResourceName

func (_m *MockAwsResource) GetResourceName() string

GetResourceName provides a mock function with given fields:

func (*MockAwsResource) GetResourceType

func (_m *MockAwsResource) GetResourceType() string

GetResourceType provides a mock function with given fields:

type MockAwsResource_Expecter

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

func (*MockAwsResource_Expecter) GetRegion

GetRegion is a helper method to define mock.On call

func (*MockAwsResource_Expecter) GetResourceArn

GetResourceArn is a helper method to define mock.On call

func (*MockAwsResource_Expecter) GetResourceName

GetResourceName is a helper method to define mock.On call

func (*MockAwsResource_Expecter) GetResourceType

GetResourceType is a helper method to define mock.On call

type MockAwsResource_GetRegion_Call

type MockAwsResource_GetRegion_Call struct {
	*mock.Call
}

MockAwsResource_GetRegion_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetRegion'

func (*MockAwsResource_GetRegion_Call) Return

func (*MockAwsResource_GetRegion_Call) Run

func (*MockAwsResource_GetRegion_Call) RunAndReturn

type MockAwsResource_GetResourceArn_Call

type MockAwsResource_GetResourceArn_Call struct {
	*mock.Call
}

MockAwsResource_GetResourceArn_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetResourceArn'

func (*MockAwsResource_GetResourceArn_Call) Return

func (*MockAwsResource_GetResourceArn_Call) Run

func (*MockAwsResource_GetResourceArn_Call) RunAndReturn

type MockAwsResource_GetResourceName_Call

type MockAwsResource_GetResourceName_Call struct {
	*mock.Call
}

MockAwsResource_GetResourceName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetResourceName'

func (*MockAwsResource_GetResourceName_Call) Return

func (*MockAwsResource_GetResourceName_Call) Run

func (*MockAwsResource_GetResourceName_Call) RunAndReturn

type MockAwsResource_GetResourceType_Call

type MockAwsResource_GetResourceType_Call struct {
	*mock.Call
}

MockAwsResource_GetResourceType_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetResourceType'

func (*MockAwsResource_GetResourceType_Call) Return

func (*MockAwsResource_GetResourceType_Call) Run

func (*MockAwsResource_GetResourceType_Call) RunAndReturn

type MockConfigProviderAPI

type MockConfigProviderAPI struct {
	mock.Mock
}

MockConfigProviderAPI is an autogenerated mock type for the ConfigProviderAPI type

func NewMockConfigProviderAPI

func NewMockConfigProviderAPI(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockConfigProviderAPI

NewMockConfigProviderAPI creates a new instance of MockConfigProviderAPI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockConfigProviderAPI) EXPECT

func (*MockConfigProviderAPI) InitializeAWSConfig

func (_m *MockConfigProviderAPI) InitializeAWSConfig(ctx context.Context, cfg aws.ConfigAWS) (*aws_sdk_go_v2aws.Config, error)

InitializeAWSConfig provides a mock function with given fields: ctx, cfg

type MockConfigProviderAPI_Expecter

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

func (*MockConfigProviderAPI_Expecter) InitializeAWSConfig

func (_e *MockConfigProviderAPI_Expecter) InitializeAWSConfig(ctx interface{}, cfg interface{}) *MockConfigProviderAPI_InitializeAWSConfig_Call

InitializeAWSConfig is a helper method to define mock.On call

  • ctx context.Context
  • cfg aws.ConfigAWS

type MockConfigProviderAPI_InitializeAWSConfig_Call

type MockConfigProviderAPI_InitializeAWSConfig_Call struct {
	*mock.Call
}

MockConfigProviderAPI_InitializeAWSConfig_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'InitializeAWSConfig'

func (*MockConfigProviderAPI_InitializeAWSConfig_Call) Return

func (*MockConfigProviderAPI_InitializeAWSConfig_Call) Run

func (*MockConfigProviderAPI_InitializeAWSConfig_Call) RunAndReturn

type MockCrossRegionFactory

type MockCrossRegionFactory[T interface{}] struct {
	mock.Mock
}

MockCrossRegionFactory is an autogenerated mock type for the CrossRegionFactory type

func NewMockCrossRegionFactory

func NewMockCrossRegionFactory[T interface{}](t interface {
	mock.TestingT
	Cleanup(func())
}) *MockCrossRegionFactory[T]

NewMockCrossRegionFactory creates a new instance of MockCrossRegionFactory. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockCrossRegionFactory[T]) EXPECT

func (*MockCrossRegionFactory[T]) NewMultiRegionClients

func (_m *MockCrossRegionFactory[T]) NewMultiRegionClients(selector RegionsSelector, cfg aws.Config, factory func(aws.Config) T, log *logp.Logger) CrossRegionFetcher[T]

NewMultiRegionClients provides a mock function with given fields: selector, cfg, factory, log

type MockCrossRegionFactory_Expecter

type MockCrossRegionFactory_Expecter[T interface{}] struct {
	// contains filtered or unexported fields
}

func (*MockCrossRegionFactory_Expecter[T]) NewMultiRegionClients

func (_e *MockCrossRegionFactory_Expecter[T]) NewMultiRegionClients(selector interface{}, cfg interface{}, factory interface{}, log interface{}) *MockCrossRegionFactory_NewMultiRegionClients_Call[T]

NewMultiRegionClients is a helper method to define mock.On call

  • selector RegionsSelector
  • cfg aws.Config
  • factory func(aws.Config) T
  • log *logp.Logger

type MockCrossRegionFactory_NewMultiRegionClients_Call

type MockCrossRegionFactory_NewMultiRegionClients_Call[T interface{}] struct {
	*mock.Call
}

MockCrossRegionFactory_NewMultiRegionClients_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'NewMultiRegionClients'

func (*MockCrossRegionFactory_NewMultiRegionClients_Call[T]) Return

func (*MockCrossRegionFactory_NewMultiRegionClients_Call[T]) Run

func (*MockCrossRegionFactory_NewMultiRegionClients_Call[T]) RunAndReturn

type MockCrossRegionFetcher

type MockCrossRegionFetcher[T interface{}] struct {
	mock.Mock
}

MockCrossRegionFetcher is an autogenerated mock type for the CrossRegionFetcher type

func NewMockCrossRegionFetcher

func NewMockCrossRegionFetcher[T interface{}](t interface {
	mock.TestingT
	Cleanup(func())
}) *MockCrossRegionFetcher[T]

NewMockCrossRegionFetcher creates a new instance of MockCrossRegionFetcher. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockCrossRegionFetcher[T]) EXPECT

func (*MockCrossRegionFetcher[T]) GetMultiRegionsClientMap

func (_m *MockCrossRegionFetcher[T]) GetMultiRegionsClientMap() map[string]T

GetMultiRegionsClientMap provides a mock function with given fields:

type MockCrossRegionFetcher_Expecter

type MockCrossRegionFetcher_Expecter[T interface{}] struct {
	// contains filtered or unexported fields
}

func (*MockCrossRegionFetcher_Expecter[T]) GetMultiRegionsClientMap

GetMultiRegionsClientMap is a helper method to define mock.On call

type MockCrossRegionFetcher_GetMultiRegionsClientMap_Call

type MockCrossRegionFetcher_GetMultiRegionsClientMap_Call[T interface{}] struct {
	*mock.Call
}

MockCrossRegionFetcher_GetMultiRegionsClientMap_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMultiRegionsClientMap'

func (*MockCrossRegionFetcher_GetMultiRegionsClientMap_Call[T]) Return

func (*MockCrossRegionFetcher_GetMultiRegionsClientMap_Call[T]) Run

func (*MockCrossRegionFetcher_GetMultiRegionsClientMap_Call[T]) RunAndReturn

type MockEKSClusterNameProviderAPI

type MockEKSClusterNameProviderAPI struct {
	mock.Mock
}

MockEKSClusterNameProviderAPI is an autogenerated mock type for the EKSClusterNameProviderAPI type

func NewMockEKSClusterNameProviderAPI

func NewMockEKSClusterNameProviderAPI(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockEKSClusterNameProviderAPI

NewMockEKSClusterNameProviderAPI creates a new instance of MockEKSClusterNameProviderAPI. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockEKSClusterNameProviderAPI) EXPECT

func (*MockEKSClusterNameProviderAPI) GetClusterName

func (_m *MockEKSClusterNameProviderAPI) GetClusterName(ctx context.Context, cfg aws.Config, instanceId string) (string, error)

GetClusterName provides a mock function with given fields: ctx, cfg, instanceId

type MockEKSClusterNameProviderAPI_Expecter

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

func (*MockEKSClusterNameProviderAPI_Expecter) GetClusterName

func (_e *MockEKSClusterNameProviderAPI_Expecter) GetClusterName(ctx interface{}, cfg interface{}, instanceId interface{}) *MockEKSClusterNameProviderAPI_GetClusterName_Call

GetClusterName is a helper method to define mock.On call

  • ctx context.Context
  • cfg aws.Config
  • instanceId string

type MockEKSClusterNameProviderAPI_GetClusterName_Call

type MockEKSClusterNameProviderAPI_GetClusterName_Call struct {
	*mock.Call
}

MockEKSClusterNameProviderAPI_GetClusterName_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetClusterName'

func (*MockEKSClusterNameProviderAPI_GetClusterName_Call) Return

func (*MockEKSClusterNameProviderAPI_GetClusterName_Call) Run

func (*MockEKSClusterNameProviderAPI_GetClusterName_Call) RunAndReturn

type MockIdentityProviderGetter

type MockIdentityProviderGetter struct {
	mock.Mock
}

MockIdentityProviderGetter is an autogenerated mock type for the IdentityProviderGetter type

func NewMockIdentityProviderGetter

func NewMockIdentityProviderGetter(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockIdentityProviderGetter

NewMockIdentityProviderGetter creates a new instance of MockIdentityProviderGetter. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockIdentityProviderGetter) EXPECT

func (*MockIdentityProviderGetter) GetIdentity

func (_m *MockIdentityProviderGetter) GetIdentity(ctx context.Context, cfg aws.Config) (*cloud.Identity, error)

GetIdentity provides a mock function with given fields: ctx, cfg

type MockIdentityProviderGetter_Expecter

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

func (*MockIdentityProviderGetter_Expecter) GetIdentity

func (_e *MockIdentityProviderGetter_Expecter) GetIdentity(ctx interface{}, cfg interface{}) *MockIdentityProviderGetter_GetIdentity_Call

GetIdentity is a helper method to define mock.On call

  • ctx context.Context
  • cfg aws.Config

type MockIdentityProviderGetter_GetIdentity_Call

type MockIdentityProviderGetter_GetIdentity_Call struct {
	*mock.Call
}

MockIdentityProviderGetter_GetIdentity_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetIdentity'

func (*MockIdentityProviderGetter_GetIdentity_Call) Return

func (*MockIdentityProviderGetter_GetIdentity_Call) Run

func (*MockIdentityProviderGetter_GetIdentity_Call) RunAndReturn

type MockMetadataProvider

type MockMetadataProvider struct {
	mock.Mock
}

MockMetadataProvider is an autogenerated mock type for the MetadataProvider type

func NewMockMetadataProvider

func NewMockMetadataProvider(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockMetadataProvider

NewMockMetadataProvider creates a new instance of MockMetadataProvider. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockMetadataProvider) EXPECT

func (*MockMetadataProvider) GetMetadata

GetMetadata provides a mock function with given fields: ctx, cfg

type MockMetadataProvider_Expecter

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

func (*MockMetadataProvider_Expecter) GetMetadata

func (_e *MockMetadataProvider_Expecter) GetMetadata(ctx interface{}, cfg interface{}) *MockMetadataProvider_GetMetadata_Call

GetMetadata is a helper method to define mock.On call

  • ctx context.Context
  • cfg aws.Config

type MockMetadataProvider_GetMetadata_Call

type MockMetadataProvider_GetMetadata_Call struct {
	*mock.Call
}

MockMetadataProvider_GetMetadata_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'GetMetadata'

func (*MockMetadataProvider_GetMetadata_Call) Return

func (*MockMetadataProvider_GetMetadata_Call) Run

func (*MockMetadataProvider_GetMetadata_Call) RunAndReturn

type MockRegionsSelector

type MockRegionsSelector struct {
	mock.Mock
}

MockRegionsSelector is an autogenerated mock type for the RegionsSelector type

func NewMockRegionsSelector

func NewMockRegionsSelector(t interface {
	mock.TestingT
	Cleanup(func())
}) *MockRegionsSelector

NewMockRegionsSelector creates a new instance of MockRegionsSelector. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations. The first argument is typically a *testing.T value.

func (*MockRegionsSelector) EXPECT

func (*MockRegionsSelector) Regions

func (_m *MockRegionsSelector) Regions(ctx context.Context, cfg aws.Config) ([]string, error)

Regions provides a mock function with given fields: ctx, cfg

type MockRegionsSelector_Expecter

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

func (*MockRegionsSelector_Expecter) Regions

func (_e *MockRegionsSelector_Expecter) Regions(ctx interface{}, cfg interface{}) *MockRegionsSelector_Regions_Call

Regions is a helper method to define mock.On call

  • ctx context.Context
  • cfg aws.Config

type MockRegionsSelector_Regions_Call

type MockRegionsSelector_Regions_Call struct {
	*mock.Call
}

MockRegionsSelector_Regions_Call is a *mock.Call that shadows Run/Return methods with type explicit version for method 'Regions'

func (*MockRegionsSelector_Regions_Call) Return

func (*MockRegionsSelector_Regions_Call) Run

func (*MockRegionsSelector_Regions_Call) RunAndReturn

type MultiRegionClientFactory

type MultiRegionClientFactory[T any] struct{}

func (*MultiRegionClientFactory[T]) NewMultiRegionClients

func (w *MultiRegionClientFactory[T]) NewMultiRegionClients(selector RegionsSelector, cfg aws.Config, factory func(cfg aws.Config) T, log *logp.Logger) CrossRegionFetcher[T]

NewMultiRegionClients is a utility function that is used to create a map of client instances of a given type T for multiple regions.

type RegionsSelector

type RegionsSelector interface {
	Regions(ctx context.Context, cfg aws.Config) ([]string, error)
}

func AllRegionSelector

func AllRegionSelector() RegionsSelector

func CurrentRegionSelector

func CurrentRegionSelector() RegionsSelector

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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