{-# 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.GetNetworkProfile
-- 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 network profile details by the network profile ARN.
module Amazonka.AlexaBusiness.GetNetworkProfile
  ( -- * Creating a Request
    GetNetworkProfile (..),
    newGetNetworkProfile,

    -- * Request Lenses
    getNetworkProfile_networkProfileArn,

    -- * Destructuring the Response
    GetNetworkProfileResponse (..),
    newGetNetworkProfileResponse,

    -- * Response Lenses
    getNetworkProfileResponse_networkProfile,
    getNetworkProfileResponse_httpStatus,
  )
where

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

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

-- |
-- Create a value of 'GetNetworkProfile' 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:
--
-- 'networkProfileArn', 'getNetworkProfile_networkProfileArn' - The ARN of the network profile associated with a device.
newGetNetworkProfile ::
  -- | 'networkProfileArn'
  Prelude.Text ->
  GetNetworkProfile
newGetNetworkProfile :: Text -> GetNetworkProfile
newGetNetworkProfile Text
pNetworkProfileArn_ =
  GetNetworkProfile'
    { $sel:networkProfileArn:GetNetworkProfile' :: Text
networkProfileArn =
        Text
pNetworkProfileArn_
    }

-- | The ARN of the network profile associated with a device.
getNetworkProfile_networkProfileArn :: Lens.Lens' GetNetworkProfile Prelude.Text
getNetworkProfile_networkProfileArn :: Lens' GetNetworkProfile Text
getNetworkProfile_networkProfileArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNetworkProfile' {Text
networkProfileArn :: Text
$sel:networkProfileArn:GetNetworkProfile' :: GetNetworkProfile -> Text
networkProfileArn} -> Text
networkProfileArn) (\s :: GetNetworkProfile
s@GetNetworkProfile' {} Text
a -> GetNetworkProfile
s {$sel:networkProfileArn:GetNetworkProfile' :: Text
networkProfileArn = Text
a} :: GetNetworkProfile)

instance Core.AWSRequest GetNetworkProfile where
  type
    AWSResponse GetNetworkProfile =
      GetNetworkProfileResponse
  request :: (Service -> Service)
-> GetNetworkProfile -> Request GetNetworkProfile
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 GetNetworkProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetNetworkProfile)))
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 NetworkProfile -> Int -> GetNetworkProfileResponse
GetNetworkProfileResponse'
            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
"NetworkProfile")
            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 GetNetworkProfile where
  hashWithSalt :: Int -> GetNetworkProfile -> Int
hashWithSalt Int
_salt GetNetworkProfile' {Text
networkProfileArn :: Text
$sel:networkProfileArn:GetNetworkProfile' :: GetNetworkProfile -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
networkProfileArn

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

instance Data.ToHeaders GetNetworkProfile where
  toHeaders :: GetNetworkProfile -> 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
"AlexaForBusiness.GetNetworkProfile" ::
                          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 GetNetworkProfile where
  toJSON :: GetNetworkProfile -> Value
toJSON GetNetworkProfile' {Text
networkProfileArn :: Text
$sel:networkProfileArn:GetNetworkProfile' :: GetNetworkProfile -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"NetworkProfileArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
networkProfileArn)
          ]
      )

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

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

-- | /See:/ 'newGetNetworkProfileResponse' smart constructor.
data GetNetworkProfileResponse = GetNetworkProfileResponse'
  { -- | The network profile associated with a device.
    GetNetworkProfileResponse -> Maybe NetworkProfile
networkProfile :: Prelude.Maybe NetworkProfile,
    -- | The response's http status code.
    GetNetworkProfileResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetNetworkProfileResponse -> GetNetworkProfileResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetNetworkProfileResponse -> GetNetworkProfileResponse -> Bool
$c/= :: GetNetworkProfileResponse -> GetNetworkProfileResponse -> Bool
== :: GetNetworkProfileResponse -> GetNetworkProfileResponse -> Bool
$c== :: GetNetworkProfileResponse -> GetNetworkProfileResponse -> Bool
Prelude.Eq, Int -> GetNetworkProfileResponse -> ShowS
[GetNetworkProfileResponse] -> ShowS
GetNetworkProfileResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetNetworkProfileResponse] -> ShowS
$cshowList :: [GetNetworkProfileResponse] -> ShowS
show :: GetNetworkProfileResponse -> String
$cshow :: GetNetworkProfileResponse -> String
showsPrec :: Int -> GetNetworkProfileResponse -> ShowS
$cshowsPrec :: Int -> GetNetworkProfileResponse -> ShowS
Prelude.Show, forall x.
Rep GetNetworkProfileResponse x -> GetNetworkProfileResponse
forall x.
GetNetworkProfileResponse -> Rep GetNetworkProfileResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetNetworkProfileResponse x -> GetNetworkProfileResponse
$cfrom :: forall x.
GetNetworkProfileResponse -> Rep GetNetworkProfileResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetNetworkProfileResponse' 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:
--
-- 'networkProfile', 'getNetworkProfileResponse_networkProfile' - The network profile associated with a device.
--
-- 'httpStatus', 'getNetworkProfileResponse_httpStatus' - The response's http status code.
newGetNetworkProfileResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetNetworkProfileResponse
newGetNetworkProfileResponse :: Int -> GetNetworkProfileResponse
newGetNetworkProfileResponse Int
pHttpStatus_ =
  GetNetworkProfileResponse'
    { $sel:networkProfile:GetNetworkProfileResponse' :: Maybe NetworkProfile
networkProfile =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetNetworkProfileResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The network profile associated with a device.
getNetworkProfileResponse_networkProfile :: Lens.Lens' GetNetworkProfileResponse (Prelude.Maybe NetworkProfile)
getNetworkProfileResponse_networkProfile :: Lens' GetNetworkProfileResponse (Maybe NetworkProfile)
getNetworkProfileResponse_networkProfile = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNetworkProfileResponse' {Maybe NetworkProfile
networkProfile :: Maybe NetworkProfile
$sel:networkProfile:GetNetworkProfileResponse' :: GetNetworkProfileResponse -> Maybe NetworkProfile
networkProfile} -> Maybe NetworkProfile
networkProfile) (\s :: GetNetworkProfileResponse
s@GetNetworkProfileResponse' {} Maybe NetworkProfile
a -> GetNetworkProfileResponse
s {$sel:networkProfile:GetNetworkProfileResponse' :: Maybe NetworkProfile
networkProfile = Maybe NetworkProfile
a} :: GetNetworkProfileResponse)

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

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