Documentation ¶
Overview ¶
Package metadata is a generated GoMock package.
Index ¶
- Constants
- Variables
- type EC2Metadata
- type EC2MetadataClient
- type KubernetesAPIClient
- type Metadata
- func (m *Metadata) GetAvailabilityZone() string
- func (m *Metadata) GetInstanceID() string
- func (m *Metadata) GetInstanceType() string
- func (m *Metadata) GetNumAttachedENIs() int
- func (m *Metadata) GetNumBlockDeviceMappings() int
- func (m *Metadata) GetOutpostArn() arn.ARN
- func (m *Metadata) GetRegion() string
- type MetadataService
- type MetadataServiceConfig
- type MockEC2Metadata
- func (m *MockEC2Metadata) EXPECT() *MockEC2MetadataMockRecorder
- func (m *MockEC2Metadata) GetDynamicData(ctx context.Context, params *imds.GetDynamicDataInput, ...) (*imds.GetDynamicDataOutput, error)
- func (m *MockEC2Metadata) GetIAMInfo(ctx context.Context, params *imds.GetIAMInfoInput, ...) (*imds.GetIAMInfoOutput, error)
- func (m *MockEC2Metadata) GetInstanceIdentityDocument(ctx context.Context, params *imds.GetInstanceIdentityDocumentInput, ...) (*imds.GetInstanceIdentityDocumentOutput, error)
- func (m *MockEC2Metadata) GetMetadata(ctx context.Context, params *imds.GetMetadataInput, ...) (*imds.GetMetadataOutput, error)
- func (m *MockEC2Metadata) GetRegion(ctx context.Context, params *imds.GetRegionInput, ...) (*imds.GetRegionOutput, error)
- func (m *MockEC2Metadata) GetUserData(ctx context.Context, params *imds.GetUserDataInput, ...) (*imds.GetUserDataOutput, error)
- type MockEC2MetadataMockRecorder
- func (mr *MockEC2MetadataMockRecorder) GetDynamicData(ctx, params interface{}, optFns ...interface{}) *gomock.Call
- func (mr *MockEC2MetadataMockRecorder) GetIAMInfo(ctx, params interface{}, optFns ...interface{}) *gomock.Call
- func (mr *MockEC2MetadataMockRecorder) GetInstanceIdentityDocument(ctx, params interface{}, optFns ...interface{}) *gomock.Call
- func (mr *MockEC2MetadataMockRecorder) GetMetadata(ctx, params interface{}, optFns ...interface{}) *gomock.Call
- func (mr *MockEC2MetadataMockRecorder) GetRegion(ctx, params interface{}, optFns ...interface{}) *gomock.Call
- func (mr *MockEC2MetadataMockRecorder) GetUserData(ctx, params interface{}, optFns ...interface{}) *gomock.Call
- type MockMetadataService
- func (m *MockMetadataService) EXPECT() *MockMetadataServiceMockRecorder
- func (m *MockMetadataService) GetAvailabilityZone() string
- func (m *MockMetadataService) GetInstanceID() string
- func (m *MockMetadataService) GetInstanceType() string
- func (m *MockMetadataService) GetNumAttachedENIs() int
- func (m *MockMetadataService) GetNumBlockDeviceMappings() int
- func (m *MockMetadataService) GetOutpostArn() arn.ARN
- func (m *MockMetadataService) GetRegion() string
- type MockMetadataServiceMockRecorder
- func (mr *MockMetadataServiceMockRecorder) GetAvailabilityZone() *gomock.Call
- func (mr *MockMetadataServiceMockRecorder) GetInstanceID() *gomock.Call
- func (mr *MockMetadataServiceMockRecorder) GetInstanceType() *gomock.Call
- func (mr *MockMetadataServiceMockRecorder) GetNumAttachedENIs() *gomock.Call
- func (mr *MockMetadataServiceMockRecorder) GetNumBlockDeviceMappings() *gomock.Call
- func (mr *MockMetadataServiceMockRecorder) GetOutpostArn() *gomock.Call
- func (mr *MockMetadataServiceMockRecorder) GetRegion() *gomock.Call
Constants ¶
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 ¶
var DefaultEC2MetadataClient = func() (EC2Metadata, error) { cfg, err := config.LoadDefaultConfig(context.Background()) if err != nil { return nil, err } svc := imds.NewFromConfig(cfg) return svc, 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)
func DefaultKubernetesAPIClient ¶
func DefaultKubernetesAPIClient(kubeconfig string) KubernetesAPIClient
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 ¶
GetAvailabilityZone returns the Availability Zone which the instance is in.
func (*Metadata) GetInstanceID ¶
GetInstanceID returns the instance identification.
func (*Metadata) GetInstanceType ¶
GetInstanceType returns the instance type.
func (*Metadata) GetNumAttachedENIs ¶
GetNumAttachedENIs returns the number of attached ENIs.
func (*Metadata) GetNumBlockDeviceMappings ¶
GetNumBlockDeviceMappings returns the number of block device mappings.
func (*Metadata) GetOutpostArn ¶
GetOutpostArn returns outpost arn if instance is running on an outpost. empty otherwise.
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 ¶
func (m *MockEC2Metadata) EXPECT() *MockEC2MetadataMockRecorder
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 ¶
func (m *MockMetadataService) EXPECT() *MockMetadataServiceMockRecorder
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.