Skip to content

create_workspace async

create_workspace(
    account_access_type: AccountAccessType,
    permission_type: PermissionType,
    authentication_providers: AuthenticationProviders,
    *,
    config_overrides: Optional[AsyncgrafanaClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    organization_role_name: Optional[OrganizationRoleName] = None,
    stack_set_name: Optional[StackSetName] = None,
    workspace_data_sources: Optional[DataSourceTypesList] = None,
    workspace_description: Optional[Description] = None,
    workspace_name: Optional[WorkspaceName] = None,
    workspace_notification_destinations: Optional[NotificationDestinationsList] = None,
    workspace_organizational_units: Optional[OrganizationalUnitList] = None,
    workspace_role_arn: Optional[IamRoleArn] = None,
    tags: Optional[TagMap] = None,
    vpc_configuration: Optional[VpcConfiguration] = None,
    configuration: Optional[OverridableConfigurationJson] = None,
    network_access_control: Optional[NetworkAccessConfiguration] = None,
    grafana_version: Optional[GrafanaVersion] = None,
    ip_address_type: Optional[IPAddressType] = None,
    kms_key_id: Optional[KmsKeyId] = None,
) -> CreateWorkspaceResponse

Creates a workspace. In a workspace, you can create Grafana dashboards and visualizations to analyze your metrics, logs, and traces. You don't have to build, package, or deploy any hardware to run the Grafana server.

Don't use CreateWorkspace to modify an existing workspace. Instead, use UpdateWorkspace.

Parameters:

  • account_access_type (AccountAccessType) –

    Specifies whether the workspace can access Amazon Web Services resources in this Amazon Web Services account only, or whether it can also access Amazon Web Services resources in other accounts in the same organization. If you specify ORGANIZATION, you must specify which organizational units the workspace can access in the workspaceOrganizationalUnits parameter.

  • client_token (Optional[ClientToken], default: None ) –

    A unique, case-sensitive, user-provided identifier to ensure the idempotency of the request.

  • organization_role_name (Optional[OrganizationRoleName], default: None ) –

    The name of an IAM role that already exists to use with Organizations to access Amazon Web Services data sources and notification channels in other accounts in an organization.

  • permission_type (PermissionType) –

    When creating a workspace through the Amazon Web Services API, CLI or Amazon Web Services CloudFormation, you must manage IAM roles and provision the permissions that the workspace needs to use Amazon Web Services data sources and notification channels.

    You must also specify a workspaceRoleArn for a role that you will manage for the workspace to use when accessing those datasources and notification channels.

    The ability for Amazon Managed Grafana to create and update IAM roles on behalf of the user is supported only in the Amazon Managed Grafana console, where this value may be set to SERVICE_MANAGED.

    Use only the CUSTOMER_MANAGED permission type when creating a workspace with the API, CLI or Amazon Web Services CloudFormation.

    For more information, see Amazon Managed Grafana permissions and policies for Amazon Web Services data sources and notification channels.

  • stack_set_name (Optional[StackSetName], default: None ) –

    The name of the CloudFormation stack set to use to generate IAM roles to be used for this workspace.

  • workspace_data_sources (Optional[DataSourceTypesList], default: None ) –

    This parameter is for internal use only, and should not be used.

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

    A description for the workspace. This is used only to help you identify this workspace.

    Pattern: ^[\\p{L}\\p{Z}\\p{N}\\p{P}]{0,2048}$

  • workspace_name (Optional[WorkspaceName], default: None ) –

    The name for the workspace. It does not have to be unique.

  • workspace_notification_destinations (Optional[NotificationDestinationsList], default: None ) –

    Specify the Amazon Web Services notification channels that you plan to use in this workspace. Specifying these data sources here enables Amazon Managed Grafana to create IAM roles and permissions that allow Amazon Managed Grafana to use these channels.

  • workspace_organizational_units (Optional[OrganizationalUnitList], default: None ) –

    Specifies the organizational units that this workspace is allowed to use data sources from, if this workspace is in an account that is part of an organization.

  • workspace_role_arn (Optional[IamRoleArn], default: None ) –

    Specified the IAM role that grants permissions to the Amazon Web Services resources that the workspace will view data from, including both data sources and notification channels. You are responsible for managing the permissions for this role as new data sources or notification channels are added.

  • authentication_providers (AuthenticationProviders) –

    Specifies whether this workspace uses SAML 2.0, IAM Identity Center, or both to authenticate users for using the Grafana console within a workspace. For more information, see User authentication in Amazon Managed Grafana.

  • tags (Optional[TagMap], default: None ) –

    The list of tags associated with the workspace.

  • vpc_configuration (Optional[VpcConfiguration], default: None ) –

    The configuration settings for an Amazon VPC that contains data sources for your Grafana workspace to connect to.

    Connecting to a private VPC is not yet available in the Asia Pacific (Seoul) Region (ap-northeast-2).

  • configuration (Optional[OverridableConfigurationJson], default: None ) –

    The configuration string for the workspace that you create. For more information about the format and configuration options available, see Working in your Grafana workspace.

  • network_access_control (Optional[NetworkAccessConfiguration], default: None ) –

    Configuration for network access to your workspace.

    When this is configured, only listed IP addresses and VPC endpoints will be able to access your workspace. Standard Grafana authentication and authorization will still be required.

    If this is not configured, or is removed, then all IP addresses and VPC endpoints will be allowed. Standard Grafana authentication and authorization will still be required.

  • grafana_version (Optional[GrafanaVersion], default: None ) –

    Specifies the version of Grafana to support in the new workspace. If not specified, defaults to the latest version (for example, 10.4).

    To get a list of supported versions, use the ListVersions operation.

  • ip_address_type (Optional[IPAddressType], default: None ) –

    Specifies whether the workspace supports IPv4 only, or IPv4 and IPv6. Valid values are IPv4 and DualStack. For more information about IP address types, see Network access control.

  • kms_key_id (Optional[KmsKeyId], default: None ) –

    The ID or ARN of the Key Management Service key to use for encrypting workspace data.

Raises:

Source code in docs_src/capo_grafana/_services/async_grafana.py
async def create_workspace(
    self,
    account_access_type: "capo_grafana.types.account_access_type.AccountAccessType",
    permission_type: "capo_grafana.types.permission_type.PermissionType",
    authentication_providers: "capo_grafana.types.authentication_providers.AuthenticationProviders",
    *,
    config_overrides: Optional[AsyncgrafanaClientConfig] = None,
    client_token: Optional["capo_grafana.types.client_token.ClientToken"] = None,
    organization_role_name: Optional[
        "capo_grafana.types.organization_role_name.OrganizationRoleName"
    ] = None,
    stack_set_name: Optional[
        "capo_grafana.types.stack_set_name.StackSetName"
    ] = None,
    workspace_data_sources: Optional[
        "capo_grafana.types.data_source_types_list.DataSourceTypesList"
    ] = None,
    workspace_description: Optional[
        "capo_grafana.types.description.Description"
    ] = None,
    workspace_name: Optional[
        "capo_grafana.types.workspace_name.WorkspaceName"
    ] = None,
    workspace_notification_destinations: Optional[
        "capo_grafana.types.notification_destinations_list.NotificationDestinationsList"
    ] = None,
    workspace_organizational_units: Optional[
        "capo_grafana.types.organizational_unit_list.OrganizationalUnitList"
    ] = None,
    workspace_role_arn: Optional[
        "capo_grafana.types.iam_role_arn.IamRoleArn"
    ] = None,
    tags: Optional["capo_grafana.types.tag_map.TagMap"] = None,
    vpc_configuration: Optional[
        "capo_grafana.types.vpc_configuration.VpcConfiguration"
    ] = None,
    configuration: Optional[
        "capo_grafana.types.overridable_configuration_json.OverridableConfigurationJson"
    ] = None,
    network_access_control: Optional[
        "capo_grafana.types.network_access_configuration.NetworkAccessConfiguration"
    ] = None,
    grafana_version: Optional[
        "capo_grafana.types.grafana_version.GrafanaVersion"
    ] = None,
    ip_address_type: Optional[
        "capo_grafana.types.ip_address_type.IPAddressType"
    ] = None,
    kms_key_id: Optional["capo_grafana.types.kms_key_id.KmsKeyId"] = None,
) -> "capo_grafana.types.create_workspace_response.CreateWorkspaceResponse":
    r"""<p>Creates a <i>workspace</i>. In a workspace, you can create Grafana dashboards and visualizations to analyze your metrics, logs, and traces. You don't have to build, package, or deploy any hardware to run the Grafana server.</p> <p>Don't use <code>CreateWorkspace</code> to modify an existing workspace. Instead, use <a href="https://docs.aws.amazon.com/grafana/latest/APIReference/API_UpdateWorkspace.html">UpdateWorkspace</a>.</p>

    Args:
        account_access_type: <p>Specifies whether the workspace can access Amazon Web Services resources in this Amazon Web Services account only, or whether it can also access Amazon Web Services resources in other accounts in the same organization. If you specify <code>ORGANIZATION</code>, you must specify which organizational units the workspace can access in the <code>workspaceOrganizationalUnits</code> parameter.</p>
        client_token: <p>A unique, case-sensitive, user-provided identifier to ensure the idempotency of the request.</p>
        organization_role_name: <p>The name of an IAM role that already exists to use with Organizations to access Amazon Web Services data sources and notification channels in other accounts in an organization.</p>
        permission_type: <p>When creating a workspace through the Amazon Web Services API, CLI or Amazon Web Services CloudFormation, you must manage IAM roles and provision the permissions that the workspace needs to use Amazon Web Services data sources and notification channels.</p> <p>You must also specify a <code>workspaceRoleArn</code> for a role that you will manage for the workspace to use when accessing those datasources and notification channels.</p> <p>The ability for Amazon Managed Grafana to create and update IAM roles on behalf of the user is supported only in the Amazon Managed Grafana console, where this value may be set to <code>SERVICE_MANAGED</code>.</p> <note> <p>Use only the <code>CUSTOMER_MANAGED</code> permission type when creating a workspace with the API, CLI or Amazon Web Services CloudFormation. </p> </note> <p>For more information, see <a href="https://docs.aws.amazon.com/grafana/latest/userguide/AMG-manage-permissions.html">Amazon Managed Grafana permissions and policies for Amazon Web Services data sources and notification channels</a>.</p>
        stack_set_name: <p>The name of the CloudFormation stack set to use to generate IAM roles to be used for this workspace.</p>
        workspace_data_sources: <p>This parameter is for internal use only, and should not be used.</p>
        workspace_description: <p>A description for the workspace. This is used only to help you identify this workspace.</p> <p>Pattern: <code>^[\\p{L}\\p{Z}\\p{N}\\p{P}]{0,2048}$</code> </p>
        workspace_name: <p>The name for the workspace. It does not have to be unique.</p>
        workspace_notification_destinations: <p>Specify the Amazon Web Services notification channels that you plan to use in this workspace. Specifying these data sources here enables Amazon Managed Grafana to create IAM roles and permissions that allow Amazon Managed Grafana to use these channels.</p>
        workspace_organizational_units: <p>Specifies the organizational units that this workspace is allowed to use data sources from, if this workspace is in an account that is part of an organization.</p>
        workspace_role_arn: <p>Specified the IAM role that grants permissions to the Amazon Web Services resources that the workspace will view data from, including both data sources and notification channels. You are responsible for managing the permissions for this role as new data sources or notification channels are added. </p>
        authentication_providers: <p>Specifies whether this workspace uses SAML 2.0, IAM Identity Center, or both to authenticate users for using the Grafana console within a workspace. For more information, see <a href="https://docs.aws.amazon.com/grafana/latest/userguide/authentication-in-AMG.html">User authentication in Amazon Managed Grafana</a>.</p>
        tags: <p>The list of tags associated with the workspace.</p>
        vpc_configuration: <p>The configuration settings for an Amazon VPC that contains data sources for your Grafana workspace to connect to.</p> <note> <p>Connecting to a private VPC is not yet available in the Asia Pacific (Seoul) Region (ap-northeast-2).</p> </note>
        configuration: <p>The configuration string for the workspace that you create. For more information about the format and configuration options available, see <a href="https://docs.aws.amazon.com/grafana/latest/userguide/AMG-configure-workspace.html">Working in your Grafana workspace</a>.</p>
        network_access_control: <p>Configuration for network access to your workspace.</p> <p>When this is configured, only listed IP addresses and VPC endpoints will be able to access your workspace. Standard Grafana authentication and authorization will still be required.</p> <p>If this is not configured, or is removed, then all IP addresses and VPC endpoints will be allowed. Standard Grafana authentication and authorization will still be required.</p>
        grafana_version: <p>Specifies the version of Grafana to support in the new workspace. If not specified, defaults to the latest version (for example, 10.4).</p> <p>To get a list of supported versions, use the <code>ListVersions</code> operation.</p>
        ip_address_type: <p>Specifies whether the workspace supports IPv4 only, or IPv4 and IPv6. Valid values are <code>IPv4</code> and <code>DualStack</code>. For more information about IP address types, see <a href="https://docs.aws.amazon.com/grafana/latest/userguide/AMG-configure-nac.html">Network access control</a>.</p>
        kms_key_id: <p>The ID or ARN of the Key Management Service key to use for encrypting workspace data.</p>

    Raises:
        capo_grafana.errors.access_denied_exception.AccessDeniedException: <p>You do not have sufficient permissions to perform this action. </p>
        capo_grafana.errors.conflict_exception.ConflictException: <p>A resource was in an inconsistent state during an update or a deletion.</p>
        capo_grafana.errors.internal_server_exception.InternalServerException: <p>Unexpected error while processing the request. Retry the request.</p>
        capo_grafana.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>The request would cause a service quota to be exceeded.</p>
        capo_grafana.errors.throttling_exception.ThrottlingException: <p>The request was denied because of request throttling. Retry the request.</p>
        capo_grafana.errors.validation_exception.ValidationException: <p>The value of a parameter in the request caused an error.</p>
        capo_grafana.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_grafana.types.create_workspace_request.CreateWorkspaceRequest]",
    ) -> AsyncOperationResponse[
        "capo_grafana.types.create_workspace_response.CreateWorkspaceResponse"
    ]:
        import capo_grafana._operations.aws_grafana_control_plane.create_workspace

        (
            output,
            http_response,
        ) = await capo_grafana._operations.aws_grafana_control_plane.create_workspace.async_create_workspace(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_grafana.types.create_workspace_request.CreateWorkspaceRequest",
    ) -> dict[str, Any]:
        import capo_grafana.types.create_workspace_request

        return capo_grafana.types.create_workspace_request.redact_sensitive(input_)

    def _redact_output(
        output: "capo_grafana.types.create_workspace_response.CreateWorkspaceResponse",
    ) -> dict[str, Any]:
        import capo_grafana.types.create_workspace_response

        return capo_grafana.types.create_workspace_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateWorkspace",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_grafana.types.create_workspace_request.CreateWorkspaceRequest = {
        "account_access_type": account_access_type,
        "permission_type": permission_type,
        "authentication_providers": authentication_providers,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if organization_role_name is not None:
        input_["organization_role_name"] = organization_role_name
    if stack_set_name is not None:
        input_["stack_set_name"] = stack_set_name
    if workspace_data_sources is not None:
        input_["workspace_data_sources"] = workspace_data_sources
    if workspace_description is not None:
        input_["workspace_description"] = workspace_description
    if workspace_name is not None:
        input_["workspace_name"] = workspace_name
    if workspace_notification_destinations is not None:
        input_["workspace_notification_destinations"] = (
            workspace_notification_destinations
        )
    if workspace_organizational_units is not None:
        input_["workspace_organizational_units"] = workspace_organizational_units
    if workspace_role_arn is not None:
        input_["workspace_role_arn"] = workspace_role_arn
    if tags is not None:
        input_["tags"] = tags
    if vpc_configuration is not None:
        input_["vpc_configuration"] = vpc_configuration
    if configuration is not None:
        input_["configuration"] = configuration
    if network_access_control is not None:
        input_["network_access_control"] = network_access_control
    if grafana_version is not None:
        input_["grafana_version"] = grafana_version
    if ip_address_type is not None:
        input_["ip_address_type"] = ip_address_type
    if kms_key_id is not None:
        input_["kms_key_id"] = kms_key_id

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