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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.ElasticSearch.Types.VPCDerivedInfo
import Amazonka.ElasticSearch.Types.VpcEndpointStatus
import qualified Amazonka.Prelude as Prelude

-- | The connection endpoint for connecting to an Amazon OpenSearch Service
-- domain through a proxy.
--
-- /See:/ 'newVpcEndpoint' smart constructor.
data VpcEndpoint = VpcEndpoint'
  { -- | The Amazon Resource Name (ARN) of the domain associated with the
    -- endpoint.
    VpcEndpoint -> Maybe Text
domainArn :: Prelude.Maybe Prelude.Text,
    -- | The connection endpoint ID for connecting to the domain.
    VpcEndpoint -> Maybe Text
endpoint :: Prelude.Maybe Prelude.Text,
    -- | The current status of the endpoint.
    VpcEndpoint -> Maybe VpcEndpointStatus
status :: Prelude.Maybe VpcEndpointStatus,
    -- | The unique identifier of the endpoint.
    VpcEndpoint -> Maybe Text
vpcEndpointId :: Prelude.Maybe Prelude.Text,
    -- | The creator of the endpoint.
    VpcEndpoint -> Maybe Text
vpcEndpointOwner :: Prelude.Maybe Prelude.Text,
    -- | Options to specify the subnets and security groups for an Amazon
    -- OpenSearch Service VPC endpoint.
    VpcEndpoint -> Maybe VPCDerivedInfo
vpcOptions :: Prelude.Maybe VPCDerivedInfo
  }
  deriving (VpcEndpoint -> VpcEndpoint -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcEndpoint -> VpcEndpoint -> Bool
$c/= :: VpcEndpoint -> VpcEndpoint -> Bool
== :: VpcEndpoint -> VpcEndpoint -> Bool
$c== :: VpcEndpoint -> VpcEndpoint -> Bool
Prelude.Eq, ReadPrec [VpcEndpoint]
ReadPrec VpcEndpoint
Int -> ReadS VpcEndpoint
ReadS [VpcEndpoint]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcEndpoint]
$creadListPrec :: ReadPrec [VpcEndpoint]
readPrec :: ReadPrec VpcEndpoint
$creadPrec :: ReadPrec VpcEndpoint
readList :: ReadS [VpcEndpoint]
$creadList :: ReadS [VpcEndpoint]
readsPrec :: Int -> ReadS VpcEndpoint
$creadsPrec :: Int -> ReadS VpcEndpoint
Prelude.Read, Int -> VpcEndpoint -> ShowS
[VpcEndpoint] -> ShowS
VpcEndpoint -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcEndpoint] -> ShowS
$cshowList :: [VpcEndpoint] -> ShowS
show :: VpcEndpoint -> String
$cshow :: VpcEndpoint -> String
showsPrec :: Int -> VpcEndpoint -> ShowS
$cshowsPrec :: Int -> VpcEndpoint -> ShowS
Prelude.Show, forall x. Rep VpcEndpoint x -> VpcEndpoint
forall x. VpcEndpoint -> Rep VpcEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VpcEndpoint x -> VpcEndpoint
$cfrom :: forall x. VpcEndpoint -> Rep VpcEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'VpcEndpoint' 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:
--
-- 'domainArn', 'vpcEndpoint_domainArn' - The Amazon Resource Name (ARN) of the domain associated with the
-- endpoint.
--
-- 'endpoint', 'vpcEndpoint_endpoint' - The connection endpoint ID for connecting to the domain.
--
-- 'status', 'vpcEndpoint_status' - The current status of the endpoint.
--
-- 'vpcEndpointId', 'vpcEndpoint_vpcEndpointId' - The unique identifier of the endpoint.
--
-- 'vpcEndpointOwner', 'vpcEndpoint_vpcEndpointOwner' - The creator of the endpoint.
--
-- 'vpcOptions', 'vpcEndpoint_vpcOptions' - Options to specify the subnets and security groups for an Amazon
-- OpenSearch Service VPC endpoint.
newVpcEndpoint ::
  VpcEndpoint
newVpcEndpoint :: VpcEndpoint
newVpcEndpoint =
  VpcEndpoint'
    { $sel:domainArn:VpcEndpoint' :: Maybe Text
domainArn = forall a. Maybe a
Prelude.Nothing,
      $sel:endpoint:VpcEndpoint' :: Maybe Text
endpoint = forall a. Maybe a
Prelude.Nothing,
      $sel:status:VpcEndpoint' :: Maybe VpcEndpointStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcEndpointId:VpcEndpoint' :: Maybe Text
vpcEndpointId = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcEndpointOwner:VpcEndpoint' :: Maybe Text
vpcEndpointOwner = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcOptions:VpcEndpoint' :: Maybe VPCDerivedInfo
vpcOptions = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the domain associated with the
-- endpoint.
vpcEndpoint_domainArn :: Lens.Lens' VpcEndpoint (Prelude.Maybe Prelude.Text)
vpcEndpoint_domainArn :: Lens' VpcEndpoint (Maybe Text)
vpcEndpoint_domainArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcEndpoint' {Maybe Text
domainArn :: Maybe Text
$sel:domainArn:VpcEndpoint' :: VpcEndpoint -> Maybe Text
domainArn} -> Maybe Text
domainArn) (\s :: VpcEndpoint
s@VpcEndpoint' {} Maybe Text
a -> VpcEndpoint
s {$sel:domainArn:VpcEndpoint' :: Maybe Text
domainArn = Maybe Text
a} :: VpcEndpoint)

-- | The connection endpoint ID for connecting to the domain.
vpcEndpoint_endpoint :: Lens.Lens' VpcEndpoint (Prelude.Maybe Prelude.Text)
vpcEndpoint_endpoint :: Lens' VpcEndpoint (Maybe Text)
vpcEndpoint_endpoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcEndpoint' {Maybe Text
endpoint :: Maybe Text
$sel:endpoint:VpcEndpoint' :: VpcEndpoint -> Maybe Text
endpoint} -> Maybe Text
endpoint) (\s :: VpcEndpoint
s@VpcEndpoint' {} Maybe Text
a -> VpcEndpoint
s {$sel:endpoint:VpcEndpoint' :: Maybe Text
endpoint = Maybe Text
a} :: VpcEndpoint)

-- | The current status of the endpoint.
vpcEndpoint_status :: Lens.Lens' VpcEndpoint (Prelude.Maybe VpcEndpointStatus)
vpcEndpoint_status :: Lens' VpcEndpoint (Maybe VpcEndpointStatus)
vpcEndpoint_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcEndpoint' {Maybe VpcEndpointStatus
status :: Maybe VpcEndpointStatus
$sel:status:VpcEndpoint' :: VpcEndpoint -> Maybe VpcEndpointStatus
status} -> Maybe VpcEndpointStatus
status) (\s :: VpcEndpoint
s@VpcEndpoint' {} Maybe VpcEndpointStatus
a -> VpcEndpoint
s {$sel:status:VpcEndpoint' :: Maybe VpcEndpointStatus
status = Maybe VpcEndpointStatus
a} :: VpcEndpoint)

-- | The unique identifier of the endpoint.
vpcEndpoint_vpcEndpointId :: Lens.Lens' VpcEndpoint (Prelude.Maybe Prelude.Text)
vpcEndpoint_vpcEndpointId :: Lens' VpcEndpoint (Maybe Text)
vpcEndpoint_vpcEndpointId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcEndpoint' {Maybe Text
vpcEndpointId :: Maybe Text
$sel:vpcEndpointId:VpcEndpoint' :: VpcEndpoint -> Maybe Text
vpcEndpointId} -> Maybe Text
vpcEndpointId) (\s :: VpcEndpoint
s@VpcEndpoint' {} Maybe Text
a -> VpcEndpoint
s {$sel:vpcEndpointId:VpcEndpoint' :: Maybe Text
vpcEndpointId = Maybe Text
a} :: VpcEndpoint)

-- | The creator of the endpoint.
vpcEndpoint_vpcEndpointOwner :: Lens.Lens' VpcEndpoint (Prelude.Maybe Prelude.Text)
vpcEndpoint_vpcEndpointOwner :: Lens' VpcEndpoint (Maybe Text)
vpcEndpoint_vpcEndpointOwner = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcEndpoint' {Maybe Text
vpcEndpointOwner :: Maybe Text
$sel:vpcEndpointOwner:VpcEndpoint' :: VpcEndpoint -> Maybe Text
vpcEndpointOwner} -> Maybe Text
vpcEndpointOwner) (\s :: VpcEndpoint
s@VpcEndpoint' {} Maybe Text
a -> VpcEndpoint
s {$sel:vpcEndpointOwner:VpcEndpoint' :: Maybe Text
vpcEndpointOwner = Maybe Text
a} :: VpcEndpoint)

-- | Options to specify the subnets and security groups for an Amazon
-- OpenSearch Service VPC endpoint.
vpcEndpoint_vpcOptions :: Lens.Lens' VpcEndpoint (Prelude.Maybe VPCDerivedInfo)
vpcEndpoint_vpcOptions :: Lens' VpcEndpoint (Maybe VPCDerivedInfo)
vpcEndpoint_vpcOptions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcEndpoint' {Maybe VPCDerivedInfo
vpcOptions :: Maybe VPCDerivedInfo
$sel:vpcOptions:VpcEndpoint' :: VpcEndpoint -> Maybe VPCDerivedInfo
vpcOptions} -> Maybe VPCDerivedInfo
vpcOptions) (\s :: VpcEndpoint
s@VpcEndpoint' {} Maybe VPCDerivedInfo
a -> VpcEndpoint
s {$sel:vpcOptions:VpcEndpoint' :: Maybe VPCDerivedInfo
vpcOptions = Maybe VPCDerivedInfo
a} :: VpcEndpoint)

instance Data.FromJSON VpcEndpoint where
  parseJSON :: Value -> Parser VpcEndpoint
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VpcEndpoint"
      ( \Object
x ->
          Maybe Text
-> Maybe Text
-> Maybe VpcEndpointStatus
-> Maybe Text
-> Maybe Text
-> Maybe VPCDerivedInfo
-> VpcEndpoint
VpcEndpoint'
            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
"DomainArn")
            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
"Endpoint")
            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
"Status")
            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
"VpcEndpointId")
            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
"VpcEndpointOwner")
            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
"VpcOptions")
      )

instance Prelude.Hashable VpcEndpoint where
  hashWithSalt :: Int -> VpcEndpoint -> Int
hashWithSalt Int
_salt VpcEndpoint' {Maybe Text
Maybe VPCDerivedInfo
Maybe VpcEndpointStatus
vpcOptions :: Maybe VPCDerivedInfo
vpcEndpointOwner :: Maybe Text
vpcEndpointId :: Maybe Text
status :: Maybe VpcEndpointStatus
endpoint :: Maybe Text
domainArn :: Maybe Text
$sel:vpcOptions:VpcEndpoint' :: VpcEndpoint -> Maybe VPCDerivedInfo
$sel:vpcEndpointOwner:VpcEndpoint' :: VpcEndpoint -> Maybe Text
$sel:vpcEndpointId:VpcEndpoint' :: VpcEndpoint -> Maybe Text
$sel:status:VpcEndpoint' :: VpcEndpoint -> Maybe VpcEndpointStatus
$sel:endpoint:VpcEndpoint' :: VpcEndpoint -> Maybe Text
$sel:domainArn:VpcEndpoint' :: VpcEndpoint -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
domainArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
endpoint
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VpcEndpointStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vpcEndpointId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vpcEndpointOwner
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VPCDerivedInfo
vpcOptions

instance Prelude.NFData VpcEndpoint where
  rnf :: VpcEndpoint -> ()
rnf VpcEndpoint' {Maybe Text
Maybe VPCDerivedInfo
Maybe VpcEndpointStatus
vpcOptions :: Maybe VPCDerivedInfo
vpcEndpointOwner :: Maybe Text
vpcEndpointId :: Maybe Text
status :: Maybe VpcEndpointStatus
endpoint :: Maybe Text
domainArn :: Maybe Text
$sel:vpcOptions:VpcEndpoint' :: VpcEndpoint -> Maybe VPCDerivedInfo
$sel:vpcEndpointOwner:VpcEndpoint' :: VpcEndpoint -> Maybe Text
$sel:vpcEndpointId:VpcEndpoint' :: VpcEndpoint -> Maybe Text
$sel:status:VpcEndpoint' :: VpcEndpoint -> Maybe VpcEndpointStatus
$sel:endpoint:VpcEndpoint' :: VpcEndpoint -> Maybe Text
$sel:domainArn:VpcEndpoint' :: VpcEndpoint -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
domainArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
endpoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VpcEndpointStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vpcEndpointId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vpcEndpointOwner
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe VPCDerivedInfo
vpcOptions