pub struct LambdaArn(/* private fields */);Expand description
Amazon Resource Name (ARN) for an AWS Lambda function.
This type represents an ARN either using variables (e.g., an AWS CloudFormation logical ID
constructed via the cloud_formation method) or as a
fully-resolved ARN via the known method. It is used to populate the
x-amazon-apigateway-integration
OpenAPI extensions that Amazon API Gateway uses to determine which Lambda function should handle
each API endpoint.
Implementations§
Source§impl LambdaArn
impl LambdaArn
Sourcepub fn cloud_formation<L>(logical_id: L) -> Self
pub fn cloud_formation<L>(logical_id: L) -> Self
Construct a variable ARN that references an AWS CloudFormation or Serverless Application Model (SAM) logical ID.
The logical ID should reference one of the following resource types defined in your CloudFormation/SAM template:
AWS::Serverless::FunctionAWS::Lambda::FunctionAWS::Lambda::Alias(e.g., by appending.Aliasto the logical ID when specifying anAutoPublishAliason theAWS::Serverless::Functionresource)AWS::Lambda::Version(e.g., by appending.Versionto the logical ID when specifying anAutoPublishAliason theAWS::Serverless::Functionresource)
When using this method, be sure to include the openapi-apigw.yaml file in your
CloudFormation/SAM template with the AWS::Include transform. Otherwise, the variables will
not be substituted during deployment, and deployment will fail. For example (where
.openapi-lambda is the out_dir passed to CodeGenerator::new):
Resources:
MyApi:
Type: AWS::Serverless::Api
Properties:
Name: my-api
StageName: prod
DefinitionBody:
Fn::Transform:
Name: AWS::Include
Parameters:
Location: .openapi-lambda/openapi-apigw.yaml§Example
LambdaArn::cloud_formation("MyApiFunction.Alias")Sourcepub fn known<A, F, G, R>(
api_gateway_region: G,
account_id: A,
function_region: R,
function_name: F,
alias_or_version: Option<String>,
) -> Self
pub fn known<A, F, G, R>( api_gateway_region: G, account_id: A, function_region: R, function_name: F, alias_or_version: Option<String>, ) -> Self
Construct a fully-resolved AWS Lambda function ARN.
The resulting ARN does not depend on any CloudFormation variables and is compatible with any deployment method.
§Arguments
api_gateway_region- Region containing the Amazon API Gateway (e.g.,us-east-1)account_id- AWS account containing the AWS Lambda functionfunction_region- Region containing the AWS Lambda function (e.g.,us-east-1)function_name- Name of the AWS Lambda functionalias_or_version- Optional Lambda function version or alias
§Example
LambdaArn::known(
"us-east-1",
"1234567890",
"us-east-1",
"my-api-function",
Some("live".to_string()),
)Trait Implementations§
Auto Trait Implementations§
impl Freeze for LambdaArn
impl RefUnwindSafe for LambdaArn
impl Send for LambdaArn
impl Sync for LambdaArn
impl Unpin for LambdaArn
impl UnwindSafe for LambdaArn
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more