{-# 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.APIGateway.GetVpcLink
-- 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 a specified VPC link under the caller\'s account in a region.
module Amazonka.APIGateway.GetVpcLink
  ( -- * Creating a Request
    GetVpcLink (..),
    newGetVpcLink,

    -- * Request Lenses
    getVpcLink_vpcLinkId,

    -- * Destructuring the Response
    VpcLink (..),
    newVpcLink,

    -- * Response Lenses
    vpcLink_status,
    vpcLink_targetArns,
    vpcLink_name,
    vpcLink_statusMessage,
    vpcLink_id,
    vpcLink_description,
    vpcLink_tags,
  )
where

import Amazonka.APIGateway.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

-- | Gets a specified VPC link under the caller\'s account in a region.
--
-- /See:/ 'newGetVpcLink' smart constructor.
data GetVpcLink = GetVpcLink'
  { -- | [Required] The identifier of the VpcLink. It is used in an Integration
    -- to reference this VpcLink.
    GetVpcLink -> Text
vpcLinkId :: Prelude.Text
  }
  deriving (GetVpcLink -> GetVpcLink -> Bool
(GetVpcLink -> GetVpcLink -> Bool)
-> (GetVpcLink -> GetVpcLink -> Bool) -> Eq GetVpcLink
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetVpcLink -> GetVpcLink -> Bool
$c/= :: GetVpcLink -> GetVpcLink -> Bool
== :: GetVpcLink -> GetVpcLink -> Bool
$c== :: GetVpcLink -> GetVpcLink -> Bool
Prelude.Eq, ReadPrec [GetVpcLink]
ReadPrec GetVpcLink
Int -> ReadS GetVpcLink
ReadS [GetVpcLink]
(Int -> ReadS GetVpcLink)
-> ReadS [GetVpcLink]
-> ReadPrec GetVpcLink
-> ReadPrec [GetVpcLink]
-> Read GetVpcLink
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetVpcLink]
$creadListPrec :: ReadPrec [GetVpcLink]
readPrec :: ReadPrec GetVpcLink
$creadPrec :: ReadPrec GetVpcLink
readList :: ReadS [GetVpcLink]
$creadList :: ReadS [GetVpcLink]
readsPrec :: Int -> ReadS GetVpcLink
$creadsPrec :: Int -> ReadS GetVpcLink
Prelude.Read, Int -> GetVpcLink -> ShowS
[GetVpcLink] -> ShowS
GetVpcLink -> String
(Int -> GetVpcLink -> ShowS)
-> (GetVpcLink -> String)
-> ([GetVpcLink] -> ShowS)
-> Show GetVpcLink
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetVpcLink] -> ShowS
$cshowList :: [GetVpcLink] -> ShowS
show :: GetVpcLink -> String
$cshow :: GetVpcLink -> String
showsPrec :: Int -> GetVpcLink -> ShowS
$cshowsPrec :: Int -> GetVpcLink -> ShowS
Prelude.Show, (forall x. GetVpcLink -> Rep GetVpcLink x)
-> (forall x. Rep GetVpcLink x -> GetVpcLink) -> Generic GetVpcLink
forall x. Rep GetVpcLink x -> GetVpcLink
forall x. GetVpcLink -> Rep GetVpcLink x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetVpcLink x -> GetVpcLink
$cfrom :: forall x. GetVpcLink -> Rep GetVpcLink x
Prelude.Generic)

-- |
-- Create a value of 'GetVpcLink' 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:
--
-- 'vpcLinkId', 'getVpcLink_vpcLinkId' - [Required] The identifier of the VpcLink. It is used in an Integration
-- to reference this VpcLink.
newGetVpcLink ::
  -- | 'vpcLinkId'
  Prelude.Text ->
  GetVpcLink
newGetVpcLink :: Text -> GetVpcLink
newGetVpcLink Text
pVpcLinkId_ =
  GetVpcLink' :: Text -> GetVpcLink
GetVpcLink' {$sel:vpcLinkId:GetVpcLink' :: Text
vpcLinkId = Text
pVpcLinkId_}

-- | [Required] The identifier of the VpcLink. It is used in an Integration
-- to reference this VpcLink.
getVpcLink_vpcLinkId :: Lens.Lens' GetVpcLink Prelude.Text
getVpcLink_vpcLinkId :: (Text -> f Text) -> GetVpcLink -> f GetVpcLink
getVpcLink_vpcLinkId = (GetVpcLink -> Text)
-> (GetVpcLink -> Text -> GetVpcLink)
-> Lens GetVpcLink GetVpcLink Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetVpcLink' {Text
vpcLinkId :: Text
$sel:vpcLinkId:GetVpcLink' :: GetVpcLink -> Text
vpcLinkId} -> Text
vpcLinkId) (\s :: GetVpcLink
s@GetVpcLink' {} Text
a -> GetVpcLink
s {$sel:vpcLinkId:GetVpcLink' :: Text
vpcLinkId = Text
a} :: GetVpcLink)

instance Core.AWSRequest GetVpcLink where
  type AWSResponse GetVpcLink = VpcLink
  request :: GetVpcLink -> Request GetVpcLink
request = Service -> GetVpcLink -> Request GetVpcLink
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy GetVpcLink
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetVpcLink)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse GetVpcLink))
-> Logger
-> Service
-> Proxy GetVpcLink
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetVpcLink)))
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 -> Object -> Either String VpcLink
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)

instance Prelude.Hashable GetVpcLink

instance Prelude.NFData GetVpcLink

instance Core.ToHeaders GetVpcLink where
  toHeaders :: GetVpcLink -> ResponseHeaders
toHeaders =
    ResponseHeaders -> GetVpcLink -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Accept"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# (ByteString
"application/json" :: Prelude.ByteString)
          ]
      )

instance Core.ToPath GetVpcLink where
  toPath :: GetVpcLink -> ByteString
toPath GetVpcLink' {Text
vpcLinkId :: Text
$sel:vpcLinkId:GetVpcLink' :: GetVpcLink -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/vpclinks/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
vpcLinkId]

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