Skip to content

put_email_monitoring_configuration

put_email_monitoring_configuration(
    organization_id: OrganizationId,
    log_group_arn: LogGroupArn,
    *,
    config_overrides: Optional[WorkMailClientConfig] = None,
    role_arn: Optional[RoleArn] = None,
) -> PutEmailMonitoringConfigurationResponse

Creates or updates the email monitoring configuration for a specified organization.

Parameters:

  • organization_id (OrganizationId) –

    The ID of the organization for which the email monitoring configuration is set.

  • role_arn (Optional[RoleArn], default: None ) –

    The Amazon Resource Name (ARN) of the IAM Role associated with the email monitoring configuration. If absent, the IAM Role Arn of AWSServiceRoleForAmazonWorkMailEvents will be used.

  • log_group_arn (LogGroupArn) –

    The Amazon Resource Name (ARN) of the CloudWatch Log group associated with the email monitoring configuration.

Raises:

Source code in docs_src/capo_workmail/_services/work_mail.py
def put_email_monitoring_configuration(
    self,
    organization_id: "capo_workmail.types.organization_id.OrganizationId",
    log_group_arn: "capo_workmail.types.log_group_arn.LogGroupArn",
    *,
    config_overrides: Optional[WorkMailClientConfig] = None,
    role_arn: Optional["capo_workmail.types.role_arn.RoleArn"] = None,
) -> "capo_workmail.types.put_email_monitoring_configuration_response.PutEmailMonitoringConfigurationResponse":
    """<p>Creates or updates the email monitoring configuration for a specified organization.</p>

    Args:
        organization_id: <p>The ID of the organization for which the email monitoring configuration is set.</p>
        role_arn: <p>The Amazon Resource Name (ARN) of the IAM Role associated with the email monitoring configuration. If absent, the IAM Role Arn of AWSServiceRoleForAmazonWorkMailEvents will be used.</p>
        log_group_arn: <p>The Amazon Resource Name (ARN) of the CloudWatch Log group associated with the email monitoring configuration.</p>

    Raises:
        capo_workmail.errors.invalid_parameter_exception.InvalidParameterException: <p>One or more of the input parameters don't match the service's restrictions.</p>
        capo_workmail.errors.organization_not_found_exception.OrganizationNotFoundException: <p>An operation received a valid organization identifier that either doesn't belong or exist in the system.</p>
        capo_workmail.errors.organization_state_exception.OrganizationStateException: <p>The organization must have a valid state to perform certain operations on the organization or its members.</p>
        capo_workmail.errors.resource_not_found_exception.ResourceNotFoundException: <p>The resource cannot be found.</p>
        capo_workmail.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_workmail.types.put_email_monitoring_configuration_request.PutEmailMonitoringConfigurationRequest]",
    ) -> OperationResponse[
        "capo_workmail.types.put_email_monitoring_configuration_response.PutEmailMonitoringConfigurationResponse"
    ]:
        import capo_workmail._operations.work_mail_service.put_email_monitoring_configuration

        output, http_response = (
            capo_workmail._operations.work_mail_service.put_email_monitoring_configuration.put_email_monitoring_configuration(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("PutEmailMonitoringConfiguration")
    )
    input_: capo_workmail.types.put_email_monitoring_configuration_request.PutEmailMonitoringConfigurationRequest = {
        "organization_id": organization_id,
        "log_group_arn": log_group_arn,
    }
    if role_arn is not None:
        input_["role_arn"] = role_arn

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