{-# 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.UpdateVTLDeviceType
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Updates the type of medium changer in a tape gateway. When you activate
-- a tape gateway, you select a medium changer type for the tape gateway.
-- This operation enables you to select a different type of medium changer
-- after a tape gateway is activated. This operation is only supported in
-- the tape gateway type.
module Amazonka.StorageGateway.UpdateVTLDeviceType
  ( -- * Creating a Request
    UpdateVTLDeviceType (..),
    newUpdateVTLDeviceType,

    -- * Request Lenses
    updateVTLDeviceType_vTLDeviceARN,
    updateVTLDeviceType_deviceType,

    -- * Destructuring the Response
    UpdateVTLDeviceTypeResponse (..),
    newUpdateVTLDeviceTypeResponse,

    -- * Response Lenses
    updateVTLDeviceTypeResponse_vTLDeviceARN,
    updateVTLDeviceTypeResponse_httpStatus,
  )
where

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

-- | /See:/ 'newUpdateVTLDeviceType' smart constructor.
data UpdateVTLDeviceType = UpdateVTLDeviceType'
  { -- | The Amazon Resource Name (ARN) of the medium changer you want to select.
    UpdateVTLDeviceType -> Text
vTLDeviceARN :: Prelude.Text,
    -- | The type of medium changer you want to select.
    --
    -- Valid Values: @STK-L700@ | @AWS-Gateway-VTL@ | @IBM-03584L32-0402@
    UpdateVTLDeviceType -> Text
deviceType :: Prelude.Text
  }
  deriving (UpdateVTLDeviceType -> UpdateVTLDeviceType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateVTLDeviceType -> UpdateVTLDeviceType -> Bool
$c/= :: UpdateVTLDeviceType -> UpdateVTLDeviceType -> Bool
== :: UpdateVTLDeviceType -> UpdateVTLDeviceType -> Bool
$c== :: UpdateVTLDeviceType -> UpdateVTLDeviceType -> Bool
Prelude.Eq, ReadPrec [UpdateVTLDeviceType]
ReadPrec UpdateVTLDeviceType
Int -> ReadS UpdateVTLDeviceType
ReadS [UpdateVTLDeviceType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateVTLDeviceType]
$creadListPrec :: ReadPrec [UpdateVTLDeviceType]
readPrec :: ReadPrec UpdateVTLDeviceType
$creadPrec :: ReadPrec UpdateVTLDeviceType
readList :: ReadS [UpdateVTLDeviceType]
$creadList :: ReadS [UpdateVTLDeviceType]
readsPrec :: Int -> ReadS UpdateVTLDeviceType
$creadsPrec :: Int -> ReadS UpdateVTLDeviceType
Prelude.Read, Int -> UpdateVTLDeviceType -> ShowS
[UpdateVTLDeviceType] -> ShowS
UpdateVTLDeviceType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateVTLDeviceType] -> ShowS
$cshowList :: [UpdateVTLDeviceType] -> ShowS
show :: UpdateVTLDeviceType -> String
$cshow :: UpdateVTLDeviceType -> String
showsPrec :: Int -> UpdateVTLDeviceType -> ShowS
$cshowsPrec :: Int -> UpdateVTLDeviceType -> ShowS
Prelude.Show, forall x. Rep UpdateVTLDeviceType x -> UpdateVTLDeviceType
forall x. UpdateVTLDeviceType -> Rep UpdateVTLDeviceType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateVTLDeviceType x -> UpdateVTLDeviceType
$cfrom :: forall x. UpdateVTLDeviceType -> Rep UpdateVTLDeviceType x
Prelude.Generic)

-- |
-- Create a value of 'UpdateVTLDeviceType' 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:
--
-- 'vTLDeviceARN', 'updateVTLDeviceType_vTLDeviceARN' - The Amazon Resource Name (ARN) of the medium changer you want to select.
--
-- 'deviceType', 'updateVTLDeviceType_deviceType' - The type of medium changer you want to select.
--
-- Valid Values: @STK-L700@ | @AWS-Gateway-VTL@ | @IBM-03584L32-0402@
newUpdateVTLDeviceType ::
  -- | 'vTLDeviceARN'
  Prelude.Text ->
  -- | 'deviceType'
  Prelude.Text ->
  UpdateVTLDeviceType
newUpdateVTLDeviceType :: Text -> Text -> UpdateVTLDeviceType
newUpdateVTLDeviceType Text
pVTLDeviceARN_ Text
pDeviceType_ =
  UpdateVTLDeviceType'
    { $sel:vTLDeviceARN:UpdateVTLDeviceType' :: Text
vTLDeviceARN = Text
pVTLDeviceARN_,
      $sel:deviceType:UpdateVTLDeviceType' :: Text
deviceType = Text
pDeviceType_
    }

-- | The Amazon Resource Name (ARN) of the medium changer you want to select.
updateVTLDeviceType_vTLDeviceARN :: Lens.Lens' UpdateVTLDeviceType Prelude.Text
updateVTLDeviceType_vTLDeviceARN :: Lens' UpdateVTLDeviceType Text
updateVTLDeviceType_vTLDeviceARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateVTLDeviceType' {Text
vTLDeviceARN :: Text
$sel:vTLDeviceARN:UpdateVTLDeviceType' :: UpdateVTLDeviceType -> Text
vTLDeviceARN} -> Text
vTLDeviceARN) (\s :: UpdateVTLDeviceType
s@UpdateVTLDeviceType' {} Text
a -> UpdateVTLDeviceType
s {$sel:vTLDeviceARN:UpdateVTLDeviceType' :: Text
vTLDeviceARN = Text
a} :: UpdateVTLDeviceType)

-- | The type of medium changer you want to select.
--
-- Valid Values: @STK-L700@ | @AWS-Gateway-VTL@ | @IBM-03584L32-0402@
updateVTLDeviceType_deviceType :: Lens.Lens' UpdateVTLDeviceType Prelude.Text
updateVTLDeviceType_deviceType :: Lens' UpdateVTLDeviceType Text
updateVTLDeviceType_deviceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateVTLDeviceType' {Text
deviceType :: Text
$sel:deviceType:UpdateVTLDeviceType' :: UpdateVTLDeviceType -> Text
deviceType} -> Text
deviceType) (\s :: UpdateVTLDeviceType
s@UpdateVTLDeviceType' {} Text
a -> UpdateVTLDeviceType
s {$sel:deviceType:UpdateVTLDeviceType' :: Text
deviceType = Text
a} :: UpdateVTLDeviceType)

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

instance Prelude.Hashable UpdateVTLDeviceType where
  hashWithSalt :: Int -> UpdateVTLDeviceType -> Int
hashWithSalt Int
_salt UpdateVTLDeviceType' {Text
deviceType :: Text
vTLDeviceARN :: Text
$sel:deviceType:UpdateVTLDeviceType' :: UpdateVTLDeviceType -> Text
$sel:vTLDeviceARN:UpdateVTLDeviceType' :: UpdateVTLDeviceType -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
vTLDeviceARN
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
deviceType

instance Prelude.NFData UpdateVTLDeviceType where
  rnf :: UpdateVTLDeviceType -> ()
rnf UpdateVTLDeviceType' {Text
deviceType :: Text
vTLDeviceARN :: Text
$sel:deviceType:UpdateVTLDeviceType' :: UpdateVTLDeviceType -> Text
$sel:vTLDeviceARN:UpdateVTLDeviceType' :: UpdateVTLDeviceType -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
vTLDeviceARN
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
deviceType

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

instance Data.ToJSON UpdateVTLDeviceType where
  toJSON :: UpdateVTLDeviceType -> Value
toJSON UpdateVTLDeviceType' {Text
deviceType :: Text
vTLDeviceARN :: Text
$sel:deviceType:UpdateVTLDeviceType' :: UpdateVTLDeviceType -> Text
$sel:vTLDeviceARN:UpdateVTLDeviceType' :: UpdateVTLDeviceType -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just (Key
"VTLDeviceARN" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
vTLDeviceARN),
            forall a. a -> Maybe a
Prelude.Just (Key
"DeviceType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
deviceType)
          ]
      )

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

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

-- | UpdateVTLDeviceTypeOutput
--
-- /See:/ 'newUpdateVTLDeviceTypeResponse' smart constructor.
data UpdateVTLDeviceTypeResponse = UpdateVTLDeviceTypeResponse'
  { -- | The Amazon Resource Name (ARN) of the medium changer you have selected.
    UpdateVTLDeviceTypeResponse -> Maybe Text
vTLDeviceARN :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    UpdateVTLDeviceTypeResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (UpdateVTLDeviceTypeResponse -> UpdateVTLDeviceTypeResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateVTLDeviceTypeResponse -> UpdateVTLDeviceTypeResponse -> Bool
$c/= :: UpdateVTLDeviceTypeResponse -> UpdateVTLDeviceTypeResponse -> Bool
== :: UpdateVTLDeviceTypeResponse -> UpdateVTLDeviceTypeResponse -> Bool
$c== :: UpdateVTLDeviceTypeResponse -> UpdateVTLDeviceTypeResponse -> Bool
Prelude.Eq, ReadPrec [UpdateVTLDeviceTypeResponse]
ReadPrec UpdateVTLDeviceTypeResponse
Int -> ReadS UpdateVTLDeviceTypeResponse
ReadS [UpdateVTLDeviceTypeResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateVTLDeviceTypeResponse]
$creadListPrec :: ReadPrec [UpdateVTLDeviceTypeResponse]
readPrec :: ReadPrec UpdateVTLDeviceTypeResponse
$creadPrec :: ReadPrec UpdateVTLDeviceTypeResponse
readList :: ReadS [UpdateVTLDeviceTypeResponse]
$creadList :: ReadS [UpdateVTLDeviceTypeResponse]
readsPrec :: Int -> ReadS UpdateVTLDeviceTypeResponse
$creadsPrec :: Int -> ReadS UpdateVTLDeviceTypeResponse
Prelude.Read, Int -> UpdateVTLDeviceTypeResponse -> ShowS
[UpdateVTLDeviceTypeResponse] -> ShowS
UpdateVTLDeviceTypeResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateVTLDeviceTypeResponse] -> ShowS
$cshowList :: [UpdateVTLDeviceTypeResponse] -> ShowS
show :: UpdateVTLDeviceTypeResponse -> String
$cshow :: UpdateVTLDeviceTypeResponse -> String
showsPrec :: Int -> UpdateVTLDeviceTypeResponse -> ShowS
$cshowsPrec :: Int -> UpdateVTLDeviceTypeResponse -> ShowS
Prelude.Show, forall x.
Rep UpdateVTLDeviceTypeResponse x -> UpdateVTLDeviceTypeResponse
forall x.
UpdateVTLDeviceTypeResponse -> Rep UpdateVTLDeviceTypeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateVTLDeviceTypeResponse x -> UpdateVTLDeviceTypeResponse
$cfrom :: forall x.
UpdateVTLDeviceTypeResponse -> Rep UpdateVTLDeviceTypeResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateVTLDeviceTypeResponse' 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:
--
-- 'vTLDeviceARN', 'updateVTLDeviceTypeResponse_vTLDeviceARN' - The Amazon Resource Name (ARN) of the medium changer you have selected.
--
-- 'httpStatus', 'updateVTLDeviceTypeResponse_httpStatus' - The response's http status code.
newUpdateVTLDeviceTypeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateVTLDeviceTypeResponse
newUpdateVTLDeviceTypeResponse :: Int -> UpdateVTLDeviceTypeResponse
newUpdateVTLDeviceTypeResponse Int
pHttpStatus_ =
  UpdateVTLDeviceTypeResponse'
    { $sel:vTLDeviceARN:UpdateVTLDeviceTypeResponse' :: Maybe Text
vTLDeviceARN =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateVTLDeviceTypeResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the medium changer you have selected.
updateVTLDeviceTypeResponse_vTLDeviceARN :: Lens.Lens' UpdateVTLDeviceTypeResponse (Prelude.Maybe Prelude.Text)
updateVTLDeviceTypeResponse_vTLDeviceARN :: Lens' UpdateVTLDeviceTypeResponse (Maybe Text)
updateVTLDeviceTypeResponse_vTLDeviceARN = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateVTLDeviceTypeResponse' {Maybe Text
vTLDeviceARN :: Maybe Text
$sel:vTLDeviceARN:UpdateVTLDeviceTypeResponse' :: UpdateVTLDeviceTypeResponse -> Maybe Text
vTLDeviceARN} -> Maybe Text
vTLDeviceARN) (\s :: UpdateVTLDeviceTypeResponse
s@UpdateVTLDeviceTypeResponse' {} Maybe Text
a -> UpdateVTLDeviceTypeResponse
s {$sel:vTLDeviceARN:UpdateVTLDeviceTypeResponse' :: Maybe Text
vTLDeviceARN = Maybe Text
a} :: UpdateVTLDeviceTypeResponse)

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

instance Prelude.NFData UpdateVTLDeviceTypeResponse where
  rnf :: UpdateVTLDeviceTypeResponse -> ()
rnf UpdateVTLDeviceTypeResponse' {Int
Maybe Text
httpStatus :: Int
vTLDeviceARN :: Maybe Text
$sel:httpStatus:UpdateVTLDeviceTypeResponse' :: UpdateVTLDeviceTypeResponse -> Int
$sel:vTLDeviceARN:UpdateVTLDeviceTypeResponse' :: UpdateVTLDeviceTypeResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vTLDeviceARN
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus