Skip to content

create_channel_moderator

create_channel_moderator(
    channel_arn: ChimeArn,
    channel_moderator_arn: ChimeArn,
    chime_bearer: ChimeArn,
    *,
    config_overrides: Optional[ChimeSDKMessagingClientConfig] = None,
) -> CreateChannelModeratorResponse

Creates a new ChannelModerator. A channel moderator can:

  • Add and remove other members of the channel.

  • Add and remove other moderators of the channel.

  • Add and remove user bans for the channel.

  • Redact messages in the channel.

  • List messages in the channel.

The x-amz-chime-bearer request header is mandatory. Use the ARN of the AppInstanceUser or AppInstanceBotof the user that makes the API call as the value in the header.

Parameters:

  • channel_arn (ChimeArn) –

    The ARN of the channel.

  • channel_moderator_arn (ChimeArn) –

    The AppInstanceUserArn of the moderator.

  • chime_bearer (ChimeArn) –

    The ARN of the AppInstanceUser or AppInstanceBot that makes the API call.

Raises:

Source code in docs_src/capo_chime_sdk_messaging/_services/chime_sdk_messaging.py
def create_channel_moderator(
    self,
    channel_arn: "capo_chime_sdk_messaging.types.chime_arn.ChimeArn",
    channel_moderator_arn: "capo_chime_sdk_messaging.types.chime_arn.ChimeArn",
    chime_bearer: "capo_chime_sdk_messaging.types.chime_arn.ChimeArn",
    *,
    config_overrides: Optional[ChimeSDKMessagingClientConfig] = None,
) -> "capo_chime_sdk_messaging.types.create_channel_moderator_response.CreateChannelModeratorResponse":
    """<p>Creates a new <code>ChannelModerator</code>. A channel moderator can:</p> <ul> <li> <p>Add and remove other members of the channel.</p> </li> <li> <p>Add and remove other moderators of the channel.</p> </li> <li> <p>Add and remove user bans for the channel.</p> </li> <li> <p>Redact messages in the channel.</p> </li> <li> <p>List messages in the channel.</p> </li> </ul> <note> <p>The <code>x-amz-chime-bearer</code> request header is mandatory. Use the ARN of the <code>AppInstanceUser</code> or <code>AppInstanceBot</code>of the user that makes the API call as the value in the header.</p> </note>

    Args:
        channel_arn: <p>The ARN of the channel.</p>
        channel_moderator_arn: <p>The <code>AppInstanceUserArn</code> of the moderator.</p>
        chime_bearer: <p>The ARN of the <code>AppInstanceUser</code> or <code>AppInstanceBot</code> that makes the API call.</p>

    Raises:
        capo_chime_sdk_messaging.errors.bad_request_exception.BadRequestException: <p>The input parameters don't match the service's restrictions.</p>
        capo_chime_sdk_messaging.errors.conflict_exception.ConflictException: <p>The request could not be processed because of conflict in the current state of the resource.</p>
        capo_chime_sdk_messaging.errors.forbidden_exception.ForbiddenException: <p>The client is permanently forbidden from making the request.</p>
        capo_chime_sdk_messaging.errors.resource_limit_exceeded_exception.ResourceLimitExceededException: <p>The request exceeds the resource limit.</p>
        capo_chime_sdk_messaging.errors.service_failure_exception.ServiceFailureException: <p>The service encountered an unexpected error.</p>
        capo_chime_sdk_messaging.errors.service_unavailable_exception.ServiceUnavailableException: <p>The service is currently unavailable.</p>
        capo_chime_sdk_messaging.errors.throttled_client_exception.ThrottledClientException: <p>The client exceeded its request rate limit.</p>
        capo_chime_sdk_messaging.errors.unauthorized_client_exception.UnauthorizedClientException: <p>The client is not currently authorized to make the request.</p>
        capo_chime_sdk_messaging.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_chime_sdk_messaging.types.create_channel_moderator_request.CreateChannelModeratorRequest]",
    ) -> OperationResponse[
        "capo_chime_sdk_messaging.types.create_channel_moderator_response.CreateChannelModeratorResponse"
    ]:
        import capo_chime_sdk_messaging._operations.chime_messaging_service.create_channel_moderator

        output, http_response = (
            capo_chime_sdk_messaging._operations.chime_messaging_service.create_channel_moderator.create_channel_moderator(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    def _redact_output(
        output: "capo_chime_sdk_messaging.types.create_channel_moderator_response.CreateChannelModeratorResponse",
    ) -> dict[str, Any]:
        import capo_chime_sdk_messaging.types.create_channel_moderator_response

        return capo_chime_sdk_messaging.types.create_channel_moderator_response.redact_sensitive(
            output
        )

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging("CreateChannelModerator", redact_output=_redact_output),
    )
    input_: capo_chime_sdk_messaging.types.create_channel_moderator_request.CreateChannelModeratorRequest = {
        "channel_arn": channel_arn,
        "channel_moderator_arn": channel_moderator_arn,
        "chime_bearer": chime_bearer,
    }

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