Documentation
¶
Index ¶
- Constants
- func CreateNewRolePolicy(ctx context.Context, iamService iamservice.Service, instanceName string, ...) (string, error)
- func ExtractPolicyNameAndCurrentPermissionSID(currentLinkState *state.LinkState, executionRoleName string, ...) (string, string)
- func PermissionFieldPath(executionRoleName string) string
- func RemoveExistingRolePolicyPermissions(ctx context.Context, iamService iamservice.Service, roleName string, ...) error
- func RemoveLambdaEnvironmentVariables(ctx context.Context, lambdaService lambdaservice.Service, functionARN string, ...) error
- func UpdateExistingRolePolicy(ctx context.Context, iamService iamservice.Service, roleName string, ...) error
- func UpdateLambdaEnvironmentVariables(ctx context.Context, lambdaService lambdaservice.Service, functionARN string, ...) error
- type LambdaLinkSetupContext
- type LambdaLinkSetupData
Constants ¶
const ( // PermissionFieldName is the name of the field in the link data that // contains the permission (statement) object. // This should be used across all link implementations that store permissions // in the link data. PermissionFieldName = "permission" // PolicyNameFieldName is the name of the field in the link data that // contains the policy name. // This should be used across all link implementations that store policy names // in the link data. PolicyNameFieldName = "policyName" )
Variables ¶
This section is empty.
Functions ¶
func CreateNewRolePolicy ¶
func CreateNewRolePolicy( ctx context.Context, iamService iamservice.Service, instanceName string, roleName string, statements []map[string]any, ) (string, error)
CreateNewRolePolicy creates a new role policy with the given statements. This is useful for links that require permissions to be added to a specific role to "activate" the link.
func ExtractPolicyNameAndCurrentPermissionSID ¶
func ExtractPolicyNameAndCurrentPermissionSID( currentLinkState *state.LinkState, executionRoleName string, rolePolicies *iam.ListRolePoliciesOutput, ) (string, string)
ExtractPolicyNameAndCurrentPermissionSID extracts the policy name and current permission SID from the link data.
func PermissionFieldPath ¶
PermissionFieldPath returns the field path for a permission (statement) object in the link data. This should be used across all link implementations that store permissions in the link data.
func RemoveExistingRolePolicyPermissions ¶
func RemoveExistingRolePolicyPermissions( ctx context.Context, iamService iamservice.Service, roleName string, policyName string, permissionsToRemove []string, ) error
RemoveExistingRolePolicyPermissions removes the specified permissions from an existing role policy. If the specified permissions are the only ones in the policy, the role policy will be removed.
func RemoveLambdaEnvironmentVariables ¶
func RemoveLambdaEnvironmentVariables( ctx context.Context, lambdaService lambdaservice.Service, functionARN string, currentConfig *types.FunctionConfiguration, envVarsToRemove []string, ) error
RemoveLambdaEnvironmentVariables removes the environment variables for a Lambda function by removing the specified environment variables from the current environment variables. This is mostly useful for links that connect lambda functions to other resources.
func UpdateExistingRolePolicy ¶
func UpdateExistingRolePolicy( ctx context.Context, iamService iamservice.Service, roleName string, policyName string, statements []map[string]any, currentPermSIDs []string, ) error
UpdateExistingRolePolicy updates an existing role policy with the given statements. This is useful for links that require permissions to be added to a specific role to "activate" the link.
func UpdateLambdaEnvironmentVariables ¶
func UpdateLambdaEnvironmentVariables( ctx context.Context, lambdaService lambdaservice.Service, functionARN string, currentConfig *types.FunctionConfiguration, envVarsToSet map[string]string, ) error
UpdateLambdaEnvironmentVariables updates the environment variables for a Lambda function by merging the current environment variables with the new ones. This is mostly useful for links that connect lambda functions to other resources.
Types ¶
type LambdaLinkSetupContext ¶
type LambdaLinkSetupContext struct {
FunctionARN string
LambdaOutput *types.FunctionConfiguration
// The name of the role in AWS.
RoleName string
// The name of the role resource in the blueprint.
RoleResourceName string
// The resource state of the role in the blueprint.
RoleResourceState *state.ResourceState
LambdaService lambdaservice.Service
}
func SetupLinkFromLambdaFunction ¶
func SetupLinkFromLambdaFunction( ctx context.Context, setupData *LambdaLinkSetupData, lambdaService lambdaservice.Service, resourceService provider.ResourceService, providerCtx provider.Context, ) (*LambdaLinkSetupContext, error)
SetupLinkFromLambdaFunction sets up a link from a Lambda function to another resource.
type LambdaLinkSetupData ¶
type LambdaLinkSetupData struct {
LambdaFuncResourceInfo *provider.ResourceInfo
LoadRoleInfo bool
}