Skip to content

create_environment_account_connection async

create_environment_account_connection(
    management_account_id: AwsAccountId,
    environment_name: ResourceName,
    *,
    config_overrides: Optional[AsyncProtonClientConfig] = None,
    client_token: Optional[ClientToken] = None,
    role_arn: Optional[RoleArn] = None,
    tags: Optional[TagList] = None,
    component_role_arn: Optional[RoleArn] = None,
    codebuild_role_arn: Optional[RoleArn] = None,
) -> CreateEnvironmentAccountConnectionOutput

Create an environment account connection in an environment account so that environment infrastructure resources can be provisioned in the environment account from a management account.

An environment account connection is a secure bi-directional connection between a management account and an environment account that maintains authorization and permissions. For more information, see Environment account connections in the Proton User guide.

Parameters:

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

    When included, if two identical requests are made with the same client token, Proton returns the environment account connection that the first request created.

  • management_account_id (AwsAccountId) –

    The ID of the management account that accepts or rejects the environment account connection. You create and manage the Proton environment in this account. If the management account accepts the environment account connection, Proton can use the associated IAM role to provision environment infrastructure resources in the associated environment account.

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

    The Amazon Resource Name (ARN) of the IAM service role that's created in the environment account. Proton uses this role to provision infrastructure resources in the associated environment account.

  • environment_name (ResourceName) –

    The name of the Proton environment that's created in the associated management account.

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

    An optional list of metadata items that you can associate with the Proton environment account connection. A tag is a key-value pair.

    For more information, see Proton resources and tagging in the Proton User Guide.

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

    The Amazon Resource Name (ARN) of the IAM service role that Proton uses when provisioning directly defined components in the associated environment account. It determines the scope of infrastructure that a component can provision in the account.

    You must specify componentRoleArn to allow directly defined components to be associated with any environments running in this account.

    For more information about components, see Proton components in the Proton User Guide.

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

    The Amazon Resource Name (ARN) of an IAM service role in the environment account. Proton uses this role to provision infrastructure resources using CodeBuild-based provisioning in the associated environment account.

Raises:

Source code in docs_src/capo_proton/_services/async_proton.py
async def create_environment_account_connection(
    self,
    management_account_id: "capo_proton.types.aws_account_id.AwsAccountId",
    environment_name: "capo_proton.types.resource_name.ResourceName",
    *,
    config_overrides: Optional[AsyncProtonClientConfig] = None,
    client_token: Optional["capo_proton.types.client_token.ClientToken"] = None,
    role_arn: Optional["capo_proton.types.role_arn.RoleArn"] = None,
    tags: Optional["capo_proton.types.tag_list.TagList"] = None,
    component_role_arn: Optional["capo_proton.types.role_arn.RoleArn"] = None,
    codebuild_role_arn: Optional["capo_proton.types.role_arn.RoleArn"] = None,
) -> "capo_proton.types.create_environment_account_connection_output.CreateEnvironmentAccountConnectionOutput":
    """<p>Create an environment account connection in an environment account so that environment infrastructure resources can be provisioned in the environment account from a management account.</p> <p>An environment account connection is a secure bi-directional connection between a <i>management account</i> and an <i>environment account</i> that maintains authorization and permissions. For more information, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/ag-env-account-connections.html">Environment account connections</a> in the <i>Proton User guide</i>.</p>

    Args:
        client_token: <p>When included, if two identical requests are made with the same client token, Proton returns the environment account connection that the first request created.</p>
        management_account_id: <p>The ID of the management account that accepts or rejects the environment account connection. You create and manage the Proton environment in this account. If the management account accepts the environment account connection, Proton can use the associated IAM role to provision environment infrastructure resources in the associated environment account.</p>
        role_arn: <p>The Amazon Resource Name (ARN) of the IAM service role that's created in the environment account. Proton uses this role to provision infrastructure resources in the associated environment account.</p>
        environment_name: <p>The name of the Proton environment that's created in the associated management account.</p>
        tags: <p>An optional list of metadata items that you can associate with the Proton environment account connection. A tag is a key-value pair.</p> <p>For more information, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/resources.html">Proton resources and tagging</a> in the <i>Proton User Guide</i>.</p>
        component_role_arn: <p>The Amazon Resource Name (ARN) of the IAM service role that Proton uses when provisioning directly defined components in the associated environment account. It determines the scope of infrastructure that a component can provision in the account.</p> <p>You must specify <code>componentRoleArn</code> to allow directly defined components to be associated with any environments running in this account.</p> <p>For more information about components, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/ag-components.html">Proton components</a> in the <i>Proton User Guide</i>.</p>
        codebuild_role_arn: <p>The Amazon Resource Name (ARN) of an IAM service role in the environment account. Proton uses this role to provision infrastructure resources using CodeBuild-based provisioning in the associated environment account.</p>

    Raises:
        capo_proton.errors.access_denied_exception.AccessDeniedException: <p>There <i>isn't</i> sufficient access for performing this action.</p>
        capo_proton.errors.conflict_exception.ConflictException: <p>The request <i>couldn't</i> be made due to a conflicting operation or resource.</p>
        capo_proton.errors.internal_server_exception.InternalServerException: <p>The request failed to register with the service.</p>
        capo_proton.errors.service_quota_exceeded_exception.ServiceQuotaExceededException: <p>A quota was exceeded. For more information, see <a href="https://docs.aws.amazon.com/proton/latest/userguide/ag-limits.html">Proton Quotas</a> in the <i>Proton User Guide</i>.</p>
        capo_proton.errors.throttling_exception.ThrottlingException: <p>The request was denied due to request throttling.</p>
        capo_proton.errors.validation_exception.ValidationException: <p>The input is invalid or an out-of-range value was supplied for the input parameter.</p>
        capo_proton.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_proton.types.create_environment_account_connection_input.CreateEnvironmentAccountConnectionInput]",
    ) -> AsyncOperationResponse[
        "capo_proton.types.create_environment_account_connection_output.CreateEnvironmentAccountConnectionOutput"
    ]:
        import capo_proton._operations.aws_proton20200720.create_environment_account_connection

        (
            output,
            http_response,
        ) = await capo_proton._operations.aws_proton20200720.create_environment_account_connection.async_create_environment_account_connection(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateEnvironmentAccountConnection")
    )
    input_: capo_proton.types.create_environment_account_connection_input.CreateEnvironmentAccountConnectionInput = {
        "management_account_id": management_account_id,
        "environment_name": environment_name,
    }
    if client_token is None:
        client_token = str(uuid.uuid4())
    input_["client_token"] = client_token
    if role_arn is not None:
        input_["role_arn"] = role_arn
    if tags is not None:
        input_["tags"] = tags
    if component_role_arn is not None:
        input_["component_role_arn"] = component_role_arn
    if codebuild_role_arn is not None:
        input_["codebuild_role_arn"] = codebuild_role_arn

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