{-# 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.SecurityHub.Types.AwsOpenSearchServiceDomainVpcOptionsDetails
-- 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.SecurityHub.Types.AwsOpenSearchServiceDomainVpcOptionsDetails where

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

-- | Contains information that OpenSearch Service derives based on the
-- @VPCOptions@ for the domain.
--
-- /See:/ 'newAwsOpenSearchServiceDomainVpcOptionsDetails' smart constructor.
data AwsOpenSearchServiceDomainVpcOptionsDetails = AwsOpenSearchServiceDomainVpcOptionsDetails'
  { -- | The list of security group IDs that are associated with the VPC
    -- endpoints for the domain.
    AwsOpenSearchServiceDomainVpcOptionsDetails -> Maybe [Text]
securityGroupIds :: Prelude.Maybe [Prelude.Text],
    -- | A list of subnet IDs that are associated with the VPC endpoints for the
    -- domain.
    AwsOpenSearchServiceDomainVpcOptionsDetails -> Maybe [Text]
subnetIds :: Prelude.Maybe [Prelude.Text]
  }
  deriving (AwsOpenSearchServiceDomainVpcOptionsDetails
-> AwsOpenSearchServiceDomainVpcOptionsDetails -> Bool
(AwsOpenSearchServiceDomainVpcOptionsDetails
 -> AwsOpenSearchServiceDomainVpcOptionsDetails -> Bool)
-> (AwsOpenSearchServiceDomainVpcOptionsDetails
    -> AwsOpenSearchServiceDomainVpcOptionsDetails -> Bool)
-> Eq AwsOpenSearchServiceDomainVpcOptionsDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AwsOpenSearchServiceDomainVpcOptionsDetails
-> AwsOpenSearchServiceDomainVpcOptionsDetails -> Bool
$c/= :: AwsOpenSearchServiceDomainVpcOptionsDetails
-> AwsOpenSearchServiceDomainVpcOptionsDetails -> Bool
== :: AwsOpenSearchServiceDomainVpcOptionsDetails
-> AwsOpenSearchServiceDomainVpcOptionsDetails -> Bool
$c== :: AwsOpenSearchServiceDomainVpcOptionsDetails
-> AwsOpenSearchServiceDomainVpcOptionsDetails -> Bool
Prelude.Eq, ReadPrec [AwsOpenSearchServiceDomainVpcOptionsDetails]
ReadPrec AwsOpenSearchServiceDomainVpcOptionsDetails
Int -> ReadS AwsOpenSearchServiceDomainVpcOptionsDetails
ReadS [AwsOpenSearchServiceDomainVpcOptionsDetails]
(Int -> ReadS AwsOpenSearchServiceDomainVpcOptionsDetails)
-> ReadS [AwsOpenSearchServiceDomainVpcOptionsDetails]
-> ReadPrec AwsOpenSearchServiceDomainVpcOptionsDetails
-> ReadPrec [AwsOpenSearchServiceDomainVpcOptionsDetails]
-> Read AwsOpenSearchServiceDomainVpcOptionsDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AwsOpenSearchServiceDomainVpcOptionsDetails]
$creadListPrec :: ReadPrec [AwsOpenSearchServiceDomainVpcOptionsDetails]
readPrec :: ReadPrec AwsOpenSearchServiceDomainVpcOptionsDetails
$creadPrec :: ReadPrec AwsOpenSearchServiceDomainVpcOptionsDetails
readList :: ReadS [AwsOpenSearchServiceDomainVpcOptionsDetails]
$creadList :: ReadS [AwsOpenSearchServiceDomainVpcOptionsDetails]
readsPrec :: Int -> ReadS AwsOpenSearchServiceDomainVpcOptionsDetails
$creadsPrec :: Int -> ReadS AwsOpenSearchServiceDomainVpcOptionsDetails
Prelude.Read, Int -> AwsOpenSearchServiceDomainVpcOptionsDetails -> ShowS
[AwsOpenSearchServiceDomainVpcOptionsDetails] -> ShowS
AwsOpenSearchServiceDomainVpcOptionsDetails -> String
(Int -> AwsOpenSearchServiceDomainVpcOptionsDetails -> ShowS)
-> (AwsOpenSearchServiceDomainVpcOptionsDetails -> String)
-> ([AwsOpenSearchServiceDomainVpcOptionsDetails] -> ShowS)
-> Show AwsOpenSearchServiceDomainVpcOptionsDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AwsOpenSearchServiceDomainVpcOptionsDetails] -> ShowS
$cshowList :: [AwsOpenSearchServiceDomainVpcOptionsDetails] -> ShowS
show :: AwsOpenSearchServiceDomainVpcOptionsDetails -> String
$cshow :: AwsOpenSearchServiceDomainVpcOptionsDetails -> String
showsPrec :: Int -> AwsOpenSearchServiceDomainVpcOptionsDetails -> ShowS
$cshowsPrec :: Int -> AwsOpenSearchServiceDomainVpcOptionsDetails -> ShowS
Prelude.Show, (forall x.
 AwsOpenSearchServiceDomainVpcOptionsDetails
 -> Rep AwsOpenSearchServiceDomainVpcOptionsDetails x)
-> (forall x.
    Rep AwsOpenSearchServiceDomainVpcOptionsDetails x
    -> AwsOpenSearchServiceDomainVpcOptionsDetails)
-> Generic AwsOpenSearchServiceDomainVpcOptionsDetails
forall x.
Rep AwsOpenSearchServiceDomainVpcOptionsDetails x
-> AwsOpenSearchServiceDomainVpcOptionsDetails
forall x.
AwsOpenSearchServiceDomainVpcOptionsDetails
-> Rep AwsOpenSearchServiceDomainVpcOptionsDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AwsOpenSearchServiceDomainVpcOptionsDetails x
-> AwsOpenSearchServiceDomainVpcOptionsDetails
$cfrom :: forall x.
AwsOpenSearchServiceDomainVpcOptionsDetails
-> Rep AwsOpenSearchServiceDomainVpcOptionsDetails x
Prelude.Generic)

-- |
-- Create a value of 'AwsOpenSearchServiceDomainVpcOptionsDetails' 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', 'awsOpenSearchServiceDomainVpcOptionsDetails_securityGroupIds' - The list of security group IDs that are associated with the VPC
-- endpoints for the domain.
--
-- 'subnetIds', 'awsOpenSearchServiceDomainVpcOptionsDetails_subnetIds' - A list of subnet IDs that are associated with the VPC endpoints for the
-- domain.
newAwsOpenSearchServiceDomainVpcOptionsDetails ::
  AwsOpenSearchServiceDomainVpcOptionsDetails
newAwsOpenSearchServiceDomainVpcOptionsDetails :: AwsOpenSearchServiceDomainVpcOptionsDetails
newAwsOpenSearchServiceDomainVpcOptionsDetails =
  AwsOpenSearchServiceDomainVpcOptionsDetails' :: Maybe [Text]
-> Maybe [Text] -> AwsOpenSearchServiceDomainVpcOptionsDetails
AwsOpenSearchServiceDomainVpcOptionsDetails'
    { $sel:securityGroupIds:AwsOpenSearchServiceDomainVpcOptionsDetails' :: Maybe [Text]
securityGroupIds =
        Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:AwsOpenSearchServiceDomainVpcOptionsDetails' :: Maybe [Text]
subnetIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

-- | The list of security group IDs that are associated with the VPC
-- endpoints for the domain.
awsOpenSearchServiceDomainVpcOptionsDetails_securityGroupIds :: Lens.Lens' AwsOpenSearchServiceDomainVpcOptionsDetails (Prelude.Maybe [Prelude.Text])
awsOpenSearchServiceDomainVpcOptionsDetails_securityGroupIds :: (Maybe [Text] -> f (Maybe [Text]))
-> AwsOpenSearchServiceDomainVpcOptionsDetails
-> f AwsOpenSearchServiceDomainVpcOptionsDetails
awsOpenSearchServiceDomainVpcOptionsDetails_securityGroupIds = (AwsOpenSearchServiceDomainVpcOptionsDetails -> Maybe [Text])
-> (AwsOpenSearchServiceDomainVpcOptionsDetails
    -> Maybe [Text] -> AwsOpenSearchServiceDomainVpcOptionsDetails)
-> Lens
     AwsOpenSearchServiceDomainVpcOptionsDetails
     AwsOpenSearchServiceDomainVpcOptionsDetails
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsOpenSearchServiceDomainVpcOptionsDetails' {Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:securityGroupIds:AwsOpenSearchServiceDomainVpcOptionsDetails' :: AwsOpenSearchServiceDomainVpcOptionsDetails -> Maybe [Text]
securityGroupIds} -> Maybe [Text]
securityGroupIds) (\s :: AwsOpenSearchServiceDomainVpcOptionsDetails
s@AwsOpenSearchServiceDomainVpcOptionsDetails' {} Maybe [Text]
a -> AwsOpenSearchServiceDomainVpcOptionsDetails
s {$sel:securityGroupIds:AwsOpenSearchServiceDomainVpcOptionsDetails' :: Maybe [Text]
securityGroupIds = Maybe [Text]
a} :: AwsOpenSearchServiceDomainVpcOptionsDetails) ((Maybe [Text] -> f (Maybe [Text]))
 -> AwsOpenSearchServiceDomainVpcOptionsDetails
 -> f AwsOpenSearchServiceDomainVpcOptionsDetails)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> AwsOpenSearchServiceDomainVpcOptionsDetails
-> f AwsOpenSearchServiceDomainVpcOptionsDetails
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

-- | A list of subnet IDs that are associated with the VPC endpoints for the
-- domain.
awsOpenSearchServiceDomainVpcOptionsDetails_subnetIds :: Lens.Lens' AwsOpenSearchServiceDomainVpcOptionsDetails (Prelude.Maybe [Prelude.Text])
awsOpenSearchServiceDomainVpcOptionsDetails_subnetIds :: (Maybe [Text] -> f (Maybe [Text]))
-> AwsOpenSearchServiceDomainVpcOptionsDetails
-> f AwsOpenSearchServiceDomainVpcOptionsDetails
awsOpenSearchServiceDomainVpcOptionsDetails_subnetIds = (AwsOpenSearchServiceDomainVpcOptionsDetails -> Maybe [Text])
-> (AwsOpenSearchServiceDomainVpcOptionsDetails
    -> Maybe [Text] -> AwsOpenSearchServiceDomainVpcOptionsDetails)
-> Lens
     AwsOpenSearchServiceDomainVpcOptionsDetails
     AwsOpenSearchServiceDomainVpcOptionsDetails
     (Maybe [Text])
     (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AwsOpenSearchServiceDomainVpcOptionsDetails' {Maybe [Text]
subnetIds :: Maybe [Text]
$sel:subnetIds:AwsOpenSearchServiceDomainVpcOptionsDetails' :: AwsOpenSearchServiceDomainVpcOptionsDetails -> Maybe [Text]
subnetIds} -> Maybe [Text]
subnetIds) (\s :: AwsOpenSearchServiceDomainVpcOptionsDetails
s@AwsOpenSearchServiceDomainVpcOptionsDetails' {} Maybe [Text]
a -> AwsOpenSearchServiceDomainVpcOptionsDetails
s {$sel:subnetIds:AwsOpenSearchServiceDomainVpcOptionsDetails' :: Maybe [Text]
subnetIds = Maybe [Text]
a} :: AwsOpenSearchServiceDomainVpcOptionsDetails) ((Maybe [Text] -> f (Maybe [Text]))
 -> AwsOpenSearchServiceDomainVpcOptionsDetails
 -> f AwsOpenSearchServiceDomainVpcOptionsDetails)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> AwsOpenSearchServiceDomainVpcOptionsDetails
-> f AwsOpenSearchServiceDomainVpcOptionsDetails
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
  Core.FromJSON
    AwsOpenSearchServiceDomainVpcOptionsDetails
  where
  parseJSON :: Value -> Parser AwsOpenSearchServiceDomainVpcOptionsDetails
parseJSON =
    String
-> (Object -> Parser AwsOpenSearchServiceDomainVpcOptionsDetails)
-> Value
-> Parser AwsOpenSearchServiceDomainVpcOptionsDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AwsOpenSearchServiceDomainVpcOptionsDetails"
      ( \Object
x ->
          Maybe [Text]
-> Maybe [Text] -> AwsOpenSearchServiceDomainVpcOptionsDetails
AwsOpenSearchServiceDomainVpcOptionsDetails'
            (Maybe [Text]
 -> Maybe [Text] -> AwsOpenSearchServiceDomainVpcOptionsDetails)
-> Parser (Maybe [Text])
-> Parser
     (Maybe [Text] -> AwsOpenSearchServiceDomainVpcOptionsDetails)
forall (f :: * -> *) a b. Functor 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
"SecurityGroupIds"
                            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] -> AwsOpenSearchServiceDomainVpcOptionsDetails)
-> Parser (Maybe [Text])
-> Parser AwsOpenSearchServiceDomainVpcOptionsDetails
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
"SubnetIds" 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)
      )

instance
  Prelude.Hashable
    AwsOpenSearchServiceDomainVpcOptionsDetails

instance
  Prelude.NFData
    AwsOpenSearchServiceDomainVpcOptionsDetails

instance
  Core.ToJSON
    AwsOpenSearchServiceDomainVpcOptionsDetails
  where
  toJSON :: AwsOpenSearchServiceDomainVpcOptionsDetails -> Value
toJSON
    AwsOpenSearchServiceDomainVpcOptionsDetails' {Maybe [Text]
subnetIds :: Maybe [Text]
securityGroupIds :: Maybe [Text]
$sel:subnetIds:AwsOpenSearchServiceDomainVpcOptionsDetails' :: AwsOpenSearchServiceDomainVpcOptionsDetails -> Maybe [Text]
$sel:securityGroupIds:AwsOpenSearchServiceDomainVpcOptionsDetails' :: AwsOpenSearchServiceDomainVpcOptionsDetails -> 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
            ]
        )