Skip to content

create_app async

create_app(
    name: EntityName,
    *,
    config_overrides: Optional[AsyncresiliencehubClientConfig] = None,
    description: Optional[EntityDescription] = None,
    policy_arn: Optional[Arn] = None,
    tags: Optional[TagMap] = None,
    client_token: Optional[ClientToken] = None,
    assessment_schedule: Optional[AppAssessmentScheduleType] = None,
    permission_model: Optional[PermissionModel] = None,
    event_subscriptions: Optional[EventSubscriptionList] = None,
    aws_application_arn: Optional[Arn] = None,
) -> CreateAppResponse

Creates an Resilience Hub application. An Resilience Hub application is a collection of Amazon Web Services resources structured to prevent and recover Amazon Web Services application disruptions. To describe a Resilience Hub application, you provide an application name, resources from one or more CloudFormation stacks, Resource Groups, Terraform state files, AppRegistry applications, and an appropriate resiliency policy. In addition, you can also add resources that are located on Amazon Elastic Kubernetes Service (Amazon EKS) clusters as optional resources. For more information about the number of resources supported per application, see Service quotas.

After you create an Resilience Hub application, you publish it so that you can run a resiliency assessment on it. You can then use recommendations from the assessment to improve resiliency by running another assessment, comparing results, and then iterating the process until you achieve your goals for recovery time objective (RTO) and recovery point objective (RPO).

Parameters:

  • name (EntityName) –

    Name of the application.

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

    The optional description for an app.

  • policy_arn (Optional[Arn], default: None ) –

    Amazon Resource Name (ARN) of the resiliency policy. The format for this ARN is: arn:partition:resiliencehub:region:account:resiliency-policy/policy-id. For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference guide.

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

    Tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key/value pair.

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

    Used for an idempotency token. A client token is a unique, case-sensitive string of up to 64 ASCII characters. You should not reuse the same client token for other API requests.

  • assessment_schedule (Optional[AppAssessmentScheduleType], default: None ) –

    Assessment execution schedule with 'Daily' or 'Disabled' values.

  • permission_model (Optional[PermissionModel], default: None ) –

    Defines the roles and credentials that Resilience Hub would use while creating the application, importing its resources, and running an assessment.

  • event_subscriptions (Optional[EventSubscriptionList], default: None ) –

    The list of events you would like to subscribe and get notification for. Currently, Resilience Hub supports only Drift detected and Scheduled assessment failure events notification.

  • aws_application_arn (Optional[Arn], default: None ) –

    Amazon Resource Name (ARN) of Resource Groups group that is integrated with an AppRegistry application. For more information about ARNs, see Amazon Resource Names (ARNs) in the Amazon Web Services General Reference guide.

Raises:

  • AccessDeniedException –

    You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions.

  • ConflictException –

    This exception occurs when a conflict with a previous successful write is detected. This generally occurs when the previous write did not have time to propagate to the host serving the current request. A retry (with appropriate backoff logic) is the recommended response to this exception.

  • InternalServerException –

    This exception occurs when there is an internal failure in the Resilience Hub service.

  • ResourceNotFoundException –

    This exception occurs when the specified resource could not be found.

  • ServiceQuotaExceededException –

    This exception occurs when you have exceeded your service quota. To perform the requested action, remove some of the relevant resources, or use Service Quotas to request a service quota increase.

  • ThrottlingException –

    This exception occurs when you have exceeded the limit on the number of requests per second.

  • ValidationException –

    This exception occurs when a request is not valid.

  • UnknownServiceError –

    The service returned an error code this client does not model.

Source code in docs_src/capo_resiliencehub/_services/async_resiliencehub.py
async def create_app(
    self,
    name: "capo_resiliencehub.types.entity_name.EntityName",
    *,
    config_overrides: Optional[AsyncresiliencehubClientConfig] = None,
    description: Optional[
        "capo_resiliencehub.types.entity_description.EntityDescription"
    ] = None,
    policy_arn: Optional["capo_resiliencehub.types.arn.Arn"] = None,
    tags: Optional["capo_resiliencehub.types.tag_map.TagMap"] = None,
    client_token: Optional[
        "capo_resiliencehub.types.client_token.ClientToken"
    ] = None,
    assessment_schedule: Optional[
        "capo_resiliencehub.types.app_assessment_schedule_type.AppAssessmentScheduleType"
    ] = None,
    permission_model: Optional[
        "capo_resiliencehub.types.permission_model.PermissionModel"
    ] = None,
    event_subscriptions: Optional[
        "capo_resiliencehub.types.event_subscription_list.EventSubscriptionList"
    ] = None,
    aws_application_arn: Optional["capo_resiliencehub.types.arn.Arn"] = None,
) -> "capo_resiliencehub.types.create_app_response.CreateAppResponse":
    """<p>Creates an Resilience Hub application. An Resilience Hub application is a collection of Amazon Web Services resources structured to prevent and recover Amazon Web Services application disruptions. To describe a Resilience Hub application, you provide an application name, resources from one or more CloudFormation stacks, Resource Groups, Terraform state files, AppRegistry applications, and an appropriate resiliency policy. In addition, you can also add resources that are located on Amazon Elastic Kubernetes Service (Amazon EKS) clusters as optional resources. For more information about the number of resources supported per application, see <a href="https://docs.aws.amazon.com/general/latest/gr/resiliencehub.html#limits_resiliencehub">Service quotas</a>.</p> <p>After you create an Resilience Hub application, you publish it so that you can run a resiliency assessment on it. You can then use recommendations from the assessment to improve resiliency by running another assessment, comparing results, and then iterating the process until you achieve your goals for recovery time objective (RTO) and recovery point objective (RPO).</p>

    Args:
        name: <p>Name of the application.</p>
        description: <p>The optional description for an app.</p>
        policy_arn: <p>Amazon Resource Name (ARN) of the resiliency policy. The format for this ARN is: arn:<code>partition</code>:resiliencehub:<code>region</code>:<code>account</code>:resiliency-policy/<code>policy-id</code>. For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html"> Amazon Resource Names (ARNs)</a> in the <i>Amazon Web Services General Reference</i> guide.</p>
        tags: <p>Tags assigned to the resource. A tag is a label that you assign to an Amazon Web Services resource. Each tag consists of a key/value pair.</p>
        client_token: <p>Used for an idempotency token. A client token is a unique, case-sensitive string of up to 64 ASCII characters. You should not reuse the same client token for other API requests.</p>
        assessment_schedule: <p> Assessment execution schedule with 'Daily' or 'Disabled' values. </p>
        permission_model: <p>Defines the roles and credentials that Resilience Hub would use while creating the application, importing its resources, and running an assessment.</p>
        event_subscriptions: <p>The list of events you would like to subscribe and get notification for. Currently, Resilience Hub supports only <b>Drift detected</b> and <b>Scheduled assessment failure</b> events notification.</p>
        aws_application_arn: <p>Amazon Resource Name (ARN) of Resource Groups group that is integrated with an AppRegistry application. For more information about ARNs, see <a href="https://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html"> Amazon Resource Names (ARNs)</a> in the <i>Amazon Web Services General Reference</i> guide.</p>

    Raises:
        capo_resiliencehub.errors.access_denied_exception.AccessDeniedException: <p>You don't have permissions to perform the requested operation. The user or role that is making the request must have at least one IAM permissions policy attached that grants the required permissions.</p>
        capo_resiliencehub.errors.conflict_exception.ConflictException: <p>This exception occurs when a conflict with a previous successful write is detected. This generally occurs when the previous write did not have time to propagate to the host serving the current request. A retry (with appropriate backoff logic) is the recommended response to this exception.</p>
        capo_resiliencehub.errors.internal_server_exception.InternalServerException: <p>This exception occurs when there is an internal failure in the Resilience Hub service.</p>
        capo_resiliencehub.errors.resource_not_found_exception.ResourceNotFoundException: <p>This exception occurs when the specified resource could not be found.</p>
        capo_resiliencehub.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>This exception occurs when you have exceeded your service quota. To perform the requested action, remove some of the relevant resources, or use Service Quotas to request a service quota increase.</p>
        capo_resiliencehub.errors.throttling_exception.ThrottlingException: <p>This exception occurs when you have exceeded the limit on the number of requests per second.</p>
        capo_resiliencehub.errors.validation_exception.ValidationException: <p>This exception occurs when a request is not valid.</p>
        capo_resiliencehub.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_resiliencehub.types.create_app_request.CreateAppRequest]",
    ) -> AsyncOperationResponse[
        "capo_resiliencehub.types.create_app_response.CreateAppResponse"
    ]:
        import capo_resiliencehub._operations.aws_resilience_hub.create_app

        (
            output,
            http_response,
        ) = await capo_resiliencehub._operations.aws_resilience_hub.create_app.async_create_app(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    def _redact_input(
        input_: "capo_resiliencehub.types.create_app_request.CreateAppRequest",
    ) -> dict[str, Any]:
        import capo_resiliencehub.types.create_app_request

        return capo_resiliencehub.types.create_app_request.redact_sensitive(input_)

    def _redact_output(
        output: "capo_resiliencehub.types.create_app_response.CreateAppResponse",
    ) -> dict[str, Any]:
        import capo_resiliencehub.types.create_app_response

        return capo_resiliencehub.types.create_app_response.redact_sensitive(output)

    interceptors_, options_ = self.operation_options(
        config_overrides,
        OperationLogging(
            "CreateApp", redact_input=_redact_input, redact_output=_redact_output
        ),
    )
    input_: capo_resiliencehub.types.create_app_request.CreateAppRequest = {
        "name": name
    }
    if description is not None:
        input_["description"] = description
    if policy_arn is not None:
        input_["policy_arn"] = policy_arn
    if tags is not None:
        input_["tags"] = tags
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if assessment_schedule is not None:
        input_["assessment_schedule"] = assessment_schedule
    if permission_model is not None:
        input_["permission_model"] = permission_model
    if event_subscriptions is not None:
        input_["event_subscriptions"] = event_subscriptions
    if aws_application_arn is not None:
        input_["aws_application_arn"] = aws_application_arn

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