{-# 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.MediaLive.TransferInputDevice
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Start an input device transfer to another AWS account. After you make
-- the request, the other account must accept or reject the transfer.
module Amazonka.MediaLive.TransferInputDevice
  ( -- * Creating a Request
    TransferInputDevice' (..),
    newTransferInputDevice',

    -- * Request Lenses
    transferInputDevice'_targetCustomerId,
    transferInputDevice'_targetRegion,
    transferInputDevice'_transferMessage,
    transferInputDevice'_inputDeviceId,

    -- * Destructuring the Response
    TransferInputDeviceResponse (..),
    newTransferInputDeviceResponse,

    -- * Response Lenses
    transferInputDeviceResponse_httpStatus,
  )
where

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

-- | A request to transfer an input device.
--
-- /See:/ 'newTransferInputDevice'' smart constructor.
data TransferInputDevice' = TransferInputDevice''
  { -- | The AWS account ID (12 digits) for the recipient of the device transfer.
    TransferInputDevice' -> Maybe Text
targetCustomerId :: Prelude.Maybe Prelude.Text,
    -- | The target AWS region to transfer the device.
    TransferInputDevice' -> Maybe Text
targetRegion :: Prelude.Maybe Prelude.Text,
    -- | An optional message for the recipient. Maximum 280 characters.
    TransferInputDevice' -> Maybe Text
transferMessage :: Prelude.Maybe Prelude.Text,
    -- | The unique ID of this input device. For example, hd-123456789abcdef.
    TransferInputDevice' -> Text
inputDeviceId :: Prelude.Text
  }
  deriving (TransferInputDevice' -> TransferInputDevice' -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TransferInputDevice' -> TransferInputDevice' -> Bool
$c/= :: TransferInputDevice' -> TransferInputDevice' -> Bool
== :: TransferInputDevice' -> TransferInputDevice' -> Bool
$c== :: TransferInputDevice' -> TransferInputDevice' -> Bool
Prelude.Eq, ReadPrec [TransferInputDevice']
ReadPrec TransferInputDevice'
Int -> ReadS TransferInputDevice'
ReadS [TransferInputDevice']
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TransferInputDevice']
$creadListPrec :: ReadPrec [TransferInputDevice']
readPrec :: ReadPrec TransferInputDevice'
$creadPrec :: ReadPrec TransferInputDevice'
readList :: ReadS [TransferInputDevice']
$creadList :: ReadS [TransferInputDevice']
readsPrec :: Int -> ReadS TransferInputDevice'
$creadsPrec :: Int -> ReadS TransferInputDevice'
Prelude.Read, Int -> TransferInputDevice' -> ShowS
[TransferInputDevice'] -> ShowS
TransferInputDevice' -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TransferInputDevice'] -> ShowS
$cshowList :: [TransferInputDevice'] -> ShowS
show :: TransferInputDevice' -> String
$cshow :: TransferInputDevice' -> String
showsPrec :: Int -> TransferInputDevice' -> ShowS
$cshowsPrec :: Int -> TransferInputDevice' -> ShowS
Prelude.Show, forall x. Rep TransferInputDevice' x -> TransferInputDevice'
forall x. TransferInputDevice' -> Rep TransferInputDevice' x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TransferInputDevice' x -> TransferInputDevice'
$cfrom :: forall x. TransferInputDevice' -> Rep TransferInputDevice' x
Prelude.Generic)

-- |
-- Create a value of 'TransferInputDevice'' 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:
--
-- 'targetCustomerId', 'transferInputDevice'_targetCustomerId' - The AWS account ID (12 digits) for the recipient of the device transfer.
--
-- 'targetRegion', 'transferInputDevice'_targetRegion' - The target AWS region to transfer the device.
--
-- 'transferMessage', 'transferInputDevice'_transferMessage' - An optional message for the recipient. Maximum 280 characters.
--
-- 'inputDeviceId', 'transferInputDevice'_inputDeviceId' - The unique ID of this input device. For example, hd-123456789abcdef.
newTransferInputDevice' ::
  -- | 'inputDeviceId'
  Prelude.Text ->
  TransferInputDevice'
newTransferInputDevice' :: Text -> TransferInputDevice'
newTransferInputDevice' Text
pInputDeviceId_ =
  TransferInputDevice''
    { $sel:targetCustomerId:TransferInputDevice'' :: Maybe Text
targetCustomerId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:targetRegion:TransferInputDevice'' :: Maybe Text
targetRegion = forall a. Maybe a
Prelude.Nothing,
      $sel:transferMessage:TransferInputDevice'' :: Maybe Text
transferMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:inputDeviceId:TransferInputDevice'' :: Text
inputDeviceId = Text
pInputDeviceId_
    }

-- | The AWS account ID (12 digits) for the recipient of the device transfer.
transferInputDevice'_targetCustomerId :: Lens.Lens' TransferInputDevice' (Prelude.Maybe Prelude.Text)
transferInputDevice'_targetCustomerId :: Lens' TransferInputDevice' (Maybe Text)
transferInputDevice'_targetCustomerId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransferInputDevice'' {Maybe Text
targetCustomerId :: Maybe Text
$sel:targetCustomerId:TransferInputDevice'' :: TransferInputDevice' -> Maybe Text
targetCustomerId} -> Maybe Text
targetCustomerId) (\s :: TransferInputDevice'
s@TransferInputDevice'' {} Maybe Text
a -> TransferInputDevice'
s {$sel:targetCustomerId:TransferInputDevice'' :: Maybe Text
targetCustomerId = Maybe Text
a} :: TransferInputDevice')

-- | The target AWS region to transfer the device.
transferInputDevice'_targetRegion :: Lens.Lens' TransferInputDevice' (Prelude.Maybe Prelude.Text)
transferInputDevice'_targetRegion :: Lens' TransferInputDevice' (Maybe Text)
transferInputDevice'_targetRegion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransferInputDevice'' {Maybe Text
targetRegion :: Maybe Text
$sel:targetRegion:TransferInputDevice'' :: TransferInputDevice' -> Maybe Text
targetRegion} -> Maybe Text
targetRegion) (\s :: TransferInputDevice'
s@TransferInputDevice'' {} Maybe Text
a -> TransferInputDevice'
s {$sel:targetRegion:TransferInputDevice'' :: Maybe Text
targetRegion = Maybe Text
a} :: TransferInputDevice')

-- | An optional message for the recipient. Maximum 280 characters.
transferInputDevice'_transferMessage :: Lens.Lens' TransferInputDevice' (Prelude.Maybe Prelude.Text)
transferInputDevice'_transferMessage :: Lens' TransferInputDevice' (Maybe Text)
transferInputDevice'_transferMessage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransferInputDevice'' {Maybe Text
transferMessage :: Maybe Text
$sel:transferMessage:TransferInputDevice'' :: TransferInputDevice' -> Maybe Text
transferMessage} -> Maybe Text
transferMessage) (\s :: TransferInputDevice'
s@TransferInputDevice'' {} Maybe Text
a -> TransferInputDevice'
s {$sel:transferMessage:TransferInputDevice'' :: Maybe Text
transferMessage = Maybe Text
a} :: TransferInputDevice')

-- | The unique ID of this input device. For example, hd-123456789abcdef.
transferInputDevice'_inputDeviceId :: Lens.Lens' TransferInputDevice' Prelude.Text
transferInputDevice'_inputDeviceId :: Lens' TransferInputDevice' Text
transferInputDevice'_inputDeviceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TransferInputDevice'' {Text
inputDeviceId :: Text
$sel:inputDeviceId:TransferInputDevice'' :: TransferInputDevice' -> Text
inputDeviceId} -> Text
inputDeviceId) (\s :: TransferInputDevice'
s@TransferInputDevice'' {} Text
a -> TransferInputDevice'
s {$sel:inputDeviceId:TransferInputDevice'' :: Text
inputDeviceId = Text
a} :: TransferInputDevice')

instance Core.AWSRequest TransferInputDevice' where
  type
    AWSResponse TransferInputDevice' =
      TransferInputDeviceResponse
  request :: (Service -> Service)
-> TransferInputDevice' -> Request TransferInputDevice'
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 TransferInputDevice'
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse TransferInputDevice')))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> TransferInputDeviceResponse
TransferInputDeviceResponse'
            forall (f :: * -> *) a b. Functor 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 TransferInputDevice' where
  hashWithSalt :: Int -> TransferInputDevice' -> Int
hashWithSalt Int
_salt TransferInputDevice'' {Maybe Text
Text
inputDeviceId :: Text
transferMessage :: Maybe Text
targetRegion :: Maybe Text
targetCustomerId :: Maybe Text
$sel:inputDeviceId:TransferInputDevice'' :: TransferInputDevice' -> Text
$sel:transferMessage:TransferInputDevice'' :: TransferInputDevice' -> Maybe Text
$sel:targetRegion:TransferInputDevice'' :: TransferInputDevice' -> Maybe Text
$sel:targetCustomerId:TransferInputDevice'' :: TransferInputDevice' -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
targetCustomerId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
targetRegion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
transferMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
inputDeviceId

instance Prelude.NFData TransferInputDevice' where
  rnf :: TransferInputDevice' -> ()
rnf TransferInputDevice'' {Maybe Text
Text
inputDeviceId :: Text
transferMessage :: Maybe Text
targetRegion :: Maybe Text
targetCustomerId :: Maybe Text
$sel:inputDeviceId:TransferInputDevice'' :: TransferInputDevice' -> Text
$sel:transferMessage:TransferInputDevice'' :: TransferInputDevice' -> Maybe Text
$sel:targetRegion:TransferInputDevice'' :: TransferInputDevice' -> Maybe Text
$sel:targetCustomerId:TransferInputDevice'' :: TransferInputDevice' -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
targetCustomerId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
targetRegion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
transferMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
inputDeviceId

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

instance Data.ToJSON TransferInputDevice' where
  toJSON :: TransferInputDevice' -> Value
toJSON TransferInputDevice'' {Maybe Text
Text
inputDeviceId :: Text
transferMessage :: Maybe Text
targetRegion :: Maybe Text
targetCustomerId :: Maybe Text
$sel:inputDeviceId:TransferInputDevice'' :: TransferInputDevice' -> Text
$sel:transferMessage:TransferInputDevice'' :: TransferInputDevice' -> Maybe Text
$sel:targetRegion:TransferInputDevice'' :: TransferInputDevice' -> Maybe Text
$sel:targetCustomerId:TransferInputDevice'' :: TransferInputDevice' -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"targetCustomerId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
targetCustomerId,
            (Key
"targetRegion" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
targetRegion,
            (Key
"transferMessage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
transferMessage
          ]
      )

instance Data.ToPath TransferInputDevice' where
  toPath :: TransferInputDevice' -> ByteString
toPath TransferInputDevice'' {Maybe Text
Text
inputDeviceId :: Text
transferMessage :: Maybe Text
targetRegion :: Maybe Text
targetCustomerId :: Maybe Text
$sel:inputDeviceId:TransferInputDevice'' :: TransferInputDevice' -> Text
$sel:transferMessage:TransferInputDevice'' :: TransferInputDevice' -> Maybe Text
$sel:targetRegion:TransferInputDevice'' :: TransferInputDevice' -> Maybe Text
$sel:targetCustomerId:TransferInputDevice'' :: TransferInputDevice' -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/prod/inputDevices/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
inputDeviceId,
        ByteString
"/transfer"
      ]

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

-- | Placeholder documentation for TransferInputDeviceResponse
--
-- /See:/ 'newTransferInputDeviceResponse' smart constructor.
data TransferInputDeviceResponse = TransferInputDeviceResponse'
  { -- | The response's http status code.
    TransferInputDeviceResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (TransferInputDeviceResponse -> TransferInputDeviceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TransferInputDeviceResponse -> TransferInputDeviceResponse -> Bool
$c/= :: TransferInputDeviceResponse -> TransferInputDeviceResponse -> Bool
== :: TransferInputDeviceResponse -> TransferInputDeviceResponse -> Bool
$c== :: TransferInputDeviceResponse -> TransferInputDeviceResponse -> Bool
Prelude.Eq, ReadPrec [TransferInputDeviceResponse]
ReadPrec TransferInputDeviceResponse
Int -> ReadS TransferInputDeviceResponse
ReadS [TransferInputDeviceResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TransferInputDeviceResponse]
$creadListPrec :: ReadPrec [TransferInputDeviceResponse]
readPrec :: ReadPrec TransferInputDeviceResponse
$creadPrec :: ReadPrec TransferInputDeviceResponse
readList :: ReadS [TransferInputDeviceResponse]
$creadList :: ReadS [TransferInputDeviceResponse]
readsPrec :: Int -> ReadS TransferInputDeviceResponse
$creadsPrec :: Int -> ReadS TransferInputDeviceResponse
Prelude.Read, Int -> TransferInputDeviceResponse -> ShowS
[TransferInputDeviceResponse] -> ShowS
TransferInputDeviceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TransferInputDeviceResponse] -> ShowS
$cshowList :: [TransferInputDeviceResponse] -> ShowS
show :: TransferInputDeviceResponse -> String
$cshow :: TransferInputDeviceResponse -> String
showsPrec :: Int -> TransferInputDeviceResponse -> ShowS
$cshowsPrec :: Int -> TransferInputDeviceResponse -> ShowS
Prelude.Show, forall x.
Rep TransferInputDeviceResponse x -> TransferInputDeviceResponse
forall x.
TransferInputDeviceResponse -> Rep TransferInputDeviceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TransferInputDeviceResponse x -> TransferInputDeviceResponse
$cfrom :: forall x.
TransferInputDeviceResponse -> Rep TransferInputDeviceResponse x
Prelude.Generic)

-- |
-- Create a value of 'TransferInputDeviceResponse' 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:
--
-- 'httpStatus', 'transferInputDeviceResponse_httpStatus' - The response's http status code.
newTransferInputDeviceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  TransferInputDeviceResponse
newTransferInputDeviceResponse :: Int -> TransferInputDeviceResponse
newTransferInputDeviceResponse Int
pHttpStatus_ =
  TransferInputDeviceResponse'
    { $sel:httpStatus:TransferInputDeviceResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance Prelude.NFData TransferInputDeviceResponse where
  rnf :: TransferInputDeviceResponse -> ()
rnf TransferInputDeviceResponse' {Int
httpStatus :: Int
$sel:httpStatus:TransferInputDeviceResponse' :: TransferInputDeviceResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus