Skip to content

create_tape_with_barcode

create_tape_with_barcode(
    gateway_arn: GatewayARN,
    tape_size_in_bytes: TapeSize,
    tape_barcode: TapeBarcode,
    *,
    config_overrides: Optional[StorageGatewayClientConfig] = None,
    kms_encrypted: Optional[Boolean] = None,
    kms_key: Optional[KMSKey] = None,
    pool_id: Optional[PoolId] = None,
    worm: Optional[Boolean2] = None,
    tags: Optional[Tags] = None,
) -> CreateTapeWithBarcodeOutput

Creates a virtual tape by using your own barcode. You write data to the virtual tape and then archive the tape. A barcode is unique and cannot be reused if it has already been used on a tape. This applies to barcodes used on deleted tapes. This operation is only supported in the tape gateway type.

Cache storage must be allocated to the gateway before you can create a virtual tape. Use the AddCache operation to add cache storage to a gateway.

Parameters:

  • gateway_arn (GatewayARN) –

    The unique Amazon Resource Name (ARN) that represents the gateway to associate the virtual tape with. Use the ListGateways operation to return a list of gateways for your account and Amazon Web Services Region.

  • tape_size_in_bytes (TapeSize) –

    The size, in bytes, of the virtual tape that you want to create.

    The size must be aligned by gigabyte (1024*1024*1024 bytes).

  • tape_barcode (TapeBarcode) –

    The barcode that you want to assign to the tape.

    Barcodes cannot be reused. This includes barcodes used for tapes that have been deleted.

  • kms_encrypted (Optional[Boolean], default: None ) –

    Set to true to use Amazon S3 server-side encryption with your own KMS key, or false to use a key managed by Amazon S3. Optional.

    Valid Values: true | false

  • kms_key (Optional[KMSKey], default: None ) –

    The Amazon Resource Name (ARN) of a symmetric customer master key (CMK) used for Amazon S3 server-side encryption. Storage Gateway does not support asymmetric CMKs. This value can only be set when KMSEncrypted is true. Optional.

  • pool_id (Optional[PoolId], default: None ) –

    The ID of the pool that you want to add your tape to for archiving. The tape in this pool is archived in the S3 storage class that is associated with the pool. When you use your backup application to eject the tape, the tape is archived directly into the storage class (S3 Glacier or S3 Deep Archive) that corresponds to the pool.

  • worm (Optional[Boolean2], default: None ) –

    Set to TRUE if the tape you are creating is to be configured as a write-once-read-many (WORM) tape.

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

    A list of up to 50 tags that can be assigned to a virtual tape that has a barcode. Each tag is a key-value pair.

    Valid characters for key and value are letters, spaces, and numbers representable in UTF-8 format, and the following special characters: + - = . _ : / @. The maximum length of a tag's key is 128 characters, and the maximum length for a tag's value is 256.

Raises:

  • InternalServerError –

    An internal server error has occurred during the request. For more information, see the error and message fields.

  • InvalidGatewayRequestException –

    An exception occurred because an invalid gateway request was issued to the service. For more information, see the error and message fields.

  • UnknownServiceError –

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

Examples:

To create a virtual tape using a barcode Creates a virtual tape by using your own barcode.

>>> client.create_tape_with_barcode(gateway_arn='arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B', tape_size_in_bytes=107374182400, tape_barcode='TEST12345')
Source code in docs_src/capo_storage_gateway/_services/storage_gateway.py
def create_tape_with_barcode(
    self,
    gateway_arn: "capo_storage_gateway.types.gateway_arn.GatewayARN",
    tape_size_in_bytes: "capo_storage_gateway.types.tape_size.TapeSize",
    tape_barcode: "capo_storage_gateway.types.tape_barcode.TapeBarcode",
    *,
    config_overrides: Optional[StorageGatewayClientConfig] = None,
    kms_encrypted: Optional["capo_storage_gateway.types.boolean.Boolean"] = None,
    kms_key: Optional["capo_storage_gateway.types.kms_key.KMSKey"] = None,
    pool_id: Optional["capo_storage_gateway.types.pool_id.PoolId"] = None,
    worm: Optional["capo_storage_gateway.types.boolean2.Boolean2"] = None,
    tags: Optional["capo_storage_gateway.types.tags.Tags"] = None,
) -> "capo_storage_gateway.types.create_tape_with_barcode_output.CreateTapeWithBarcodeOutput":
    """<p>Creates a virtual tape by using your own barcode. You write data to the virtual tape and then archive the tape. A barcode is unique and cannot be reused if it has already been used on a tape. This applies to barcodes used on deleted tapes. This operation is only supported in the tape gateway type.</p> <note> <p>Cache storage must be allocated to the gateway before you can create a virtual tape. Use the <a>AddCache</a> operation to add cache storage to a gateway.</p> </note>

    Args:
        gateway_arn: <p>The unique Amazon Resource Name (ARN) that represents the gateway to associate the virtual tape with. Use the <a>ListGateways</a> operation to return a list of gateways for your account and Amazon Web Services Region.</p>
        tape_size_in_bytes: <p>The size, in bytes, of the virtual tape that you want to create.</p> <note> <p>The size must be aligned by gigabyte (1024*1024*1024 bytes).</p> </note>
        tape_barcode: <p>The barcode that you want to assign to the tape.</p> <note> <p>Barcodes cannot be reused. This includes barcodes used for tapes that have been deleted.</p> </note>
        kms_encrypted: <p>Set to <code>true</code> to use Amazon S3 server-side encryption with your own KMS key, or <code>false</code> to use a key managed by Amazon S3. Optional.</p> <p>Valid Values: <code>true</code> | <code>false</code> </p>
        kms_key: <p>The Amazon Resource Name (ARN) of a symmetric customer master key (CMK) used for Amazon S3 server-side encryption. Storage Gateway does not support asymmetric CMKs. This value can only be set when <code>KMSEncrypted</code> is <code>true</code>. Optional.</p>
        pool_id: <p>The ID of the pool that you want to add your tape to for archiving. The tape in this pool is archived in the S3 storage class that is associated with the pool. When you use your backup application to eject the tape, the tape is archived directly into the storage class (S3 Glacier or S3 Deep Archive) that corresponds to the pool.</p>
        worm: <p>Set to <code>TRUE</code> if the tape you are creating is to be configured as a write-once-read-many (WORM) tape.</p>
        tags: <p>A list of up to 50 tags that can be assigned to a virtual tape that has a barcode. Each tag is a key-value pair.</p> <note> <p>Valid characters for key and value are letters, spaces, and numbers representable in UTF-8 format, and the following special characters: + - = . _ : / @. The maximum length of a tag's key is 128 characters, and the maximum length for a tag's value is 256.</p> </note>

    Raises:
        capo_storage_gateway.errors.internal_server_error.InternalServerError: <p>An internal server error has occurred during the request. For more information, see the error and message fields.</p>
        capo_storage_gateway.errors.invalid_gateway_request_exception.InvalidGatewayRequestException: <p>An exception occurred because an invalid gateway request was issued to the service. For more information, see the error and message fields.</p>
        capo_storage_gateway.errors.UnknownServiceError: The service returned an error code this client does not model.

    Examples:
        To create a virtual tape using a barcode
        Creates a virtual tape by using your own barcode.

        >>> client.create_tape_with_barcode(gateway_arn='arn:aws:storagegateway:us-east-1:999999999999:gateway/sgw-12A3456B', tape_size_in_bytes=107374182400, tape_barcode='TEST12345')
    """

    def _handler(
        req: "OperationRequest[capo_storage_gateway.types.create_tape_with_barcode_input.CreateTapeWithBarcodeInput]",
    ) -> OperationResponse[
        "capo_storage_gateway.types.create_tape_with_barcode_output.CreateTapeWithBarcodeOutput"
    ]:
        import capo_storage_gateway._operations.storage_gateway_20130630.create_tape_with_barcode

        output, http_response = (
            capo_storage_gateway._operations.storage_gateway_20130630.create_tape_with_barcode.create_tape_with_barcode(
                req.options, req.input
            )
        )
        return OperationResponse(output=output, response=http_response)

    interceptors_, options_ = self.operation_options(
        config_overrides, OperationLogging("CreateTapeWithBarcode")
    )
    input_: capo_storage_gateway.types.create_tape_with_barcode_input.CreateTapeWithBarcodeInput = {
        "gateway_arn": gateway_arn,
        "tape_size_in_bytes": tape_size_in_bytes,
        "tape_barcode": tape_barcode,
    }
    if kms_encrypted is not None:
        input_["kms_encrypted"] = kms_encrypted
    if kms_key is not None:
        input_["kms_key"] = kms_key
    if pool_id is not None:
        input_["pool_id"] = pool_id
    if worm is not None:
        input_["worm"] = worm
    if tags is not None:
        input_["tags"] = tags

    response = execute_pipeline(
        OperationRequest(input=input_, options=options_),
        handler=_handler,
        interceptors=list(interceptors_),
    )
    response.response.close()
    return response.output