{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.VpcLink
-- 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)
module Amazonka.APIGateway.Types.VpcLink where

import Amazonka.APIGateway.Types.VpcLinkStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | An API Gateway VPC link for a RestApi to access resources in an Amazon
-- Virtual Private Cloud (VPC).
--
-- To enable access to a resource in an Amazon Virtual Private Cloud
-- through Amazon API Gateway, you, as an API developer, create a VpcLink
-- resource targeted for one or more network load balancers of the VPC and
-- then integrate an API method with a private integration that uses the
-- VpcLink. The private integration has an integration type of @HTTP@ or
-- @HTTP_PROXY@ and has a connection type of @VPC_LINK@. The integration
-- uses the @connectionId@ property to identify the VpcLink used.
--
-- /See:/ 'newVpcLink' smart constructor.
data VpcLink = VpcLink'
  { -- | The status of the VPC link. The valid values are @AVAILABLE@, @PENDING@,
    -- @DELETING@, or @FAILED@. Deploying an API will wait if the status is
    -- @PENDING@ and will fail if the status is @DELETING@.
    VpcLink -> Maybe VpcLinkStatus
status :: Prelude.Maybe VpcLinkStatus,
    -- | The ARN of the network load balancer of the VPC targeted by the VPC
    -- link. The network load balancer must be owned by the same AWS account of
    -- the API owner.
    VpcLink -> Maybe [Text]
targetArns :: Prelude.Maybe [Prelude.Text],
    -- | The name used to label and identify the VPC link.
    VpcLink -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | A description about the VPC link status.
    VpcLink -> Maybe Text
statusMessage :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the VpcLink. It is used in an Integration to reference
    -- this VpcLink.
    VpcLink -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The description of the VPC link.
    VpcLink -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | The collection of tags. Each tag element is associated with a given
    -- resource.
    VpcLink -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (VpcLink -> VpcLink -> Bool
(VpcLink -> VpcLink -> Bool)
-> (VpcLink -> VpcLink -> Bool) -> Eq VpcLink
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcLink -> VpcLink -> Bool
$c/= :: VpcLink -> VpcLink -> Bool
== :: VpcLink -> VpcLink -> Bool
$c== :: VpcLink -> VpcLink -> Bool
Prelude.Eq, ReadPrec [VpcLink]
ReadPrec VpcLink
Int -> ReadS VpcLink
ReadS [VpcLink]
(Int -> ReadS VpcLink)
-> ReadS [VpcLink]
-> ReadPrec VpcLink
-> ReadPrec [VpcLink]
-> Read VpcLink
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcLink]
$creadListPrec :: ReadPrec [VpcLink]
readPrec :: ReadPrec VpcLink
$creadPrec :: ReadPrec VpcLink
readList :: ReadS [VpcLink]
$creadList :: ReadS [VpcLink]
readsPrec :: Int -> ReadS VpcLink
$creadsPrec :: Int -> ReadS VpcLink
Prelude.Read, Int -> VpcLink -> ShowS
[VpcLink] -> ShowS
VpcLink -> String
(Int -> VpcLink -> ShowS)
-> (VpcLink -> String) -> ([VpcLink] -> ShowS) -> Show VpcLink
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcLink] -> ShowS
$cshowList :: [VpcLink] -> ShowS
show :: VpcLink -> String
$cshow :: VpcLink -> String
showsPrec :: Int -> VpcLink -> ShowS
$cshowsPrec :: Int -> VpcLink -> ShowS
Prelude.Show, (forall x. VpcLink -> Rep VpcLink x)
-> (forall x. Rep VpcLink x -> VpcLink) -> Generic VpcLink
forall x. Rep VpcLink x -> VpcLink
forall x. VpcLink -> Rep VpcLink x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VpcLink x -> VpcLink
$cfrom :: forall x. VpcLink -> Rep VpcLink x
Prelude.Generic)

-- |
-- Create a value of 'VpcLink' 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:
--
-- 'status', 'vpcLink_status' - The status of the VPC link. The valid values are @AVAILABLE@, @PENDING@,
-- @DELETING@, or @FAILED@. Deploying an API will wait if the status is
-- @PENDING@ and will fail if the status is @DELETING@.
--
-- 'targetArns', 'vpcLink_targetArns' - The ARN of the network load balancer of the VPC targeted by the VPC
-- link. The network load balancer must be owned by the same AWS account of
-- the API owner.
--
-- 'name', 'vpcLink_name' - The name used to label and identify the VPC link.
--
-- 'statusMessage', 'vpcLink_statusMessage' - A description about the VPC link status.
--
-- 'id', 'vpcLink_id' - The identifier of the VpcLink. It is used in an Integration to reference
-- this VpcLink.
--
-- 'description', 'vpcLink_description' - The description of the VPC link.
--
-- 'tags', 'vpcLink_tags' - The collection of tags. Each tag element is associated with a given
-- resource.
newVpcLink ::
  VpcLink
newVpcLink :: VpcLink
newVpcLink =
  VpcLink' :: Maybe VpcLinkStatus
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> VpcLink
VpcLink'
    { $sel:status:VpcLink' :: Maybe VpcLinkStatus
status = Maybe VpcLinkStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:targetArns:VpcLink' :: Maybe [Text]
targetArns = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:VpcLink' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:VpcLink' :: Maybe Text
statusMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:VpcLink' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:VpcLink' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:VpcLink' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | The status of the VPC link. The valid values are @AVAILABLE@, @PENDING@,
-- @DELETING@, or @FAILED@. Deploying an API will wait if the status is
-- @PENDING@ and will fail if the status is @DELETING@.
vpcLink_status :: Lens.Lens' VpcLink (Prelude.Maybe VpcLinkStatus)
vpcLink_status :: (Maybe VpcLinkStatus -> f (Maybe VpcLinkStatus))
-> VpcLink -> f VpcLink
vpcLink_status = (VpcLink -> Maybe VpcLinkStatus)
-> (VpcLink -> Maybe VpcLinkStatus -> VpcLink)
-> Lens VpcLink VpcLink (Maybe VpcLinkStatus) (Maybe VpcLinkStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcLink' {Maybe VpcLinkStatus
status :: Maybe VpcLinkStatus
$sel:status:VpcLink' :: VpcLink -> Maybe VpcLinkStatus
status} -> Maybe VpcLinkStatus
status) (\s :: VpcLink
s@VpcLink' {} Maybe VpcLinkStatus
a -> VpcLink
s {$sel:status:VpcLink' :: Maybe VpcLinkStatus
status = Maybe VpcLinkStatus
a} :: VpcLink)

-- | The ARN of the network load balancer of the VPC targeted by the VPC
-- link. The network load balancer must be owned by the same AWS account of
-- the API owner.
vpcLink_targetArns :: Lens.Lens' VpcLink (Prelude.Maybe [Prelude.Text])
vpcLink_targetArns :: (Maybe [Text] -> f (Maybe [Text])) -> VpcLink -> f VpcLink
vpcLink_targetArns = (VpcLink -> Maybe [Text])
-> (VpcLink -> Maybe [Text] -> VpcLink)
-> Lens VpcLink VpcLink (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcLink' {Maybe [Text]
targetArns :: Maybe [Text]
$sel:targetArns:VpcLink' :: VpcLink -> Maybe [Text]
targetArns} -> Maybe [Text]
targetArns) (\s :: VpcLink
s@VpcLink' {} Maybe [Text]
a -> VpcLink
s {$sel:targetArns:VpcLink' :: Maybe [Text]
targetArns = Maybe [Text]
a} :: VpcLink) ((Maybe [Text] -> f (Maybe [Text])) -> VpcLink -> f VpcLink)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> VpcLink
-> f VpcLink
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 AnIso [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name used to label and identify the VPC link.
vpcLink_name :: Lens.Lens' VpcLink (Prelude.Maybe Prelude.Text)
vpcLink_name :: (Maybe Text -> f (Maybe Text)) -> VpcLink -> f VpcLink
vpcLink_name = (VpcLink -> Maybe Text)
-> (VpcLink -> Maybe Text -> VpcLink)
-> Lens VpcLink VpcLink (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcLink' {Maybe Text
name :: Maybe Text
$sel:name:VpcLink' :: VpcLink -> Maybe Text
name} -> Maybe Text
name) (\s :: VpcLink
s@VpcLink' {} Maybe Text
a -> VpcLink
s {$sel:name:VpcLink' :: Maybe Text
name = Maybe Text
a} :: VpcLink)

-- | A description about the VPC link status.
vpcLink_statusMessage :: Lens.Lens' VpcLink (Prelude.Maybe Prelude.Text)
vpcLink_statusMessage :: (Maybe Text -> f (Maybe Text)) -> VpcLink -> f VpcLink
vpcLink_statusMessage = (VpcLink -> Maybe Text)
-> (VpcLink -> Maybe Text -> VpcLink)
-> Lens VpcLink VpcLink (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcLink' {Maybe Text
statusMessage :: Maybe Text
$sel:statusMessage:VpcLink' :: VpcLink -> Maybe Text
statusMessage} -> Maybe Text
statusMessage) (\s :: VpcLink
s@VpcLink' {} Maybe Text
a -> VpcLink
s {$sel:statusMessage:VpcLink' :: Maybe Text
statusMessage = Maybe Text
a} :: VpcLink)

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

-- | The description of the VPC link.
vpcLink_description :: Lens.Lens' VpcLink (Prelude.Maybe Prelude.Text)
vpcLink_description :: (Maybe Text -> f (Maybe Text)) -> VpcLink -> f VpcLink
vpcLink_description = (VpcLink -> Maybe Text)
-> (VpcLink -> Maybe Text -> VpcLink)
-> Lens VpcLink VpcLink (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcLink' {Maybe Text
description :: Maybe Text
$sel:description:VpcLink' :: VpcLink -> Maybe Text
description} -> Maybe Text
description) (\s :: VpcLink
s@VpcLink' {} Maybe Text
a -> VpcLink
s {$sel:description:VpcLink' :: Maybe Text
description = Maybe Text
a} :: VpcLink)

-- | The collection of tags. Each tag element is associated with a given
-- resource.
vpcLink_tags :: Lens.Lens' VpcLink (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
vpcLink_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> VpcLink -> f VpcLink
vpcLink_tags = (VpcLink -> Maybe (HashMap Text Text))
-> (VpcLink -> Maybe (HashMap Text Text) -> VpcLink)
-> Lens
     VpcLink
     VpcLink
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcLink' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:VpcLink' :: VpcLink -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: VpcLink
s@VpcLink' {} Maybe (HashMap Text Text)
a -> VpcLink
s {$sel:tags:VpcLink' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: VpcLink) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> VpcLink -> f VpcLink)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> VpcLink
-> f VpcLink
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.FromJSON VpcLink where
  parseJSON :: Value -> Parser VpcLink
parseJSON =
    String -> (Object -> Parser VpcLink) -> Value -> Parser VpcLink
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VpcLink"
      ( \Object
x ->
          Maybe VpcLinkStatus
-> Maybe [Text]
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> VpcLink
VpcLink'
            (Maybe VpcLinkStatus
 -> Maybe [Text]
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe (HashMap Text Text)
 -> VpcLink)
-> Parser (Maybe VpcLinkStatus)
-> Parser
     (Maybe [Text]
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> VpcLink)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe VpcLinkStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe [Text]
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> VpcLink)
-> Parser (Maybe [Text])
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> VpcLink)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe [Text]))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"targetArns" Parser (Maybe (Maybe [Text]))
-> Maybe [Text] -> Parser (Maybe [Text])
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe [Text]
forall a. Monoid a => a
Prelude.mempty)
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> VpcLink)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe (HashMap Text Text)
      -> VpcLink)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
            Parser
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe (HashMap Text Text)
   -> VpcLink)
-> Parser (Maybe Text)
-> Parser
     (Maybe Text -> Maybe Text -> Maybe (HashMap Text Text) -> VpcLink)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"statusMessage")
            Parser
  (Maybe Text -> Maybe Text -> Maybe (HashMap Text Text) -> VpcLink)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe (HashMap Text Text) -> VpcLink)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"id")
            Parser (Maybe Text -> Maybe (HashMap Text Text) -> VpcLink)
-> Parser (Maybe Text)
-> Parser (Maybe (HashMap Text Text) -> VpcLink)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"description")
            Parser (Maybe (HashMap Text Text) -> VpcLink)
-> Parser (Maybe (HashMap Text Text)) -> Parser VpcLink
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (Maybe (HashMap Text Text)))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"tags" Parser (Maybe (Maybe (HashMap Text Text)))
-> Maybe (HashMap Text Text) -> Parser (Maybe (HashMap Text Text))
forall a. Parser (Maybe a) -> a -> Parser a
Core..!= Maybe (HashMap Text Text)
forall a. Monoid a => a
Prelude.mempty)
      )

instance Prelude.Hashable VpcLink

instance Prelude.NFData VpcLink