metadata

package
v1.30.0 Latest Latest
Warning

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

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

Documentation

Overview

Package metadata is a generated GoMock package.

Index

Constants

View Source
const (
	// OutpostArnEndpoint is the ec2 instance metadata endpoint to query to get the outpost arn
	OutpostArnEndpoint string = "outpost-arn"

	// enisEndpoint is the ec2 instance metadata endpoint to query the number of attached ENIs
	EnisEndpoint string = "network/interfaces/macs"

	// blockDevicesEndpoint is the ec2 instance metadata endpoint to query the number of attached block devices
	BlockDevicesEndpoint string = "block-device-mapping"
)

Variables

View Source
var DefaultEC2MetadataClient = func() (EC2Metadata, error) {
	cfg, err := config.LoadDefaultConfig(context.Background())
	if err != nil {
		return nil, err
	}
	svc := imds.NewFromConfig(cfg)
	return svc, nil
}
View Source
var DefaultKubernetesAPIClient = func() (kubernetes.Interface, error) {

	config, err := rest.InClusterConfig()
	if err != nil {
		return nil, err
	}

	clientset, err := kubernetes.NewForConfig(config)
	if err != nil {
		return nil, err
	}
	return clientset, nil
}

Functions

This section is empty.

Types

type EC2Metadata

type EC2Metadata interface {
	GetDynamicData(ctx context.Context, params *imds.GetDynamicDataInput, optFns ...func(*imds.Options)) (*imds.GetDynamicDataOutput, error)
	GetIAMInfo(ctx context.Context, params *imds.GetIAMInfoInput, optFns ...func(*imds.Options)) (*imds.GetIAMInfoOutput, error)
	GetInstanceIdentityDocument(ctx context.Context, params *imds.GetInstanceIdentityDocumentInput, optFns ...func(*imds.Options)) (*imds.GetInstanceIdentityDocumentOutput, error)
	GetMetadata(ctx context.Context, params *imds.GetMetadataInput, optFns ...func(*imds.Options)) (*imds.GetMetadataOutput, error)
	GetRegion(ctx context.Context, params *imds.GetRegionInput, optFns ...func(*imds.Options)) (*imds.GetRegionOutput, error)
	GetUserData(ctx context.Context, params *imds.GetUserDataInput, optFns ...func(*imds.Options)) (*imds.GetUserDataOutput, error)
}

type EC2MetadataClient

type EC2MetadataClient func() (EC2Metadata, error)

type KubernetesAPIClient

type KubernetesAPIClient func() (kubernetes.Interface, error)

type Metadata

type Metadata struct {
	InstanceID             string
	InstanceType           string
	Region                 string
	AvailabilityZone       string
	NumAttachedENIs        int
	NumBlockDeviceMappings int
	OutpostArn             arn.ARN
}

Metadata is info about the ec2 instance on which the driver is running

func EC2MetadataInstanceInfo

func EC2MetadataInstanceInfo(svc EC2Metadata, regionFromSession string) (*Metadata, error)

func KubernetesAPIInstanceInfo

func KubernetesAPIInstanceInfo(clientset kubernetes.Interface) (*Metadata, error)

func (*Metadata) GetAvailabilityZone

func (m *Metadata) GetAvailabilityZone() string

GetAvailabilityZone returns the Availability Zone which the instance is in.

func (*Metadata) GetInstanceID

func (m *Metadata) GetInstanceID() string

GetInstanceID returns the instance identification.

func (*Metadata) GetInstanceType

func (m *Metadata) GetInstanceType() string

GetInstanceType returns the instance type.

func (*Metadata) GetNumAttachedENIs

func (m *Metadata) GetNumAttachedENIs() int

GetNumAttachedENIs returns the number of attached ENIs.

func (*Metadata) GetNumBlockDeviceMappings

func (m *Metadata) GetNumBlockDeviceMappings() int

GetNumBlockDeviceMappings returns the number of block device mappings.

func (*Metadata) GetOutpostArn

func (m *Metadata) GetOutpostArn() arn.ARN

GetOutpostArn returns outpost arn if instance is running on an outpost. empty otherwise.

func (*Metadata) GetRegion

func (m *Metadata) GetRegion() string

GetRegion returns the region which the instance is in.

type MetadataService

type MetadataService interface {
	GetInstanceID() string
	GetInstanceType() string
	GetRegion() string
	GetAvailabilityZone() string
	GetNumAttachedENIs() int
	GetNumBlockDeviceMappings() int
	GetOutpostArn() arn.ARN
}

MetadataService represents AWS metadata service.

func NewMetadataService

func NewMetadataService(cfg MetadataServiceConfig, region string) (MetadataService, error)

type MetadataServiceConfig

type MetadataServiceConfig struct {
	EC2MetadataClient EC2MetadataClient
	K8sAPIClient      KubernetesAPIClient
}

type MockEC2Metadata

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

MockEC2Metadata is a mock of EC2Metadata interface.

func NewMockEC2Metadata

func NewMockEC2Metadata(ctrl *gomock.Controller) *MockEC2Metadata

NewMockEC2Metadata creates a new mock instance.

func (*MockEC2Metadata) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockEC2Metadata) GetDynamicData

func (m *MockEC2Metadata) GetDynamicData(ctx context.Context, params *imds.GetDynamicDataInput, optFns ...func(*imds.Options)) (*imds.GetDynamicDataOutput, error)

GetDynamicData mocks base method.

func (*MockEC2Metadata) GetIAMInfo

func (m *MockEC2Metadata) GetIAMInfo(ctx context.Context, params *imds.GetIAMInfoInput, optFns ...func(*imds.Options)) (*imds.GetIAMInfoOutput, error)

GetIAMInfo mocks base method.

func (*MockEC2Metadata) GetInstanceIdentityDocument

func (m *MockEC2Metadata) GetInstanceIdentityDocument(ctx context.Context, params *imds.GetInstanceIdentityDocumentInput, optFns ...func(*imds.Options)) (*imds.GetInstanceIdentityDocumentOutput, error)

GetInstanceIdentityDocument mocks base method.

func (*MockEC2Metadata) GetMetadata

func (m *MockEC2Metadata) GetMetadata(ctx context.Context, params *imds.GetMetadataInput, optFns ...func(*imds.Options)) (*imds.GetMetadataOutput, error)

GetMetadata mocks base method.

func (*MockEC2Metadata) GetRegion

func (m *MockEC2Metadata) GetRegion(ctx context.Context, params *imds.GetRegionInput, optFns ...func(*imds.Options)) (*imds.GetRegionOutput, error)

GetRegion mocks base method.

func (*MockEC2Metadata) GetUserData

func (m *MockEC2Metadata) GetUserData(ctx context.Context, params *imds.GetUserDataInput, optFns ...func(*imds.Options)) (*imds.GetUserDataOutput, error)

GetUserData mocks base method.

type MockEC2MetadataMockRecorder

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

MockEC2MetadataMockRecorder is the mock recorder for MockEC2Metadata.

func (*MockEC2MetadataMockRecorder) GetDynamicData

func (mr *MockEC2MetadataMockRecorder) GetDynamicData(ctx, params interface{}, optFns ...interface{}) *gomock.Call

GetDynamicData indicates an expected call of GetDynamicData.

func (*MockEC2MetadataMockRecorder) GetIAMInfo

func (mr *MockEC2MetadataMockRecorder) GetIAMInfo(ctx, params interface{}, optFns ...interface{}) *gomock.Call

GetIAMInfo indicates an expected call of GetIAMInfo.

func (*MockEC2MetadataMockRecorder) GetInstanceIdentityDocument

func (mr *MockEC2MetadataMockRecorder) GetInstanceIdentityDocument(ctx, params interface{}, optFns ...interface{}) *gomock.Call

GetInstanceIdentityDocument indicates an expected call of GetInstanceIdentityDocument.

func (*MockEC2MetadataMockRecorder) GetMetadata

func (mr *MockEC2MetadataMockRecorder) GetMetadata(ctx, params interface{}, optFns ...interface{}) *gomock.Call

GetMetadata indicates an expected call of GetMetadata.

func (*MockEC2MetadataMockRecorder) GetRegion

func (mr *MockEC2MetadataMockRecorder) GetRegion(ctx, params interface{}, optFns ...interface{}) *gomock.Call

GetRegion indicates an expected call of GetRegion.

func (*MockEC2MetadataMockRecorder) GetUserData

func (mr *MockEC2MetadataMockRecorder) GetUserData(ctx, params interface{}, optFns ...interface{}) *gomock.Call

GetUserData indicates an expected call of GetUserData.

type MockMetadataService

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

MockMetadataService is a mock of MetadataService interface.

func NewMockMetadataService

func NewMockMetadataService(ctrl *gomock.Controller) *MockMetadataService

NewMockMetadataService creates a new mock instance.

func (*MockMetadataService) EXPECT

EXPECT returns an object that allows the caller to indicate expected use.

func (*MockMetadataService) GetAvailabilityZone

func (m *MockMetadataService) GetAvailabilityZone() string

GetAvailabilityZone mocks base method.

func (*MockMetadataService) GetInstanceID

func (m *MockMetadataService) GetInstanceID() string

GetInstanceID mocks base method.

func (*MockMetadataService) GetInstanceType

func (m *MockMetadataService) GetInstanceType() string

GetInstanceType mocks base method.

func (*MockMetadataService) GetNumAttachedENIs

func (m *MockMetadataService) GetNumAttachedENIs() int

GetNumAttachedENIs mocks base method.

func (*MockMetadataService) GetNumBlockDeviceMappings

func (m *MockMetadataService) GetNumBlockDeviceMappings() int

GetNumBlockDeviceMappings mocks base method.

func (*MockMetadataService) GetOutpostArn

func (m *MockMetadataService) GetOutpostArn() arn.ARN

GetOutpostArn mocks base method.

func (*MockMetadataService) GetRegion

func (m *MockMetadataService) GetRegion() string

GetRegion mocks base method.

type MockMetadataServiceMockRecorder

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

MockMetadataServiceMockRecorder is the mock recorder for MockMetadataService.

func (*MockMetadataServiceMockRecorder) GetAvailabilityZone

func (mr *MockMetadataServiceMockRecorder) GetAvailabilityZone() *gomock.Call

GetAvailabilityZone indicates an expected call of GetAvailabilityZone.

func (*MockMetadataServiceMockRecorder) GetInstanceID

func (mr *MockMetadataServiceMockRecorder) GetInstanceID() *gomock.Call

GetInstanceID indicates an expected call of GetInstanceID.

func (*MockMetadataServiceMockRecorder) GetInstanceType

func (mr *MockMetadataServiceMockRecorder) GetInstanceType() *gomock.Call

GetInstanceType indicates an expected call of GetInstanceType.

func (*MockMetadataServiceMockRecorder) GetNumAttachedENIs

func (mr *MockMetadataServiceMockRecorder) GetNumAttachedENIs() *gomock.Call

GetNumAttachedENIs indicates an expected call of GetNumAttachedENIs.

func (*MockMetadataServiceMockRecorder) GetNumBlockDeviceMappings

func (mr *MockMetadataServiceMockRecorder) GetNumBlockDeviceMappings() *gomock.Call

GetNumBlockDeviceMappings indicates an expected call of GetNumBlockDeviceMappings.

func (*MockMetadataServiceMockRecorder) GetOutpostArn

func (mr *MockMetadataServiceMockRecorder) GetOutpostArn() *gomock.Call

GetOutpostArn indicates an expected call of GetOutpostArn.

func (*MockMetadataServiceMockRecorder) GetRegion

func (mr *MockMetadataServiceMockRecorder) GetRegion() *gomock.Call

GetRegion indicates an expected call of GetRegion.

Jump to

Keyboard shortcuts

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