Documentation
¶
Index ¶
- func AssetCodeGo(compiler Compiler) awslambda.Code
- func NewContainerGo(scope constructs.Construct, id *string, spec *ContainerGoProps) awslambda.Function
- func NewFunction(scope constructs.Construct, id *string, spec FunctionProps) awslambda.Function
- func NewFunctionGo(scope constructs.Construct, id *string, spec *FunctionGoProps) awslambda.Function
- type AuthorizerBasic
- type AuthorizerIAM
- type AuthorizerJwt
- type AuthorizerPublic
- type Compiler
- type ContainerGoProps
- type FunctionGoProps
- type FunctionProps
- type Gateway
- func (gw *Gateway) NewAuthorizerBasic(access, secret string, source ...string) *AuthorizerBasic
- func (gw *Gateway) NewAuthorizerCognito(cognitoArn string, clients ...string) *AuthorizerJwt
- func (gw *Gateway) NewAuthorizerIAM() *AuthorizerIAM
- func (gw *Gateway) NewAuthorizerJwt(iss string, aud ...string) *AuthorizerJwt
- func (gw *Gateway) NewAuthorizerPublic() *AuthorizerPublic
- type GatewayProps
- type GoCompiler
- type Hasher
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssetCodeGo ¶
AssetCodeGo bundles lambda function from source code
func NewContainerGo ¶ added in v0.8.4
func NewContainerGo(scope constructs.Construct, id *string, spec *ContainerGoProps) awslambda.Function
func NewFunction ¶ added in v0.10.1
func NewFunction(scope constructs.Construct, id *string, spec FunctionProps) awslambda.Function
func NewFunctionGo ¶
func NewFunctionGo(scope constructs.Construct, id *string, spec *FunctionGoProps) awslambda.Function
NewFunctionGo creates Golang Lambda Function from "inline" code
Types ¶
type AuthorizerBasic ¶ added in v0.11.3
func (*AuthorizerBasic) AddResource ¶ added in v0.11.3
func (api *AuthorizerBasic) AddResource( endpoint string, handler awslambda.Function, ) *AuthorizerBasic
Associate a Lambda function with a REST API path. It uses the specified path as a prefix, enabling the association of the Lambda function with all subpaths under that prefix.
type AuthorizerIAM ¶ added in v0.8.0
type AuthorizerIAM struct {
constructs.Construct
RestAPI apigw2.HttpApi
// contains filtered or unexported fields
}
func (*AuthorizerIAM) AddResource ¶ added in v0.8.0
func (api *AuthorizerIAM) AddResource( endpoint string, handler awslambda.Function, grantee awsiam.IGrantable, ) *AuthorizerIAM
Associate a Lambda function with a REST API path. It uses the specified path as a prefix, enabling the association of the Lambda function with all subpaths under that prefix.
Protect access to resource only for AWS IAM principals.
type AuthorizerJwt ¶ added in v0.8.0
type AuthorizerJwt struct {
constructs.Construct
RestAPI apigw2.HttpApi
// contains filtered or unexported fields
}
func (*AuthorizerJwt) AddResource ¶ added in v0.8.0
func (api *AuthorizerJwt) AddResource( endpoint string, handler awslambda.Function, accessScope ...string, ) *AuthorizerJwt
Associate a Lambda function with a REST API path. It uses the specified path as a prefix, enabling the association of the Lambda function with all subpaths under that prefix.
Protect access to resource only for principals with valid JWT token.
type AuthorizerPublic ¶ added in v0.11.3
func (*AuthorizerPublic) AddResource ¶ added in v0.11.3
func (api *AuthorizerPublic) AddResource( endpoint string, handler awslambda.Function, ) *AuthorizerPublic
Associate a Lambda function with a REST API path. It uses the specified path as a prefix, enabling the association of the Lambda function with all subpaths under that prefix.
type ContainerGoProps ¶ added in v0.8.4
type ContainerGoProps struct {
*awslambda.DockerImageFunctionProps
// Canonical name of Golang module that containing the function
// SourceCodeModule: "github.com/fogfish/scud",
SourceCodeModule string
// Path to lambda function relative to the module
// SourceCodeLambda: "test/lambda/go"
SourceCodeLambda string
// The version of software asset passed as linker flag
// -ldflags '-X main.version=...'
SourceCodeVersion string
// Variables and its values passed as linker flags
// -ldflags '-X key1=val1 -X key2=val2 ...'
GoVar map[string]string
// Go environment, default includes
// GOOS=linux
// GOARCH=arm64
// CGO_ENABLED=0
GoEnv map[string]string
// Static files included into container, the path is relative to module
StaticAssets []string
// Linux Alpine Packages (apk) to be installed within the container
Packages []string
}
func (*ContainerGoProps) HKT1 ¶ added in v0.10.7
func (*ContainerGoProps) HKT1(awslambda.Function)
func (*ContainerGoProps) UniqueID ¶ added in v0.10.4
func (props *ContainerGoProps) UniqueID() string
type FunctionGoProps ¶
type FunctionGoProps struct {
*awslambda.FunctionProps
// Canonical name of Golang module that containing the function
// SourceCodeModule: "github.com/fogfish/scud",
SourceCodeModule string
// Path to lambda function relative to the module
// SourceCodeLambda: "test/lambda/go"
SourceCodeLambda string
// The version of software asset passed as linker flag
// -ldflags '-X main.version=...'
SourceCodeVersion string
// Variables and its values passed as linker flags
// -ldflags '-X key1=val1 -X key2=val2 ...'
GoVar map[string]string
// Go environment, default includes
// GOOS=linux
// GOARCH=arm64
// CGO_ENABLED=0
GoEnv map[string]string
}
FunctionGoProps is properties of the function
func (*FunctionGoProps) HKT1 ¶ added in v0.10.7
func (*FunctionGoProps) HKT1(awslambda.Function)
func (*FunctionGoProps) UniqueID ¶ added in v0.10.4
func (props *FunctionGoProps) UniqueID() string
type FunctionProps ¶ added in v0.10.1
type Gateway ¶
type Gateway struct {
constructs.Construct
RestAPI apigw2.HttpApi
// contains filtered or unexported fields
}
func NewGateway ¶
func NewGateway(scope constructs.Construct, id *string, props *GatewayProps) *Gateway
NewGateway creates new instance of Gateway
func (*Gateway) NewAuthorizerBasic ¶ added in v0.11.3
func (gw *Gateway) NewAuthorizerBasic(access, secret string, source ...string) *AuthorizerBasic
Creates integration with Basic Authorizer to authorize incoming requests. This integration implements a simple access/secret key validation mechanism, allowing you to protect your API endpoints using basic authentication. By validating the provided credentials against the configured access and secret keys, the library ensures that only authorized clients can access your resources, enhancing the security of your API.
func (*Gateway) NewAuthorizerCognito ¶ added in v0.8.0
func (gw *Gateway) NewAuthorizerCognito(cognitoArn string, clients ...string) *AuthorizerJwt
Creates integration with AWS Cognito to authorize incoming requests. This integration allows you to manage user authentication and authorization seamlessly. By utilizing AWS Cognito, you can implement robust user sign-up, sign-in, and access control mechanisms. The library ensures that only authenticated users with valid tokens can access your API endpoints, providing an additional layer of security and user management capabilities.
func (*Gateway) NewAuthorizerIAM ¶ added in v0.8.0
func (gw *Gateway) NewAuthorizerIAM() *AuthorizerIAM
Creates integration with AWS IAM to authorize incoming requests. This integration ensures that only authenticated and authorized principals can access the resources and functionalities provided by your Lambda functions. By leveraging AWS IAM policies and roles, the library enforces fine-grained access control, enhancing the security of your API endpoints.
func (*Gateway) NewAuthorizerJwt ¶ added in v0.8.0
func (gw *Gateway) NewAuthorizerJwt(iss string, aud ...string) *AuthorizerJwt
Creates integration with Single Sign On provider (e.g. Auth0) to authorize incoming requests using JWT tokens. This integration allows you to leverage external identity providers for user authentication, ensuring secure and seamless access to your API endpoints. By validating JWT tokens issued by the SSO provider, the library ensures that only authenticated users can access your resources. Additionally, this setup can support various SSO standards and providers, enhancing flexibility and security in managing user identities and permissions.
func (*Gateway) NewAuthorizerPublic ¶ added in v0.11.3
func (gw *Gateway) NewAuthorizerPublic() *AuthorizerPublic
Creates public (unprotected) integration to authorize incoming requests. This integration allows unrestricted access to the associated API endpoints, enabling any client to interact with the resources and functionalities provided by your Lambda functions without requiring authentication or authorization. It is suitable for scenarios where open access is desired, such as public APIs or endpoints that do not handle sensitive data.
type GatewayProps ¶ added in v0.7.0
type GatewayProps struct {
*apigw2.HttpApiProps
Host *string
TlsArn *string
}
type GoCompiler ¶ added in v0.6.0
type GoCompiler struct {
// contains filtered or unexported fields
}
func NewGoCompiler ¶ added in v0.6.0
func (*GoCompiler) SourceCodeLambda ¶ added in v0.6.0
func (g *GoCompiler) SourceCodeLambda() string
func (*GoCompiler) SourceCodeModule ¶ added in v0.8.3
func (g *GoCompiler) SourceCodeModule() string
func (*GoCompiler) SourceCodeVersion ¶ added in v0.8.3
func (g *GoCompiler) SourceCodeVersion() string
func (*GoCompiler) TryBundle ¶ added in v0.6.0
func (g *GoCompiler) TryBundle(outputDir *string, options *awscdk.BundlingOptions) *bool
Source Files
¶
Directories
¶
| Path | Synopsis |
|---|---|
|
examples
|
|
|
01_simple_function
command
|
|
|
01_simple_function/lambda
command
|
|
|
02_api_with_auth
command
|
|
|
internal
|
|
|
cmd/auth
command
|
|
|
test
|
|
|
lambda/another
command
|
|
|
lambda/go
command
|