{-# 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.Outposts.GetOutpost
-- 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)
--
-- Gets information about the specified Outpost.
module Amazonka.Outposts.GetOutpost
  ( -- * Creating a Request
    GetOutpost (..),
    newGetOutpost,

    -- * Request Lenses
    getOutpost_outpostId,

    -- * Destructuring the Response
    GetOutpostResponse (..),
    newGetOutpostResponse,

    -- * Response Lenses
    getOutpostResponse_outpost,
    getOutpostResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Outposts.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

-- |
-- Create a value of 'GetOutpost' 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:
--
-- 'outpostId', 'getOutpost_outpostId' - The ID of the Outpost.
newGetOutpost ::
  -- | 'outpostId'
  Prelude.Text ->
  GetOutpost
newGetOutpost :: Text -> GetOutpost
newGetOutpost Text
pOutpostId_ =
  GetOutpost' :: Text -> GetOutpost
GetOutpost' {$sel:outpostId:GetOutpost' :: Text
outpostId = Text
pOutpostId_}

-- | The ID of the Outpost.
getOutpost_outpostId :: Lens.Lens' GetOutpost Prelude.Text
getOutpost_outpostId :: (Text -> f Text) -> GetOutpost -> f GetOutpost
getOutpost_outpostId = (GetOutpost -> Text)
-> (GetOutpost -> Text -> GetOutpost)
-> Lens GetOutpost GetOutpost Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOutpost' {Text
outpostId :: Text
$sel:outpostId:GetOutpost' :: GetOutpost -> Text
outpostId} -> Text
outpostId) (\s :: GetOutpost
s@GetOutpost' {} Text
a -> GetOutpost
s {$sel:outpostId:GetOutpost' :: Text
outpostId = Text
a} :: GetOutpost)

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

instance Prelude.NFData GetOutpost

instance Core.ToHeaders GetOutpost where
  toHeaders :: GetOutpost -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetOutpost -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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.ToPath GetOutpost where
  toPath :: GetOutpost -> ByteString
toPath GetOutpost' {Text
outpostId :: Text
$sel:outpostId:GetOutpost' :: GetOutpost -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/outposts/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
outpostId]

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

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

-- |
-- Create a value of 'GetOutpostResponse' 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:
--
-- 'outpost', 'getOutpostResponse_outpost' - Undocumented member.
--
-- 'httpStatus', 'getOutpostResponse_httpStatus' - The response's http status code.
newGetOutpostResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetOutpostResponse
newGetOutpostResponse :: Int -> GetOutpostResponse
newGetOutpostResponse Int
pHttpStatus_ =
  GetOutpostResponse' :: Maybe Outpost -> Int -> GetOutpostResponse
GetOutpostResponse'
    { $sel:outpost:GetOutpostResponse' :: Maybe Outpost
outpost = Maybe Outpost
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:GetOutpostResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Undocumented member.
getOutpostResponse_outpost :: Lens.Lens' GetOutpostResponse (Prelude.Maybe Outpost)
getOutpostResponse_outpost :: (Maybe Outpost -> f (Maybe Outpost))
-> GetOutpostResponse -> f GetOutpostResponse
getOutpostResponse_outpost = (GetOutpostResponse -> Maybe Outpost)
-> (GetOutpostResponse -> Maybe Outpost -> GetOutpostResponse)
-> Lens
     GetOutpostResponse
     GetOutpostResponse
     (Maybe Outpost)
     (Maybe Outpost)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetOutpostResponse' {Maybe Outpost
outpost :: Maybe Outpost
$sel:outpost:GetOutpostResponse' :: GetOutpostResponse -> Maybe Outpost
outpost} -> Maybe Outpost
outpost) (\s :: GetOutpostResponse
s@GetOutpostResponse' {} Maybe Outpost
a -> GetOutpostResponse
s {$sel:outpost:GetOutpostResponse' :: Maybe Outpost
outpost = Maybe Outpost
a} :: GetOutpostResponse)

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

instance Prelude.NFData GetOutpostResponse