CustomWidget Class
A CustomWidget shows the result of a AWS lambda function.
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"),
}))
Initializer
ts
new CustomWidget(props: CustomWidgetProps)
python
CustomWidget(props: CustomWidgetProps)
java
new CustomWidget(CustomWidgetProps props)
csharp
new CustomWidget(CustomWidgetProps props)
go
NewCustomWidget(Props CustomWidgetProps)
Properties
The amount of vertical grid units the widget will take up.
warningsmay be undefinedstring[]warningsmay be undefinedtyping.List[str]warningsmay be undefinedList<String>Warningsmay be undefinedstring[]Warningsmay be undefined*[]*string#Any warnings that are produced as a result of putting together this widget.
warningsV2may be undefined{ [key: string]: string }warnings_v2may be undefinedtyping.Mapping[str, str]warningsV2may be undefinedMap<String, String>WarningsV2may be undefinedIDictionary<string, string>WarningsV2may be undefined*map[string]*string#Any warnings that are produced as a result of putting together this widget.
The amount of horizontal grid units the widget will take up.
Methods
position(x: number, y: number): voiddef position(self, x: int | float, y: int | float) -> Nonepublic void position(Number x, Number y)public void Position(double x, double y)func Position(X *float64, Y *float64)#Place the widget at a given position.
toJson(): any[]def to_json(self, ) -> typing.List[Any]public List<Object> toJson()public object[] ToJson()func ToJson() *[]interface{}#Return the widget JSON for use in the dashboard.