CustomWidgetProps Struct
The properties for a CustomWidget.
| Source | aws-cloudwatch/lib/graph.ts |
|---|---|
| Type last changed |
Example
ts
declare const dashboard: cloudwatch.Dashboard;
// Import or create a lambda function
const fn = lambda.Function.fromFunctionArn(
dashboard,
'Function',
'arn:aws:lambda:us-east-1:123456789012:function:MyFn',
);
dashboard.addWidgets(new cloudwatch.CustomWidget({
functionArn: fn.functionArn,
title: 'My lambda baked widget',
}));
python
# dashboard: cloudwatch.Dashboard
# Import or create a lambda function
fn = lambda_.Function.from_function_arn(dashboard, "Function", "arn:aws:lambda:us-east-1:123456789012:function:MyFn")
dashboard.add_widgets(cloudwatch.CustomWidget(
function_arn=fn.function_arn,
title="My lambda baked widget"
))
java
Dashboard dashboard;
// Import or create a lambda function
IFunction fn = Function.fromFunctionArn(dashboard, "Function", "arn:aws:lambda:us-east-1:123456789012:function:MyFn");
dashboard.addWidgets(CustomWidget.Builder.create()
.functionArn(fn.getFunctionArn())
.title("My lambda baked widget")
.build());
csharp
// Install: dotnet add package Amazon.CDK.Lib
Dashboard dashboard;
// Import or create a lambda function
var fn = Function.FromFunctionArn(dashboard, "Function", "arn:aws:lambda:us-east-1:123456789012:function:MyFn");
dashboard.AddWidgets(new CustomWidget(new CustomWidgetProps {
FunctionArn = fn.FunctionArn,
Title = "My lambda baked widget"
}));
go
// Install: go get github.com/aws/aws-cdk-go/awscdk/v2
var dashboard Dashboard
// Import or create a lambda function
fn := lambda.Function_FromFunctionArn(dashboard, jsii.String("Function"), jsii.String("arn:aws:lambda:us-east-1:123456789012:function:MyFn"))
dashboard.AddWidgets(cloudwatch.NewCustomWidget(&CustomWidgetProps{
FunctionArn: fn.FunctionArn,
Title: jsii.String("My lambda baked widget"),
}))
Properties
The Arn of the AWS Lambda function that returns HTML or JSON that will be displayed in the widget.
heightoptionalnumberheightoptionalint | floatheightoptionalNumberHeightoptionaldoubleHeightoptional*float64 #Height of the widget.
Default: 6 for Alarm and Graph widgets. 3 for single value widgets where most recent value of a metric is displayed.
paramsoptionalanyparamsoptionalAnyparamsoptionalObjectParamsoptionalobjectParamsoptionalinterface{} #Parameters passed to the lambda function.
Default: no parameters are passed to the lambda function
The title of the widget.
updateOnRefreshoptionalbooleanupdate_on_refreshoptionalboolupdateOnRefreshoptionalBooleanUpdateOnRefreshoptionalboolUpdateOnRefreshoptional*bool = true #Update the widget on refresh.
updateOnResizeoptionalbooleanupdate_on_resizeoptionalboolupdateOnResizeoptionalBooleanUpdateOnResizeoptionalboolUpdateOnResizeoptional*bool = true #Update the widget on resize.
updateOnTimeRangeChangeoptionalbooleanupdate_on_time_range_changeoptionalboolupdateOnTimeRangeChangeoptionalBooleanUpdateOnTimeRangeChangeoptionalboolUpdateOnTimeRangeChangeoptional*bool = true #Update the widget on time range change.
widthoptionalnumberwidthoptionalint | floatwidthoptionalNumberWidthoptionaldoubleWidthoptional*float64 = 6 #Width of the widget, in a grid of 24 units wide.