Skip to content

create_test

create_test(
    service_arn: Arn,
    test_template_arn: ServiceOwnedArn,
    *,
    config_overrides: Optional[resiliencehubv2ClientConfig] = None,
    logging_configuration: Optional[LoggingConfiguration] = None,
    stop_conditions: Optional[StopConditionList] = None,
    role_name: Optional[IamRoleName] = None,
    parameters: Optional[TestParameters] = None,
) -> CreateTestResponse

Creates a test for a service by configuring a test template. Each service has one test per template.

Parameters:

  • service_arn (Arn) –

    The ARN of the service to create the test for.

  • test_template_arn (ServiceOwnedArn) –

    The ARN of the test template to configure.

  • logging_configuration (Optional[LoggingConfiguration], default: None ) –

    The logging configuration for the test.

  • stop_conditions (Optional[StopConditionList], default: None ) –

    The stop conditions for the test.

  • role_name (Optional[IamRoleName], default: None ) –

    The name of the IAM execution role to use when running the test.

  • parameters (Optional[TestParameters], default: None ) –

    The parameter values for the test.

Raises:

Source code in docs_src/capo_resiliencehubv2/_services/resiliencehubv2.py
def create_test(
    self,
    service_arn: "capo_resiliencehubv2.types.arn.Arn",
    test_template_arn: "capo_resiliencehubv2.types.service_owned_arn.ServiceOwnedArn",
    *,
    config_overrides: Optional[resiliencehubv2ClientConfig] = None,
    logging_configuration: Optional[
        "capo_resiliencehubv2.types.logging_configuration.LoggingConfiguration"
    ] = None,
    stop_conditions: Optional[
        "capo_resiliencehubv2.types.stop_condition_list.StopConditionList"
    ] = None,
    role_name: Optional[
        "capo_resiliencehubv2.types.iam_role_name.IamRoleName"
    ] = None,
    parameters: Optional[
        "capo_resiliencehubv2.types.test_parameters.TestParameters"
    ] = None,
) -> "capo_resiliencehubv2.types.create_test_response.CreateTestResponse":
    """<p>Creates a test for a service by configuring a test template. Each service has one test per template.</p>

    Args:
        service_arn: <p>The ARN of the service to create the test for.</p>
        test_template_arn: <p>The ARN of the test template to configure.</p>
        logging_configuration: <p>The logging configuration for the test.</p>
        stop_conditions: <p>The stop conditions for the test.</p>
        role_name: <p>The name of the IAM execution role to use when running the test.</p>
        parameters: <p>The parameter values for the test.</p>

    Raises:
        capo_resiliencehubv2.errors.access_denied_exception.AccessDeniedException: <p>Access denied — caller lacks required permissions.</p>
        capo_resiliencehubv2.errors.conflict_exception.ConflictException: <p>Conflict — resource already exists.</p>
        capo_resiliencehubv2.errors.internal_server_exception.InternalServerException: <p>Internal service error.</p>
        capo_resiliencehubv2.errors.resource_not_found_exception.ResourceNotFoundException: <p>Resource not found.</p>
        capo_resiliencehubv2.errors.validation_exception.ValidationException: <p>Validation error — invalid input parameters.</p>
        capo_resiliencehubv2.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    def _handler(
        req: "OperationRequest[capo_resiliencehubv2.types.create_test_request.CreateTestRequest]",
    ) -> OperationResponse[
        "capo_resiliencehubv2.types.create_test_response.CreateTestResponse"
    ]:
        import capo_resiliencehubv2._operations.ngrh_service_core.create_test

        output, http_response = (
            capo_resiliencehubv2._operations.ngrh_service_core.create_test.create_test(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateTest")
    )
    input_: capo_resiliencehubv2.types.create_test_request.CreateTestRequest = {
        "service_arn": service_arn,
        "test_template_arn": test_template_arn,
    }
    if logging_configuration is not None:
        input_["logging_configuration"] = logging_configuration
    if stop_conditions is not None:
        input_["stop_conditions"] = stop_conditions
    if role_name is not None:
        input_["role_name"] = role_name
    if parameters is not None:
        input_["parameters"] = parameters

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