awscommon

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Sep 23, 2026 License: Apache-2.0 Imports: 27 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var SERVICE_GLOBAL = map[string]bool{
	"iam": true,
	"s3":  true,
}
View Source
var SERVICE_RESOURCE_ID_COLON_SEPARATOR = map[string]bool{
	"lambda":         true,
	"logs":           true,
	"secretsmanager": true,
}
View Source
var SERVICE_UNIQUE_ACROSS_ACCOUNTS = map[string]bool{
	"s3": true,
}

Functions

func ConvertAwsMapToMap

func ConvertAwsMapToMap(awsMap []types.KeyValuePair) map[string]string

func ConvertMapToAwsMap

func ConvertMapToAwsMap(mapStr map[string]string) []types.KeyValuePair

func CreateAwsArnFromName

func CreateAwsArnFromName(serviceName, resourceType, resourceName string) string

Example Output: arn:aws:iam:region:123456789012:role/esprm-analytics-opensearch-admin-role-ap-south-1

func GetAccountId

func GetAccountId() string

func GetPartition

func GetPartition() string

func GetRmngRegion

func GetRmngRegion() string

GetRmngRegion returns the AWS region for data-plane calls (DynamoDB, IoT, SSM, etc.). When RMNG_REGION is set (e.g. for the alexa_skill Lambda in a separate region), that is used so the Lambda can access resources in the rmng deployment region. Otherwise AWS_REGION is used.

func IsSQSEvent

func IsSQSEvent(raw json.RawMessage) bool

IsSQSEvent reports whether the raw Lambda payload is an SQS event-source invocation. It detects the top-level "Records" key, which only SQS carries. Presence of the key (not its value) is the discriminator — an empty SQS batch still carries the key and must return an SQSEventResponse.

func SetCognitoIdentityClient

func SetCognitoIdentityClient(client CognitoIdentityInterface)

func SetCognitoProviderClient

func SetCognitoProviderClient(client CognitoProviderInterface)

func SetDynamoDBClient

func SetDynamoDBClient(client DynamoDBClientInterface)

func SetECSClient

func SetECSClient(client ECSClientInterface)

func SetIoTClient

func SetIoTClient(client IoTClientInterface)

func SetIoTDataPlaneClient

func SetIoTDataPlaneClient(client IoTDataPlaneClientInterface)

func SetKMSClient

func SetKMSClient(client KMSClientInterface)

func SetKVSClient

func SetKVSClient(client KVSClientInterface)

func SetLambdaClient

func SetLambdaClient(client LambdaClientInterface)

func SetS3Client

func SetS3Client(client S3ClientInterface)

func SetS3PresignClient

func SetS3PresignClient(client S3PresignClientInterface)

func SetSESClient

func SetSESClient(client SESClientInterface)

func SetSNSClient

func SetSNSClient(client SNSClientInterface)

func SetSQSClient

func SetSQSClient(client SQSClientInterface)

func SetSSMClient

func SetSSMClient(client SSMClientInterface)

func SetSTSClient

func SetSTSClient(client STSClientInterface)

Types

type CognitoIdentityInterface

type CognitoIdentityInterface interface {
	GetId(ctx context.Context, params *cognitoidentity.GetIdInput, optFns ...func(*cognitoidentity.Options)) (*cognitoidentity.GetIdOutput, error)
	GetCredentialsForIdentity(ctx context.Context, params *cognitoidentity.GetCredentialsForIdentityInput, optFns ...func(*cognitoidentity.Options)) (*cognitoidentity.GetCredentialsForIdentityOutput, error)
}

func GetCognitoIdentityClient

func GetCognitoIdentityClient() CognitoIdentityInterface

type CognitoProviderInterface

type CognitoProviderInterface interface {
	UpdateUserPoolClient(ctx context.Context, params *cognitoidentityprovider.UpdateUserPoolClientInput, optFns ...func(*cognitoidentityprovider.Options)) (*cognitoidentityprovider.UpdateUserPoolClientOutput, error)
	DescribeUserPoolClient(ctx context.Context, params *cognitoidentityprovider.DescribeUserPoolClientInput, optFns ...func(*cognitoidentityprovider.Options)) (*cognitoidentityprovider.DescribeUserPoolClientOutput, error)
	SignUp(ctx context.Context, params *cognitoidentityprovider.SignUpInput, optFns ...func(*cognitoidentityprovider.Options)) (*cognitoidentityprovider.SignUpOutput, error)
	ConfirmSignUp(ctx context.Context, params *cognitoidentityprovider.ConfirmSignUpInput, optFns ...func(*cognitoidentityprovider.Options)) (*cognitoidentityprovider.ConfirmSignUpOutput, error)
	InitiateAuth(ctx context.Context, params *cognitoidentityprovider.InitiateAuthInput, optFns ...func(*cognitoidentityprovider.Options)) (*cognitoidentityprovider.InitiateAuthOutput, error)
	RespondToAuthChallenge(ctx context.Context, params *cognitoidentityprovider.RespondToAuthChallengeInput, optFns ...func(*cognitoidentityprovider.Options)) (*cognitoidentityprovider.RespondToAuthChallengeOutput, error)
	ForgotPassword(ctx context.Context, params *cognitoidentityprovider.ForgotPasswordInput, optFns ...func(*cognitoidentityprovider.Options)) (*cognitoidentityprovider.ForgotPasswordOutput, error)
	ConfirmForgotPassword(ctx context.Context, params *cognitoidentityprovider.ConfirmForgotPasswordInput, optFns ...func(*cognitoidentityprovider.Options)) (*cognitoidentityprovider.ConfirmForgotPasswordOutput, error)
	ChangePassword(ctx context.Context, params *cognitoidentityprovider.ChangePasswordInput, optFns ...func(*cognitoidentityprovider.Options)) (*cognitoidentityprovider.ChangePasswordOutput, error)
	RevokeToken(ctx context.Context, params *cognitoidentityprovider.RevokeTokenInput, optFns ...func(*cognitoidentityprovider.Options)) (*cognitoidentityprovider.RevokeTokenOutput, error)
	GetUser(ctx context.Context, params *cognitoidentityprovider.GetUserInput, optFns ...func(*cognitoidentityprovider.Options)) (*cognitoidentityprovider.GetUserOutput, error)
	GlobalSignOut(ctx context.Context, params *cognitoidentityprovider.GlobalSignOutInput, optFns ...func(*cognitoidentityprovider.Options)) (*cognitoidentityprovider.GlobalSignOutOutput, error)
	AdminGetUser(ctx context.Context, params *cognitoidentityprovider.AdminGetUserInput, optFns ...func(*cognitoidentityprovider.Options)) (*cognitoidentityprovider.AdminGetUserOutput, error)
	AdminCreateUser(ctx context.Context, params *cognitoidentityprovider.AdminCreateUserInput, optFns ...func(*cognitoidentityprovider.Options)) (*cognitoidentityprovider.AdminCreateUserOutput, error)
	AdminSetUserPassword(ctx context.Context, params *cognitoidentityprovider.AdminSetUserPasswordInput, optFns ...func(*cognitoidentityprovider.Options)) (*cognitoidentityprovider.AdminSetUserPasswordOutput, error)
	AdminUpdateUserAttributes(ctx context.Context, params *cognitoidentityprovider.AdminUpdateUserAttributesInput, optFns ...func(*cognitoidentityprovider.Options)) (*cognitoidentityprovider.AdminUpdateUserAttributesOutput, error)
	ResendConfirmationCode(ctx context.Context, params *cognitoidentityprovider.ResendConfirmationCodeInput, optFns ...func(*cognitoidentityprovider.Options)) (*cognitoidentityprovider.ResendConfirmationCodeOutput, error)
}

func CognitoProviderClientForRegion

func CognitoProviderClientForRegion(region string) CognitoProviderInterface

CognitoProviderClientForRegion returns a Cognito Identity Provider client for the given region. The shared client is pinned to the deployment region, but a provider whose user pool lives in another region needs InitiateAuth/SignUp to reach that region's endpoint. An empty region, or the deployment region, returns the shared client — so the test mock and same-region providers are unaffected; only a genuinely cross-region provider builds its own client.

func GetCognitoProviderClient

func GetCognitoProviderClient() CognitoProviderInterface

type DynamoDBClientInterface

type DynamoDBClientInterface interface {
	GetItem(ctx context.Context, params *dynamodb.GetItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.GetItemOutput, error)
	PutItem(ctx context.Context, params *dynamodb.PutItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.PutItemOutput, error)
	DeleteItem(ctx context.Context, params *dynamodb.DeleteItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.DeleteItemOutput, error)
	UpdateItem(ctx context.Context, params *dynamodb.UpdateItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.UpdateItemOutput, error)
	BatchGetItem(ctx context.Context, params *dynamodb.BatchGetItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.BatchGetItemOutput, error)
	BatchWriteItem(ctx context.Context, params *dynamodb.BatchWriteItemInput, optFns ...func(*dynamodb.Options)) (*dynamodb.BatchWriteItemOutput, error)
	Query(ctx context.Context, params *dynamodb.QueryInput, optFns ...func(*dynamodb.Options)) (*dynamodb.QueryOutput, error)
	Scan(ctx context.Context, params *dynamodb.ScanInput, optFns ...func(*dynamodb.Options)) (*dynamodb.ScanOutput, error)
	DescribeTable(ctx context.Context, params *dynamodb.DescribeTableInput, optFns ...func(*dynamodb.Options)) (*dynamodb.DescribeTableOutput, error)
	UpdateTable(ctx context.Context, params *dynamodb.UpdateTableInput, optFns ...func(*dynamodb.Options)) (*dynamodb.UpdateTableOutput, error)
}

func GetDynamoDBClient

func GetDynamoDBClient() DynamoDBClientInterface

GetDynamoDBClient returns the globally initialized DynamoDB client

type ECSClientInterface

type ECSClientInterface interface {
	RunTask(ctx context.Context, params *ecs.RunTaskInput, optFns ...func(*ecs.Options)) (*ecs.RunTaskOutput, error)
}

func GetECSClient

func GetECSClient() ECSClientInterface

type IoTClientInterface

type IoTClientInterface interface {
	ListThingPrincipals(ctx context.Context, params *iot.ListThingPrincipalsInput, optFns ...func(*iot.Options)) (*iot.ListThingPrincipalsOutput, error)
	DescribeCertificate(ctx context.Context, params *iot.DescribeCertificateInput, optFns ...func(*iot.Options)) (*iot.DescribeCertificateOutput, error)
	RegisterCertificateWithoutCA(ctx context.Context, params *iot.RegisterCertificateWithoutCAInput, optFns ...func(*iot.Options)) (*iot.RegisterCertificateWithoutCAOutput, error)
	CreateThing(ctx context.Context, params *iot.CreateThingInput, optFns ...func(*iot.Options)) (*iot.CreateThingOutput, error)
	AttachThingPrincipal(ctx context.Context, params *iot.AttachThingPrincipalInput, optFns ...func(*iot.Options)) (*iot.AttachThingPrincipalOutput, error)
	ListThingGroups(ctx context.Context, params *iot.ListThingGroupsInput, optFns ...func(*iot.Options)) (*iot.ListThingGroupsOutput, error)
	CreateThingGroup(ctx context.Context, params *iot.CreateThingGroupInput, optFns ...func(*iot.Options)) (*iot.CreateThingGroupOutput, error)
	AddThingToThingGroup(ctx context.Context, params *iot.AddThingToThingGroupInput, optFns ...func(*iot.Options)) (*iot.AddThingToThingGroupOutput, error)
	AttachPolicy(ctx context.Context, params *iot.AttachPolicyInput, optFns ...func(*iot.Options)) (*iot.AttachPolicyOutput, error)
	DescribeThingGroup(ctx context.Context, params *iot.DescribeThingGroupInput, optFns ...func(*iot.Options)) (*iot.DescribeThingGroupOutput, error)
	DeleteCertificate(ctx context.Context, params *iot.DeleteCertificateInput, optFns ...func(*iot.Options)) (*iot.DeleteCertificateOutput, error)
	DeleteThing(ctx context.Context, params *iot.DeleteThingInput, optFns ...func(*iot.Options)) (*iot.DeleteThingOutput, error)
	DetachThingPrincipal(ctx context.Context, params *iot.DetachThingPrincipalInput, optFns ...func(*iot.Options)) (*iot.DetachThingPrincipalOutput, error)
	UpdateCertificate(ctx context.Context, params *iot.UpdateCertificateInput, optFns ...func(*iot.Options)) (*iot.UpdateCertificateOutput, error)
	UpdateThing(ctx context.Context, params *iot.UpdateThingInput, optFns ...func(*iot.Options)) (*iot.UpdateThingOutput, error)
	DescribeThing(ctx context.Context, params *iot.DescribeThingInput, optFns ...func(*iot.Options)) (*iot.DescribeThingOutput, error)
	GetTopicRule(ctx context.Context, params *iot.GetTopicRuleInput, optFns ...func(*iot.Options)) (*iot.GetTopicRuleOutput, error)
	ReplaceTopicRule(ctx context.Context, params *iot.ReplaceTopicRuleInput, optFns ...func(*iot.Options)) (*iot.ReplaceTopicRuleOutput, error)
}

func GetIoTClient

func GetIoTClient() IoTClientInterface

GetIoTClient returns the globally initialized AWS IoT client

type IoTDataPlaneClientInterface

type IoTDataPlaneClientInterface interface {
	Publish(ctx context.Context, params *iotdataplane.PublishInput, optFns ...func(*iotdataplane.Options)) (*iotdataplane.PublishOutput, error)
	UpdateThingShadow(ctx context.Context, params *iotdataplane.UpdateThingShadowInput, optFns ...func(*iotdataplane.Options)) (*iotdataplane.UpdateThingShadowOutput, error)
	GetThingShadow(ctx context.Context, params *iotdataplane.GetThingShadowInput, optFns ...func(*iotdataplane.Options)) (*iotdataplane.GetThingShadowOutput, error)
	DeleteThingShadow(ctx context.Context, params *iotdataplane.DeleteThingShadowInput, optFns ...func(*iotdataplane.Options)) (*iotdataplane.DeleteThingShadowOutput, error)
}

func GetIoTDataPlaneClient

func GetIoTDataPlaneClient() IoTDataPlaneClientInterface

GetIoTDataPlaneClient returns the globally initialized AWS IoT Data Plane client

type KMSClientInterface

type KMSClientInterface interface {
	Sign(ctx context.Context, params *kms.SignInput, optFns ...func(*kms.Options)) (*kms.SignOutput, error)
	GetPublicKey(ctx context.Context, params *kms.GetPublicKeyInput, optFns ...func(*kms.Options)) (*kms.GetPublicKeyOutput, error)
}

KMSClientInterface is the slice of KMS used for signing. Only these two calls are needed: the private key never leaves KMS, so there is no Decrypt/GenerateDataKey here and no code path that could export key material.

func GetKMSClient

func GetKMSClient() KMSClientInterface

type KVSClientInterface

type KVSClientInterface interface {
	CreateSignalingChannel(ctx context.Context, params *kinesisvideo.CreateSignalingChannelInput, optFns ...func(*kinesisvideo.Options)) (*kinesisvideo.CreateSignalingChannelOutput, error)
	DescribeSignalingChannel(ctx context.Context, params *kinesisvideo.DescribeSignalingChannelInput, optFns ...func(*kinesisvideo.Options)) (*kinesisvideo.DescribeSignalingChannelOutput, error)
}

func GetKVSClient

func GetKVSClient() KVSClientInterface

type LambdaClientInterface

type LambdaClientInterface interface {
	AddPermission(ctx context.Context, params *lambda.AddPermissionInput, optFns ...func(*lambda.Options)) (*lambda.AddPermissionOutput, error)
	RemovePermission(ctx context.Context, params *lambda.RemovePermissionInput, optFns ...func(*lambda.Options)) (*lambda.RemovePermissionOutput, error)
	Invoke(ctx context.Context, params *lambda.InvokeInput, optFns ...func(*lambda.Options)) (*lambda.InvokeOutput, error)
}

func GetLambdaClient

func GetLambdaClient() LambdaClientInterface

type S3ClientInterface

type S3ClientInterface interface {
	PutObject(context.Context, *s3.PutObjectInput, ...func(*s3.Options)) (*s3.PutObjectOutput, error)
	GetObject(context.Context, *s3.GetObjectInput, ...func(*s3.Options)) (*s3.GetObjectOutput, error)
	ListBuckets(context.Context, *s3.ListBucketsInput, ...func(*s3.Options)) (*s3.ListBucketsOutput, error)
}

func GetS3Client

func GetS3Client() S3ClientInterface

type S3PresignClientInterface

type S3PresignClientInterface interface {
	PresignPutObject(ctx context.Context, params *s3.PutObjectInput, optFns ...func(*s3.PresignOptions)) (*v4.PresignedHTTPRequest, error)
	PresignGetObject(ctx context.Context, params *s3.GetObjectInput, optFns ...func(*s3.PresignOptions)) (*v4.PresignedHTTPRequest, error)
}

func GetS3PresignClient

func GetS3PresignClient() S3PresignClientInterface

type SESClientInterface

type SESClientInterface interface {
	SendEmail(ctx context.Context, params *sesv2.SendEmailInput, optFns ...func(*sesv2.Options)) (*sesv2.SendEmailOutput, error)
	CreateEmailIdentity(ctx context.Context, params *sesv2.CreateEmailIdentityInput, optFns ...func(*sesv2.Options)) (*sesv2.CreateEmailIdentityOutput, error)
	GetEmailIdentity(ctx context.Context, params *sesv2.GetEmailIdentityInput, optFns ...func(*sesv2.Options)) (*sesv2.GetEmailIdentityOutput, error)
	ListEmailIdentities(ctx context.Context, params *sesv2.ListEmailIdentitiesInput, optFns ...func(*sesv2.Options)) (*sesv2.ListEmailIdentitiesOutput, error)
	DeleteEmailIdentity(ctx context.Context, params *sesv2.DeleteEmailIdentityInput, optFns ...func(*sesv2.Options)) (*sesv2.DeleteEmailIdentityOutput, error)
	GetAccount(ctx context.Context, params *sesv2.GetAccountInput, optFns ...func(*sesv2.Options)) (*sesv2.GetAccountOutput, error)
	PutAccountDetails(ctx context.Context, params *sesv2.PutAccountDetailsInput, optFns ...func(*sesv2.Options)) (*sesv2.PutAccountDetailsOutput, error)
}

func GetSESClient

func GetSESClient() SESClientInterface

type SNSClientInterface

type SNSClientInterface interface {
	Publish(ctx context.Context, params *sns.PublishInput, optFns ...func(*sns.Options)) (*sns.PublishOutput, error)
	CreatePlatformApplication(ctx context.Context, params *sns.CreatePlatformApplicationInput, optFns ...func(*sns.Options)) (*sns.CreatePlatformApplicationOutput, error)
	CreatePlatformEndpoint(ctx context.Context, params *sns.CreatePlatformEndpointInput, optFns ...func(*sns.Options)) (*sns.CreatePlatformEndpointOutput, error)
	DeleteEndpoint(ctx context.Context, params *sns.DeleteEndpointInput, optFns ...func(*sns.Options)) (*sns.DeleteEndpointOutput, error)
	ListPlatformApplications(ctx context.Context, params *sns.ListPlatformApplicationsInput, optFns ...func(*sns.Options)) (*sns.ListPlatformApplicationsOutput, error)
	SetPlatformApplicationAttributes(ctx context.Context, params *sns.SetPlatformApplicationAttributesInput, optFns ...func(*sns.Options)) (*sns.SetPlatformApplicationAttributesOutput, error)
	GetPlatformApplicationAttributes(ctx context.Context, params *sns.GetPlatformApplicationAttributesInput, optFns ...func(*sns.Options)) (*sns.GetPlatformApplicationAttributesOutput, error)
	DeletePlatformApplication(ctx context.Context, params *sns.DeletePlatformApplicationInput, optFns ...func(*sns.Options)) (*sns.DeletePlatformApplicationOutput, error)
}

func GetSNSClient

func GetSNSClient() SNSClientInterface

type SQSClientInterface

type SQSClientInterface interface {
	SendMessage(ctx context.Context, params *sqs.SendMessageInput, optFns ...func(*sqs.Options)) (*sqs.SendMessageOutput, error)
}

func GetSQSClient

func GetSQSClient() SQSClientInterface

type SSMClientInterface

type SSMClientInterface interface {
	PutParameter(ctx context.Context, params *ssm.PutParameterInput, optFns ...func(*ssm.Options)) (*ssm.PutParameterOutput, error)
	GetParameter(ctx context.Context, params *ssm.GetParameterInput, optFns ...func(*ssm.Options)) (*ssm.GetParameterOutput, error)
	GetParametersByPath(ctx context.Context, params *ssm.GetParametersByPathInput, optFns ...func(*ssm.Options)) (*ssm.GetParametersByPathOutput, error)
	DeleteParameter(ctx context.Context, params *ssm.DeleteParameterInput, optFns ...func(*ssm.Options)) (*ssm.DeleteParameterOutput, error)
}

func GetSSMClient

func GetSSMClient() SSMClientInterface

type STSClientInterface

type STSClientInterface interface {
	GetCallerIdentity(ctx context.Context, params *sts.GetCallerIdentityInput, optFns ...func(*sts.Options)) (*sts.GetCallerIdentityOutput, error)
	AssumeRole(ctx context.Context, params *sts.AssumeRoleInput, optFns ...func(*sts.Options)) (*sts.AssumeRoleOutput, error)
}

func GetSTSClient

func GetSTSClient() STSClientInterface

Jump to

Keyboard shortcuts

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