Skip to content

create_target_account_configuration async

create_target_account_configuration(
    experiment_template_id: ExperimentTemplateId,
    account_id: TargetAccountId,
    role_arn: RoleArn,
    *,
    config_overrides: Optional[AsyncfisClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    description: Optional[TargetAccountConfigurationDescription] = None,
) -> CreateTargetAccountConfigurationResponse

Creates a target account configuration for the experiment template. A target account configuration is required when accountTargeting of experimentOptions is set to multi-account. For more information, see experiment options in the Fault Injection Service User Guide.

Parameters:

  • client_token (Optional[ClientToken], default: None ) –

    Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.

  • experiment_template_id (ExperimentTemplateId) –

    The experiment template ID.

  • account_id (TargetAccountId) –

    The Amazon Web Services account ID of the target account.

  • role_arn (RoleArn) –

    The Amazon Resource Name (ARN) of an IAM role for the target account.

  • description (Optional[TargetAccountConfigurationDescription], default: None ) –

    The description of the target account.

Raises:

Source code in docs_src/capo_fis/_services/async_fis.py
async def create_target_account_configuration(
    self,
    experiment_template_id: "capo_fis.types.experiment_template_id.ExperimentTemplateId",
    account_id: "capo_fis.types.target_account_id.TargetAccountId",
    role_arn: "capo_fis.types.role_arn.RoleArn",
    *,
    config_overrides: Optional[AsyncfisClientConfig] = None,
    client_token: Optional["capo_fis.types.client_token.ClientToken"] = None,
    description: Optional[
        "capo_fis.types.target_account_configuration_description.TargetAccountConfigurationDescription"
    ] = None,
) -> "capo_fis.types.create_target_account_configuration_response.CreateTargetAccountConfigurationResponse":
    """<p>Creates a target account configuration for the experiment template. A target account configuration is required when <code>accountTargeting</code> of <code>experimentOptions</code> is set to <code>multi-account</code>. For more information, see <a href="https://docs.aws.amazon.com/fis/latest/userguide/experiment-options.html">experiment options</a> in the <i>Fault Injection Service User Guide</i>. </p>

    Args:
        client_token: <p>Unique, case-sensitive identifier that you provide to ensure the idempotency of the request.</p>
        experiment_template_id: <p>The experiment template ID.</p>
        account_id: <p>The Amazon Web Services account ID of the target account.</p>
        role_arn: <p>The Amazon Resource Name (ARN) of an IAM role for the target account.</p>
        description: <p>The description of the target account.</p>

    Raises:
        capo_fis.errors.conflict_exception.ConflictException: <p>The request could not be processed because of a conflict.</p>
        capo_fis.errors.resource_not_found_exception.ResourceNotFoundException: <p>The specified resource cannot be found.</p>
        capo_fis.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>You have exceeded your service quota.</p>
        capo_fis.errors.validation_exception.ValidationException: <p>The specified input is not valid, or fails to satisfy the constraints for the request.</p>
        capo_fis.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_fis.types.create_target_account_configuration_request.CreateTargetAccountConfigurationRequest]",
    ) -> AsyncOperationResponse[
        "capo_fis.types.create_target_account_configuration_response.CreateTargetAccountConfigurationResponse"
    ]:
        import capo_fis._operations.fault_injection_simulator.create_target_account_configuration

        (
            output,
            http_response,
        ) = await capo_fis._operations.fault_injection_simulator.create_target_account_configuration.async_create_target_account_configuration(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateTargetAccountConfiguration")
    )
    input_: capo_fis.types.create_target_account_configuration_request.CreateTargetAccountConfigurationRequest = {
        "experiment_template_id": experiment_template_id,
        "account_id": account_id,
        "role_arn": role_arn,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if description is not None:
        input_["description"] = description

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