{-# 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.OpenSearch.Types.VPCDerivedInfo
-- 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.OpenSearch.Types.VPCDerivedInfo 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

-- | Information about the subnets and security groups for an Amazon
-- OpenSearch Service domain provisioned within a virtual private cloud
-- (VPC). For more information, see
-- <https://docs.aws.amazon.com/opensearch-service/latest/developerguide/vpc.html Launching your Amazon OpenSearch Service domains using a VPC>.
-- This information only exists if the domain was created with
-- @VPCOptions@.
--
-- /See:/ 'newVPCDerivedInfo' smart constructor.
data VPCDerivedInfo = VPCDerivedInfo'
  { -- | The list of Availability Zones associated with the VPC subnets.
    VPCDerivedInfo -> Maybe [Text]
availabilityZones :: Prelude.Maybe [Prelude.Text],
    -- | The list of security group IDs associated with the VPC endpoints for the
    -- domain.
    VPCDerivedInfo -> Maybe [Text]
securityGroupIds :: Prelude.Maybe [Prelude.Text],
    -- | A list of subnet IDs associated with the VPC endpoints for the domain.
    VPCDerivedInfo -> Maybe [Text]
subnetIds :: Prelude.Maybe [Prelude.Text],
    -- | The ID for your VPC. Amazon VPC generates this value when you create a
    -- VPC.
    VPCDerivedInfo -> Maybe Text
vPCId :: Prelude.Maybe Prelude.Text
  }
  deriving (VPCDerivedInfo -> VPCDerivedInfo -> Bool
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]
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
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. 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:
--
-- 'availabilityZones', 'vPCDerivedInfo_availabilityZones' - The list of Availability Zones associated with the VPC subnets.
--
-- 'securityGroupIds', 'vPCDerivedInfo_securityGroupIds' - The list of security group IDs associated with the VPC endpoints for the
-- domain.
--
-- 'subnetIds', 'vPCDerivedInfo_subnetIds' - A list of subnet IDs associated with the VPC endpoints for the domain.
--
-- 'vPCId', 'vPCDerivedInfo_vPCId' - The ID for your VPC. Amazon VPC generates this value when you create a
-- VPC.
newVPCDerivedInfo ::
  VPCDerivedInfo
newVPCDerivedInfo :: VPCDerivedInfo
newVPCDerivedInfo =
  VPCDerivedInfo'
    { $sel:availabilityZones:VPCDerivedInfo' :: Maybe [Text]
availabilityZones =
        forall a. Maybe a
Prelude.Nothing,
      $sel:securityGroupIds:VPCDerivedInfo' :: Maybe [Text]
securityGroupIds = forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:VPCDerivedInfo' :: Maybe [Text]
subnetIds = forall a. Maybe a
Prelude.Nothing,
      $sel:vPCId:VPCDerivedInfo' :: Maybe Text
vPCId = forall a. Maybe a
Prelude.Nothing
    }

-- | The list of Availability Zones associated with the VPC subnets.
vPCDerivedInfo_availabilityZones :: Lens.Lens' VPCDerivedInfo (Prelude.Maybe [Prelude.Text])
vPCDerivedInfo_availabilityZones :: Lens' VPCDerivedInfo (Maybe [Text])
vPCDerivedInfo_availabilityZones = 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) 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 list of security group IDs associated with the VPC endpoints for the
-- domain.
vPCDerivedInfo_securityGroupIds :: Lens.Lens' VPCDerivedInfo (Prelude.Maybe [Prelude.Text])
vPCDerivedInfo_securityGroupIds :: Lens' VPCDerivedInfo (Maybe [Text])
vPCDerivedInfo_securityGroupIds = 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) 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

-- | A list of subnet IDs associated with the VPC endpoints for the domain.
vPCDerivedInfo_subnetIds :: Lens.Lens' VPCDerivedInfo (Prelude.Maybe [Prelude.Text])
vPCDerivedInfo_subnetIds :: Lens' VPCDerivedInfo (Maybe [Text])
vPCDerivedInfo_subnetIds = 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) 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 ID for your VPC. Amazon VPC generates this value when you create a
-- VPC.
vPCDerivedInfo_vPCId :: Lens.Lens' VPCDerivedInfo (Prelude.Maybe Prelude.Text)
vPCDerivedInfo_vPCId :: Lens' VPCDerivedInfo (Maybe Text)
vPCDerivedInfo_vPCId = 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)

instance Data.FromJSON VPCDerivedInfo where
  parseJSON :: Value -> Parser VPCDerivedInfo
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VPCDerivedInfo"
      ( \Object
x ->
          Maybe [Text]
-> Maybe [Text] -> Maybe [Text] -> Maybe Text -> VPCDerivedInfo
VPCDerivedInfo'
            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
"AvailabilityZones"
                            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
"SecurityGroupIds"
                            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
"SubnetIds" 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
"VPCId")
      )

instance Prelude.Hashable VPCDerivedInfo where
  hashWithSalt :: Int -> VPCDerivedInfo -> Int
hashWithSalt Int
_salt VPCDerivedInfo' {Maybe [Text]
Maybe Text
vPCId :: Maybe Text
subnetIds :: Maybe [Text]
securityGroupIds :: Maybe [Text]
availabilityZones :: Maybe [Text]
$sel:vPCId:VPCDerivedInfo' :: VPCDerivedInfo -> Maybe Text
$sel:subnetIds:VPCDerivedInfo' :: VPCDerivedInfo -> Maybe [Text]
$sel:securityGroupIds:VPCDerivedInfo' :: VPCDerivedInfo -> Maybe [Text]
$sel:availabilityZones:VPCDerivedInfo' :: VPCDerivedInfo -> Maybe [Text]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
availabilityZones
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
securityGroupIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
subnetIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vPCId

instance Prelude.NFData VPCDerivedInfo where
  rnf :: VPCDerivedInfo -> ()
rnf VPCDerivedInfo' {Maybe [Text]
Maybe Text
vPCId :: Maybe Text
subnetIds :: Maybe [Text]
securityGroupIds :: Maybe [Text]
availabilityZones :: Maybe [Text]
$sel:vPCId:VPCDerivedInfo' :: VPCDerivedInfo -> Maybe Text
$sel:subnetIds:VPCDerivedInfo' :: VPCDerivedInfo -> Maybe [Text]
$sel:securityGroupIds:VPCDerivedInfo' :: VPCDerivedInfo -> Maybe [Text]
$sel:availabilityZones:VPCDerivedInfo' :: VPCDerivedInfo -> Maybe [Text]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
availabilityZones
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
securityGroupIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
subnetIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vPCId