Skip to content

create_studio_session_mapping

create_studio_session_mapping(
    *,
    config_overrides: Optional[EMRClientConfig] = None,
    studio_id: Optional[XmlStringMaxLen256] = None,
    identity_id: Optional[XmlStringMaxLen256] = None,
    identity_name: Optional[XmlStringMaxLen256] = None,
    identity_type: Optional[IdentityType] = None,
    session_policy_arn: Optional[XmlStringMaxLen256] = None,
) -> None

Maps a user or group to the Amazon EMR Studio specified by StudioId, and applies a session policy to refine Studio permissions for that user or group. Use CreateStudioSessionMapping to assign users to a Studio when you use IAM Identity Center authentication. For instructions on how to assign users to a Studio when you use IAM authentication, see Assign a user or group to your EMR Studio.

Parameters:

  • studio_id (Optional[XmlStringMaxLen256], default: None ) –

    The ID of the Amazon EMR Studio to which the user or group will be mapped.

  • identity_id (Optional[XmlStringMaxLen256], default: None ) –

    The globally unique identifier (GUID) of the user or group from the IAM Identity Center Identity Store. For more information, see UserId and GroupId in the IAM Identity Center Identity Store API Reference. Either IdentityName or IdentityId must be specified, but not both.

  • identity_name (Optional[XmlStringMaxLen256], default: None ) –

    The name of the user or group. For more information, see UserName and DisplayName in the IAM Identity Center Identity Store API Reference. Either IdentityName or IdentityId must be specified, but not both.

  • identity_type (Optional[IdentityType], default: None ) –

    Specifies whether the identity to map to the Amazon EMR Studio is a user or a group.

  • session_policy_arn (Optional[XmlStringMaxLen256], default: None ) –

    The Amazon Resource Name (ARN) for the session policy that will be applied to the user or group. You should specify the ARN for the session policy that you want to apply, not the ARN of your user role. For more information, see Create an Amazon EMR Studio User Role with Session Policies.

Raises:

  • InternalServerError –

    Indicates that an error occurred while processing the request and that the request was not completed.

  • InvalidRequestException –

    This exception occurs when there is something wrong with user input.

  • UnknownServiceError –

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

Source code in docs_src/capo_emr/_services/emr.py
def create_studio_session_mapping(
    self,
    *,
    config_overrides: Optional[EMRClientConfig] = None,
    studio_id: Optional[
        "capo_emr.types.xml_string_max_len256.XmlStringMaxLen256"
    ] = None,
    identity_id: Optional[
        "capo_emr.types.xml_string_max_len256.XmlStringMaxLen256"
    ] = None,
    identity_name: Optional[
        "capo_emr.types.xml_string_max_len256.XmlStringMaxLen256"
    ] = None,
    identity_type: Optional["capo_emr.types.identity_type.IdentityType"] = None,
    session_policy_arn: Optional[
        "capo_emr.types.xml_string_max_len256.XmlStringMaxLen256"
    ] = None,
) -> None:
    """<p>Maps a user or group to the Amazon EMR Studio specified by <code>StudioId</code>, and applies a session policy to refine Studio permissions for that user or group. Use <code>CreateStudioSessionMapping</code> to assign users to a Studio when you use IAM Identity Center authentication. For instructions on how to assign users to a Studio when you use IAM authentication, see <a href="https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-studio-manage-users.html#emr-studio-assign-users-groups">Assign a user or group to your EMR Studio</a>.</p>

    Args:
        studio_id: <p>The ID of the Amazon EMR Studio to which the user or group will be mapped.</p>
        identity_id: <p>The globally unique identifier (GUID) of the user or group from the IAM Identity Center Identity Store. For more information, see <a href="https://docs.aws.amazon.com/singlesignon/latest/IdentityStoreAPIReference/API_User.html#singlesignon-Type-User-UserId">UserId</a> and <a href="https://docs.aws.amazon.com/singlesignon/latest/IdentityStoreAPIReference/API_Group.html#singlesignon-Type-Group-GroupId">GroupId</a> in the <i>IAM Identity Center Identity Store API Reference</i>. Either <code>IdentityName</code> or <code>IdentityId</code> must be specified, but not both.</p>
        identity_name: <p>The name of the user or group. For more information, see <a href="https://docs.aws.amazon.com/singlesignon/latest/IdentityStoreAPIReference/API_User.html#singlesignon-Type-User-UserName">UserName</a> and <a href="https://docs.aws.amazon.com/singlesignon/latest/IdentityStoreAPIReference/API_Group.html#singlesignon-Type-Group-DisplayName">DisplayName</a> in the <i>IAM Identity Center Identity Store API Reference</i>. Either <code>IdentityName</code> or <code>IdentityId</code> must be specified, but not both.</p>
        identity_type: <p>Specifies whether the identity to map to the Amazon EMR Studio is a user or a group.</p>
        session_policy_arn: <p>The Amazon Resource Name (ARN) for the session policy that will be applied to the user or group. You should specify the ARN for the session policy that you want to apply, not the ARN of your user role. For more information, see <a href="https://docs.aws.amazon.com/emr/latest/ManagementGuide/emr-studio-user-role.html">Create an Amazon EMR Studio User Role with Session Policies</a>.</p>

    Raises:
        capo_emr.errors.internal_server_error.InternalServerError: <p>Indicates that an error occurred while processing the request and that the request was not completed.</p>
        capo_emr.errors.invalid_request_exception.InvalidRequestException: <p>This exception occurs when there is something wrong with user input.</p>
        capo_emr.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_emr.types.create_studio_session_mapping_input.CreateStudioSessionMappingInput]",
    ) -> OperationResponse[None]:
        import capo_emr._operations.elastic_map_reduce.create_studio_session_mapping

        output, http_response = (
            capo_emr._operations.elastic_map_reduce.create_studio_session_mapping.create_studio_session_mapping(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateStudioSessionMapping")
    )
    input_: capo_emr.types.create_studio_session_mapping_input.CreateStudioSessionMappingInput = {}
    if studio_id is not None:
        input_["studio_id"] = studio_id
    if identity_id is not None:
        input_["identity_id"] = identity_id
    if identity_name is not None:
        input_["identity_name"] = identity_name
    if identity_type is not None:
        input_["identity_type"] = identity_type
    if session_policy_arn is not None:
        input_["session_policy_arn"] = session_policy_arn

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