Skip to content

create_gateway async

create_gateway(
    activation_key: ActivationKey,
    gateway_display_name: Name,
    gateway_type: GatewayType,
    *,
    config_overrides: Optional[AsyncBackupGatewayClientConfig] = None,
    tags: Optional[Tags] = None,
) -> CreateGatewayOutput

Creates a backup gateway. After you create a gateway, you can associate it with a server using the AssociateGatewayToServer operation.

Parameters:

  • activation_key (ActivationKey) –

    The activation key of the created gateway.

  • gateway_display_name (Name) –

    The display name of the created gateway.

  • gateway_type (GatewayType) –

    The type of created gateway.

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

    A list of up to 50 tags to assign to the gateway. Each tag is a key-value pair.

Raises:

  • InternalServerException –

    The operation did not succeed because an internal error occurred. Try again later.

  • ThrottlingException –

    TPS has been limited to protect against intentional or unintentional high request volumes.

  • ValidationException –

    The operation did not succeed because a validation error occurred.

  • UnknownServiceError –

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

Source code in docs_src/capo_backup_gateway/_services/async_backup_gateway.py
async def create_gateway(
    self,
    activation_key: "capo_backup_gateway.types.activation_key.ActivationKey",
    gateway_display_name: "capo_backup_gateway.types.name.Name",
    gateway_type: "capo_backup_gateway.types.gateway_type.GatewayType",
    *,
    config_overrides: Optional[AsyncBackupGatewayClientConfig] = None,
    tags: Optional["capo_backup_gateway.types.tags.Tags"] = None,
) -> "capo_backup_gateway.types.create_gateway_output.CreateGatewayOutput":
    """<p>Creates a backup gateway. After you create a gateway, you can associate it with a server using the <code>AssociateGatewayToServer</code> operation.</p>

    Args:
        activation_key: <p>The activation key of the created gateway.</p>
        gateway_display_name: <p>The display name of the created gateway.</p>
        gateway_type: <p>The type of created gateway.</p>
        tags: <p>A list of up to 50 tags to assign to the gateway. Each tag is a key-value pair.</p>

    Raises:
        capo_backup_gateway.errors.internal_server_exception.InternalServerException: <p>The operation did not succeed because an internal error occurred. Try again later.</p>
        capo_backup_gateway.errors.throttling_exception.ThrottlingException: <p>TPS has been limited to protect against intentional or unintentional high request volumes.</p>
        capo_backup_gateway.errors.validation_exception.ValidationException: <p>The operation did not succeed because a validation error occurred.</p>
        capo_backup_gateway.errors.UnknownServiceError: The service returned an error code this client does not model.
    """

    async def _handler(
        req: "AsyncOperationRequest[capo_backup_gateway.types.create_gateway_input.CreateGatewayInput]",
    ) -> AsyncOperationResponse[
        "capo_backup_gateway.types.create_gateway_output.CreateGatewayOutput"
    ]:
        import capo_backup_gateway._operations.backup_on_premises_v20210101.create_gateway

        (
            output,
            http_response,
        ) = await capo_backup_gateway._operations.backup_on_premises_v20210101.create_gateway.async_create_gateway(
            req.options, req.input
        )
        return AsyncOperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateGateway")
    )
    input_: capo_backup_gateway.types.create_gateway_input.CreateGatewayInput = {
        "activation_key": activation_key,
        "gateway_display_name": gateway_display_name,
        "gateway_type": gateway_type,
    }
    if tags is not None:
        input_["tags"] = tags

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