{-# 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.DataSync.Types.PrivateLinkConfig
-- 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.DataSync.Types.PrivateLinkConfig where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The VPC endpoint, subnet, and security group that an agent uses to
-- access IP addresses in a VPC (Virtual Private Cloud).
--
-- /See:/ 'newPrivateLinkConfig' smart constructor.
data PrivateLinkConfig = PrivateLinkConfig'
  { -- | The Amazon Resource Names (ARNs) of the security groups that are
    -- configured for the EC2 resource that hosts an agent activated in a VPC
    -- or an agent that has access to a VPC endpoint.
    PrivateLinkConfig -> Maybe (NonEmpty Text)
securityGroupArns :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The Amazon Resource Names (ARNs) of the subnets that are configured for
    -- an agent activated in a VPC or an agent that has access to a VPC
    -- endpoint.
    PrivateLinkConfig -> Maybe (NonEmpty Text)
subnetArns :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The private endpoint that is configured for an agent that has access to
    -- IP addresses in a
    -- <https://docs.aws.amazon.com/vpc/latest/userguide/endpoint-service.html PrivateLink>.
    -- An agent that is configured with this endpoint will not be accessible
    -- over the public internet.
    PrivateLinkConfig -> Maybe Text
privateLinkEndpoint :: Prelude.Maybe Prelude.Text,
    -- | The ID of the VPC endpoint that is configured for an agent. An agent
    -- that is configured with a VPC endpoint will not be accessible over the
    -- public internet.
    PrivateLinkConfig -> Maybe Text
vpcEndpointId :: Prelude.Maybe Prelude.Text
  }
  deriving (PrivateLinkConfig -> PrivateLinkConfig -> Bool
(PrivateLinkConfig -> PrivateLinkConfig -> Bool)
-> (PrivateLinkConfig -> PrivateLinkConfig -> Bool)
-> Eq PrivateLinkConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: PrivateLinkConfig -> PrivateLinkConfig -> Bool
$c/= :: PrivateLinkConfig -> PrivateLinkConfig -> Bool
== :: PrivateLinkConfig -> PrivateLinkConfig -> Bool
$c== :: PrivateLinkConfig -> PrivateLinkConfig -> Bool
Prelude.Eq, ReadPrec [PrivateLinkConfig]
ReadPrec PrivateLinkConfig
Int -> ReadS PrivateLinkConfig
ReadS [PrivateLinkConfig]
(Int -> ReadS PrivateLinkConfig)
-> ReadS [PrivateLinkConfig]
-> ReadPrec PrivateLinkConfig
-> ReadPrec [PrivateLinkConfig]
-> Read PrivateLinkConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [PrivateLinkConfig]
$creadListPrec :: ReadPrec [PrivateLinkConfig]
readPrec :: ReadPrec PrivateLinkConfig
$creadPrec :: ReadPrec PrivateLinkConfig
readList :: ReadS [PrivateLinkConfig]
$creadList :: ReadS [PrivateLinkConfig]
readsPrec :: Int -> ReadS PrivateLinkConfig
$creadsPrec :: Int -> ReadS PrivateLinkConfig
Prelude.Read, Int -> PrivateLinkConfig -> ShowS
[PrivateLinkConfig] -> ShowS
PrivateLinkConfig -> String
(Int -> PrivateLinkConfig -> ShowS)
-> (PrivateLinkConfig -> String)
-> ([PrivateLinkConfig] -> ShowS)
-> Show PrivateLinkConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [PrivateLinkConfig] -> ShowS
$cshowList :: [PrivateLinkConfig] -> ShowS
show :: PrivateLinkConfig -> String
$cshow :: PrivateLinkConfig -> String
showsPrec :: Int -> PrivateLinkConfig -> ShowS
$cshowsPrec :: Int -> PrivateLinkConfig -> ShowS
Prelude.Show, (forall x. PrivateLinkConfig -> Rep PrivateLinkConfig x)
-> (forall x. Rep PrivateLinkConfig x -> PrivateLinkConfig)
-> Generic PrivateLinkConfig
forall x. Rep PrivateLinkConfig x -> PrivateLinkConfig
forall x. PrivateLinkConfig -> Rep PrivateLinkConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep PrivateLinkConfig x -> PrivateLinkConfig
$cfrom :: forall x. PrivateLinkConfig -> Rep PrivateLinkConfig x
Prelude.Generic)

-- |
-- Create a value of 'PrivateLinkConfig' 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:
--
-- 'securityGroupArns', 'privateLinkConfig_securityGroupArns' - The Amazon Resource Names (ARNs) of the security groups that are
-- configured for the EC2 resource that hosts an agent activated in a VPC
-- or an agent that has access to a VPC endpoint.
--
-- 'subnetArns', 'privateLinkConfig_subnetArns' - The Amazon Resource Names (ARNs) of the subnets that are configured for
-- an agent activated in a VPC or an agent that has access to a VPC
-- endpoint.
--
-- 'privateLinkEndpoint', 'privateLinkConfig_privateLinkEndpoint' - The private endpoint that is configured for an agent that has access to
-- IP addresses in a
-- <https://docs.aws.amazon.com/vpc/latest/userguide/endpoint-service.html PrivateLink>.
-- An agent that is configured with this endpoint will not be accessible
-- over the public internet.
--
-- 'vpcEndpointId', 'privateLinkConfig_vpcEndpointId' - The ID of the VPC endpoint that is configured for an agent. An agent
-- that is configured with a VPC endpoint will not be accessible over the
-- public internet.
newPrivateLinkConfig ::
  PrivateLinkConfig
newPrivateLinkConfig :: PrivateLinkConfig
newPrivateLinkConfig =
  PrivateLinkConfig' :: Maybe (NonEmpty Text)
-> Maybe (NonEmpty Text)
-> Maybe Text
-> Maybe Text
-> PrivateLinkConfig
PrivateLinkConfig'
    { $sel:securityGroupArns:PrivateLinkConfig' :: Maybe (NonEmpty Text)
securityGroupArns =
        Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetArns:PrivateLinkConfig' :: Maybe (NonEmpty Text)
subnetArns = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:privateLinkEndpoint:PrivateLinkConfig' :: Maybe Text
privateLinkEndpoint = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:vpcEndpointId:PrivateLinkConfig' :: Maybe Text
vpcEndpointId = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Names (ARNs) of the security groups that are
-- configured for the EC2 resource that hosts an agent activated in a VPC
-- or an agent that has access to a VPC endpoint.
privateLinkConfig_securityGroupArns :: Lens.Lens' PrivateLinkConfig (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
privateLinkConfig_securityGroupArns :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> PrivateLinkConfig -> f PrivateLinkConfig
privateLinkConfig_securityGroupArns = (PrivateLinkConfig -> Maybe (NonEmpty Text))
-> (PrivateLinkConfig
    -> Maybe (NonEmpty Text) -> PrivateLinkConfig)
-> Lens
     PrivateLinkConfig
     PrivateLinkConfig
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrivateLinkConfig' {Maybe (NonEmpty Text)
securityGroupArns :: Maybe (NonEmpty Text)
$sel:securityGroupArns:PrivateLinkConfig' :: PrivateLinkConfig -> Maybe (NonEmpty Text)
securityGroupArns} -> Maybe (NonEmpty Text)
securityGroupArns) (\s :: PrivateLinkConfig
s@PrivateLinkConfig' {} Maybe (NonEmpty Text)
a -> PrivateLinkConfig
s {$sel:securityGroupArns:PrivateLinkConfig' :: Maybe (NonEmpty Text)
securityGroupArns = Maybe (NonEmpty Text)
a} :: PrivateLinkConfig) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> PrivateLinkConfig -> f PrivateLinkConfig)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> PrivateLinkConfig
-> f PrivateLinkConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty 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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Names (ARNs) of the subnets that are configured for
-- an agent activated in a VPC or an agent that has access to a VPC
-- endpoint.
privateLinkConfig_subnetArns :: Lens.Lens' PrivateLinkConfig (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
privateLinkConfig_subnetArns :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> PrivateLinkConfig -> f PrivateLinkConfig
privateLinkConfig_subnetArns = (PrivateLinkConfig -> Maybe (NonEmpty Text))
-> (PrivateLinkConfig
    -> Maybe (NonEmpty Text) -> PrivateLinkConfig)
-> Lens
     PrivateLinkConfig
     PrivateLinkConfig
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrivateLinkConfig' {Maybe (NonEmpty Text)
subnetArns :: Maybe (NonEmpty Text)
$sel:subnetArns:PrivateLinkConfig' :: PrivateLinkConfig -> Maybe (NonEmpty Text)
subnetArns} -> Maybe (NonEmpty Text)
subnetArns) (\s :: PrivateLinkConfig
s@PrivateLinkConfig' {} Maybe (NonEmpty Text)
a -> PrivateLinkConfig
s {$sel:subnetArns:PrivateLinkConfig' :: Maybe (NonEmpty Text)
subnetArns = Maybe (NonEmpty Text)
a} :: PrivateLinkConfig) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> PrivateLinkConfig -> f PrivateLinkConfig)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> PrivateLinkConfig
-> f PrivateLinkConfig
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty 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
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The private endpoint that is configured for an agent that has access to
-- IP addresses in a
-- <https://docs.aws.amazon.com/vpc/latest/userguide/endpoint-service.html PrivateLink>.
-- An agent that is configured with this endpoint will not be accessible
-- over the public internet.
privateLinkConfig_privateLinkEndpoint :: Lens.Lens' PrivateLinkConfig (Prelude.Maybe Prelude.Text)
privateLinkConfig_privateLinkEndpoint :: (Maybe Text -> f (Maybe Text))
-> PrivateLinkConfig -> f PrivateLinkConfig
privateLinkConfig_privateLinkEndpoint = (PrivateLinkConfig -> Maybe Text)
-> (PrivateLinkConfig -> Maybe Text -> PrivateLinkConfig)
-> Lens
     PrivateLinkConfig PrivateLinkConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrivateLinkConfig' {Maybe Text
privateLinkEndpoint :: Maybe Text
$sel:privateLinkEndpoint:PrivateLinkConfig' :: PrivateLinkConfig -> Maybe Text
privateLinkEndpoint} -> Maybe Text
privateLinkEndpoint) (\s :: PrivateLinkConfig
s@PrivateLinkConfig' {} Maybe Text
a -> PrivateLinkConfig
s {$sel:privateLinkEndpoint:PrivateLinkConfig' :: Maybe Text
privateLinkEndpoint = Maybe Text
a} :: PrivateLinkConfig)

-- | The ID of the VPC endpoint that is configured for an agent. An agent
-- that is configured with a VPC endpoint will not be accessible over the
-- public internet.
privateLinkConfig_vpcEndpointId :: Lens.Lens' PrivateLinkConfig (Prelude.Maybe Prelude.Text)
privateLinkConfig_vpcEndpointId :: (Maybe Text -> f (Maybe Text))
-> PrivateLinkConfig -> f PrivateLinkConfig
privateLinkConfig_vpcEndpointId = (PrivateLinkConfig -> Maybe Text)
-> (PrivateLinkConfig -> Maybe Text -> PrivateLinkConfig)
-> Lens
     PrivateLinkConfig PrivateLinkConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\PrivateLinkConfig' {Maybe Text
vpcEndpointId :: Maybe Text
$sel:vpcEndpointId:PrivateLinkConfig' :: PrivateLinkConfig -> Maybe Text
vpcEndpointId} -> Maybe Text
vpcEndpointId) (\s :: PrivateLinkConfig
s@PrivateLinkConfig' {} Maybe Text
a -> PrivateLinkConfig
s {$sel:vpcEndpointId:PrivateLinkConfig' :: Maybe Text
vpcEndpointId = Maybe Text
a} :: PrivateLinkConfig)

instance Core.FromJSON PrivateLinkConfig where
  parseJSON :: Value -> Parser PrivateLinkConfig
parseJSON =
    String
-> (Object -> Parser PrivateLinkConfig)
-> Value
-> Parser PrivateLinkConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"PrivateLinkConfig"
      ( \Object
x ->
          Maybe (NonEmpty Text)
-> Maybe (NonEmpty Text)
-> Maybe Text
-> Maybe Text
-> PrivateLinkConfig
PrivateLinkConfig'
            (Maybe (NonEmpty Text)
 -> Maybe (NonEmpty Text)
 -> Maybe Text
 -> Maybe Text
 -> PrivateLinkConfig)
-> Parser (Maybe (NonEmpty Text))
-> Parser
     (Maybe (NonEmpty Text)
      -> Maybe Text -> Maybe Text -> PrivateLinkConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe (NonEmpty Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SecurityGroupArns")
            Parser
  (Maybe (NonEmpty Text)
   -> Maybe Text -> Maybe Text -> PrivateLinkConfig)
-> Parser (Maybe (NonEmpty Text))
-> Parser (Maybe Text -> Maybe Text -> PrivateLinkConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe (NonEmpty Text))
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"SubnetArns")
            Parser (Maybe Text -> Maybe Text -> PrivateLinkConfig)
-> Parser (Maybe Text) -> Parser (Maybe Text -> PrivateLinkConfig)
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
"PrivateLinkEndpoint")
            Parser (Maybe Text -> PrivateLinkConfig)
-> Parser (Maybe Text) -> Parser PrivateLinkConfig
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
"VpcEndpointId")
      )

instance Prelude.Hashable PrivateLinkConfig

instance Prelude.NFData PrivateLinkConfig