{-# 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.DeviceFarm.GetNetworkProfile
-- 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)
--
-- Returns information about a network profile.
module Amazonka.DeviceFarm.GetNetworkProfile
  ( -- * Creating a Request
    GetNetworkProfile (..),
    newGetNetworkProfile,

    -- * Request Lenses
    getNetworkProfile_arn,

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

    -- * Response Lenses
    getNetworkProfileResponse_networkProfile,
    getNetworkProfileResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DeviceFarm.Types
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:/ 'newGetNetworkProfile' smart constructor.
data GetNetworkProfile = GetNetworkProfile'
  { -- | The ARN of the network profile to return information about.
    GetNetworkProfile -> Text
arn :: Prelude.Text
  }
  deriving (GetNetworkProfile -> GetNetworkProfile -> Bool
(GetNetworkProfile -> GetNetworkProfile -> Bool)
-> (GetNetworkProfile -> GetNetworkProfile -> Bool)
-> Eq GetNetworkProfile
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]
(Int -> ReadS GetNetworkProfile)
-> ReadS [GetNetworkProfile]
-> ReadPrec GetNetworkProfile
-> ReadPrec [GetNetworkProfile]
-> Read 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
(Int -> GetNetworkProfile -> ShowS)
-> (GetNetworkProfile -> String)
-> ([GetNetworkProfile] -> ShowS)
-> Show GetNetworkProfile
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. GetNetworkProfile -> Rep GetNetworkProfile x)
-> (forall x. Rep GetNetworkProfile x -> GetNetworkProfile)
-> Generic GetNetworkProfile
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:
--
-- 'arn', 'getNetworkProfile_arn' - The ARN of the network profile to return information about.
newGetNetworkProfile ::
  -- | 'arn'
  Prelude.Text ->
  GetNetworkProfile
newGetNetworkProfile :: Text -> GetNetworkProfile
newGetNetworkProfile Text
pArn_ =
  GetNetworkProfile' :: Text -> GetNetworkProfile
GetNetworkProfile' {$sel:arn:GetNetworkProfile' :: Text
arn = Text
pArn_}

-- | The ARN of the network profile to return information about.
getNetworkProfile_arn :: Lens.Lens' GetNetworkProfile Prelude.Text
getNetworkProfile_arn :: (Text -> f Text) -> GetNetworkProfile -> f GetNetworkProfile
getNetworkProfile_arn = (GetNetworkProfile -> Text)
-> (GetNetworkProfile -> Text -> GetNetworkProfile)
-> Lens GetNetworkProfile GetNetworkProfile Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetNetworkProfile' {Text
arn :: Text
$sel:arn:GetNetworkProfile' :: GetNetworkProfile -> Text
arn} -> Text
arn) (\s :: GetNetworkProfile
s@GetNetworkProfile' {} Text
a -> GetNetworkProfile
s {$sel:arn:GetNetworkProfile' :: Text
arn = Text
a} :: GetNetworkProfile)

instance Core.AWSRequest GetNetworkProfile where
  type
    AWSResponse GetNetworkProfile =
      GetNetworkProfileResponse
  request :: GetNetworkProfile -> Request GetNetworkProfile
request = Service -> GetNetworkProfile -> Request GetNetworkProfile
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy GetNetworkProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetNetworkProfile)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetNetworkProfile))
-> Logger
-> Service
-> Proxy GetNetworkProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse GetNetworkProfile)))
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 NetworkProfile -> Int -> GetNetworkProfileResponse
GetNetworkProfileResponse'
            (Maybe NetworkProfile -> Int -> GetNetworkProfileResponse)
-> Either String (Maybe NetworkProfile)
-> Either String (Int -> GetNetworkProfileResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe NetworkProfile)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"networkProfile")
            Either String (Int -> GetNetworkProfileResponse)
-> Either String Int -> Either String GetNetworkProfileResponse
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 GetNetworkProfile

instance Prelude.NFData GetNetworkProfile

instance Core.ToHeaders GetNetworkProfile where
  toHeaders :: GetNetworkProfile -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetNetworkProfile -> 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
"DeviceFarm_20150623.GetNetworkProfile" ::
                          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 GetNetworkProfile where
  toJSON :: GetNetworkProfile -> Value
toJSON GetNetworkProfile' {Text
arn :: Text
$sel:arn:GetNetworkProfile' :: GetNetworkProfile -> 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
"arn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
arn)]
      )

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

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

-- | /See:/ 'newGetNetworkProfileResponse' smart constructor.
data GetNetworkProfileResponse = GetNetworkProfileResponse'
  { -- | The network profile.
    GetNetworkProfileResponse -> Maybe NetworkProfile
networkProfile :: Prelude.Maybe NetworkProfile,
    -- | The response's http status code.
    GetNetworkProfileResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetNetworkProfileResponse -> GetNetworkProfileResponse -> Bool
(GetNetworkProfileResponse -> GetNetworkProfileResponse -> Bool)
-> (GetNetworkProfileResponse -> GetNetworkProfileResponse -> Bool)
-> Eq GetNetworkProfileResponse
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, ReadPrec [GetNetworkProfileResponse]
ReadPrec GetNetworkProfileResponse
Int -> ReadS GetNetworkProfileResponse
ReadS [GetNetworkProfileResponse]
(Int -> ReadS GetNetworkProfileResponse)
-> ReadS [GetNetworkProfileResponse]
-> ReadPrec GetNetworkProfileResponse
-> ReadPrec [GetNetworkProfileResponse]
-> Read GetNetworkProfileResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetNetworkProfileResponse]
$creadListPrec :: ReadPrec [GetNetworkProfileResponse]
readPrec :: ReadPrec GetNetworkProfileResponse
$creadPrec :: ReadPrec GetNetworkProfileResponse
readList :: ReadS [GetNetworkProfileResponse]
$creadList :: ReadS [GetNetworkProfileResponse]
readsPrec :: Int -> ReadS GetNetworkProfileResponse
$creadsPrec :: Int -> ReadS GetNetworkProfileResponse
Prelude.Read, Int -> GetNetworkProfileResponse -> ShowS
[GetNetworkProfileResponse] -> ShowS
GetNetworkProfileResponse -> String
(Int -> GetNetworkProfileResponse -> ShowS)
-> (GetNetworkProfileResponse -> String)
-> ([GetNetworkProfileResponse] -> ShowS)
-> Show GetNetworkProfileResponse
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.
 GetNetworkProfileResponse -> Rep GetNetworkProfileResponse x)
-> (forall x.
    Rep GetNetworkProfileResponse x -> GetNetworkProfileResponse)
-> Generic GetNetworkProfileResponse
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.
--
-- 'httpStatus', 'getNetworkProfileResponse_httpStatus' - The response's http status code.
newGetNetworkProfileResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetNetworkProfileResponse
newGetNetworkProfileResponse :: Int -> GetNetworkProfileResponse
newGetNetworkProfileResponse Int
pHttpStatus_ =
  GetNetworkProfileResponse' :: Maybe NetworkProfile -> Int -> GetNetworkProfileResponse
GetNetworkProfileResponse'
    { $sel:networkProfile:GetNetworkProfileResponse' :: Maybe NetworkProfile
networkProfile =
        Maybe NetworkProfile
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetNetworkProfileResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The network profile.
getNetworkProfileResponse_networkProfile :: Lens.Lens' GetNetworkProfileResponse (Prelude.Maybe NetworkProfile)
getNetworkProfileResponse_networkProfile :: (Maybe NetworkProfile -> f (Maybe NetworkProfile))
-> GetNetworkProfileResponse -> f GetNetworkProfileResponse
getNetworkProfileResponse_networkProfile = (GetNetworkProfileResponse -> Maybe NetworkProfile)
-> (GetNetworkProfileResponse
    -> Maybe NetworkProfile -> GetNetworkProfileResponse)
-> Lens
     GetNetworkProfileResponse
     GetNetworkProfileResponse
     (Maybe NetworkProfile)
     (Maybe 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 :: (Int -> f Int)
-> GetNetworkProfileResponse -> f GetNetworkProfileResponse
getNetworkProfileResponse_httpStatus = (GetNetworkProfileResponse -> Int)
-> (GetNetworkProfileResponse -> Int -> GetNetworkProfileResponse)
-> Lens GetNetworkProfileResponse GetNetworkProfileResponse Int Int
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