{-# 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.PrivateNetworks.GetDeviceIdentifier
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets the specified device identifier.
module Amazonka.PrivateNetworks.GetDeviceIdentifier
  ( -- * Creating a Request
    GetDeviceIdentifier (..),
    newGetDeviceIdentifier,

    -- * Request Lenses
    getDeviceIdentifier_deviceIdentifierArn,

    -- * Destructuring the Response
    GetDeviceIdentifierResponse (..),
    newGetDeviceIdentifierResponse,

    -- * Response Lenses
    getDeviceIdentifierResponse_deviceIdentifier,
    getDeviceIdentifierResponse_tags,
    getDeviceIdentifierResponse_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 Amazonka.PrivateNetworks.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newGetDeviceIdentifier' smart constructor.
data GetDeviceIdentifier = GetDeviceIdentifier'
  { -- | The Amazon Resource Name (ARN) of the device identifier.
    GetDeviceIdentifier -> Text
deviceIdentifierArn :: Prelude.Text
  }
  deriving (GetDeviceIdentifier -> GetDeviceIdentifier -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDeviceIdentifier -> GetDeviceIdentifier -> Bool
$c/= :: GetDeviceIdentifier -> GetDeviceIdentifier -> Bool
== :: GetDeviceIdentifier -> GetDeviceIdentifier -> Bool
$c== :: GetDeviceIdentifier -> GetDeviceIdentifier -> Bool
Prelude.Eq, ReadPrec [GetDeviceIdentifier]
ReadPrec GetDeviceIdentifier
Int -> ReadS GetDeviceIdentifier
ReadS [GetDeviceIdentifier]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDeviceIdentifier]
$creadListPrec :: ReadPrec [GetDeviceIdentifier]
readPrec :: ReadPrec GetDeviceIdentifier
$creadPrec :: ReadPrec GetDeviceIdentifier
readList :: ReadS [GetDeviceIdentifier]
$creadList :: ReadS [GetDeviceIdentifier]
readsPrec :: Int -> ReadS GetDeviceIdentifier
$creadsPrec :: Int -> ReadS GetDeviceIdentifier
Prelude.Read, Int -> GetDeviceIdentifier -> ShowS
[GetDeviceIdentifier] -> ShowS
GetDeviceIdentifier -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDeviceIdentifier] -> ShowS
$cshowList :: [GetDeviceIdentifier] -> ShowS
show :: GetDeviceIdentifier -> String
$cshow :: GetDeviceIdentifier -> String
showsPrec :: Int -> GetDeviceIdentifier -> ShowS
$cshowsPrec :: Int -> GetDeviceIdentifier -> ShowS
Prelude.Show, forall x. Rep GetDeviceIdentifier x -> GetDeviceIdentifier
forall x. GetDeviceIdentifier -> Rep GetDeviceIdentifier x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDeviceIdentifier x -> GetDeviceIdentifier
$cfrom :: forall x. GetDeviceIdentifier -> Rep GetDeviceIdentifier x
Prelude.Generic)

-- |
-- Create a value of 'GetDeviceIdentifier' 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:
--
-- 'deviceIdentifierArn', 'getDeviceIdentifier_deviceIdentifierArn' - The Amazon Resource Name (ARN) of the device identifier.
newGetDeviceIdentifier ::
  -- | 'deviceIdentifierArn'
  Prelude.Text ->
  GetDeviceIdentifier
newGetDeviceIdentifier :: Text -> GetDeviceIdentifier
newGetDeviceIdentifier Text
pDeviceIdentifierArn_ =
  GetDeviceIdentifier'
    { $sel:deviceIdentifierArn:GetDeviceIdentifier' :: Text
deviceIdentifierArn =
        Text
pDeviceIdentifierArn_
    }

-- | The Amazon Resource Name (ARN) of the device identifier.
getDeviceIdentifier_deviceIdentifierArn :: Lens.Lens' GetDeviceIdentifier Prelude.Text
getDeviceIdentifier_deviceIdentifierArn :: Lens' GetDeviceIdentifier Text
getDeviceIdentifier_deviceIdentifierArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeviceIdentifier' {Text
deviceIdentifierArn :: Text
$sel:deviceIdentifierArn:GetDeviceIdentifier' :: GetDeviceIdentifier -> Text
deviceIdentifierArn} -> Text
deviceIdentifierArn) (\s :: GetDeviceIdentifier
s@GetDeviceIdentifier' {} Text
a -> GetDeviceIdentifier
s {$sel:deviceIdentifierArn:GetDeviceIdentifier' :: Text
deviceIdentifierArn = Text
a} :: GetDeviceIdentifier)

instance Core.AWSRequest GetDeviceIdentifier where
  type
    AWSResponse GetDeviceIdentifier =
      GetDeviceIdentifierResponse
  request :: (Service -> Service)
-> GetDeviceIdentifier -> Request GetDeviceIdentifier
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetDeviceIdentifier
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetDeviceIdentifier)))
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 DeviceIdentifier
-> Maybe (Sensitive (HashMap Text Text))
-> Int
-> GetDeviceIdentifierResponse
GetDeviceIdentifierResponse'
            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
"deviceIdentifier")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"tags" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            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 GetDeviceIdentifier where
  hashWithSalt :: Int -> GetDeviceIdentifier -> Int
hashWithSalt Int
_salt GetDeviceIdentifier' {Text
deviceIdentifierArn :: Text
$sel:deviceIdentifierArn:GetDeviceIdentifier' :: GetDeviceIdentifier -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
deviceIdentifierArn

instance Prelude.NFData GetDeviceIdentifier where
  rnf :: GetDeviceIdentifier -> ()
rnf GetDeviceIdentifier' {Text
deviceIdentifierArn :: Text
$sel:deviceIdentifierArn:GetDeviceIdentifier' :: GetDeviceIdentifier -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
deviceIdentifierArn

instance Data.ToHeaders GetDeviceIdentifier where
  toHeaders :: GetDeviceIdentifier -> 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.ToPath GetDeviceIdentifier where
  toPath :: GetDeviceIdentifier -> ByteString
toPath GetDeviceIdentifier' {Text
deviceIdentifierArn :: Text
$sel:deviceIdentifierArn:GetDeviceIdentifier' :: GetDeviceIdentifier -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/device-identifiers/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
deviceIdentifierArn
      ]

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

-- | /See:/ 'newGetDeviceIdentifierResponse' smart constructor.
data GetDeviceIdentifierResponse = GetDeviceIdentifierResponse'
  { -- | Information about the device identifier.
    GetDeviceIdentifierResponse -> Maybe DeviceIdentifier
deviceIdentifier :: Prelude.Maybe DeviceIdentifier,
    -- | The device identifier tags.
    GetDeviceIdentifierResponse
-> Maybe (Sensitive (HashMap Text Text))
tags :: Prelude.Maybe (Data.Sensitive (Prelude.HashMap Prelude.Text Prelude.Text)),
    -- | The response's http status code.
    GetDeviceIdentifierResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetDeviceIdentifierResponse -> GetDeviceIdentifierResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDeviceIdentifierResponse -> GetDeviceIdentifierResponse -> Bool
$c/= :: GetDeviceIdentifierResponse -> GetDeviceIdentifierResponse -> Bool
== :: GetDeviceIdentifierResponse -> GetDeviceIdentifierResponse -> Bool
$c== :: GetDeviceIdentifierResponse -> GetDeviceIdentifierResponse -> Bool
Prelude.Eq, Int -> GetDeviceIdentifierResponse -> ShowS
[GetDeviceIdentifierResponse] -> ShowS
GetDeviceIdentifierResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDeviceIdentifierResponse] -> ShowS
$cshowList :: [GetDeviceIdentifierResponse] -> ShowS
show :: GetDeviceIdentifierResponse -> String
$cshow :: GetDeviceIdentifierResponse -> String
showsPrec :: Int -> GetDeviceIdentifierResponse -> ShowS
$cshowsPrec :: Int -> GetDeviceIdentifierResponse -> ShowS
Prelude.Show, forall x.
Rep GetDeviceIdentifierResponse x -> GetDeviceIdentifierResponse
forall x.
GetDeviceIdentifierResponse -> Rep GetDeviceIdentifierResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDeviceIdentifierResponse x -> GetDeviceIdentifierResponse
$cfrom :: forall x.
GetDeviceIdentifierResponse -> Rep GetDeviceIdentifierResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetDeviceIdentifierResponse' 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:
--
-- 'deviceIdentifier', 'getDeviceIdentifierResponse_deviceIdentifier' - Information about the device identifier.
--
-- 'tags', 'getDeviceIdentifierResponse_tags' - The device identifier tags.
--
-- 'httpStatus', 'getDeviceIdentifierResponse_httpStatus' - The response's http status code.
newGetDeviceIdentifierResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetDeviceIdentifierResponse
newGetDeviceIdentifierResponse :: Int -> GetDeviceIdentifierResponse
newGetDeviceIdentifierResponse Int
pHttpStatus_ =
  GetDeviceIdentifierResponse'
    { $sel:deviceIdentifier:GetDeviceIdentifierResponse' :: Maybe DeviceIdentifier
deviceIdentifier =
        forall a. Maybe a
Prelude.Nothing,
      $sel:tags:GetDeviceIdentifierResponse' :: Maybe (Sensitive (HashMap Text Text))
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetDeviceIdentifierResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the device identifier.
getDeviceIdentifierResponse_deviceIdentifier :: Lens.Lens' GetDeviceIdentifierResponse (Prelude.Maybe DeviceIdentifier)
getDeviceIdentifierResponse_deviceIdentifier :: Lens' GetDeviceIdentifierResponse (Maybe DeviceIdentifier)
getDeviceIdentifierResponse_deviceIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeviceIdentifierResponse' {Maybe DeviceIdentifier
deviceIdentifier :: Maybe DeviceIdentifier
$sel:deviceIdentifier:GetDeviceIdentifierResponse' :: GetDeviceIdentifierResponse -> Maybe DeviceIdentifier
deviceIdentifier} -> Maybe DeviceIdentifier
deviceIdentifier) (\s :: GetDeviceIdentifierResponse
s@GetDeviceIdentifierResponse' {} Maybe DeviceIdentifier
a -> GetDeviceIdentifierResponse
s {$sel:deviceIdentifier:GetDeviceIdentifierResponse' :: Maybe DeviceIdentifier
deviceIdentifier = Maybe DeviceIdentifier
a} :: GetDeviceIdentifierResponse)

-- | The device identifier tags.
getDeviceIdentifierResponse_tags :: Lens.Lens' GetDeviceIdentifierResponse (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
getDeviceIdentifierResponse_tags :: Lens' GetDeviceIdentifierResponse (Maybe (HashMap Text Text))
getDeviceIdentifierResponse_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDeviceIdentifierResponse' {Maybe (Sensitive (HashMap Text Text))
tags :: Maybe (Sensitive (HashMap Text Text))
$sel:tags:GetDeviceIdentifierResponse' :: GetDeviceIdentifierResponse
-> Maybe (Sensitive (HashMap Text Text))
tags} -> Maybe (Sensitive (HashMap Text Text))
tags) (\s :: GetDeviceIdentifierResponse
s@GetDeviceIdentifierResponse' {} Maybe (Sensitive (HashMap Text Text))
a -> GetDeviceIdentifierResponse
s {$sel:tags:GetDeviceIdentifierResponse' :: Maybe (Sensitive (HashMap Text Text))
tags = Maybe (Sensitive (HashMap Text Text))
a} :: GetDeviceIdentifierResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 (forall a. Iso' (Sensitive a) a
Data._Sensitive forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced)

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

instance Prelude.NFData GetDeviceIdentifierResponse where
  rnf :: GetDeviceIdentifierResponse -> ()
rnf GetDeviceIdentifierResponse' {Int
Maybe (Sensitive (HashMap Text Text))
Maybe DeviceIdentifier
httpStatus :: Int
tags :: Maybe (Sensitive (HashMap Text Text))
deviceIdentifier :: Maybe DeviceIdentifier
$sel:httpStatus:GetDeviceIdentifierResponse' :: GetDeviceIdentifierResponse -> Int
$sel:tags:GetDeviceIdentifierResponse' :: GetDeviceIdentifierResponse
-> Maybe (Sensitive (HashMap Text Text))
$sel:deviceIdentifier:GetDeviceIdentifierResponse' :: GetDeviceIdentifierResponse -> Maybe DeviceIdentifier
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe DeviceIdentifier
deviceIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive (HashMap Text Text))
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus