Skip to content

create_scheduled_audit async

create_scheduled_audit(
    frequency: AuditFrequency,
    target_check_names: TargetAuditCheckNames,
    scheduled_audit_name: ScheduledAuditName,
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    day_of_month: Optional[DayOfMonth] = None,
    day_of_week: Optional[DayOfWeek] = None,
    tags: Optional[TagList] = None,
) -> CreateScheduledAuditResponse

Creates a scheduled audit that is run at a specified time interval.

Requires permission to access the CreateScheduledAudit action.

Parameters:

  • frequency (AuditFrequency) –

    How often the scheduled audit takes place, either DAILY, WEEKLY, BIWEEKLY or MONTHLY. The start time of each audit is determined by the system.

  • day_of_month (Optional[DayOfMonth], default: None ) –

    The day of the month on which the scheduled audit takes place. This can be "1" through "31" or "LAST". This field is required if the "frequency" parameter is set to MONTHLY. If days 29 to 31 are specified, and the month doesn't have that many days, the audit takes place on the LAST day of the month.

  • day_of_week (Optional[DayOfWeek], default: None ) –

    The day of the week on which the scheduled audit takes place, either SUN, MON, TUE, WED, THU, FRI, or SAT. This field is required if the frequency parameter is set to WEEKLY or BIWEEKLY.

  • target_check_names (TargetAuditCheckNames) –

    Which checks are performed during the scheduled audit. Checks must be enabled for your account. (Use DescribeAccountAuditConfiguration to see the list of all checks, including those that are enabled or use UpdateAccountAuditConfiguration to select which checks are enabled.)

  • scheduled_audit_name (ScheduledAuditName) –

    The name you want to give to the scheduled audit. (Max. 128 chars)

  • tags (Optional[TagList], default: None ) –

    Metadata that can be used to manage the scheduled audit.

Raises:

Source code in docs_src/capo_iot/_services/async_io_t.py
async def create_scheduled_audit(
    self,
    frequency: "capo_iot.types.audit_frequency.AuditFrequency",
    target_check_names: "capo_iot.types.target_audit_check_names.TargetAuditCheckNames",
    scheduled_audit_name: "capo_iot.types.scheduled_audit_name.ScheduledAuditName",
    *,
    config_overrides: Optional[AsyncIoTClientConfig] = None,
    day_of_month: Optional["capo_iot.types.day_of_month.DayOfMonth"] = None,
    day_of_week: Optional["capo_iot.types.day_of_week.DayOfWeek"] = None,
    tags: Optional["capo_iot.types.tag_list.TagList"] = None,
) -> "capo_iot.types.create_scheduled_audit_response.CreateScheduledAuditResponse":
    """<p>Creates a scheduled audit that is run at a specified time interval.</p> <p>Requires permission to access the <a href="https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions">CreateScheduledAudit</a> action.</p>

    Args:
        frequency: <p>How often the scheduled audit takes place, either <code>DAILY</code>, <code>WEEKLY</code>, <code>BIWEEKLY</code> or <code>MONTHLY</code>. The start time of each audit is determined by the system.</p>
        day_of_month: <p>The day of the month on which the scheduled audit takes place. This can be "1" through "31" or "LAST". This field is required if the "frequency" parameter is set to <code>MONTHLY</code>. If days 29 to 31 are specified, and the month doesn't have that many days, the audit takes place on the <code>LAST</code> day of the month.</p>
        day_of_week: <p>The day of the week on which the scheduled audit takes place, either <code>SUN</code>, <code>MON</code>, <code>TUE</code>, <code>WED</code>, <code>THU</code>, <code>FRI</code>, or <code>SAT</code>. This field is required if the <code>frequency</code> parameter is set to <code>WEEKLY</code> or <code>BIWEEKLY</code>.</p>
        target_check_names: <p>Which checks are performed during the scheduled audit. Checks must be enabled for your account. (Use <code>DescribeAccountAuditConfiguration</code> to see the list of all checks, including those that are enabled or use <code>UpdateAccountAuditConfiguration</code> to select which checks are enabled.)</p>
        scheduled_audit_name: <p>The name you want to give to the scheduled audit. (Max. 128 chars)</p>
        tags: <p>Metadata that can be used to manage the scheduled audit.</p>

    Raises:
        capo_iot.errors.internal_failure_exception.InternalFailureException: <p>An unexpected error has occurred.</p>
        capo_iot.errors.invalid_request_exception.InvalidRequestException: <p>The request is not valid.</p>
        capo_iot.errors.limit_exceeded_exception.LimitExceededException: <p>A limit has been exceeded.</p>
        capo_iot.errors.resource_already_exists_exception.ResourceAlreadyExistsException: <p>The resource already exists.</p>
        capo_iot.errors.throttling_exception.ThrottlingException: <p>The rate exceeds the limit.</p>
        capo_iot.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_iot.types.create_scheduled_audit_request.CreateScheduledAuditRequest]",
    ) -> AsyncOperationResponse[
        "capo_iot.types.create_scheduled_audit_response.CreateScheduledAuditResponse"
    ]:
        import capo_iot._operations.aws_iot_service.create_scheduled_audit

        (
            output,
            http_response,
        ) = await capo_iot._operations.aws_iot_service.create_scheduled_audit.async_create_scheduled_audit(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateScheduledAudit")
    )
    input_: capo_iot.types.create_scheduled_audit_request.CreateScheduledAuditRequest = {
        "frequency": frequency,
        "target_check_names": target_check_names,
        "scheduled_audit_name": scheduled_audit_name,
    }
    if day_of_month is not None:
        input_["day_of_month"] = day_of_month
    if day_of_week is not None:
        input_["day_of_week"] = day_of_week
    if tags is not None:
        input_["tags"] = tags

    response = await aexecute_pipeline(
        AsyncOperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    await response.response.aclose()
    return response.output