{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.StorageGateway.CreateTapeWithBarcode
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- 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.
module Amazonka.StorageGateway.CreateTapeWithBarcode
  ( -- * Creating a Request
    CreateTapeWithBarcode (..),
    newCreateTapeWithBarcode,

    -- * Request Lenses
    createTapeWithBarcode_kmsKey,
    createTapeWithBarcode_kmsEncrypted,
    createTapeWithBarcode_poolId,
    createTapeWithBarcode_worm,
    createTapeWithBarcode_tags,
    createTapeWithBarcode_gatewayARN,
    createTapeWithBarcode_tapeSizeInBytes,
    createTapeWithBarcode_tapeBarcode,

    -- * Destructuring the Response
    CreateTapeWithBarcodeResponse (..),
    newCreateTapeWithBarcodeResponse,

    -- * Response Lenses
    createTapeWithBarcodeResponse_tapeARN,
    createTapeWithBarcodeResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.StorageGateway.Types

-- | CreateTapeWithBarcodeInput
--
-- /See:/ 'newCreateTapeWithBarcode' smart constructor.
data CreateTapeWithBarcode = CreateTapeWithBarcode'
  { -- | 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.
    CreateTapeWithBarcode -> Maybe Text
kmsKey :: Prelude.Maybe Prelude.Text,
    -- | 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@
    CreateTapeWithBarcode -> Maybe Bool
kmsEncrypted :: Prelude.Maybe Prelude.Bool,
    -- | 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.
    --
    -- Valid Values: @GLACIER@ | @DEEP_ARCHIVE@
    CreateTapeWithBarcode -> Maybe Text
poolId :: Prelude.Maybe Prelude.Text,
    -- | Set to @TRUE@ if the tape you are creating is to be configured as a
    -- write-once-read-many (WORM) tape.
    CreateTapeWithBarcode -> Maybe Bool
worm :: Prelude.Maybe Prelude.Bool,
    -- | 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.
    CreateTapeWithBarcode -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | 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.
    CreateTapeWithBarcode -> Text
gatewayARN :: Prelude.Text,
    -- | The size, in bytes, of the virtual tape that you want to create.
    --
    -- The size must be aligned by gigabyte (1024*1024*1024 bytes).
    CreateTapeWithBarcode -> Integer
tapeSizeInBytes :: Prelude.Integer,
    -- | The barcode that you want to assign to the tape.
    --
    -- Barcodes cannot be reused. This includes barcodes used for tapes that
    -- have been deleted.
    CreateTapeWithBarcode -> Text
tapeBarcode :: Prelude.Text
  }
  deriving (CreateTapeWithBarcode -> CreateTapeWithBarcode -> Bool
(CreateTapeWithBarcode -> CreateTapeWithBarcode -> Bool)
-> (CreateTapeWithBarcode -> CreateTapeWithBarcode -> Bool)
-> Eq CreateTapeWithBarcode
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTapeWithBarcode -> CreateTapeWithBarcode -> Bool
$c/= :: CreateTapeWithBarcode -> CreateTapeWithBarcode -> Bool
== :: CreateTapeWithBarcode -> CreateTapeWithBarcode -> Bool
$c== :: CreateTapeWithBarcode -> CreateTapeWithBarcode -> Bool
Prelude.Eq, ReadPrec [CreateTapeWithBarcode]
ReadPrec CreateTapeWithBarcode
Int -> ReadS CreateTapeWithBarcode
ReadS [CreateTapeWithBarcode]
(Int -> ReadS CreateTapeWithBarcode)
-> ReadS [CreateTapeWithBarcode]
-> ReadPrec CreateTapeWithBarcode
-> ReadPrec [CreateTapeWithBarcode]
-> Read CreateTapeWithBarcode
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTapeWithBarcode]
$creadListPrec :: ReadPrec [CreateTapeWithBarcode]
readPrec :: ReadPrec CreateTapeWithBarcode
$creadPrec :: ReadPrec CreateTapeWithBarcode
readList :: ReadS [CreateTapeWithBarcode]
$creadList :: ReadS [CreateTapeWithBarcode]
readsPrec :: Int -> ReadS CreateTapeWithBarcode
$creadsPrec :: Int -> ReadS CreateTapeWithBarcode
Prelude.Read, Int -> CreateTapeWithBarcode -> ShowS
[CreateTapeWithBarcode] -> ShowS
CreateTapeWithBarcode -> String
(Int -> CreateTapeWithBarcode -> ShowS)
-> (CreateTapeWithBarcode -> String)
-> ([CreateTapeWithBarcode] -> ShowS)
-> Show CreateTapeWithBarcode
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTapeWithBarcode] -> ShowS
$cshowList :: [CreateTapeWithBarcode] -> ShowS
show :: CreateTapeWithBarcode -> String
$cshow :: CreateTapeWithBarcode -> String
showsPrec :: Int -> CreateTapeWithBarcode -> ShowS
$cshowsPrec :: Int -> CreateTapeWithBarcode -> ShowS
Prelude.Show, (forall x. CreateTapeWithBarcode -> Rep CreateTapeWithBarcode x)
-> (forall x. Rep CreateTapeWithBarcode x -> CreateTapeWithBarcode)
-> Generic CreateTapeWithBarcode
forall x. Rep CreateTapeWithBarcode x -> CreateTapeWithBarcode
forall x. CreateTapeWithBarcode -> Rep CreateTapeWithBarcode x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTapeWithBarcode x -> CreateTapeWithBarcode
$cfrom :: forall x. CreateTapeWithBarcode -> Rep CreateTapeWithBarcode x
Prelude.Generic)

-- |
-- Create a value of 'CreateTapeWithBarcode' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'kmsKey', 'createTapeWithBarcode_kmsKey' - 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.
--
-- 'kmsEncrypted', 'createTapeWithBarcode_kmsEncrypted' - 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@
--
-- 'poolId', 'createTapeWithBarcode_poolId' - 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.
--
-- Valid Values: @GLACIER@ | @DEEP_ARCHIVE@
--
-- 'worm', 'createTapeWithBarcode_worm' - Set to @TRUE@ if the tape you are creating is to be configured as a
-- write-once-read-many (WORM) tape.
--
-- 'tags', 'createTapeWithBarcode_tags' - 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.
--
-- 'gatewayARN', 'createTapeWithBarcode_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.
--
-- 'tapeSizeInBytes', 'createTapeWithBarcode_tapeSizeInBytes' - The size, in bytes, of the virtual tape that you want to create.
--
-- The size must be aligned by gigabyte (1024*1024*1024 bytes).
--
-- 'tapeBarcode', 'createTapeWithBarcode_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.
newCreateTapeWithBarcode ::
  -- | 'gatewayARN'
  Prelude.Text ->
  -- | 'tapeSizeInBytes'
  Prelude.Integer ->
  -- | 'tapeBarcode'
  Prelude.Text ->
  CreateTapeWithBarcode
newCreateTapeWithBarcode :: Text -> Integer -> Text -> CreateTapeWithBarcode
newCreateTapeWithBarcode
  Text
pGatewayARN_
  Integer
pTapeSizeInBytes_
  Text
pTapeBarcode_ =
    CreateTapeWithBarcode' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Bool
-> Maybe [Tag]
-> Text
-> Integer
-> Text
-> CreateTapeWithBarcode
CreateTapeWithBarcode'
      { $sel:kmsKey:CreateTapeWithBarcode' :: Maybe Text
kmsKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:kmsEncrypted:CreateTapeWithBarcode' :: Maybe Bool
kmsEncrypted = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:poolId:CreateTapeWithBarcode' :: Maybe Text
poolId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:worm:CreateTapeWithBarcode' :: Maybe Bool
worm = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateTapeWithBarcode' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:gatewayARN:CreateTapeWithBarcode' :: Text
gatewayARN = Text
pGatewayARN_,
        $sel:tapeSizeInBytes:CreateTapeWithBarcode' :: Integer
tapeSizeInBytes = Integer
pTapeSizeInBytes_,
        $sel:tapeBarcode:CreateTapeWithBarcode' :: Text
tapeBarcode = Text
pTapeBarcode_
      }

-- | 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.
createTapeWithBarcode_kmsKey :: Lens.Lens' CreateTapeWithBarcode (Prelude.Maybe Prelude.Text)
createTapeWithBarcode_kmsKey :: (Maybe Text -> f (Maybe Text))
-> CreateTapeWithBarcode -> f CreateTapeWithBarcode
createTapeWithBarcode_kmsKey = (CreateTapeWithBarcode -> Maybe Text)
-> (CreateTapeWithBarcode -> Maybe Text -> CreateTapeWithBarcode)
-> Lens
     CreateTapeWithBarcode
     CreateTapeWithBarcode
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapeWithBarcode' {Maybe Text
kmsKey :: Maybe Text
$sel:kmsKey:CreateTapeWithBarcode' :: CreateTapeWithBarcode -> Maybe Text
kmsKey} -> Maybe Text
kmsKey) (\s :: CreateTapeWithBarcode
s@CreateTapeWithBarcode' {} Maybe Text
a -> CreateTapeWithBarcode
s {$sel:kmsKey:CreateTapeWithBarcode' :: Maybe Text
kmsKey = Maybe Text
a} :: CreateTapeWithBarcode)

-- | 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@
createTapeWithBarcode_kmsEncrypted :: Lens.Lens' CreateTapeWithBarcode (Prelude.Maybe Prelude.Bool)
createTapeWithBarcode_kmsEncrypted :: (Maybe Bool -> f (Maybe Bool))
-> CreateTapeWithBarcode -> f CreateTapeWithBarcode
createTapeWithBarcode_kmsEncrypted = (CreateTapeWithBarcode -> Maybe Bool)
-> (CreateTapeWithBarcode -> Maybe Bool -> CreateTapeWithBarcode)
-> Lens
     CreateTapeWithBarcode
     CreateTapeWithBarcode
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapeWithBarcode' {Maybe Bool
kmsEncrypted :: Maybe Bool
$sel:kmsEncrypted:CreateTapeWithBarcode' :: CreateTapeWithBarcode -> Maybe Bool
kmsEncrypted} -> Maybe Bool
kmsEncrypted) (\s :: CreateTapeWithBarcode
s@CreateTapeWithBarcode' {} Maybe Bool
a -> CreateTapeWithBarcode
s {$sel:kmsEncrypted:CreateTapeWithBarcode' :: Maybe Bool
kmsEncrypted = Maybe Bool
a} :: CreateTapeWithBarcode)

-- | 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.
--
-- Valid Values: @GLACIER@ | @DEEP_ARCHIVE@
createTapeWithBarcode_poolId :: Lens.Lens' CreateTapeWithBarcode (Prelude.Maybe Prelude.Text)
createTapeWithBarcode_poolId :: (Maybe Text -> f (Maybe Text))
-> CreateTapeWithBarcode -> f CreateTapeWithBarcode
createTapeWithBarcode_poolId = (CreateTapeWithBarcode -> Maybe Text)
-> (CreateTapeWithBarcode -> Maybe Text -> CreateTapeWithBarcode)
-> Lens
     CreateTapeWithBarcode
     CreateTapeWithBarcode
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapeWithBarcode' {Maybe Text
poolId :: Maybe Text
$sel:poolId:CreateTapeWithBarcode' :: CreateTapeWithBarcode -> Maybe Text
poolId} -> Maybe Text
poolId) (\s :: CreateTapeWithBarcode
s@CreateTapeWithBarcode' {} Maybe Text
a -> CreateTapeWithBarcode
s {$sel:poolId:CreateTapeWithBarcode' :: Maybe Text
poolId = Maybe Text
a} :: CreateTapeWithBarcode)

-- | Set to @TRUE@ if the tape you are creating is to be configured as a
-- write-once-read-many (WORM) tape.
createTapeWithBarcode_worm :: Lens.Lens' CreateTapeWithBarcode (Prelude.Maybe Prelude.Bool)
createTapeWithBarcode_worm :: (Maybe Bool -> f (Maybe Bool))
-> CreateTapeWithBarcode -> f CreateTapeWithBarcode
createTapeWithBarcode_worm = (CreateTapeWithBarcode -> Maybe Bool)
-> (CreateTapeWithBarcode -> Maybe Bool -> CreateTapeWithBarcode)
-> Lens
     CreateTapeWithBarcode
     CreateTapeWithBarcode
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapeWithBarcode' {Maybe Bool
worm :: Maybe Bool
$sel:worm:CreateTapeWithBarcode' :: CreateTapeWithBarcode -> Maybe Bool
worm} -> Maybe Bool
worm) (\s :: CreateTapeWithBarcode
s@CreateTapeWithBarcode' {} Maybe Bool
a -> CreateTapeWithBarcode
s {$sel:worm:CreateTapeWithBarcode' :: Maybe Bool
worm = Maybe Bool
a} :: CreateTapeWithBarcode)

-- | 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.
createTapeWithBarcode_tags :: Lens.Lens' CreateTapeWithBarcode (Prelude.Maybe [Tag])
createTapeWithBarcode_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateTapeWithBarcode -> f CreateTapeWithBarcode
createTapeWithBarcode_tags = (CreateTapeWithBarcode -> Maybe [Tag])
-> (CreateTapeWithBarcode -> Maybe [Tag] -> CreateTapeWithBarcode)
-> Lens
     CreateTapeWithBarcode
     CreateTapeWithBarcode
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapeWithBarcode' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateTapeWithBarcode' :: CreateTapeWithBarcode -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateTapeWithBarcode
s@CreateTapeWithBarcode' {} Maybe [Tag]
a -> CreateTapeWithBarcode
s {$sel:tags:CreateTapeWithBarcode' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateTapeWithBarcode) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateTapeWithBarcode -> f CreateTapeWithBarcode)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateTapeWithBarcode
-> f CreateTapeWithBarcode
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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.
createTapeWithBarcode_gatewayARN :: Lens.Lens' CreateTapeWithBarcode Prelude.Text
createTapeWithBarcode_gatewayARN :: (Text -> f Text)
-> CreateTapeWithBarcode -> f CreateTapeWithBarcode
createTapeWithBarcode_gatewayARN = (CreateTapeWithBarcode -> Text)
-> (CreateTapeWithBarcode -> Text -> CreateTapeWithBarcode)
-> Lens CreateTapeWithBarcode CreateTapeWithBarcode Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapeWithBarcode' {Text
gatewayARN :: Text
$sel:gatewayARN:CreateTapeWithBarcode' :: CreateTapeWithBarcode -> Text
gatewayARN} -> Text
gatewayARN) (\s :: CreateTapeWithBarcode
s@CreateTapeWithBarcode' {} Text
a -> CreateTapeWithBarcode
s {$sel:gatewayARN:CreateTapeWithBarcode' :: Text
gatewayARN = Text
a} :: CreateTapeWithBarcode)

-- | The size, in bytes, of the virtual tape that you want to create.
--
-- The size must be aligned by gigabyte (1024*1024*1024 bytes).
createTapeWithBarcode_tapeSizeInBytes :: Lens.Lens' CreateTapeWithBarcode Prelude.Integer
createTapeWithBarcode_tapeSizeInBytes :: (Integer -> f Integer)
-> CreateTapeWithBarcode -> f CreateTapeWithBarcode
createTapeWithBarcode_tapeSizeInBytes = (CreateTapeWithBarcode -> Integer)
-> (CreateTapeWithBarcode -> Integer -> CreateTapeWithBarcode)
-> Lens CreateTapeWithBarcode CreateTapeWithBarcode Integer Integer
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapeWithBarcode' {Integer
tapeSizeInBytes :: Integer
$sel:tapeSizeInBytes:CreateTapeWithBarcode' :: CreateTapeWithBarcode -> Integer
tapeSizeInBytes} -> Integer
tapeSizeInBytes) (\s :: CreateTapeWithBarcode
s@CreateTapeWithBarcode' {} Integer
a -> CreateTapeWithBarcode
s {$sel:tapeSizeInBytes:CreateTapeWithBarcode' :: Integer
tapeSizeInBytes = Integer
a} :: CreateTapeWithBarcode)

-- | The barcode that you want to assign to the tape.
--
-- Barcodes cannot be reused. This includes barcodes used for tapes that
-- have been deleted.
createTapeWithBarcode_tapeBarcode :: Lens.Lens' CreateTapeWithBarcode Prelude.Text
createTapeWithBarcode_tapeBarcode :: (Text -> f Text)
-> CreateTapeWithBarcode -> f CreateTapeWithBarcode
createTapeWithBarcode_tapeBarcode = (CreateTapeWithBarcode -> Text)
-> (CreateTapeWithBarcode -> Text -> CreateTapeWithBarcode)
-> Lens CreateTapeWithBarcode CreateTapeWithBarcode Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapeWithBarcode' {Text
tapeBarcode :: Text
$sel:tapeBarcode:CreateTapeWithBarcode' :: CreateTapeWithBarcode -> Text
tapeBarcode} -> Text
tapeBarcode) (\s :: CreateTapeWithBarcode
s@CreateTapeWithBarcode' {} Text
a -> CreateTapeWithBarcode
s {$sel:tapeBarcode:CreateTapeWithBarcode' :: Text
tapeBarcode = Text
a} :: CreateTapeWithBarcode)

instance Core.AWSRequest CreateTapeWithBarcode where
  type
    AWSResponse CreateTapeWithBarcode =
      CreateTapeWithBarcodeResponse
  request :: CreateTapeWithBarcode -> Request CreateTapeWithBarcode
request = Service -> CreateTapeWithBarcode -> Request CreateTapeWithBarcode
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateTapeWithBarcode
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateTapeWithBarcode)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateTapeWithBarcode))
-> Logger
-> Service
-> Proxy CreateTapeWithBarcode
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateTapeWithBarcode)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> CreateTapeWithBarcodeResponse
CreateTapeWithBarcodeResponse'
            (Maybe Text -> Int -> CreateTapeWithBarcodeResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateTapeWithBarcodeResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TapeARN")
            Either String (Int -> CreateTapeWithBarcodeResponse)
-> Either String Int -> Either String CreateTapeWithBarcodeResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateTapeWithBarcode

instance Prelude.NFData CreateTapeWithBarcode

instance Core.ToHeaders CreateTapeWithBarcode where
  toHeaders :: CreateTapeWithBarcode -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateTapeWithBarcode -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"StorageGateway_20130630.CreateTapeWithBarcode" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateTapeWithBarcode where
  toJSON :: CreateTapeWithBarcode -> Value
toJSON CreateTapeWithBarcode' {Integer
Maybe Bool
Maybe [Tag]
Maybe Text
Text
tapeBarcode :: Text
tapeSizeInBytes :: Integer
gatewayARN :: Text
tags :: Maybe [Tag]
worm :: Maybe Bool
poolId :: Maybe Text
kmsEncrypted :: Maybe Bool
kmsKey :: Maybe Text
$sel:tapeBarcode:CreateTapeWithBarcode' :: CreateTapeWithBarcode -> Text
$sel:tapeSizeInBytes:CreateTapeWithBarcode' :: CreateTapeWithBarcode -> Integer
$sel:gatewayARN:CreateTapeWithBarcode' :: CreateTapeWithBarcode -> Text
$sel:tags:CreateTapeWithBarcode' :: CreateTapeWithBarcode -> Maybe [Tag]
$sel:worm:CreateTapeWithBarcode' :: CreateTapeWithBarcode -> Maybe Bool
$sel:poolId:CreateTapeWithBarcode' :: CreateTapeWithBarcode -> Maybe Text
$sel:kmsEncrypted:CreateTapeWithBarcode' :: CreateTapeWithBarcode -> Maybe Bool
$sel:kmsKey:CreateTapeWithBarcode' :: CreateTapeWithBarcode -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"KMSKey" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
kmsKey,
            (Text
"KMSEncrypted" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
kmsEncrypted,
            (Text
"PoolId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
poolId,
            (Text
"Worm" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
worm,
            (Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GatewayARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
gatewayARN),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"TapeSizeInBytes" Text -> Integer -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Integer
tapeSizeInBytes),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TapeBarcode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tapeBarcode)
          ]
      )

instance Core.ToPath CreateTapeWithBarcode where
  toPath :: CreateTapeWithBarcode -> ByteString
toPath = ByteString -> CreateTapeWithBarcode -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery CreateTapeWithBarcode where
  toQuery :: CreateTapeWithBarcode -> QueryString
toQuery = QueryString -> CreateTapeWithBarcode -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | CreateTapeOutput
--
-- /See:/ 'newCreateTapeWithBarcodeResponse' smart constructor.
data CreateTapeWithBarcodeResponse = CreateTapeWithBarcodeResponse'
  { -- | A unique Amazon Resource Name (ARN) that represents the virtual tape
    -- that was created.
    CreateTapeWithBarcodeResponse -> Maybe Text
tapeARN :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateTapeWithBarcodeResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateTapeWithBarcodeResponse
-> CreateTapeWithBarcodeResponse -> Bool
(CreateTapeWithBarcodeResponse
 -> CreateTapeWithBarcodeResponse -> Bool)
-> (CreateTapeWithBarcodeResponse
    -> CreateTapeWithBarcodeResponse -> Bool)
-> Eq CreateTapeWithBarcodeResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTapeWithBarcodeResponse
-> CreateTapeWithBarcodeResponse -> Bool
$c/= :: CreateTapeWithBarcodeResponse
-> CreateTapeWithBarcodeResponse -> Bool
== :: CreateTapeWithBarcodeResponse
-> CreateTapeWithBarcodeResponse -> Bool
$c== :: CreateTapeWithBarcodeResponse
-> CreateTapeWithBarcodeResponse -> Bool
Prelude.Eq, ReadPrec [CreateTapeWithBarcodeResponse]
ReadPrec CreateTapeWithBarcodeResponse
Int -> ReadS CreateTapeWithBarcodeResponse
ReadS [CreateTapeWithBarcodeResponse]
(Int -> ReadS CreateTapeWithBarcodeResponse)
-> ReadS [CreateTapeWithBarcodeResponse]
-> ReadPrec CreateTapeWithBarcodeResponse
-> ReadPrec [CreateTapeWithBarcodeResponse]
-> Read CreateTapeWithBarcodeResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTapeWithBarcodeResponse]
$creadListPrec :: ReadPrec [CreateTapeWithBarcodeResponse]
readPrec :: ReadPrec CreateTapeWithBarcodeResponse
$creadPrec :: ReadPrec CreateTapeWithBarcodeResponse
readList :: ReadS [CreateTapeWithBarcodeResponse]
$creadList :: ReadS [CreateTapeWithBarcodeResponse]
readsPrec :: Int -> ReadS CreateTapeWithBarcodeResponse
$creadsPrec :: Int -> ReadS CreateTapeWithBarcodeResponse
Prelude.Read, Int -> CreateTapeWithBarcodeResponse -> ShowS
[CreateTapeWithBarcodeResponse] -> ShowS
CreateTapeWithBarcodeResponse -> String
(Int -> CreateTapeWithBarcodeResponse -> ShowS)
-> (CreateTapeWithBarcodeResponse -> String)
-> ([CreateTapeWithBarcodeResponse] -> ShowS)
-> Show CreateTapeWithBarcodeResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTapeWithBarcodeResponse] -> ShowS
$cshowList :: [CreateTapeWithBarcodeResponse] -> ShowS
show :: CreateTapeWithBarcodeResponse -> String
$cshow :: CreateTapeWithBarcodeResponse -> String
showsPrec :: Int -> CreateTapeWithBarcodeResponse -> ShowS
$cshowsPrec :: Int -> CreateTapeWithBarcodeResponse -> ShowS
Prelude.Show, (forall x.
 CreateTapeWithBarcodeResponse
 -> Rep CreateTapeWithBarcodeResponse x)
-> (forall x.
    Rep CreateTapeWithBarcodeResponse x
    -> CreateTapeWithBarcodeResponse)
-> Generic CreateTapeWithBarcodeResponse
forall x.
Rep CreateTapeWithBarcodeResponse x
-> CreateTapeWithBarcodeResponse
forall x.
CreateTapeWithBarcodeResponse
-> Rep CreateTapeWithBarcodeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateTapeWithBarcodeResponse x
-> CreateTapeWithBarcodeResponse
$cfrom :: forall x.
CreateTapeWithBarcodeResponse
-> Rep CreateTapeWithBarcodeResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateTapeWithBarcodeResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'tapeARN', 'createTapeWithBarcodeResponse_tapeARN' - A unique Amazon Resource Name (ARN) that represents the virtual tape
-- that was created.
--
-- 'httpStatus', 'createTapeWithBarcodeResponse_httpStatus' - The response's http status code.
newCreateTapeWithBarcodeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateTapeWithBarcodeResponse
newCreateTapeWithBarcodeResponse :: Int -> CreateTapeWithBarcodeResponse
newCreateTapeWithBarcodeResponse Int
pHttpStatus_ =
  CreateTapeWithBarcodeResponse' :: Maybe Text -> Int -> CreateTapeWithBarcodeResponse
CreateTapeWithBarcodeResponse'
    { $sel:tapeARN:CreateTapeWithBarcodeResponse' :: Maybe Text
tapeARN =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateTapeWithBarcodeResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A unique Amazon Resource Name (ARN) that represents the virtual tape
-- that was created.
createTapeWithBarcodeResponse_tapeARN :: Lens.Lens' CreateTapeWithBarcodeResponse (Prelude.Maybe Prelude.Text)
createTapeWithBarcodeResponse_tapeARN :: (Maybe Text -> f (Maybe Text))
-> CreateTapeWithBarcodeResponse -> f CreateTapeWithBarcodeResponse
createTapeWithBarcodeResponse_tapeARN = (CreateTapeWithBarcodeResponse -> Maybe Text)
-> (CreateTapeWithBarcodeResponse
    -> Maybe Text -> CreateTapeWithBarcodeResponse)
-> Lens
     CreateTapeWithBarcodeResponse
     CreateTapeWithBarcodeResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapeWithBarcodeResponse' {Maybe Text
tapeARN :: Maybe Text
$sel:tapeARN:CreateTapeWithBarcodeResponse' :: CreateTapeWithBarcodeResponse -> Maybe Text
tapeARN} -> Maybe Text
tapeARN) (\s :: CreateTapeWithBarcodeResponse
s@CreateTapeWithBarcodeResponse' {} Maybe Text
a -> CreateTapeWithBarcodeResponse
s {$sel:tapeARN:CreateTapeWithBarcodeResponse' :: Maybe Text
tapeARN = Maybe Text
a} :: CreateTapeWithBarcodeResponse)

-- | The response's http status code.
createTapeWithBarcodeResponse_httpStatus :: Lens.Lens' CreateTapeWithBarcodeResponse Prelude.Int
createTapeWithBarcodeResponse_httpStatus :: (Int -> f Int)
-> CreateTapeWithBarcodeResponse -> f CreateTapeWithBarcodeResponse
createTapeWithBarcodeResponse_httpStatus = (CreateTapeWithBarcodeResponse -> Int)
-> (CreateTapeWithBarcodeResponse
    -> Int -> CreateTapeWithBarcodeResponse)
-> Lens
     CreateTapeWithBarcodeResponse CreateTapeWithBarcodeResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapeWithBarcodeResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateTapeWithBarcodeResponse' :: CreateTapeWithBarcodeResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateTapeWithBarcodeResponse
s@CreateTapeWithBarcodeResponse' {} Int
a -> CreateTapeWithBarcodeResponse
s {$sel:httpStatus:CreateTapeWithBarcodeResponse' :: Int
httpStatus = Int
a} :: CreateTapeWithBarcodeResponse)

instance Prelude.NFData CreateTapeWithBarcodeResponse