createDashboard method

Future<CreateDashboardResponse> createDashboard({
  1. required String dashboardDefinition,
  2. required String dashboardName,
  3. required String projectId,
  4. String? clientToken,
  5. String? dashboardDescription,
  6. Map<String, String>? tags,
})

Creates a dashboard in an IoT SiteWise Monitor project.

May throw InternalFailureException. May throw InvalidRequestException. May throw LimitExceededException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter dashboardDefinition : The dashboard definition specified in a JSON literal.

in the IoT SiteWise User Guide

Parameter dashboardName : A friendly name for the dashboard.

Parameter projectId : The ID of the project in which to create the dashboard.

Parameter clientToken : A unique case-sensitive identifier that you can provide to ensure the idempotency of the request. Don't reuse this client token if a new idempotent request is required.

Parameter dashboardDescription : A description for the dashboard.

Parameter tags : A list of key-value pairs that contain metadata for the dashboard. For more information, see Tagging your IoT SiteWise resources in the IoT SiteWise User Guide.

Implementation

Future<CreateDashboardResponse> createDashboard({
  required String dashboardDefinition,
  required String dashboardName,
  required String projectId,
  String? clientToken,
  String? dashboardDescription,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'dashboardDefinition': dashboardDefinition,
    'dashboardName': dashboardName,
    'projectId': projectId,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (dashboardDescription != null)
      'dashboardDescription': dashboardDescription,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/dashboards',
    hostPrefix: 'monitor.',
    exceptionFnMap: _exceptionFns,
  );
  return CreateDashboardResponse.fromJson(response);
}