{-# 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.OpenSearchServerless.Types.VpcEndpointDetail
-- 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.OpenSearchServerless.Types.VpcEndpointDetail where

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

-- | Details about an OpenSearch Serverless-managed interface endpoint.
--
-- /See:/ 'newVpcEndpointDetail' smart constructor.
data VpcEndpointDetail = VpcEndpointDetail'
  { -- | The date the endpoint was created.
    VpcEndpointDetail -> Maybe Integer
createdDate :: Prelude.Maybe Prelude.Integer,
    -- | The unique identifier of the endpoint.
    VpcEndpointDetail -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The name of the endpoint.
    VpcEndpointDetail -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The unique identifiers of the security groups that define the ports,
    -- protocols, and sources for inbound traffic that you are authorizing into
    -- your endpoint.
    VpcEndpointDetail -> Maybe (NonEmpty Text)
securityGroupIds :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The current status of the endpoint.
    VpcEndpointDetail -> Maybe VpcEndpointStatus
status :: Prelude.Maybe VpcEndpointStatus,
    -- | The ID of the subnets from which you access OpenSearch Serverless.
    VpcEndpointDetail -> Maybe (NonEmpty Text)
subnetIds :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The ID of the VPC from which you access OpenSearch Serverless
    VpcEndpointDetail -> Maybe Text
vpcId :: Prelude.Maybe Prelude.Text
  }
  deriving (VpcEndpointDetail -> VpcEndpointDetail -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: VpcEndpointDetail -> VpcEndpointDetail -> Bool
$c/= :: VpcEndpointDetail -> VpcEndpointDetail -> Bool
== :: VpcEndpointDetail -> VpcEndpointDetail -> Bool
$c== :: VpcEndpointDetail -> VpcEndpointDetail -> Bool
Prelude.Eq, ReadPrec [VpcEndpointDetail]
ReadPrec VpcEndpointDetail
Int -> ReadS VpcEndpointDetail
ReadS [VpcEndpointDetail]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [VpcEndpointDetail]
$creadListPrec :: ReadPrec [VpcEndpointDetail]
readPrec :: ReadPrec VpcEndpointDetail
$creadPrec :: ReadPrec VpcEndpointDetail
readList :: ReadS [VpcEndpointDetail]
$creadList :: ReadS [VpcEndpointDetail]
readsPrec :: Int -> ReadS VpcEndpointDetail
$creadsPrec :: Int -> ReadS VpcEndpointDetail
Prelude.Read, Int -> VpcEndpointDetail -> ShowS
[VpcEndpointDetail] -> ShowS
VpcEndpointDetail -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [VpcEndpointDetail] -> ShowS
$cshowList :: [VpcEndpointDetail] -> ShowS
show :: VpcEndpointDetail -> String
$cshow :: VpcEndpointDetail -> String
showsPrec :: Int -> VpcEndpointDetail -> ShowS
$cshowsPrec :: Int -> VpcEndpointDetail -> ShowS
Prelude.Show, forall x. Rep VpcEndpointDetail x -> VpcEndpointDetail
forall x. VpcEndpointDetail -> Rep VpcEndpointDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep VpcEndpointDetail x -> VpcEndpointDetail
$cfrom :: forall x. VpcEndpointDetail -> Rep VpcEndpointDetail x
Prelude.Generic)

-- |
-- Create a value of 'VpcEndpointDetail' 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:
--
-- 'createdDate', 'vpcEndpointDetail_createdDate' - The date the endpoint was created.
--
-- 'id', 'vpcEndpointDetail_id' - The unique identifier of the endpoint.
--
-- 'name', 'vpcEndpointDetail_name' - The name of the endpoint.
--
-- 'securityGroupIds', 'vpcEndpointDetail_securityGroupIds' - The unique identifiers of the security groups that define the ports,
-- protocols, and sources for inbound traffic that you are authorizing into
-- your endpoint.
--
-- 'status', 'vpcEndpointDetail_status' - The current status of the endpoint.
--
-- 'subnetIds', 'vpcEndpointDetail_subnetIds' - The ID of the subnets from which you access OpenSearch Serverless.
--
-- 'vpcId', 'vpcEndpointDetail_vpcId' - The ID of the VPC from which you access OpenSearch Serverless
newVpcEndpointDetail ::
  VpcEndpointDetail
newVpcEndpointDetail :: VpcEndpointDetail
newVpcEndpointDetail =
  VpcEndpointDetail'
    { $sel:createdDate:VpcEndpointDetail' :: Maybe Integer
createdDate = forall a. Maybe a
Prelude.Nothing,
      $sel:id:VpcEndpointDetail' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:name:VpcEndpointDetail' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:securityGroupIds:VpcEndpointDetail' :: Maybe (NonEmpty Text)
securityGroupIds = forall a. Maybe a
Prelude.Nothing,
      $sel:status:VpcEndpointDetail' :: Maybe VpcEndpointStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:subnetIds:VpcEndpointDetail' :: Maybe (NonEmpty Text)
subnetIds = forall a. Maybe a
Prelude.Nothing,
      $sel:vpcId:VpcEndpointDetail' :: Maybe Text
vpcId = forall a. Maybe a
Prelude.Nothing
    }

-- | The date the endpoint was created.
vpcEndpointDetail_createdDate :: Lens.Lens' VpcEndpointDetail (Prelude.Maybe Prelude.Integer)
vpcEndpointDetail_createdDate :: Lens' VpcEndpointDetail (Maybe Integer)
vpcEndpointDetail_createdDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcEndpointDetail' {Maybe Integer
createdDate :: Maybe Integer
$sel:createdDate:VpcEndpointDetail' :: VpcEndpointDetail -> Maybe Integer
createdDate} -> Maybe Integer
createdDate) (\s :: VpcEndpointDetail
s@VpcEndpointDetail' {} Maybe Integer
a -> VpcEndpointDetail
s {$sel:createdDate:VpcEndpointDetail' :: Maybe Integer
createdDate = Maybe Integer
a} :: VpcEndpointDetail)

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

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

-- | The unique identifiers of the security groups that define the ports,
-- protocols, and sources for inbound traffic that you are authorizing into
-- your endpoint.
vpcEndpointDetail_securityGroupIds :: Lens.Lens' VpcEndpointDetail (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
vpcEndpointDetail_securityGroupIds :: Lens' VpcEndpointDetail (Maybe (NonEmpty Text))
vpcEndpointDetail_securityGroupIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcEndpointDetail' {Maybe (NonEmpty Text)
securityGroupIds :: Maybe (NonEmpty Text)
$sel:securityGroupIds:VpcEndpointDetail' :: VpcEndpointDetail -> Maybe (NonEmpty Text)
securityGroupIds} -> Maybe (NonEmpty Text)
securityGroupIds) (\s :: VpcEndpointDetail
s@VpcEndpointDetail' {} Maybe (NonEmpty Text)
a -> VpcEndpointDetail
s {$sel:securityGroupIds:VpcEndpointDetail' :: Maybe (NonEmpty Text)
securityGroupIds = Maybe (NonEmpty Text)
a} :: VpcEndpointDetail) 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 current status of the endpoint.
vpcEndpointDetail_status :: Lens.Lens' VpcEndpointDetail (Prelude.Maybe VpcEndpointStatus)
vpcEndpointDetail_status :: Lens' VpcEndpointDetail (Maybe VpcEndpointStatus)
vpcEndpointDetail_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcEndpointDetail' {Maybe VpcEndpointStatus
status :: Maybe VpcEndpointStatus
$sel:status:VpcEndpointDetail' :: VpcEndpointDetail -> Maybe VpcEndpointStatus
status} -> Maybe VpcEndpointStatus
status) (\s :: VpcEndpointDetail
s@VpcEndpointDetail' {} Maybe VpcEndpointStatus
a -> VpcEndpointDetail
s {$sel:status:VpcEndpointDetail' :: Maybe VpcEndpointStatus
status = Maybe VpcEndpointStatus
a} :: VpcEndpointDetail)

-- | The ID of the subnets from which you access OpenSearch Serverless.
vpcEndpointDetail_subnetIds :: Lens.Lens' VpcEndpointDetail (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
vpcEndpointDetail_subnetIds :: Lens' VpcEndpointDetail (Maybe (NonEmpty Text))
vpcEndpointDetail_subnetIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcEndpointDetail' {Maybe (NonEmpty Text)
subnetIds :: Maybe (NonEmpty Text)
$sel:subnetIds:VpcEndpointDetail' :: VpcEndpointDetail -> Maybe (NonEmpty Text)
subnetIds} -> Maybe (NonEmpty Text)
subnetIds) (\s :: VpcEndpointDetail
s@VpcEndpointDetail' {} Maybe (NonEmpty Text)
a -> VpcEndpointDetail
s {$sel:subnetIds:VpcEndpointDetail' :: Maybe (NonEmpty Text)
subnetIds = Maybe (NonEmpty Text)
a} :: VpcEndpointDetail) 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 of the VPC from which you access OpenSearch Serverless
vpcEndpointDetail_vpcId :: Lens.Lens' VpcEndpointDetail (Prelude.Maybe Prelude.Text)
vpcEndpointDetail_vpcId :: Lens' VpcEndpointDetail (Maybe Text)
vpcEndpointDetail_vpcId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\VpcEndpointDetail' {Maybe Text
vpcId :: Maybe Text
$sel:vpcId:VpcEndpointDetail' :: VpcEndpointDetail -> Maybe Text
vpcId} -> Maybe Text
vpcId) (\s :: VpcEndpointDetail
s@VpcEndpointDetail' {} Maybe Text
a -> VpcEndpointDetail
s {$sel:vpcId:VpcEndpointDetail' :: Maybe Text
vpcId = Maybe Text
a} :: VpcEndpointDetail)

instance Data.FromJSON VpcEndpointDetail where
  parseJSON :: Value -> Parser VpcEndpointDetail
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"VpcEndpointDetail"
      ( \Object
x ->
          Maybe Integer
-> Maybe Text
-> Maybe Text
-> Maybe (NonEmpty Text)
-> Maybe VpcEndpointStatus
-> Maybe (NonEmpty Text)
-> Maybe Text
-> VpcEndpointDetail
VpcEndpointDetail'
            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
"createdDate")
            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
"id")
            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
"name")
            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 (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
"subnetIds")
            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 VpcEndpointDetail where
  hashWithSalt :: Int -> VpcEndpointDetail -> Int
hashWithSalt Int
_salt VpcEndpointDetail' {Maybe Integer
Maybe (NonEmpty Text)
Maybe Text
Maybe VpcEndpointStatus
vpcId :: Maybe Text
subnetIds :: Maybe (NonEmpty Text)
status :: Maybe VpcEndpointStatus
securityGroupIds :: Maybe (NonEmpty Text)
name :: Maybe Text
id :: Maybe Text
createdDate :: Maybe Integer
$sel:vpcId:VpcEndpointDetail' :: VpcEndpointDetail -> Maybe Text
$sel:subnetIds:VpcEndpointDetail' :: VpcEndpointDetail -> Maybe (NonEmpty Text)
$sel:status:VpcEndpointDetail' :: VpcEndpointDetail -> Maybe VpcEndpointStatus
$sel:securityGroupIds:VpcEndpointDetail' :: VpcEndpointDetail -> Maybe (NonEmpty Text)
$sel:name:VpcEndpointDetail' :: VpcEndpointDetail -> Maybe Text
$sel:id:VpcEndpointDetail' :: VpcEndpointDetail -> Maybe Text
$sel:createdDate:VpcEndpointDetail' :: VpcEndpointDetail -> Maybe Integer
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
createdDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
securityGroupIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe VpcEndpointStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (NonEmpty Text)
subnetIds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vpcId

instance Prelude.NFData VpcEndpointDetail where
  rnf :: VpcEndpointDetail -> ()
rnf VpcEndpointDetail' {Maybe Integer
Maybe (NonEmpty Text)
Maybe Text
Maybe VpcEndpointStatus
vpcId :: Maybe Text
subnetIds :: Maybe (NonEmpty Text)
status :: Maybe VpcEndpointStatus
securityGroupIds :: Maybe (NonEmpty Text)
name :: Maybe Text
id :: Maybe Text
createdDate :: Maybe Integer
$sel:vpcId:VpcEndpointDetail' :: VpcEndpointDetail -> Maybe Text
$sel:subnetIds:VpcEndpointDetail' :: VpcEndpointDetail -> Maybe (NonEmpty Text)
$sel:status:VpcEndpointDetail' :: VpcEndpointDetail -> Maybe VpcEndpointStatus
$sel:securityGroupIds:VpcEndpointDetail' :: VpcEndpointDetail -> Maybe (NonEmpty Text)
$sel:name:VpcEndpointDetail' :: VpcEndpointDetail -> Maybe Text
$sel:id:VpcEndpointDetail' :: VpcEndpointDetail -> Maybe Text
$sel:createdDate:VpcEndpointDetail' :: VpcEndpointDetail -> Maybe Integer
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
createdDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
id
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
securityGroupIds
      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 (NonEmpty Text)
subnetIds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
vpcId