{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude

-- | An API Gateway VPC link for a RestApi to access resources in an Amazon
-- Virtual Private Cloud (VPC).
--
-- /See:/ 'newVpcLink' smart constructor.
data VpcLink = VpcLink'
  { -- | The description of the VPC link.
    VpcLink -> Maybe Text
description :: 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 name used to label and identify the VPC link.
    VpcLink -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | 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,
    -- | A description about the VPC link status.
    VpcLink -> Maybe Text
statusMessage :: 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),
    -- | 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]
  }
  deriving (VpcLink -> VpcLink -> Bool
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]
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
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. 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:
--
-- 'description', 'vpcLink_description' - The description of the VPC link.
--
-- 'id', 'vpcLink_id' - The identifier of the VpcLink. It is used in an Integration to reference
-- this VpcLink.
--
-- 'name', 'vpcLink_name' - The name used to label and identify the VPC link.
--
-- '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@.
--
-- 'statusMessage', 'vpcLink_statusMessage' - A description about the VPC link status.
--
-- 'tags', 'vpcLink_tags' - The collection of tags. Each tag element is associated with a given
-- resource.
--
-- '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.
newVpcLink ::
  VpcLink
newVpcLink :: VpcLink
newVpcLink =
  VpcLink'
    { $sel:description:VpcLink' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
      $sel:id:VpcLink' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:name:VpcLink' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:status:VpcLink' :: Maybe VpcLinkStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:statusMessage:VpcLink' :: Maybe Text
statusMessage = forall a. Maybe a
Prelude.Nothing,
      $sel:tags:VpcLink' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
      $sel:targetArns:VpcLink' :: Maybe [Text]
targetArns = forall a. Maybe a
Prelude.Nothing
    }

-- | The description of the VPC link.
vpcLink_description :: Lens.Lens' VpcLink (Prelude.Maybe Prelude.Text)
vpcLink_description :: Lens' VpcLink (Maybe Text)
vpcLink_description = 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 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 :: Lens' VpcLink (Maybe Text)
vpcLink_id = 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 name used to label and identify the VPC link.
vpcLink_name :: Lens.Lens' VpcLink (Prelude.Maybe Prelude.Text)
vpcLink_name :: Lens' VpcLink (Maybe Text)
vpcLink_name = 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)

-- | 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 :: Lens' VpcLink (Maybe VpcLinkStatus)
vpcLink_status = 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)

-- | A description about the VPC link status.
vpcLink_statusMessage :: Lens.Lens' VpcLink (Prelude.Maybe Prelude.Text)
vpcLink_statusMessage :: Lens' VpcLink (Maybe Text)
vpcLink_statusMessage = 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 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 :: Lens' VpcLink (Maybe (HashMap Text Text))
vpcLink_tags = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | 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 :: Lens' VpcLink (Maybe [Text])
vpcLink_targetArns = 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) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable VpcLink where
  hashWithSalt :: Int -> VpcLink -> Int
hashWithSalt Int
_salt VpcLink' {Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe VpcLinkStatus
targetArns :: Maybe [Text]
tags :: Maybe (HashMap Text Text)
statusMessage :: Maybe Text
status :: Maybe VpcLinkStatus
name :: Maybe Text
id :: Maybe Text
description :: Maybe Text
$sel:targetArns:VpcLink' :: VpcLink -> Maybe [Text]
$sel:tags:VpcLink' :: VpcLink -> Maybe (HashMap Text Text)
$sel:statusMessage:VpcLink' :: VpcLink -> Maybe Text
$sel:status:VpcLink' :: VpcLink -> Maybe VpcLinkStatus
$sel:name:VpcLink' :: VpcLink -> Maybe Text
$sel:id:VpcLink' :: VpcLink -> Maybe Text
$sel:description:VpcLink' :: VpcLink -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VpcLinkStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
statusMessage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
targetArns

instance Prelude.NFData VpcLink where
  rnf :: VpcLink -> ()
rnf VpcLink' {Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe VpcLinkStatus
targetArns :: Maybe [Text]
tags :: Maybe (HashMap Text Text)
statusMessage :: Maybe Text
status :: Maybe VpcLinkStatus
name :: Maybe Text
id :: Maybe Text
description :: Maybe Text
$sel:targetArns:VpcLink' :: VpcLink -> Maybe [Text]
$sel:tags:VpcLink' :: VpcLink -> Maybe (HashMap Text Text)
$sel:statusMessage:VpcLink' :: VpcLink -> Maybe Text
$sel:status:VpcLink' :: VpcLink -> Maybe VpcLinkStatus
$sel:name:VpcLink' :: VpcLink -> Maybe Text
$sel:id:VpcLink' :: VpcLink -> Maybe Text
$sel:description:VpcLink' :: VpcLink -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VpcLinkStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
statusMessage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
targetArns