{-# 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.RedshiftServerLess.Types.VpcEndpoint
-- 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.RedshiftServerLess.Types.VpcEndpoint where

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
import Amazonka.RedshiftServerLess.Types.NetworkInterface

-- | The connection endpoint for connecting to Amazon Redshift Serverless
-- through the proxy.
--
-- /See:/ 'newVpcEndpoint' smart constructor.
data VpcEndpoint = VpcEndpoint'
  { -- | One or more network interfaces of the endpoint. Also known as an
    -- interface endpoint.
    VpcEndpoint -> Maybe [NetworkInterface]
networkInterfaces :: Prelude.Maybe [NetworkInterface],
    -- | The connection endpoint ID for connecting to Amazon Redshift Serverless.
    VpcEndpoint -> Maybe Text
vpcEndpointId :: Prelude.Maybe Prelude.Text,
    -- | The VPC identifier that the endpoint is associated with.
    VpcEndpoint -> Maybe Text
vpcId :: Prelude.Maybe Prelude.Text
  }
  deriving (VpcEndpoint -> VpcEndpoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcEndpoint -> VpcEndpoint -> Bool
$c/= :: VpcEndpoint -> VpcEndpoint -> Bool
== :: VpcEndpoint -> VpcEndpoint -> Bool
$c== :: VpcEndpoint -> VpcEndpoint -> Bool
Prelude.Eq, ReadPrec [VpcEndpoint]
ReadPrec VpcEndpoint
Int -> ReadS VpcEndpoint
ReadS [VpcEndpoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcEndpoint]
$creadListPrec :: ReadPrec [VpcEndpoint]
readPrec :: ReadPrec VpcEndpoint
$creadPrec :: ReadPrec VpcEndpoint
readList :: ReadS [VpcEndpoint]
$creadList :: ReadS [VpcEndpoint]
readsPrec :: Int -> ReadS VpcEndpoint
$creadsPrec :: Int -> ReadS VpcEndpoint
Prelude.Read, Int -> VpcEndpoint -> ShowS
[VpcEndpoint] -> ShowS
VpcEndpoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcEndpoint] -> ShowS
$cshowList :: [VpcEndpoint] -> ShowS
show :: VpcEndpoint -> String
$cshow :: VpcEndpoint -> String
showsPrec :: Int -> VpcEndpoint -> ShowS
$cshowsPrec :: Int -> VpcEndpoint -> ShowS
Prelude.Show, forall x. Rep VpcEndpoint x -> VpcEndpoint
forall x. VpcEndpoint -> Rep VpcEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VpcEndpoint x -> VpcEndpoint
$cfrom :: forall x. VpcEndpoint -> Rep VpcEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'VpcEndpoint' 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:
--
-- 'networkInterfaces', 'vpcEndpoint_networkInterfaces' - One or more network interfaces of the endpoint. Also known as an
-- interface endpoint.
--
-- 'vpcEndpointId', 'vpcEndpoint_vpcEndpointId' - The connection endpoint ID for connecting to Amazon Redshift Serverless.
--
-- 'vpcId', 'vpcEndpoint_vpcId' - The VPC identifier that the endpoint is associated with.
newVpcEndpoint ::
  VpcEndpoint
newVpcEndpoint :: VpcEndpoint
newVpcEndpoint =
  VpcEndpoint'
    { $sel:networkInterfaces:VpcEndpoint' :: Maybe [NetworkInterface]
networkInterfaces = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcEndpointId:VpcEndpoint' :: Maybe Text
vpcEndpointId = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcId:VpcEndpoint' :: Maybe Text
vpcId = forall a. Maybe a
Prelude.Nothing
    }

-- | One or more network interfaces of the endpoint. Also known as an
-- interface endpoint.
vpcEndpoint_networkInterfaces :: Lens.Lens' VpcEndpoint (Prelude.Maybe [NetworkInterface])
vpcEndpoint_networkInterfaces :: Lens' VpcEndpoint (Maybe [NetworkInterface])
vpcEndpoint_networkInterfaces = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcEndpoint' {Maybe [NetworkInterface]
networkInterfaces :: Maybe [NetworkInterface]
$sel:networkInterfaces:VpcEndpoint' :: VpcEndpoint -> Maybe [NetworkInterface]
networkInterfaces} -> Maybe [NetworkInterface]
networkInterfaces) (\s :: VpcEndpoint
s@VpcEndpoint' {} Maybe [NetworkInterface]
a -> VpcEndpoint
s {$sel:networkInterfaces:VpcEndpoint' :: Maybe [NetworkInterface]
networkInterfaces = Maybe [NetworkInterface]
a} :: VpcEndpoint) 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 connection endpoint ID for connecting to Amazon Redshift Serverless.
vpcEndpoint_vpcEndpointId :: Lens.Lens' VpcEndpoint (Prelude.Maybe Prelude.Text)
vpcEndpoint_vpcEndpointId :: Lens' VpcEndpoint (Maybe Text)
vpcEndpoint_vpcEndpointId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcEndpoint' {Maybe Text
vpcEndpointId :: Maybe Text
$sel:vpcEndpointId:VpcEndpoint' :: VpcEndpoint -> Maybe Text
vpcEndpointId} -> Maybe Text
vpcEndpointId) (\s :: VpcEndpoint
s@VpcEndpoint' {} Maybe Text
a -> VpcEndpoint
s {$sel:vpcEndpointId:VpcEndpoint' :: Maybe Text
vpcEndpointId = Maybe Text
a} :: VpcEndpoint)

-- | The VPC identifier that the endpoint is associated with.
vpcEndpoint_vpcId :: Lens.Lens' VpcEndpoint (Prelude.Maybe Prelude.Text)
vpcEndpoint_vpcId :: Lens' VpcEndpoint (Maybe Text)
vpcEndpoint_vpcId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcEndpoint' {Maybe Text
vpcId :: Maybe Text
$sel:vpcId:VpcEndpoint' :: VpcEndpoint -> Maybe Text
vpcId} -> Maybe Text
vpcId) (\s :: VpcEndpoint
s@VpcEndpoint' {} Maybe Text
a -> VpcEndpoint
s {$sel:vpcId:VpcEndpoint' :: Maybe Text
vpcId = Maybe Text
a} :: VpcEndpoint)

instance Data.FromJSON VpcEndpoint where
  parseJSON :: Value -> Parser VpcEndpoint
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VpcEndpoint"
      ( \Object
x ->
          Maybe [NetworkInterface] -> Maybe Text -> Maybe Text -> VpcEndpoint
VpcEndpoint'
            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
"networkInterfaces"
                            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
"vpcEndpointId")
            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
"vpcId")
      )

instance Prelude.Hashable VpcEndpoint where
  hashWithSalt :: Int -> VpcEndpoint -> Int
hashWithSalt Int
_salt VpcEndpoint' {Maybe [NetworkInterface]
Maybe Text
vpcId :: Maybe Text
vpcEndpointId :: Maybe Text
networkInterfaces :: Maybe [NetworkInterface]
$sel:vpcId:VpcEndpoint' :: VpcEndpoint -> Maybe Text
$sel:vpcEndpointId:VpcEndpoint' :: VpcEndpoint -> Maybe Text
$sel:networkInterfaces:VpcEndpoint' :: VpcEndpoint -> Maybe [NetworkInterface]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [NetworkInterface]
networkInterfaces
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vpcEndpointId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vpcId

instance Prelude.NFData VpcEndpoint where
  rnf :: VpcEndpoint -> ()
rnf VpcEndpoint' {Maybe [NetworkInterface]
Maybe Text
vpcId :: Maybe Text
vpcEndpointId :: Maybe Text
networkInterfaces :: Maybe [NetworkInterface]
$sel:vpcId:VpcEndpoint' :: VpcEndpoint -> Maybe Text
$sel:vpcEndpointId:VpcEndpoint' :: VpcEndpoint -> Maybe Text
$sel:networkInterfaces:VpcEndpoint' :: VpcEndpoint -> Maybe [NetworkInterface]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [NetworkInterface]
networkInterfaces
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vpcEndpointId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vpcId