Skip to content

update_workspace

update_workspace(
    workspace_id: WorkspaceId,
    *,
    config_overrides: Optional[grafanaClientConfig] = None,
    account_access_type: Optional[AccountAccessType] = None,
    organization_role_name: Optional[OrganizationRoleName] = None,
    permission_type: Optional[PermissionType] = 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,
    vpc_configuration: Optional[VpcConfiguration] = None,
    remove_vpc_configuration: Optional[bool] = None,
    network_access_control: Optional[NetworkAccessConfiguration] = None,
    remove_network_access_configuration: Optional[bool] = None,
    ip_address_type: Optional[IPAddressType] = None,
) -> UpdateWorkspaceResponse

Modifies an existing Amazon Managed Grafana workspace. If you use this operation and omit any optional parameters, the existing values of those parameters are not changed.

To modify the user authentication methods that the workspace uses, such as SAML or IAM Identity Center, use UpdateWorkspaceAuthentication.

To modify which users in the workspace have the Admin and Editor Grafana roles, use UpdatePermissions.

Parameters:

  • account_access_type (Optional[AccountAccessType], default: None ) –

    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.

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

    The name of an IAM role that already exists to use to access resources through Organizations. This can only be used with a workspace that has the permissionType set to CUSTOMER_MANAGED.

  • permission_type (Optional[PermissionType], default: None ) –

    Use this parameter if you want to change a workspace from SERVICE_MANAGED to CUSTOMER_MANAGED. This allows you to manage the permissions that the workspace uses to access datasources and notification channels. If the workspace is in a member Amazon Web Services account of an organization, and that account is not a delegated administrator account, and you want the workspace to access data sources in other Amazon Web Services accounts in the organization, you must choose CUSTOMER_MANAGED.

    If you specify this as CUSTOMER_MANAGED, you must also specify a workspaceRoleArn that the workspace will use for accessing Amazon Web Services resources.

    For more information on the role and permissions needed, see Amazon Managed Grafana permissions and policies for Amazon Web Services data sources and notification channels

    Do not use this to convert a CUSTOMER_MANAGED workspace to SERVICE_MANAGED. Do not include this parameter if you want to leave the workspace as SERVICE_MANAGED.

    You can convert a CUSTOMER_MANAGED workspace to SERVICE_MANAGED using the Amazon Managed Grafana console. For more information, see Managing permissions for 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.

  • workspace_id (WorkspaceId) –

    The ID of the workspace to update.

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

    A new name for the workspace to update.

  • 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 ) –

    Specifies an IAM role that grants permissions to Amazon Web Services resources that the workspace accesses, such as data sources and notification channels. If this workspace has permissionType CUSTOMER_MANAGED, then this role is required.

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

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

  • remove_vpc_configuration (Optional[bool], default: None ) –

    Whether to remove the VPC configuration from the workspace.

    Setting this to true and providing a vpcConfiguration to set will return an error.

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

    The configuration settings 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.

  • remove_network_access_configuration (Optional[bool], default: None ) –

    Whether to remove the network access configuration from the workspace.

    Setting this to true and providing a networkAccessControl to set will return an error.

    If you remove this configuration by setting this to true, then all IP addresses and VPC endpoints will be allowed. Standard Grafana authentication and authorization will still be required.

  • 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.

Raises:

Source code in docs_src/capo_grafana/_services/grafana.py
def update_workspace(
    self,
    workspace_id: "capo_grafana.types.workspace_id.WorkspaceId",
    *,
    config_overrides: Optional[grafanaClientConfig] = None,
    account_access_type: Optional[
        "capo_grafana.types.account_access_type.AccountAccessType"
    ] = None,
    organization_role_name: Optional[
        "capo_grafana.types.organization_role_name.OrganizationRoleName"
    ] = None,
    permission_type: Optional[
        "capo_grafana.types.permission_type.PermissionType"
    ] = 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,
    vpc_configuration: Optional[
        "capo_grafana.types.vpc_configuration.VpcConfiguration"
    ] = None,
    remove_vpc_configuration: Optional[bool] = None,
    network_access_control: Optional[
        "capo_grafana.types.network_access_configuration.NetworkAccessConfiguration"
    ] = None,
    remove_network_access_configuration: Optional[bool] = None,
    ip_address_type: Optional[
        "capo_grafana.types.ip_address_type.IPAddressType"
    ] = None,
) -> "capo_grafana.types.update_workspace_response.UpdateWorkspaceResponse":
    """<p>Modifies an existing Amazon Managed Grafana workspace. If you use this operation and omit any optional parameters, the existing values of those parameters are not changed.</p> <p>To modify the user authentication methods that the workspace uses, such as SAML or IAM Identity Center, use <a href="https://docs.aws.amazon.com/grafana/latest/APIReference/API_UpdateWorkspaceAuthentication.html">UpdateWorkspaceAuthentication</a>.</p> <p>To modify which users in the workspace have the <code>Admin</code> and <code>Editor</code> Grafana roles, use <a href="https://docs.aws.amazon.com/grafana/latest/APIReference/API_UpdatePermissions.html">UpdatePermissions</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>
        organization_role_name: <p>The name of an IAM role that already exists to use to access resources through Organizations. This can only be used with a workspace that has the <code>permissionType</code> set to <code>CUSTOMER_MANAGED</code>.</p>
        permission_type: <p>Use this parameter if you want to change a workspace from <code>SERVICE_MANAGED</code> to <code>CUSTOMER_MANAGED</code>. This allows you to manage the permissions that the workspace uses to access datasources and notification channels. If the workspace is in a member Amazon Web Services account of an organization, and that account is not a delegated administrator account, and you want the workspace to access data sources in other Amazon Web Services accounts in the organization, you must choose <code>CUSTOMER_MANAGED</code>.</p> <p>If you specify this as <code>CUSTOMER_MANAGED</code>, you must also specify a <code>workspaceRoleArn</code> that the workspace will use for accessing Amazon Web Services resources.</p> <p>For more information on the role and permissions needed, 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> <note> <p>Do not use this to convert a <code>CUSTOMER_MANAGED</code> workspace to <code>SERVICE_MANAGED</code>. Do not include this parameter if you want to leave the workspace as <code>SERVICE_MANAGED</code>.</p> <p>You can convert a <code>CUSTOMER_MANAGED</code> workspace to <code>SERVICE_MANAGED</code> using the Amazon Managed Grafana console. For more information, see <a href="https://docs.aws.amazon.com/grafana/latest/userguide/AMG-datasource-and-notification.html">Managing permissions for data sources and notification channels</a>.</p> </note>
        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>
        workspace_id: <p>The ID of the workspace to update.</p>
        workspace_name: <p>A new name for the workspace to update.</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>Specifies an IAM role that grants permissions to Amazon Web Services resources that the workspace accesses, such as data sources and notification channels. If this workspace has <code>permissionType</code> <code>CUSTOMER_MANAGED</code>, then this role is required.</p>
        vpc_configuration: <p>The configuration settings for an Amazon VPC that contains data sources for your Grafana workspace to connect to.</p>
        remove_vpc_configuration: <p>Whether to remove the VPC configuration from the workspace.</p> <p>Setting this to <code>true</code> and providing a <code>vpcConfiguration</code> to set will return an error.</p>
        network_access_control: <p>The configuration settings 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>
        remove_network_access_configuration: <p>Whether to remove the network access configuration from the workspace.</p> <p>Setting this to <code>true</code> and providing a <code>networkAccessControl</code> to set will return an error.</p> <p>If you remove this configuration by setting this to <code>true</code>, then all IP addresses and VPC endpoints will be allowed. Standard Grafana authentication and authorization will still be required.</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>

    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.resource_not_found_exception.ResourceNotFoundException: <p>The request references a resource that does not exist.</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.
    """

    def _handler(
        req: "OperationRequest[capo_grafana.types.update_workspace_request.UpdateWorkspaceRequest]",
    ) -> OperationResponse[
        "capo_grafana.types.update_workspace_response.UpdateWorkspaceResponse"
    ]:
        import capo_grafana._operations.aws_grafana_control_plane.update_workspace

        output, http_response = (
            capo_grafana._operations.aws_grafana_control_plane.update_workspace.update_workspace(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

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

        return capo_grafana.types.update_workspace_request.redact_sensitive(input_)

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

        return capo_grafana.types.update_workspace_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "UpdateWorkspace",
            redact_input=_redact_input,
            redact_output=_redact_output,
        ),
    )
    input_: capo_grafana.types.update_workspace_request.UpdateWorkspaceRequest = {
        "workspace_id": workspace_id
    }
    if account_access_type is not None:
        input_["account_access_type"] = account_access_type
    if organization_role_name is not None:
        input_["organization_role_name"] = organization_role_name
    if permission_type is not None:
        input_["permission_type"] = permission_type
    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 vpc_configuration is not None:
        input_["vpc_configuration"] = vpc_configuration
    if remove_vpc_configuration is not None:
        input_["remove_vpc_configuration"] = remove_vpc_configuration
    if network_access_control is not None:
        input_["network_access_control"] = network_access_control
    if remove_network_access_configuration is not None:
        input_["remove_network_access_configuration"] = (
            remove_network_access_configuration
        )
    if ip_address_type is not None:
        input_["ip_address_type"] = ip_address_type

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output