{-# 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.AlexaBusiness.RegisterAVSDevice
-- 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)
--
-- Registers an Alexa-enabled device built by an Original Equipment
-- Manufacturer (OEM) using Alexa Voice Service (AVS).
module Amazonka.AlexaBusiness.RegisterAVSDevice
  ( -- * Creating a Request
    RegisterAVSDevice (..),
    newRegisterAVSDevice,

    -- * Request Lenses
    registerAVSDevice_roomArn,
    registerAVSDevice_deviceSerialNumber,
    registerAVSDevice_tags,
    registerAVSDevice_clientId,
    registerAVSDevice_userCode,
    registerAVSDevice_productId,
    registerAVSDevice_amazonId,

    -- * Destructuring the Response
    RegisterAVSDeviceResponse (..),
    newRegisterAVSDeviceResponse,

    -- * Response Lenses
    registerAVSDeviceResponse_deviceArn,
    registerAVSDeviceResponse_httpStatus,
  )
where

import Amazonka.AlexaBusiness.Types
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

-- | /See:/ 'newRegisterAVSDevice' smart constructor.
data RegisterAVSDevice = RegisterAVSDevice'
  { -- | The Amazon Resource Name (ARN) of the room with which to associate your
    -- AVS device.
    RegisterAVSDevice -> Maybe Text
roomArn :: Prelude.Maybe Prelude.Text,
    -- | The key generated by the OEM that uniquely identifies a specified
    -- instance of your AVS device.
    RegisterAVSDevice -> Maybe Text
deviceSerialNumber :: Prelude.Maybe Prelude.Text,
    -- | The tags to be added to the specified resource. Do not provide system
    -- tags.
    RegisterAVSDevice -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The client ID of the OEM used for code-based linking authorization on an
    -- AVS device.
    RegisterAVSDevice -> Text
clientId :: Prelude.Text,
    -- | The code that is obtained after your AVS device has made a POST request
    -- to LWA as a part of the Device Authorization Request component of the
    -- OAuth code-based linking specification.
    RegisterAVSDevice -> Text
userCode :: Prelude.Text,
    -- | The product ID used to identify your AVS device during authorization.
    RegisterAVSDevice -> Text
productId :: Prelude.Text,
    -- | The device type ID for your AVS device generated by Amazon when the OEM
    -- creates a new product on Amazon\'s Developer Console.
    RegisterAVSDevice -> Text
amazonId :: Prelude.Text
  }
  deriving (RegisterAVSDevice -> RegisterAVSDevice -> Bool
(RegisterAVSDevice -> RegisterAVSDevice -> Bool)
-> (RegisterAVSDevice -> RegisterAVSDevice -> Bool)
-> Eq RegisterAVSDevice
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterAVSDevice -> RegisterAVSDevice -> Bool
$c/= :: RegisterAVSDevice -> RegisterAVSDevice -> Bool
== :: RegisterAVSDevice -> RegisterAVSDevice -> Bool
$c== :: RegisterAVSDevice -> RegisterAVSDevice -> Bool
Prelude.Eq, ReadPrec [RegisterAVSDevice]
ReadPrec RegisterAVSDevice
Int -> ReadS RegisterAVSDevice
ReadS [RegisterAVSDevice]
(Int -> ReadS RegisterAVSDevice)
-> ReadS [RegisterAVSDevice]
-> ReadPrec RegisterAVSDevice
-> ReadPrec [RegisterAVSDevice]
-> Read RegisterAVSDevice
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterAVSDevice]
$creadListPrec :: ReadPrec [RegisterAVSDevice]
readPrec :: ReadPrec RegisterAVSDevice
$creadPrec :: ReadPrec RegisterAVSDevice
readList :: ReadS [RegisterAVSDevice]
$creadList :: ReadS [RegisterAVSDevice]
readsPrec :: Int -> ReadS RegisterAVSDevice
$creadsPrec :: Int -> ReadS RegisterAVSDevice
Prelude.Read, Int -> RegisterAVSDevice -> ShowS
[RegisterAVSDevice] -> ShowS
RegisterAVSDevice -> String
(Int -> RegisterAVSDevice -> ShowS)
-> (RegisterAVSDevice -> String)
-> ([RegisterAVSDevice] -> ShowS)
-> Show RegisterAVSDevice
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterAVSDevice] -> ShowS
$cshowList :: [RegisterAVSDevice] -> ShowS
show :: RegisterAVSDevice -> String
$cshow :: RegisterAVSDevice -> String
showsPrec :: Int -> RegisterAVSDevice -> ShowS
$cshowsPrec :: Int -> RegisterAVSDevice -> ShowS
Prelude.Show, (forall x. RegisterAVSDevice -> Rep RegisterAVSDevice x)
-> (forall x. Rep RegisterAVSDevice x -> RegisterAVSDevice)
-> Generic RegisterAVSDevice
forall x. Rep RegisterAVSDevice x -> RegisterAVSDevice
forall x. RegisterAVSDevice -> Rep RegisterAVSDevice x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegisterAVSDevice x -> RegisterAVSDevice
$cfrom :: forall x. RegisterAVSDevice -> Rep RegisterAVSDevice x
Prelude.Generic)

-- |
-- Create a value of 'RegisterAVSDevice' 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:
--
-- 'roomArn', 'registerAVSDevice_roomArn' - The Amazon Resource Name (ARN) of the room with which to associate your
-- AVS device.
--
-- 'deviceSerialNumber', 'registerAVSDevice_deviceSerialNumber' - The key generated by the OEM that uniquely identifies a specified
-- instance of your AVS device.
--
-- 'tags', 'registerAVSDevice_tags' - The tags to be added to the specified resource. Do not provide system
-- tags.
--
-- 'clientId', 'registerAVSDevice_clientId' - The client ID of the OEM used for code-based linking authorization on an
-- AVS device.
--
-- 'userCode', 'registerAVSDevice_userCode' - The code that is obtained after your AVS device has made a POST request
-- to LWA as a part of the Device Authorization Request component of the
-- OAuth code-based linking specification.
--
-- 'productId', 'registerAVSDevice_productId' - The product ID used to identify your AVS device during authorization.
--
-- 'amazonId', 'registerAVSDevice_amazonId' - The device type ID for your AVS device generated by Amazon when the OEM
-- creates a new product on Amazon\'s Developer Console.
newRegisterAVSDevice ::
  -- | 'clientId'
  Prelude.Text ->
  -- | 'userCode'
  Prelude.Text ->
  -- | 'productId'
  Prelude.Text ->
  -- | 'amazonId'
  Prelude.Text ->
  RegisterAVSDevice
newRegisterAVSDevice :: Text -> Text -> Text -> Text -> RegisterAVSDevice
newRegisterAVSDevice
  Text
pClientId_
  Text
pUserCode_
  Text
pProductId_
  Text
pAmazonId_ =
    RegisterAVSDevice' :: Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Text
-> Text
-> Text
-> Text
-> RegisterAVSDevice
RegisterAVSDevice'
      { $sel:roomArn:RegisterAVSDevice' :: Maybe Text
roomArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:deviceSerialNumber:RegisterAVSDevice' :: Maybe Text
deviceSerialNumber = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:RegisterAVSDevice' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:clientId:RegisterAVSDevice' :: Text
clientId = Text
pClientId_,
        $sel:userCode:RegisterAVSDevice' :: Text
userCode = Text
pUserCode_,
        $sel:productId:RegisterAVSDevice' :: Text
productId = Text
pProductId_,
        $sel:amazonId:RegisterAVSDevice' :: Text
amazonId = Text
pAmazonId_
      }

-- | The Amazon Resource Name (ARN) of the room with which to associate your
-- AVS device.
registerAVSDevice_roomArn :: Lens.Lens' RegisterAVSDevice (Prelude.Maybe Prelude.Text)
registerAVSDevice_roomArn :: (Maybe Text -> f (Maybe Text))
-> RegisterAVSDevice -> f RegisterAVSDevice
registerAVSDevice_roomArn = (RegisterAVSDevice -> Maybe Text)
-> (RegisterAVSDevice -> Maybe Text -> RegisterAVSDevice)
-> Lens
     RegisterAVSDevice RegisterAVSDevice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterAVSDevice' {Maybe Text
roomArn :: Maybe Text
$sel:roomArn:RegisterAVSDevice' :: RegisterAVSDevice -> Maybe Text
roomArn} -> Maybe Text
roomArn) (\s :: RegisterAVSDevice
s@RegisterAVSDevice' {} Maybe Text
a -> RegisterAVSDevice
s {$sel:roomArn:RegisterAVSDevice' :: Maybe Text
roomArn = Maybe Text
a} :: RegisterAVSDevice)

-- | The key generated by the OEM that uniquely identifies a specified
-- instance of your AVS device.
registerAVSDevice_deviceSerialNumber :: Lens.Lens' RegisterAVSDevice (Prelude.Maybe Prelude.Text)
registerAVSDevice_deviceSerialNumber :: (Maybe Text -> f (Maybe Text))
-> RegisterAVSDevice -> f RegisterAVSDevice
registerAVSDevice_deviceSerialNumber = (RegisterAVSDevice -> Maybe Text)
-> (RegisterAVSDevice -> Maybe Text -> RegisterAVSDevice)
-> Lens
     RegisterAVSDevice RegisterAVSDevice (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterAVSDevice' {Maybe Text
deviceSerialNumber :: Maybe Text
$sel:deviceSerialNumber:RegisterAVSDevice' :: RegisterAVSDevice -> Maybe Text
deviceSerialNumber} -> Maybe Text
deviceSerialNumber) (\s :: RegisterAVSDevice
s@RegisterAVSDevice' {} Maybe Text
a -> RegisterAVSDevice
s {$sel:deviceSerialNumber:RegisterAVSDevice' :: Maybe Text
deviceSerialNumber = Maybe Text
a} :: RegisterAVSDevice)

-- | The tags to be added to the specified resource. Do not provide system
-- tags.
registerAVSDevice_tags :: Lens.Lens' RegisterAVSDevice (Prelude.Maybe [Tag])
registerAVSDevice_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> RegisterAVSDevice -> f RegisterAVSDevice
registerAVSDevice_tags = (RegisterAVSDevice -> Maybe [Tag])
-> (RegisterAVSDevice -> Maybe [Tag] -> RegisterAVSDevice)
-> Lens
     RegisterAVSDevice RegisterAVSDevice (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterAVSDevice' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:RegisterAVSDevice' :: RegisterAVSDevice -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: RegisterAVSDevice
s@RegisterAVSDevice' {} Maybe [Tag]
a -> RegisterAVSDevice
s {$sel:tags:RegisterAVSDevice' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: RegisterAVSDevice) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> RegisterAVSDevice -> f RegisterAVSDevice)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> RegisterAVSDevice
-> f RegisterAVSDevice
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 client ID of the OEM used for code-based linking authorization on an
-- AVS device.
registerAVSDevice_clientId :: Lens.Lens' RegisterAVSDevice Prelude.Text
registerAVSDevice_clientId :: (Text -> f Text) -> RegisterAVSDevice -> f RegisterAVSDevice
registerAVSDevice_clientId = (RegisterAVSDevice -> Text)
-> (RegisterAVSDevice -> Text -> RegisterAVSDevice)
-> Lens RegisterAVSDevice RegisterAVSDevice Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterAVSDevice' {Text
clientId :: Text
$sel:clientId:RegisterAVSDevice' :: RegisterAVSDevice -> Text
clientId} -> Text
clientId) (\s :: RegisterAVSDevice
s@RegisterAVSDevice' {} Text
a -> RegisterAVSDevice
s {$sel:clientId:RegisterAVSDevice' :: Text
clientId = Text
a} :: RegisterAVSDevice)

-- | The code that is obtained after your AVS device has made a POST request
-- to LWA as a part of the Device Authorization Request component of the
-- OAuth code-based linking specification.
registerAVSDevice_userCode :: Lens.Lens' RegisterAVSDevice Prelude.Text
registerAVSDevice_userCode :: (Text -> f Text) -> RegisterAVSDevice -> f RegisterAVSDevice
registerAVSDevice_userCode = (RegisterAVSDevice -> Text)
-> (RegisterAVSDevice -> Text -> RegisterAVSDevice)
-> Lens RegisterAVSDevice RegisterAVSDevice Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterAVSDevice' {Text
userCode :: Text
$sel:userCode:RegisterAVSDevice' :: RegisterAVSDevice -> Text
userCode} -> Text
userCode) (\s :: RegisterAVSDevice
s@RegisterAVSDevice' {} Text
a -> RegisterAVSDevice
s {$sel:userCode:RegisterAVSDevice' :: Text
userCode = Text
a} :: RegisterAVSDevice)

-- | The product ID used to identify your AVS device during authorization.
registerAVSDevice_productId :: Lens.Lens' RegisterAVSDevice Prelude.Text
registerAVSDevice_productId :: (Text -> f Text) -> RegisterAVSDevice -> f RegisterAVSDevice
registerAVSDevice_productId = (RegisterAVSDevice -> Text)
-> (RegisterAVSDevice -> Text -> RegisterAVSDevice)
-> Lens RegisterAVSDevice RegisterAVSDevice Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterAVSDevice' {Text
productId :: Text
$sel:productId:RegisterAVSDevice' :: RegisterAVSDevice -> Text
productId} -> Text
productId) (\s :: RegisterAVSDevice
s@RegisterAVSDevice' {} Text
a -> RegisterAVSDevice
s {$sel:productId:RegisterAVSDevice' :: Text
productId = Text
a} :: RegisterAVSDevice)

-- | The device type ID for your AVS device generated by Amazon when the OEM
-- creates a new product on Amazon\'s Developer Console.
registerAVSDevice_amazonId :: Lens.Lens' RegisterAVSDevice Prelude.Text
registerAVSDevice_amazonId :: (Text -> f Text) -> RegisterAVSDevice -> f RegisterAVSDevice
registerAVSDevice_amazonId = (RegisterAVSDevice -> Text)
-> (RegisterAVSDevice -> Text -> RegisterAVSDevice)
-> Lens RegisterAVSDevice RegisterAVSDevice Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterAVSDevice' {Text
amazonId :: Text
$sel:amazonId:RegisterAVSDevice' :: RegisterAVSDevice -> Text
amazonId} -> Text
amazonId) (\s :: RegisterAVSDevice
s@RegisterAVSDevice' {} Text
a -> RegisterAVSDevice
s {$sel:amazonId:RegisterAVSDevice' :: Text
amazonId = Text
a} :: RegisterAVSDevice)

instance Core.AWSRequest RegisterAVSDevice where
  type
    AWSResponse RegisterAVSDevice =
      RegisterAVSDeviceResponse
  request :: RegisterAVSDevice -> Request RegisterAVSDevice
request = Service -> RegisterAVSDevice -> Request RegisterAVSDevice
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy RegisterAVSDevice
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RegisterAVSDevice)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse RegisterAVSDevice))
-> Logger
-> Service
-> Proxy RegisterAVSDevice
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse RegisterAVSDevice)))
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 -> RegisterAVSDeviceResponse
RegisterAVSDeviceResponse'
            (Maybe Text -> Int -> RegisterAVSDeviceResponse)
-> Either String (Maybe Text)
-> Either String (Int -> RegisterAVSDeviceResponse)
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
"DeviceArn")
            Either String (Int -> RegisterAVSDeviceResponse)
-> Either String Int -> Either String RegisterAVSDeviceResponse
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 RegisterAVSDevice

instance Prelude.NFData RegisterAVSDevice

instance Core.ToHeaders RegisterAVSDevice where
  toHeaders :: RegisterAVSDevice -> ResponseHeaders
toHeaders =
    ResponseHeaders -> RegisterAVSDevice -> 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
"AlexaForBusiness.RegisterAVSDevice" ::
                          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 RegisterAVSDevice where
  toJSON :: RegisterAVSDevice -> Value
toJSON RegisterAVSDevice' {Maybe [Tag]
Maybe Text
Text
amazonId :: Text
productId :: Text
userCode :: Text
clientId :: Text
tags :: Maybe [Tag]
deviceSerialNumber :: Maybe Text
roomArn :: Maybe Text
$sel:amazonId:RegisterAVSDevice' :: RegisterAVSDevice -> Text
$sel:productId:RegisterAVSDevice' :: RegisterAVSDevice -> Text
$sel:userCode:RegisterAVSDevice' :: RegisterAVSDevice -> Text
$sel:clientId:RegisterAVSDevice' :: RegisterAVSDevice -> Text
$sel:tags:RegisterAVSDevice' :: RegisterAVSDevice -> Maybe [Tag]
$sel:deviceSerialNumber:RegisterAVSDevice' :: RegisterAVSDevice -> Maybe Text
$sel:roomArn:RegisterAVSDevice' :: RegisterAVSDevice -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"RoomArn" 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
roomArn,
            (Text
"DeviceSerialNumber" 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
deviceSerialNumber,
            (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
"ClientId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserCode" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userCode),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ProductId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
productId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"AmazonId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
amazonId)
          ]
      )

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

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

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

-- |
-- Create a value of 'RegisterAVSDeviceResponse' 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:
--
-- 'deviceArn', 'registerAVSDeviceResponse_deviceArn' - The ARN of the device.
--
-- 'httpStatus', 'registerAVSDeviceResponse_httpStatus' - The response's http status code.
newRegisterAVSDeviceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  RegisterAVSDeviceResponse
newRegisterAVSDeviceResponse :: Int -> RegisterAVSDeviceResponse
newRegisterAVSDeviceResponse Int
pHttpStatus_ =
  RegisterAVSDeviceResponse' :: Maybe Text -> Int -> RegisterAVSDeviceResponse
RegisterAVSDeviceResponse'
    { $sel:deviceArn:RegisterAVSDeviceResponse' :: Maybe Text
deviceArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:RegisterAVSDeviceResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the device.
registerAVSDeviceResponse_deviceArn :: Lens.Lens' RegisterAVSDeviceResponse (Prelude.Maybe Prelude.Text)
registerAVSDeviceResponse_deviceArn :: (Maybe Text -> f (Maybe Text))
-> RegisterAVSDeviceResponse -> f RegisterAVSDeviceResponse
registerAVSDeviceResponse_deviceArn = (RegisterAVSDeviceResponse -> Maybe Text)
-> (RegisterAVSDeviceResponse
    -> Maybe Text -> RegisterAVSDeviceResponse)
-> Lens
     RegisterAVSDeviceResponse
     RegisterAVSDeviceResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterAVSDeviceResponse' {Maybe Text
deviceArn :: Maybe Text
$sel:deviceArn:RegisterAVSDeviceResponse' :: RegisterAVSDeviceResponse -> Maybe Text
deviceArn} -> Maybe Text
deviceArn) (\s :: RegisterAVSDeviceResponse
s@RegisterAVSDeviceResponse' {} Maybe Text
a -> RegisterAVSDeviceResponse
s {$sel:deviceArn:RegisterAVSDeviceResponse' :: Maybe Text
deviceArn = Maybe Text
a} :: RegisterAVSDeviceResponse)

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

instance Prelude.NFData RegisterAVSDeviceResponse