func (imds TypedIMDS) GetMAC(ctx context.Context) (string, error) {
	mac, err := imds.GetMetadataWithContext(ctx, "mac")
	if err != nil {
		if imdsErr, ok := err.(*imdsRequestError); ok {
			log.Warnf("%v", err)
			return mac, imdsErr.err
		}
		return "", err
	}
	return mac, err
}
GetMAC returns the first/primary network interface mac address.
package awsutils
import (
	"context"
	"fmt"
	"net"
	"net/http"
	"strconv"
	"strings"
	"github.com/aws/aws-sdk-go/aws/awserr"
	"github.com/pkg/errors"
)
type EC2MetadataIface interface {
	GetMetadataWithContext(ctx context.Context, p string) (string, error)
}
type TypedIMDS struct {
	EC2MetadataIface
}
type imdsRequestError struct {
	requestKey string
	err        error
}
var _ error = &imdsRequestError{}
func newIMDSRequestError(requestKey string, err error) *imdsRequestError {
	return &imdsRequestError{
		requestKey: requestKey,
		err:        err,
	}
}
func (e *imdsRequestError) Error() string {
	return fmt.Sprintf("failed to retrieve %s from instance metadata %v", e.requestKey, e.err)
}
func (imds TypedIMDS) getList(ctx context.Context, key string) ([]string, error) {
	data, err := imds.GetMetadataWithContext(ctx, key)
	if err != nil {
		return nil, err
	}
	return strings.Fields(data), err
}
func (imds TypedIMDS) GetAZ(ctx context.Context) (string, error) {
	az, err := imds.GetMetadataWithContext(ctx, "placement/availability-zone")
	if err != nil {
		if imdsErr, ok := err.(*imdsRequestError); ok {
			log.Warnf("%v", err)
			return az, imdsErr.err
		}
		return "", err
	}
	return az, err
}
func (imds TypedIMDS) GetInstanceType(ctx context.Context) (string, error) {
	instanceType, err := imds.GetMetadataWithContext(ctx, "instance-type")
	if err != nil {
		if imdsErr, ok := err.(*imdsRequestError); ok {
			log.Warnf("%v", err)
			return instanceType, imdsErr.err
		}
		return "", err
	}
	return instanceType, err
}
func (imds TypedIMDS) GetLocalIPv4(ctx context.Context) (net.IP, error) {
	return imds.getIP(ctx, "local-ipv4")
}
func (imds TypedIMDS) GetInstanceID(ctx context.Context) (string, error) {
	instanceID, err := imds.GetMetadataWithContext(ctx, "instance-id")
	if err != nil {
		if imdsErr, ok := err.(*imdsRequestError); ok {
			log.Warnf("%v", err)
			return instanceID, imdsErr.err
		}
		return "", err
	}
	return instanceID, err
}