Skip to content

create_participant_token

create_participant_token(
    stage_arn: StageArn,
    *,
    config_overrides: Optional[IVSRealTimeClientConfig] = None,
    duration: Optional[ParticipantTokenDurationMinutes] = None,
    user_id: Optional[ParticipantTokenUserId] = None,
    attributes: Optional[ParticipantTokenAttributes] = None,
    capabilities: Optional[ParticipantTokenCapabilities] = None,
) -> CreateParticipantTokenResponse

Creates an additional token for a specified stage. This can be done after stage creation or when tokens expire. Tokens always are scoped to the stage for which they are created.

Encryption keys are owned by Amazon IVS and never used directly by your application.

Parameters:

  • stage_arn (StageArn) –

    ARN of the stage to which this token is scoped.

  • duration (Optional[ParticipantTokenDurationMinutes], default: None ) –

    Duration (in minutes), after which the token expires. Default: 720 (12 hours).

  • user_id (Optional[ParticipantTokenUserId], default: None ) –

    Name that can be specified to help identify the token. This can be any UTF-8 encoded text. This field is exposed to all stage participants and should not be used for personally identifying, confidential, or sensitive information.

  • attributes (Optional[ParticipantTokenAttributes], default: None ) –

    Application-provided attributes to encode into the token and attach to a stage. Map keys and values can contain UTF-8 encoded text. The maximum length of this field is 1 KB total. This field is exposed to all stage participants and should not be used for personally identifying, confidential, or sensitive information.

  • capabilities (Optional[ParticipantTokenCapabilities], default: None ) –

    Set of capabilities that the user is allowed to perform in the stage. Default: PUBLISH, SUBSCRIBE.

Raises:

Source code in docs_src/capo_ivs_realtime/_services/ivs_real_time.py
def create_participant_token(
    self,
    stage_arn: "capo_ivs_realtime.types.stage_arn.StageArn",
    *,
    config_overrides: Optional[IVSRealTimeClientConfig] = None,
    duration: Optional[
        "capo_ivs_realtime.types.participant_token_duration_minutes.ParticipantTokenDurationMinutes"
    ] = None,
    user_id: Optional[
        "capo_ivs_realtime.types.participant_token_user_id.ParticipantTokenUserId"
    ] = None,
    attributes: Optional[
        "capo_ivs_realtime.types.participant_token_attributes.ParticipantTokenAttributes"
    ] = None,
    capabilities: Optional[
        "capo_ivs_realtime.types.participant_token_capabilities.ParticipantTokenCapabilities"
    ] = None,
) -> "capo_ivs_realtime.types.create_participant_token_response.CreateParticipantTokenResponse":
    """<p>Creates an additional token for a specified stage. This can be done after stage creation or when tokens expire. Tokens always are scoped to the stage for which they are created.</p> <p>Encryption keys are owned by Amazon IVS and never used directly by your application.</p>

    Args:
        stage_arn: <p>ARN of the stage to which this token is scoped.</p>
        duration: <p>Duration (in minutes), after which the token expires. Default: 720 (12 hours).</p>
        user_id: <p>Name that can be specified to help identify the token. This can be any UTF-8 encoded text. <i>This field is exposed to all stage participants and should not be used for personally identifying, confidential, or sensitive information.</i> </p>
        attributes: <p>Application-provided attributes to encode into the token and attach to a stage. Map keys and values can contain UTF-8 encoded text. The maximum length of this field is 1 KB total. <i>This field is exposed to all stage participants and should not be used for personally identifying, confidential, or sensitive information.</i> </p>
        capabilities: <p>Set of capabilities that the user is allowed to perform in the stage. Default: <code>PUBLISH, SUBSCRIBE</code>.</p>

    Raises:
        capo_ivs_realtime.errors.access_denied_exception.AccessDeniedException: <p>User does not have sufficient access to perform this action.</p>
        capo_ivs_realtime.errors.pending_verification.PendingVerification: <p>Your account is pending verification.</p>
        capo_ivs_realtime.errors.resource_not_found_exception.ResourceNotFoundException: <p>Request references a resource which does not exist.</p>
        capo_ivs_realtime.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>Request would cause a service quota to be exceeded.</p>
        capo_ivs_realtime.errors.validation_exception.ValidationException: <p>The input fails to satisfy the constraints specified by an Amazon Web Services service.</p>
        capo_ivs_realtime.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_ivs_realtime.types.create_participant_token_request.CreateParticipantTokenRequest]",
    ) -> OperationResponse[
        "capo_ivs_realtime.types.create_participant_token_response.CreateParticipantTokenResponse"
    ]:
        import capo_ivs_realtime._operations.amazon_interactive_video_service_real_time.create_participant_token

        output, http_response = (
            capo_ivs_realtime._operations.amazon_interactive_video_service_real_time.create_participant_token.create_participant_token(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_ivs_realtime.types.create_participant_token_response.CreateParticipantTokenResponse",
    ) -> dict[str, Any]:
        import capo_ivs_realtime.types.create_participant_token_response

        return capo_ivs_realtime.types.create_participant_token_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateParticipantToken", redact_output=_redact_output),
    )
    input_: capo_ivs_realtime.types.create_participant_token_request.CreateParticipantTokenRequest = {
        "stage_arn": stage_arn
    }
    if duration is not None:
        input_["duration"] = duration
    if user_id is not None:
        input_["user_id"] = user_id
    if attributes is not None:
        input_["attributes"] = attributes
    if capabilities is not None:
        input_["capabilities"] = capabilities

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