{-# 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.GroundStation.Types.EndpointDetails
-- 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.GroundStation.Types.EndpointDetails where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GroundStation.Types.DataflowEndpoint
import Amazonka.GroundStation.Types.SecurityDetails
import qualified Amazonka.Prelude as Prelude

-- | Information about the endpoint details.
--
-- /See:/ 'newEndpointDetails' smart constructor.
data EndpointDetails = EndpointDetails'
  { -- | A dataflow endpoint.
    EndpointDetails -> Maybe DataflowEndpoint
endpoint :: Prelude.Maybe DataflowEndpoint,
    -- | Endpoint security details including a list of subnets, a list of
    -- security groups and a role to connect streams to instances.
    EndpointDetails -> Maybe SecurityDetails
securityDetails :: Prelude.Maybe SecurityDetails
  }
  deriving (EndpointDetails -> EndpointDetails -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EndpointDetails -> EndpointDetails -> Bool
$c/= :: EndpointDetails -> EndpointDetails -> Bool
== :: EndpointDetails -> EndpointDetails -> Bool
$c== :: EndpointDetails -> EndpointDetails -> Bool
Prelude.Eq, ReadPrec [EndpointDetails]
ReadPrec EndpointDetails
Int -> ReadS EndpointDetails
ReadS [EndpointDetails]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EndpointDetails]
$creadListPrec :: ReadPrec [EndpointDetails]
readPrec :: ReadPrec EndpointDetails
$creadPrec :: ReadPrec EndpointDetails
readList :: ReadS [EndpointDetails]
$creadList :: ReadS [EndpointDetails]
readsPrec :: Int -> ReadS EndpointDetails
$creadsPrec :: Int -> ReadS EndpointDetails
Prelude.Read, Int -> EndpointDetails -> ShowS
[EndpointDetails] -> ShowS
EndpointDetails -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EndpointDetails] -> ShowS
$cshowList :: [EndpointDetails] -> ShowS
show :: EndpointDetails -> String
$cshow :: EndpointDetails -> String
showsPrec :: Int -> EndpointDetails -> ShowS
$cshowsPrec :: Int -> EndpointDetails -> ShowS
Prelude.Show, forall x. Rep EndpointDetails x -> EndpointDetails
forall x. EndpointDetails -> Rep EndpointDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep EndpointDetails x -> EndpointDetails
$cfrom :: forall x. EndpointDetails -> Rep EndpointDetails x
Prelude.Generic)

-- |
-- Create a value of 'EndpointDetails' 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:
--
-- 'endpoint', 'endpointDetails_endpoint' - A dataflow endpoint.
--
-- 'securityDetails', 'endpointDetails_securityDetails' - Endpoint security details including a list of subnets, a list of
-- security groups and a role to connect streams to instances.
newEndpointDetails ::
  EndpointDetails
newEndpointDetails :: EndpointDetails
newEndpointDetails =
  EndpointDetails'
    { $sel:endpoint:EndpointDetails' :: Maybe DataflowEndpoint
endpoint = forall a. Maybe a
Prelude.Nothing,
      $sel:securityDetails:EndpointDetails' :: Maybe SecurityDetails
securityDetails = forall a. Maybe a
Prelude.Nothing
    }

-- | A dataflow endpoint.
endpointDetails_endpoint :: Lens.Lens' EndpointDetails (Prelude.Maybe DataflowEndpoint)
endpointDetails_endpoint :: Lens' EndpointDetails (Maybe DataflowEndpoint)
endpointDetails_endpoint = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointDetails' {Maybe DataflowEndpoint
endpoint :: Maybe DataflowEndpoint
$sel:endpoint:EndpointDetails' :: EndpointDetails -> Maybe DataflowEndpoint
endpoint} -> Maybe DataflowEndpoint
endpoint) (\s :: EndpointDetails
s@EndpointDetails' {} Maybe DataflowEndpoint
a -> EndpointDetails
s {$sel:endpoint:EndpointDetails' :: Maybe DataflowEndpoint
endpoint = Maybe DataflowEndpoint
a} :: EndpointDetails)

-- | Endpoint security details including a list of subnets, a list of
-- security groups and a role to connect streams to instances.
endpointDetails_securityDetails :: Lens.Lens' EndpointDetails (Prelude.Maybe SecurityDetails)
endpointDetails_securityDetails :: Lens' EndpointDetails (Maybe SecurityDetails)
endpointDetails_securityDetails = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EndpointDetails' {Maybe SecurityDetails
securityDetails :: Maybe SecurityDetails
$sel:securityDetails:EndpointDetails' :: EndpointDetails -> Maybe SecurityDetails
securityDetails} -> Maybe SecurityDetails
securityDetails) (\s :: EndpointDetails
s@EndpointDetails' {} Maybe SecurityDetails
a -> EndpointDetails
s {$sel:securityDetails:EndpointDetails' :: Maybe SecurityDetails
securityDetails = Maybe SecurityDetails
a} :: EndpointDetails)

instance Data.FromJSON EndpointDetails where
  parseJSON :: Value -> Parser EndpointDetails
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"EndpointDetails"
      ( \Object
x ->
          Maybe DataflowEndpoint -> Maybe SecurityDetails -> EndpointDetails
EndpointDetails'
            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
"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
"securityDetails")
      )

instance Prelude.Hashable EndpointDetails where
  hashWithSalt :: Int -> EndpointDetails -> Int
hashWithSalt Int
_salt EndpointDetails' {Maybe SecurityDetails
Maybe DataflowEndpoint
securityDetails :: Maybe SecurityDetails
endpoint :: Maybe DataflowEndpoint
$sel:securityDetails:EndpointDetails' :: EndpointDetails -> Maybe SecurityDetails
$sel:endpoint:EndpointDetails' :: EndpointDetails -> Maybe DataflowEndpoint
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DataflowEndpoint
endpoint
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SecurityDetails
securityDetails

instance Prelude.NFData EndpointDetails where
  rnf :: EndpointDetails -> ()
rnf EndpointDetails' {Maybe SecurityDetails
Maybe DataflowEndpoint
securityDetails :: Maybe SecurityDetails
endpoint :: Maybe DataflowEndpoint
$sel:securityDetails:EndpointDetails' :: EndpointDetails -> Maybe SecurityDetails
$sel:endpoint:EndpointDetails' :: EndpointDetails -> Maybe DataflowEndpoint
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe DataflowEndpoint
endpoint
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe SecurityDetails
securityDetails

instance Data.ToJSON EndpointDetails where
  toJSON :: EndpointDetails -> Value
toJSON EndpointDetails' {Maybe SecurityDetails
Maybe DataflowEndpoint
securityDetails :: Maybe SecurityDetails
endpoint :: Maybe DataflowEndpoint
$sel:securityDetails:EndpointDetails' :: EndpointDetails -> Maybe SecurityDetails
$sel:endpoint:EndpointDetails' :: EndpointDetails -> Maybe DataflowEndpoint
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"endpoint" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DataflowEndpoint
endpoint,
            (Key
"securityDetails" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SecurityDetails
securityDetails
          ]
      )