Skip to content

swap_environment_cnam_es async

swap_environment_cnam_es(
    *,
    config_overrides: Optional[AsyncElasticBeanstalkClientConfig] = None,
    source_environment_id: Optional[EnvironmentId] = None,
    source_environment_name: Optional[EnvironmentName] = None,
    destination_environment_id: Optional[EnvironmentId] = None,
    destination_environment_name: Optional[EnvironmentName] = None,
) -> None

Swaps the CNAMEs of two environments.

Parameters:

  • source_environment_id (Optional[EnvironmentId], default: None ) –

    The ID of the source environment.

    Condition: You must specify at least the SourceEnvironmentID or the SourceEnvironmentName. You may also specify both. If you specify the SourceEnvironmentId, you must specify the DestinationEnvironmentId.

  • source_environment_name (Optional[EnvironmentName], default: None ) –

    The name of the source environment.

    Condition: You must specify at least the SourceEnvironmentID or the SourceEnvironmentName. You may also specify both. If you specify the SourceEnvironmentName, you must specify the DestinationEnvironmentName.

  • destination_environment_id (Optional[EnvironmentId], default: None ) –

    The ID of the destination environment.

    Condition: You must specify at least the DestinationEnvironmentID or the DestinationEnvironmentName. You may also specify both. You must specify the SourceEnvironmentId with the DestinationEnvironmentId.

  • destination_environment_name (Optional[EnvironmentName], default: None ) –

    The name of the destination environment.

    Condition: You must specify at least the DestinationEnvironmentID or the DestinationEnvironmentName. You may also specify both. You must specify the SourceEnvironmentName with the DestinationEnvironmentName.

Raises:

Examples:

To swap environment CNAMES The following operation swaps the assigned subdomains of two environments:

>>> await client.swap_environment_cnam_es(source_environment_name='my-env-blue', destination_environment_name='my-env-green')
Source code in docs_src/capo_elastic_beanstalk/_services/async_elastic_beanstalk.py
async def swap_environment_cnam_es(
    self,
    *,
    config_overrides: Optional[AsyncElasticBeanstalkClientConfig] = None,
    source_environment_id: Optional[
        "capo_elastic_beanstalk.types.environment_id.EnvironmentId"
    ] = None,
    source_environment_name: Optional[
        "capo_elastic_beanstalk.types.environment_name.EnvironmentName"
    ] = None,
    destination_environment_id: Optional[
        "capo_elastic_beanstalk.types.environment_id.EnvironmentId"
    ] = None,
    destination_environment_name: Optional[
        "capo_elastic_beanstalk.types.environment_name.EnvironmentName"
    ] = None,
) -> None:
    """<p>Swaps the CNAMEs of two environments.</p>

    Args:
        source_environment_id: <p>The ID of the source environment.</p> <p> Condition: You must specify at least the <code>SourceEnvironmentID</code> or the <code>SourceEnvironmentName</code>. You may also specify both. If you specify the <code>SourceEnvironmentId</code>, you must specify the <code>DestinationEnvironmentId</code>. </p>
        source_environment_name: <p>The name of the source environment.</p> <p> Condition: You must specify at least the <code>SourceEnvironmentID</code> or the <code>SourceEnvironmentName</code>. You may also specify both. If you specify the <code>SourceEnvironmentName</code>, you must specify the <code>DestinationEnvironmentName</code>. </p>
        destination_environment_id: <p>The ID of the destination environment.</p> <p> Condition: You must specify at least the <code>DestinationEnvironmentID</code> or the <code>DestinationEnvironmentName</code>. You may also specify both. You must specify the <code>SourceEnvironmentId</code> with the <code>DestinationEnvironmentId</code>. </p>
        destination_environment_name: <p>The name of the destination environment.</p> <p> Condition: You must specify at least the <code>DestinationEnvironmentID</code> or the <code>DestinationEnvironmentName</code>. You may also specify both. You must specify the <code>SourceEnvironmentName</code> with the <code>DestinationEnvironmentName</code>. </p>

    Raises:
        capo_elastic_beanstalk.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To swap environment CNAMES
        The following operation swaps the assigned subdomains of two environments:

        >>> await client.swap_environment_cnam_es(source_environment_name='my-env-blue', destination_environment_name='my-env-green')
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_elastic_beanstalk.types.swap_environment_cnam_es_message.SwapEnvironmentCNAMEsMessage]",
    ) -> AsyncOperationResponse[None]:
        import capo_elastic_beanstalk._operations.aws_elastic_beanstalk_service.swap_environment_cnam_es

        (
            output,
            http_response,
        ) = await capo_elastic_beanstalk._operations.aws_elastic_beanstalk_service.swap_environment_cnam_es.async_swap_environment_cnam_es(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("SwapEnvironmentCNAMEs")
    )
    input_: capo_elastic_beanstalk.types.swap_environment_cnam_es_message.SwapEnvironmentCNAMEsMessage = {}
    if source_environment_id is not None:
        input_["source_environment_id"] = source_environment_id
    if source_environment_name is not None:
        input_["source_environment_name"] = source_environment_name
    if destination_environment_id is not None:
        input_["destination_environment_id"] = destination_environment_id
    if destination_environment_name is not None:
        input_["destination_environment_name"] = destination_environment_name

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