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

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

-- | Information about the endpoint details.
--
-- /See:/ 'newEndpointDetails' smart constructor.
data EndpointDetails = EndpointDetails'
  { -- | Endpoint security details.
    EndpointDetails -> Maybe SecurityDetails
securityDetails :: Prelude.Maybe SecurityDetails,
    -- | A dataflow endpoint.
    EndpointDetails -> Maybe DataflowEndpoint
endpoint :: Prelude.Maybe DataflowEndpoint
  }
  deriving (EndpointDetails -> EndpointDetails -> Bool
(EndpointDetails -> EndpointDetails -> Bool)
-> (EndpointDetails -> EndpointDetails -> Bool)
-> Eq EndpointDetails
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]
(Int -> ReadS EndpointDetails)
-> ReadS [EndpointDetails]
-> ReadPrec EndpointDetails
-> ReadPrec [EndpointDetails]
-> Read 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
(Int -> EndpointDetails -> ShowS)
-> (EndpointDetails -> String)
-> ([EndpointDetails] -> ShowS)
-> Show EndpointDetails
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. EndpointDetails -> Rep EndpointDetails x)
-> (forall x. Rep EndpointDetails x -> EndpointDetails)
-> Generic EndpointDetails
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:
--
-- 'securityDetails', 'endpointDetails_securityDetails' - Endpoint security details.
--
-- 'endpoint', 'endpointDetails_endpoint' - A dataflow endpoint.
newEndpointDetails ::
  EndpointDetails
newEndpointDetails :: EndpointDetails
newEndpointDetails =
  EndpointDetails' :: Maybe SecurityDetails -> Maybe DataflowEndpoint -> EndpointDetails
EndpointDetails'
    { $sel:securityDetails:EndpointDetails' :: Maybe SecurityDetails
securityDetails = Maybe SecurityDetails
forall a. Maybe a
Prelude.Nothing,
      $sel:endpoint:EndpointDetails' :: Maybe DataflowEndpoint
endpoint = Maybe DataflowEndpoint
forall a. Maybe a
Prelude.Nothing
    }

-- | Endpoint security details.
endpointDetails_securityDetails :: Lens.Lens' EndpointDetails (Prelude.Maybe SecurityDetails)
endpointDetails_securityDetails :: (Maybe SecurityDetails -> f (Maybe SecurityDetails))
-> EndpointDetails -> f EndpointDetails
endpointDetails_securityDetails = (EndpointDetails -> Maybe SecurityDetails)
-> (EndpointDetails -> Maybe SecurityDetails -> EndpointDetails)
-> Lens
     EndpointDetails
     EndpointDetails
     (Maybe SecurityDetails)
     (Maybe 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)

-- | A dataflow endpoint.
endpointDetails_endpoint :: Lens.Lens' EndpointDetails (Prelude.Maybe DataflowEndpoint)
endpointDetails_endpoint :: (Maybe DataflowEndpoint -> f (Maybe DataflowEndpoint))
-> EndpointDetails -> f EndpointDetails
endpointDetails_endpoint = (EndpointDetails -> Maybe DataflowEndpoint)
-> (EndpointDetails -> Maybe DataflowEndpoint -> EndpointDetails)
-> Lens
     EndpointDetails
     EndpointDetails
     (Maybe DataflowEndpoint)
     (Maybe DataflowEndpoint)
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)

instance Core.FromJSON EndpointDetails where
  parseJSON :: Value -> Parser EndpointDetails
parseJSON =
    String
-> (Object -> Parser EndpointDetails)
-> Value
-> Parser EndpointDetails
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"EndpointDetails"
      ( \Object
x ->
          Maybe SecurityDetails -> Maybe DataflowEndpoint -> EndpointDetails
EndpointDetails'
            (Maybe SecurityDetails
 -> Maybe DataflowEndpoint -> EndpointDetails)
-> Parser (Maybe SecurityDetails)
-> Parser (Maybe DataflowEndpoint -> EndpointDetails)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe SecurityDetails)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"securityDetails")
            Parser (Maybe DataflowEndpoint -> EndpointDetails)
-> Parser (Maybe DataflowEndpoint) -> Parser EndpointDetails
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe DataflowEndpoint)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"endpoint")
      )

instance Prelude.Hashable EndpointDetails

instance Prelude.NFData EndpointDetails

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