{-# 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.VPCDerivedInfo
-- 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.VPCDerivedInfo 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:/ 'newVPCDerivedInfo' smart constructor.
data VPCDerivedInfo = VPCDerivedInfo'
  { -- | Specifies the security groups for VPC endpoint.
    VPCDerivedInfo -> Maybe [Text]
securityGroupIds :: Prelude.Maybe [Prelude.Text],
    -- | Specifies the subnets for VPC endpoint.
    VPCDerivedInfo -> Maybe [Text]
subnetIds :: Prelude.Maybe [Prelude.Text],
    -- | The VPC Id for the Elasticsearch domain. Exists only if the domain was
    -- created with VPCOptions.
    VPCDerivedInfo -> Maybe Text
vPCId :: Prelude.Maybe Prelude.Text,
    -- | The availability zones for the Elasticsearch domain. Exists only if the
    -- domain was created with VPCOptions.
    VPCDerivedInfo -> Maybe [Text]
availabilityZones :: Prelude.Maybe [Prelude.Text]
  }
  deriving (VPCDerivedInfo -> VPCDerivedInfo -> Bool
(VPCDerivedInfo -> VPCDerivedInfo -> Bool)
-> (VPCDerivedInfo -> VPCDerivedInfo -> Bool) -> Eq VPCDerivedInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VPCDerivedInfo -> VPCDerivedInfo -> Bool
$c/= :: VPCDerivedInfo -> VPCDerivedInfo -> Bool
== :: VPCDerivedInfo -> VPCDerivedInfo -> Bool
$c== :: VPCDerivedInfo -> VPCDerivedInfo -> Bool
Prelude.Eq, ReadPrec [VPCDerivedInfo]
ReadPrec VPCDerivedInfo
Int -> ReadS VPCDerivedInfo
ReadS [VPCDerivedInfo]
(Int -> ReadS VPCDerivedInfo)
-> ReadS [VPCDerivedInfo]
-> ReadPrec VPCDerivedInfo
-> ReadPrec [VPCDerivedInfo]
-> Read VPCDerivedInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VPCDerivedInfo]
$creadListPrec :: ReadPrec [VPCDerivedInfo]
readPrec :: ReadPrec VPCDerivedInfo
$creadPrec :: ReadPrec VPCDerivedInfo
readList :: ReadS [VPCDerivedInfo]
$creadList :: ReadS [VPCDerivedInfo]
readsPrec :: Int -> ReadS VPCDerivedInfo
$creadsPrec :: Int -> ReadS VPCDerivedInfo
Prelude.Read, Int -> VPCDerivedInfo -> ShowS
[VPCDerivedInfo] -> ShowS
VPCDerivedInfo -> String
(Int -> VPCDerivedInfo -> ShowS)
-> (VPCDerivedInfo -> String)
-> ([VPCDerivedInfo] -> ShowS)
-> Show VPCDerivedInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VPCDerivedInfo] -> ShowS
$cshowList :: [VPCDerivedInfo] -> ShowS
show :: VPCDerivedInfo -> String
$cshow :: VPCDerivedInfo -> String
showsPrec :: Int -> VPCDerivedInfo -> ShowS
$cshowsPrec :: Int -> VPCDerivedInfo -> ShowS
Prelude.Show, (forall x. VPCDerivedInfo -> Rep VPCDerivedInfo x)
-> (forall x. Rep VPCDerivedInfo x -> VPCDerivedInfo)
-> Generic VPCDerivedInfo
forall x. Rep VPCDerivedInfo x -> VPCDerivedInfo
forall x. VPCDerivedInfo -> Rep VPCDerivedInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VPCDerivedInfo x -> VPCDerivedInfo
$cfrom :: forall x. VPCDerivedInfo -> Rep VPCDerivedInfo x
Prelude.Generic)

-- |
-- Create a value of 'VPCDerivedInfo' 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', 'vPCDerivedInfo_securityGroupIds' - Specifies the security groups for VPC endpoint.
--
-- 'subnetIds', 'vPCDerivedInfo_subnetIds' - Specifies the subnets for VPC endpoint.
--
-- 'vPCId', 'vPCDerivedInfo_vPCId' - The VPC Id for the Elasticsearch domain. Exists only if the domain was
-- created with VPCOptions.
--
-- 'availabilityZones', 'vPCDerivedInfo_availabilityZones' - The availability zones for the Elasticsearch domain. Exists only if the
-- domain was created with VPCOptions.
newVPCDerivedInfo ::
  VPCDerivedInfo
newVPCDerivedInfo :: VPCDerivedInfo
newVPCDerivedInfo =
  VPCDerivedInfo' :: Maybe [Text]
-> Maybe [Text] -> Maybe Text -> Maybe [Text] -> VPCDerivedInfo
VPCDerivedInfo'
    { $sel:securityGroupIds:VPCDerivedInfo' :: Maybe [Text]
securityGroupIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:VPCDerivedInfo' :: Maybe [Text]
subnetIds = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
      $sel:vPCId:VPCDerivedInfo' :: Maybe Text
vPCId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:availabilityZones:VPCDerivedInfo' :: Maybe [Text]
availabilityZones = Maybe [Text]
forall a. Maybe a
Prelude.Nothing
    }

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

-- | The VPC Id for the Elasticsearch domain. Exists only if the domain was
-- created with VPCOptions.
vPCDerivedInfo_vPCId :: Lens.Lens' VPCDerivedInfo (Prelude.Maybe Prelude.Text)
vPCDerivedInfo_vPCId :: (Maybe Text -> f (Maybe Text))
-> VPCDerivedInfo -> f VPCDerivedInfo
vPCDerivedInfo_vPCId = (VPCDerivedInfo -> Maybe Text)
-> (VPCDerivedInfo -> Maybe Text -> VPCDerivedInfo)
-> Lens VPCDerivedInfo VPCDerivedInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VPCDerivedInfo' {Maybe Text
vPCId :: Maybe Text
$sel:vPCId:VPCDerivedInfo' :: VPCDerivedInfo -> Maybe Text
vPCId} -> Maybe Text
vPCId) (\s :: VPCDerivedInfo
s@VPCDerivedInfo' {} Maybe Text
a -> VPCDerivedInfo
s {$sel:vPCId:VPCDerivedInfo' :: Maybe Text
vPCId = Maybe Text
a} :: VPCDerivedInfo)

-- | The availability zones for the Elasticsearch domain. Exists only if the
-- domain was created with VPCOptions.
vPCDerivedInfo_availabilityZones :: Lens.Lens' VPCDerivedInfo (Prelude.Maybe [Prelude.Text])
vPCDerivedInfo_availabilityZones :: (Maybe [Text] -> f (Maybe [Text]))
-> VPCDerivedInfo -> f VPCDerivedInfo
vPCDerivedInfo_availabilityZones = (VPCDerivedInfo -> Maybe [Text])
-> (VPCDerivedInfo -> Maybe [Text] -> VPCDerivedInfo)
-> Lens VPCDerivedInfo VPCDerivedInfo (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VPCDerivedInfo' {Maybe [Text]
availabilityZones :: Maybe [Text]
$sel:availabilityZones:VPCDerivedInfo' :: VPCDerivedInfo -> Maybe [Text]
availabilityZones} -> Maybe [Text]
availabilityZones) (\s :: VPCDerivedInfo
s@VPCDerivedInfo' {} Maybe [Text]
a -> VPCDerivedInfo
s {$sel:availabilityZones:VPCDerivedInfo' :: Maybe [Text]
availabilityZones = Maybe [Text]
a} :: VPCDerivedInfo) ((Maybe [Text] -> f (Maybe [Text]))
 -> VPCDerivedInfo -> f VPCDerivedInfo)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> VPCDerivedInfo
-> f VPCDerivedInfo
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 VPCDerivedInfo where
  parseJSON :: Value -> Parser VPCDerivedInfo
parseJSON =
    String
-> (Object -> Parser VPCDerivedInfo)
-> Value
-> Parser VPCDerivedInfo
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"VPCDerivedInfo"
      ( \Object
x ->
          Maybe [Text]
-> Maybe [Text] -> Maybe Text -> Maybe [Text] -> VPCDerivedInfo
VPCDerivedInfo'
            (Maybe [Text]
 -> Maybe [Text] -> Maybe Text -> Maybe [Text] -> VPCDerivedInfo)
-> Parser (Maybe [Text])
-> Parser
     (Maybe [Text] -> Maybe Text -> Maybe [Text] -> VPCDerivedInfo)
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] -> Maybe Text -> Maybe [Text] -> VPCDerivedInfo)
-> Parser (Maybe [Text])
-> Parser (Maybe Text -> Maybe [Text] -> VPCDerivedInfo)
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)
            Parser (Maybe Text -> Maybe [Text] -> VPCDerivedInfo)
-> Parser (Maybe Text) -> Parser (Maybe [Text] -> VPCDerivedInfo)
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
"VPCId")
            Parser (Maybe [Text] -> VPCDerivedInfo)
-> Parser (Maybe [Text]) -> Parser VPCDerivedInfo
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
"AvailabilityZones"
                            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 VPCDerivedInfo

instance Prelude.NFData VPCDerivedInfo