{-# 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.ElasticSearch.Types.VPCOptions
-- 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.ElasticSearch.Types.VPCOptions where

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

-- | Options to specify the subnets and security groups for VPC endpoint. For
-- more information, see
-- <http://docs.aws.amazon.com/elasticsearch-service/latest/developerguide/es-vpc.html VPC Endpoints for Amazon Elasticsearch Service Domains>.
--
-- /See:/ 'newVPCOptions' smart constructor.
data VPCOptions = VPCOptions'
  { -- | Specifies the security groups for VPC endpoint.
    VPCOptions -> Maybe [Text]
securityGroupIds :: Prelude.Maybe [Prelude.Text],
    -- | Specifies the subnets for VPC endpoint.
    VPCOptions -> Maybe [Text]
subnetIds :: Prelude.Maybe [Prelude.Text]
  }
  deriving (VPCOptions -> VPCOptions -> Bool
(VPCOptions -> VPCOptions -> Bool)
-> (VPCOptions -> VPCOptions -> Bool) -> Eq VPCOptions
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VPCOptions -> VPCOptions -> Bool
$c/= :: VPCOptions -> VPCOptions -> Bool
== :: VPCOptions -> VPCOptions -> Bool
$c== :: VPCOptions -> VPCOptions -> Bool
Prelude.Eq, ReadPrec [VPCOptions]
ReadPrec VPCOptions
Int -> ReadS VPCOptions
ReadS [VPCOptions]
(Int -> ReadS VPCOptions)
-> ReadS [VPCOptions]
-> ReadPrec VPCOptions
-> ReadPrec [VPCOptions]
-> Read VPCOptions
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VPCOptions]
$creadListPrec :: ReadPrec [VPCOptions]
readPrec :: ReadPrec VPCOptions
$creadPrec :: ReadPrec VPCOptions
readList :: ReadS [VPCOptions]
$creadList :: ReadS [VPCOptions]
readsPrec :: Int -> ReadS VPCOptions
$creadsPrec :: Int -> ReadS VPCOptions
Prelude.Read, Int -> VPCOptions -> ShowS
[VPCOptions] -> ShowS
VPCOptions -> String
(Int -> VPCOptions -> ShowS)
-> (VPCOptions -> String)
-> ([VPCOptions] -> ShowS)
-> Show VPCOptions
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VPCOptions] -> ShowS
$cshowList :: [VPCOptions] -> ShowS
show :: VPCOptions -> String
$cshow :: VPCOptions -> String
showsPrec :: Int -> VPCOptions -> ShowS
$cshowsPrec :: Int -> VPCOptions -> ShowS
Prelude.Show, (forall x. VPCOptions -> Rep VPCOptions x)
-> (forall x. Rep VPCOptions x -> VPCOptions) -> Generic VPCOptions
forall x. Rep VPCOptions x -> VPCOptions
forall x. VPCOptions -> Rep VPCOptions x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VPCOptions x -> VPCOptions
$cfrom :: forall x. VPCOptions -> Rep VPCOptions x
Prelude.Generic)

-- |
-- Create a value of 'VPCOptions' 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:
--
-- 'securityGroupIds', 'vPCOptions_securityGroupIds' - Specifies the security groups for VPC endpoint.
--
-- 'subnetIds', 'vPCOptions_subnetIds' - Specifies the subnets for VPC endpoint.
newVPCOptions ::
  VPCOptions
newVPCOptions :: VPCOptions
newVPCOptions =
  VPCOptions' :: Maybe [Text] -> Maybe [Text] -> VPCOptions
VPCOptions'
    { $sel:securityGroupIds:VPCOptions' :: Maybe [Text]
securityGroupIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:VPCOptions' :: Maybe [Text]
subnetIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | Specifies the security groups for VPC endpoint.
vPCOptions_securityGroupIds :: Lens.Lens' VPCOptions (Prelude.Maybe [Prelude.Text])
vPCOptions_securityGroupIds :: (Maybe [Text] -> f (Maybe [Text])) -> VPCOptions -> f VPCOptions
vPCOptions_securityGroupIds = (VPCOptions -> Maybe [Text])
-> (VPCOptions -> Maybe [Text] -> VPCOptions)
-> Lens VPCOptions VPCOptions (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VPCOptions' {Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:securityGroupIds:VPCOptions' :: VPCOptions -> Maybe [Text]
securityGroupIds} -> Maybe [Text]
securityGroupIds) (\s :: VPCOptions
s@VPCOptions' {} Maybe [Text]
a -> VPCOptions
s {$sel:securityGroupIds:VPCOptions' :: Maybe [Text]
securityGroupIds = Maybe [Text]
a} :: VPCOptions) ((Maybe [Text] -> f (Maybe [Text])) -> VPCOptions -> f VPCOptions)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> VPCOptions
-> f VPCOptions
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

-- | Specifies the subnets for VPC endpoint.
vPCOptions_subnetIds :: Lens.Lens' VPCOptions (Prelude.Maybe [Prelude.Text])
vPCOptions_subnetIds :: (Maybe [Text] -> f (Maybe [Text])) -> VPCOptions -> f VPCOptions
vPCOptions_subnetIds = (VPCOptions -> Maybe [Text])
-> (VPCOptions -> Maybe [Text] -> VPCOptions)
-> Lens VPCOptions VPCOptions (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VPCOptions' {Maybe [Text]
subnetIds :: Maybe [Text]
$sel:subnetIds:VPCOptions' :: VPCOptions -> Maybe [Text]
subnetIds} -> Maybe [Text]
subnetIds) (\s :: VPCOptions
s@VPCOptions' {} Maybe [Text]
a -> VPCOptions
s {$sel:subnetIds:VPCOptions' :: Maybe [Text]
subnetIds = Maybe [Text]
a} :: VPCOptions) ((Maybe [Text] -> f (Maybe [Text])) -> VPCOptions -> f VPCOptions)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> VPCOptions
-> f VPCOptions
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

instance Prelude.Hashable VPCOptions

instance Prelude.NFData VPCOptions

instance Core.ToJSON VPCOptions where
  toJSON :: VPCOptions -> Value
toJSON VPCOptions' {Maybe [Text]
subnetIds :: Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:subnetIds:VPCOptions' :: VPCOptions -> Maybe [Text]
$sel:securityGroupIds:VPCOptions' :: VPCOptions -> Maybe [Text]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SecurityGroupIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
securityGroupIds,
            (Text
"SubnetIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
subnetIds
          ]
      )