{-# 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.CreateTapes
-- 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 one or more virtual tapes. You write data to the virtual tapes
-- and then archive the tapes. This operation is only supported in the tape
-- gateway type.
--
-- Cache storage must be allocated to the gateway before you can create
-- virtual tapes. Use the AddCache operation to add cache storage to a
-- gateway.
module Amazonka.StorageGateway.CreateTapes
  ( -- * Creating a Request
    CreateTapes (..),
    newCreateTapes,

    -- * Request Lenses
    createTapes_kmsKey,
    createTapes_kmsEncrypted,
    createTapes_poolId,
    createTapes_worm,
    createTapes_tags,
    createTapes_gatewayARN,
    createTapes_tapeSizeInBytes,
    createTapes_clientToken,
    createTapes_numTapesToCreate,
    createTapes_tapeBarcodePrefix,

    -- * Destructuring the Response
    CreateTapesResponse (..),
    newCreateTapesResponse,

    -- * Response Lenses
    createTapesResponse_tapeARNs,
    createTapesResponse_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

-- | CreateTapesInput
--
-- /See:/ 'newCreateTapes' smart constructor.
data CreateTapes = CreateTapes'
  { -- | 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.
    CreateTapes -> 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@
    CreateTapes -> 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
    -- Glacier Deep Archive) that corresponds to the pool.
    --
    -- Valid Values: @GLACIER@ | @DEEP_ARCHIVE@
    CreateTapes -> 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.
    CreateTapes -> Maybe Bool
worm :: Prelude.Maybe Prelude.Bool,
    -- | A list of up to 50 tags that can be assigned to a virtual tape. 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.
    CreateTapes -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The unique Amazon Resource Name (ARN) that represents the gateway to
    -- associate the virtual tapes with. Use the ListGateways operation to
    -- return a list of gateways for your account and Amazon Web Services
    -- Region.
    CreateTapes -> Text
gatewayARN :: Prelude.Text,
    -- | The size, in bytes, of the virtual tapes that you want to create.
    --
    -- The size must be aligned by gigabyte (1024*1024*1024 bytes).
    CreateTapes -> Integer
tapeSizeInBytes :: Prelude.Integer,
    -- | A unique identifier that you use to retry a request. If you retry a
    -- request, use the same @ClientToken@ you specified in the initial
    -- request.
    --
    -- Using the same @ClientToken@ prevents creating the tape multiple times.
    CreateTapes -> Text
clientToken :: Prelude.Text,
    -- | The number of virtual tapes that you want to create.
    CreateTapes -> Natural
numTapesToCreate :: Prelude.Natural,
    -- | A prefix that you append to the barcode of the virtual tape you are
    -- creating. This prefix makes the barcode unique.
    --
    -- The prefix must be 1-4 characters in length and must be one of the
    -- uppercase letters from A to Z.
    CreateTapes -> Text
tapeBarcodePrefix :: Prelude.Text
  }
  deriving (CreateTapes -> CreateTapes -> Bool
(CreateTapes -> CreateTapes -> Bool)
-> (CreateTapes -> CreateTapes -> Bool) -> Eq CreateTapes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTapes -> CreateTapes -> Bool
$c/= :: CreateTapes -> CreateTapes -> Bool
== :: CreateTapes -> CreateTapes -> Bool
$c== :: CreateTapes -> CreateTapes -> Bool
Prelude.Eq, ReadPrec [CreateTapes]
ReadPrec CreateTapes
Int -> ReadS CreateTapes
ReadS [CreateTapes]
(Int -> ReadS CreateTapes)
-> ReadS [CreateTapes]
-> ReadPrec CreateTapes
-> ReadPrec [CreateTapes]
-> Read CreateTapes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTapes]
$creadListPrec :: ReadPrec [CreateTapes]
readPrec :: ReadPrec CreateTapes
$creadPrec :: ReadPrec CreateTapes
readList :: ReadS [CreateTapes]
$creadList :: ReadS [CreateTapes]
readsPrec :: Int -> ReadS CreateTapes
$creadsPrec :: Int -> ReadS CreateTapes
Prelude.Read, Int -> CreateTapes -> ShowS
[CreateTapes] -> ShowS
CreateTapes -> String
(Int -> CreateTapes -> ShowS)
-> (CreateTapes -> String)
-> ([CreateTapes] -> ShowS)
-> Show CreateTapes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTapes] -> ShowS
$cshowList :: [CreateTapes] -> ShowS
show :: CreateTapes -> String
$cshow :: CreateTapes -> String
showsPrec :: Int -> CreateTapes -> ShowS
$cshowsPrec :: Int -> CreateTapes -> ShowS
Prelude.Show, (forall x. CreateTapes -> Rep CreateTapes x)
-> (forall x. Rep CreateTapes x -> CreateTapes)
-> Generic CreateTapes
forall x. Rep CreateTapes x -> CreateTapes
forall x. CreateTapes -> Rep CreateTapes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTapes x -> CreateTapes
$cfrom :: forall x. CreateTapes -> Rep CreateTapes x
Prelude.Generic)

-- |
-- Create a value of 'CreateTapes' 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', 'createTapes_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', 'createTapes_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', 'createTapes_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
-- Glacier Deep Archive) that corresponds to the pool.
--
-- Valid Values: @GLACIER@ | @DEEP_ARCHIVE@
--
-- 'worm', 'createTapes_worm' - Set to @TRUE@ if the tape you are creating is to be configured as a
-- write-once-read-many (WORM) tape.
--
-- 'tags', 'createTapes_tags' - A list of up to 50 tags that can be assigned to a virtual tape. 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', 'createTapes_gatewayARN' - The unique Amazon Resource Name (ARN) that represents the gateway to
-- associate the virtual tapes with. Use the ListGateways operation to
-- return a list of gateways for your account and Amazon Web Services
-- Region.
--
-- 'tapeSizeInBytes', 'createTapes_tapeSizeInBytes' - The size, in bytes, of the virtual tapes that you want to create.
--
-- The size must be aligned by gigabyte (1024*1024*1024 bytes).
--
-- 'clientToken', 'createTapes_clientToken' - A unique identifier that you use to retry a request. If you retry a
-- request, use the same @ClientToken@ you specified in the initial
-- request.
--
-- Using the same @ClientToken@ prevents creating the tape multiple times.
--
-- 'numTapesToCreate', 'createTapes_numTapesToCreate' - The number of virtual tapes that you want to create.
--
-- 'tapeBarcodePrefix', 'createTapes_tapeBarcodePrefix' - A prefix that you append to the barcode of the virtual tape you are
-- creating. This prefix makes the barcode unique.
--
-- The prefix must be 1-4 characters in length and must be one of the
-- uppercase letters from A to Z.
newCreateTapes ::
  -- | 'gatewayARN'
  Prelude.Text ->
  -- | 'tapeSizeInBytes'
  Prelude.Integer ->
  -- | 'clientToken'
  Prelude.Text ->
  -- | 'numTapesToCreate'
  Prelude.Natural ->
  -- | 'tapeBarcodePrefix'
  Prelude.Text ->
  CreateTapes
newCreateTapes :: Text -> Integer -> Text -> Natural -> Text -> CreateTapes
newCreateTapes
  Text
pGatewayARN_
  Integer
pTapeSizeInBytes_
  Text
pClientToken_
  Natural
pNumTapesToCreate_
  Text
pTapeBarcodePrefix_ =
    CreateTapes' :: Maybe Text
-> Maybe Bool
-> Maybe Text
-> Maybe Bool
-> Maybe [Tag]
-> Text
-> Integer
-> Text
-> Natural
-> Text
-> CreateTapes
CreateTapes'
      { $sel:kmsKey:CreateTapes' :: Maybe Text
kmsKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:kmsEncrypted:CreateTapes' :: Maybe Bool
kmsEncrypted = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:poolId:CreateTapes' :: Maybe Text
poolId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:worm:CreateTapes' :: Maybe Bool
worm = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateTapes' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:gatewayARN:CreateTapes' :: Text
gatewayARN = Text
pGatewayARN_,
        $sel:tapeSizeInBytes:CreateTapes' :: Integer
tapeSizeInBytes = Integer
pTapeSizeInBytes_,
        $sel:clientToken:CreateTapes' :: Text
clientToken = Text
pClientToken_,
        $sel:numTapesToCreate:CreateTapes' :: Natural
numTapesToCreate = Natural
pNumTapesToCreate_,
        $sel:tapeBarcodePrefix:CreateTapes' :: Text
tapeBarcodePrefix = Text
pTapeBarcodePrefix_
      }

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

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

-- | 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
-- Glacier Deep Archive) that corresponds to the pool.
--
-- Valid Values: @GLACIER@ | @DEEP_ARCHIVE@
createTapes_poolId :: Lens.Lens' CreateTapes (Prelude.Maybe Prelude.Text)
createTapes_poolId :: (Maybe Text -> f (Maybe Text)) -> CreateTapes -> f CreateTapes
createTapes_poolId = (CreateTapes -> Maybe Text)
-> (CreateTapes -> Maybe Text -> CreateTapes)
-> Lens CreateTapes CreateTapes (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapes' {Maybe Text
poolId :: Maybe Text
$sel:poolId:CreateTapes' :: CreateTapes -> Maybe Text
poolId} -> Maybe Text
poolId) (\s :: CreateTapes
s@CreateTapes' {} Maybe Text
a -> CreateTapes
s {$sel:poolId:CreateTapes' :: Maybe Text
poolId = Maybe Text
a} :: CreateTapes)

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

-- | A list of up to 50 tags that can be assigned to a virtual tape. 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.
createTapes_tags :: Lens.Lens' CreateTapes (Prelude.Maybe [Tag])
createTapes_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> CreateTapes -> f CreateTapes
createTapes_tags = (CreateTapes -> Maybe [Tag])
-> (CreateTapes -> Maybe [Tag] -> CreateTapes)
-> Lens CreateTapes CreateTapes (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapes' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateTapes' :: CreateTapes -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateTapes
s@CreateTapes' {} Maybe [Tag]
a -> CreateTapes
s {$sel:tags:CreateTapes' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateTapes) ((Maybe [Tag] -> f (Maybe [Tag])) -> CreateTapes -> f CreateTapes)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateTapes
-> f CreateTapes
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 tapes with. Use the ListGateways operation to
-- return a list of gateways for your account and Amazon Web Services
-- Region.
createTapes_gatewayARN :: Lens.Lens' CreateTapes Prelude.Text
createTapes_gatewayARN :: (Text -> f Text) -> CreateTapes -> f CreateTapes
createTapes_gatewayARN = (CreateTapes -> Text)
-> (CreateTapes -> Text -> CreateTapes)
-> Lens CreateTapes CreateTapes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapes' {Text
gatewayARN :: Text
$sel:gatewayARN:CreateTapes' :: CreateTapes -> Text
gatewayARN} -> Text
gatewayARN) (\s :: CreateTapes
s@CreateTapes' {} Text
a -> CreateTapes
s {$sel:gatewayARN:CreateTapes' :: Text
gatewayARN = Text
a} :: CreateTapes)

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

-- | A unique identifier that you use to retry a request. If you retry a
-- request, use the same @ClientToken@ you specified in the initial
-- request.
--
-- Using the same @ClientToken@ prevents creating the tape multiple times.
createTapes_clientToken :: Lens.Lens' CreateTapes Prelude.Text
createTapes_clientToken :: (Text -> f Text) -> CreateTapes -> f CreateTapes
createTapes_clientToken = (CreateTapes -> Text)
-> (CreateTapes -> Text -> CreateTapes)
-> Lens CreateTapes CreateTapes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapes' {Text
clientToken :: Text
$sel:clientToken:CreateTapes' :: CreateTapes -> Text
clientToken} -> Text
clientToken) (\s :: CreateTapes
s@CreateTapes' {} Text
a -> CreateTapes
s {$sel:clientToken:CreateTapes' :: Text
clientToken = Text
a} :: CreateTapes)

-- | The number of virtual tapes that you want to create.
createTapes_numTapesToCreate :: Lens.Lens' CreateTapes Prelude.Natural
createTapes_numTapesToCreate :: (Natural -> f Natural) -> CreateTapes -> f CreateTapes
createTapes_numTapesToCreate = (CreateTapes -> Natural)
-> (CreateTapes -> Natural -> CreateTapes)
-> Lens CreateTapes CreateTapes Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapes' {Natural
numTapesToCreate :: Natural
$sel:numTapesToCreate:CreateTapes' :: CreateTapes -> Natural
numTapesToCreate} -> Natural
numTapesToCreate) (\s :: CreateTapes
s@CreateTapes' {} Natural
a -> CreateTapes
s {$sel:numTapesToCreate:CreateTapes' :: Natural
numTapesToCreate = Natural
a} :: CreateTapes)

-- | A prefix that you append to the barcode of the virtual tape you are
-- creating. This prefix makes the barcode unique.
--
-- The prefix must be 1-4 characters in length and must be one of the
-- uppercase letters from A to Z.
createTapes_tapeBarcodePrefix :: Lens.Lens' CreateTapes Prelude.Text
createTapes_tapeBarcodePrefix :: (Text -> f Text) -> CreateTapes -> f CreateTapes
createTapes_tapeBarcodePrefix = (CreateTapes -> Text)
-> (CreateTapes -> Text -> CreateTapes)
-> Lens CreateTapes CreateTapes Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapes' {Text
tapeBarcodePrefix :: Text
$sel:tapeBarcodePrefix:CreateTapes' :: CreateTapes -> Text
tapeBarcodePrefix} -> Text
tapeBarcodePrefix) (\s :: CreateTapes
s@CreateTapes' {} Text
a -> CreateTapes
s {$sel:tapeBarcodePrefix:CreateTapes' :: Text
tapeBarcodePrefix = Text
a} :: CreateTapes)

instance Core.AWSRequest CreateTapes where
  type AWSResponse CreateTapes = CreateTapesResponse
  request :: CreateTapes -> Request CreateTapes
request = Service -> CreateTapes -> Request CreateTapes
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateTapes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateTapes)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateTapes))
-> Logger
-> Service
-> Proxy CreateTapes
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateTapes)))
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 -> CreateTapesResponse
CreateTapesResponse'
            (Maybe [Text] -> Int -> CreateTapesResponse)
-> Either String (Maybe [Text])
-> Either String (Int -> CreateTapesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"TapeARNs" Either String (Maybe (Maybe [Text]))
-> Maybe [Text] -> Either String (Maybe [Text])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> CreateTapesResponse)
-> Either String Int -> Either String CreateTapesResponse
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 CreateTapes

instance Prelude.NFData CreateTapes

instance Core.ToHeaders CreateTapes where
  toHeaders :: CreateTapes -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateTapes -> 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.CreateTapes" ::
                          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 CreateTapes where
  toJSON :: CreateTapes -> Value
toJSON CreateTapes' {Integer
Natural
Maybe Bool
Maybe [Tag]
Maybe Text
Text
tapeBarcodePrefix :: Text
numTapesToCreate :: Natural
clientToken :: Text
tapeSizeInBytes :: Integer
gatewayARN :: Text
tags :: Maybe [Tag]
worm :: Maybe Bool
poolId :: Maybe Text
kmsEncrypted :: Maybe Bool
kmsKey :: Maybe Text
$sel:tapeBarcodePrefix:CreateTapes' :: CreateTapes -> Text
$sel:numTapesToCreate:CreateTapes' :: CreateTapes -> Natural
$sel:clientToken:CreateTapes' :: CreateTapes -> Text
$sel:tapeSizeInBytes:CreateTapes' :: CreateTapes -> Integer
$sel:gatewayARN:CreateTapes' :: CreateTapes -> Text
$sel:tags:CreateTapes' :: CreateTapes -> Maybe [Tag]
$sel:worm:CreateTapes' :: CreateTapes -> Maybe Bool
$sel:poolId:CreateTapes' :: CreateTapes -> Maybe Text
$sel:kmsEncrypted:CreateTapes' :: CreateTapes -> Maybe Bool
$sel:kmsKey:CreateTapes' :: CreateTapes -> 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
"ClientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientToken),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"NumTapesToCreate" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
numTapesToCreate),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"TapeBarcodePrefix" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
tapeBarcodePrefix)
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateTapesResponse' 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:
--
-- 'tapeARNs', 'createTapesResponse_tapeARNs' - A list of unique Amazon Resource Names (ARNs) that represents the
-- virtual tapes that were created.
--
-- 'httpStatus', 'createTapesResponse_httpStatus' - The response's http status code.
newCreateTapesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateTapesResponse
newCreateTapesResponse :: Int -> CreateTapesResponse
newCreateTapesResponse Int
pHttpStatus_ =
  CreateTapesResponse' :: Maybe [Text] -> Int -> CreateTapesResponse
CreateTapesResponse'
    { $sel:tapeARNs:CreateTapesResponse' :: Maybe [Text]
tapeARNs = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateTapesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of unique Amazon Resource Names (ARNs) that represents the
-- virtual tapes that were created.
createTapesResponse_tapeARNs :: Lens.Lens' CreateTapesResponse (Prelude.Maybe [Prelude.Text])
createTapesResponse_tapeARNs :: (Maybe [Text] -> f (Maybe [Text]))
-> CreateTapesResponse -> f CreateTapesResponse
createTapesResponse_tapeARNs = (CreateTapesResponse -> Maybe [Text])
-> (CreateTapesResponse -> Maybe [Text] -> CreateTapesResponse)
-> Lens
     CreateTapesResponse
     CreateTapesResponse
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTapesResponse' {Maybe [Text]
tapeARNs :: Maybe [Text]
$sel:tapeARNs:CreateTapesResponse' :: CreateTapesResponse -> Maybe [Text]
tapeARNs} -> Maybe [Text]
tapeARNs) (\s :: CreateTapesResponse
s@CreateTapesResponse' {} Maybe [Text]
a -> CreateTapesResponse
s {$sel:tapeARNs:CreateTapesResponse' :: Maybe [Text]
tapeARNs = Maybe [Text]
a} :: CreateTapesResponse) ((Maybe [Text] -> f (Maybe [Text]))
 -> CreateTapesResponse -> f CreateTapesResponse)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateTapesResponse
-> f CreateTapesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData CreateTapesResponse