Skip to content

create_dashboard async

create_dashboard(
    name: DashboardName,
    widgets: WidgetList,
    *,
    config_overrides: Optional[AsyncBCMDashboardsClientConfig] = None,
    description: Optional[Description] = None,
    resource_tags: Optional[ResourceTagList] = None,
) -> CreateDashboardResponse

Creates a new dashboard that can contain multiple widgets displaying cost and usage data. You can add custom widgets or use predefined widgets, arranging them in your preferred layout.

Parameters:

  • name (DashboardName) –

    The name of the dashboard. The name must be unique within your account.

  • description (Optional[Description], default: None ) –

    A description of the dashboard's purpose or contents.

  • widgets (WidgetList) –

    An array of widget configurations that define the visualizations to be displayed in the dashboard. Each dashboard can contain up to 20 widgets.

  • resource_tags (Optional[ResourceTagList], default: None ) –

    The tags to apply to the dashboard resource for organization and management.

Raises:

  • AccessDeniedException –

    You do not have sufficient permissions to perform this action. Verify your IAM permissions and any resource policies.

  • InternalServerException –

    An internal error occurred while processing the request. Retry your request. If the problem persists, contact Amazon Web Services Support.

  • ServiceQuotaExceededException –

    The request would exceed a service quota. Review the service quotas for Amazon Web Services Billing and Cost Management Dashboards and retry your request.

  • ThrottlingException –

    The request was denied due to request throttling. Reduce the frequency of requests and use exponential backoff.

  • ValidationException –

    The input parameters do not satisfy the requirements. Check the error message for specific validation details.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Examples:

Creating a dashboard

>>> await client.create_dashboard(name='cost-dashboards', description='Dashboard for tracking costs', widgets=[{'title': 'Monthly Cost Trend', 'width': 4, 'height': 7, 'horizontalOffset': 0, 'configs': [{'displayConfig': {'graph': {'costTrend': {'visualType': 'LINE'}}}, 'queryParameters': {'costAndUsage': {'granularity': 'MONTHLY', 'groupBy': [{'key': 'SERVICE', 'type': 'DIMENSION'}], 'metrics': ['UnblendedCost'], 'timeRange': {'endTime': {'type': 'RELATIVE', 'value': 'now'}, 'startTime': {'type': 'RELATIVE', 'value': '-9M'}}}}}]}])
Source code in docs_src/capo_bcm_dashboards/_services/async_bcm_dashboards.py
async def create_dashboard(
    self,
    name: "capo_bcm_dashboards.types.dashboard_name.DashboardName",
    widgets: "capo_bcm_dashboards.types.widget_list.WidgetList",
    *,
    config_overrides: Optional[AsyncBCMDashboardsClientConfig] = None,
    description: Optional[
        "capo_bcm_dashboards.types.description.Description"
    ] = None,
    resource_tags: Optional[
        "capo_bcm_dashboards.types.resource_tag_list.ResourceTagList"
    ] = None,
) -> "capo_bcm_dashboards.types.create_dashboard_response.CreateDashboardResponse":
    """<p>Creates a new dashboard that can contain multiple widgets displaying cost and usage data. You can add custom widgets or use predefined widgets, arranging them in your preferred layout.</p>

    Args:
        name: <p>The name of the dashboard. The name must be unique within your account.</p>
        description: <p>A description of the dashboard's purpose or contents.</p>
        widgets: <p>An array of widget configurations that define the visualizations to be displayed in the dashboard. Each dashboard can contain up to 20 widgets.</p>
        resource_tags: <p>The tags to apply to the dashboard resource for organization and management.</p>

    Raises:
        capo_bcm_dashboards.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action. Verify your IAM permissions and any resource policies.</p>
        capo_bcm_dashboards.errors.internal_server_exception.InternalServerException: <p>An internal error occurred while processing the request. Retry your request. If the problem persists, contact Amazon Web Services Support.</p>
        capo_bcm_dashboards.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would exceed a service quota. Review the service quotas for Amazon Web Services Billing and Cost Management Dashboards and retry your request.</p>
        capo_bcm_dashboards.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling. Reduce the frequency of requests and use exponential backoff.</p>
        capo_bcm_dashboards.errors.validation_exception.ValidationException: <p>The input parameters do not satisfy the requirements. Check the error message for specific validation details.</p>
        capo_bcm_dashboards.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        Creating a dashboard

        >>> await client.create_dashboard(name='cost-dashboards', description='Dashboard for tracking costs', widgets=[{'title': 'Monthly Cost Trend', 'width': 4, 'height': 7, 'horizontalOffset': 0, 'configs': [{'displayConfig': {'graph': {'costTrend': {'visualType': 'LINE'}}}, 'queryParameters': {'costAndUsage': {'granularity': 'MONTHLY', 'groupBy': [{'key': 'SERVICE', 'type': 'DIMENSION'}], 'metrics': ['UnblendedCost'], 'timeRange': {'endTime': {'type': 'RELATIVE', 'value': 'now'}, 'startTime': {'type': 'RELATIVE', 'value': '-9M'}}}}}]}])
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_bcm_dashboards.types.create_dashboard_request.CreateDashboardRequest]",
    ) -> AsyncOperationResponse[
        "capo_bcm_dashboards.types.create_dashboard_response.CreateDashboardResponse"
    ]:
        import capo_bcm_dashboards._operations.awsbcm_dashboards_service.create_dashboard

        (
            output,
            http_response,
        ) = await capo_bcm_dashboards._operations.awsbcm_dashboards_service.create_dashboard.async_create_dashboard(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateDashboard")
    )
    input_: capo_bcm_dashboards.types.create_dashboard_request.CreateDashboardRequest = {
        "name": name,
        "widgets": widgets,
    }
    if description is not None:
        input_["description"] = description
    if resource_tags is not None:
        input_["resource_tags"] = resource_tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output