{-# 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-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)
--
-- 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.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

-- | /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
(UpdateVTLDeviceType -> UpdateVTLDeviceType -> Bool)
-> (UpdateVTLDeviceType -> UpdateVTLDeviceType -> Bool)
-> Eq UpdateVTLDeviceType
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]
(Int -> ReadS UpdateVTLDeviceType)
-> ReadS [UpdateVTLDeviceType]
-> ReadPrec UpdateVTLDeviceType
-> ReadPrec [UpdateVTLDeviceType]
-> Read 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
(Int -> UpdateVTLDeviceType -> ShowS)
-> (UpdateVTLDeviceType -> String)
-> ([UpdateVTLDeviceType] -> ShowS)
-> Show UpdateVTLDeviceType
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. UpdateVTLDeviceType -> Rep UpdateVTLDeviceType x)
-> (forall x. Rep UpdateVTLDeviceType x -> UpdateVTLDeviceType)
-> Generic UpdateVTLDeviceType
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' :: Text -> Text -> UpdateVTLDeviceType
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 :: (Text -> f Text) -> UpdateVTLDeviceType -> f UpdateVTLDeviceType
updateVTLDeviceType_vTLDeviceARN = (UpdateVTLDeviceType -> Text)
-> (UpdateVTLDeviceType -> Text -> UpdateVTLDeviceType)
-> Lens UpdateVTLDeviceType UpdateVTLDeviceType Text Text
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 :: (Text -> f Text) -> UpdateVTLDeviceType -> f UpdateVTLDeviceType
updateVTLDeviceType_deviceType = (UpdateVTLDeviceType -> Text)
-> (UpdateVTLDeviceType -> Text -> UpdateVTLDeviceType)
-> Lens UpdateVTLDeviceType UpdateVTLDeviceType Text Text
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 :: UpdateVTLDeviceType -> Request UpdateVTLDeviceType
request = Service -> UpdateVTLDeviceType -> Request UpdateVTLDeviceType
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateVTLDeviceType
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateVTLDeviceType)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateVTLDeviceType))
-> Logger
-> Service
-> Proxy UpdateVTLDeviceType
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateVTLDeviceType)))
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 -> UpdateVTLDeviceTypeResponse
UpdateVTLDeviceTypeResponse'
            (Maybe Text -> Int -> UpdateVTLDeviceTypeResponse)
-> Either String (Maybe Text)
-> Either String (Int -> UpdateVTLDeviceTypeResponse)
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
"VTLDeviceARN")
            Either String (Int -> UpdateVTLDeviceTypeResponse)
-> Either String Int -> Either String UpdateVTLDeviceTypeResponse
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 UpdateVTLDeviceType

instance Prelude.NFData UpdateVTLDeviceType

instance Core.ToHeaders UpdateVTLDeviceType where
  toHeaders :: UpdateVTLDeviceType -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateVTLDeviceType -> 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.UpdateVTLDeviceType" ::
                          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 UpdateVTLDeviceType where
  toJSON :: UpdateVTLDeviceType -> Value
toJSON UpdateVTLDeviceType' {Text
deviceType :: Text
vTLDeviceARN :: Text
$sel:deviceType:UpdateVTLDeviceType' :: UpdateVTLDeviceType -> Text
$sel:vTLDeviceARN:UpdateVTLDeviceType' :: UpdateVTLDeviceType -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"VTLDeviceARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
vTLDeviceARN),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DeviceType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
deviceType)
          ]
      )

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

instance Core.ToQuery UpdateVTLDeviceType where
  toQuery :: UpdateVTLDeviceType -> QueryString
toQuery = QueryString -> UpdateVTLDeviceType -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(UpdateVTLDeviceTypeResponse
 -> UpdateVTLDeviceTypeResponse -> Bool)
-> (UpdateVTLDeviceTypeResponse
    -> UpdateVTLDeviceTypeResponse -> Bool)
-> Eq UpdateVTLDeviceTypeResponse
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]
(Int -> ReadS UpdateVTLDeviceTypeResponse)
-> ReadS [UpdateVTLDeviceTypeResponse]
-> ReadPrec UpdateVTLDeviceTypeResponse
-> ReadPrec [UpdateVTLDeviceTypeResponse]
-> Read 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
(Int -> UpdateVTLDeviceTypeResponse -> ShowS)
-> (UpdateVTLDeviceTypeResponse -> String)
-> ([UpdateVTLDeviceTypeResponse] -> ShowS)
-> Show UpdateVTLDeviceTypeResponse
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.
 UpdateVTLDeviceTypeResponse -> Rep UpdateVTLDeviceTypeResponse x)
-> (forall x.
    Rep UpdateVTLDeviceTypeResponse x -> UpdateVTLDeviceTypeResponse)
-> Generic UpdateVTLDeviceTypeResponse
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' :: Maybe Text -> Int -> UpdateVTLDeviceTypeResponse
UpdateVTLDeviceTypeResponse'
    { $sel:vTLDeviceARN:UpdateVTLDeviceTypeResponse' :: Maybe Text
vTLDeviceARN =
        Maybe Text
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 :: (Maybe Text -> f (Maybe Text))
-> UpdateVTLDeviceTypeResponse -> f UpdateVTLDeviceTypeResponse
updateVTLDeviceTypeResponse_vTLDeviceARN = (UpdateVTLDeviceTypeResponse -> Maybe Text)
-> (UpdateVTLDeviceTypeResponse
    -> Maybe Text -> UpdateVTLDeviceTypeResponse)
-> Lens
     UpdateVTLDeviceTypeResponse
     UpdateVTLDeviceTypeResponse
     (Maybe Text)
     (Maybe Text)
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 :: (Int -> f Int)
-> UpdateVTLDeviceTypeResponse -> f UpdateVTLDeviceTypeResponse
updateVTLDeviceTypeResponse_httpStatus = (UpdateVTLDeviceTypeResponse -> Int)
-> (UpdateVTLDeviceTypeResponse
    -> Int -> UpdateVTLDeviceTypeResponse)
-> Lens
     UpdateVTLDeviceTypeResponse UpdateVTLDeviceTypeResponse Int Int
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