{-# 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.Lightsail.Types.DestinationInfo
-- 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.Lightsail.Types.DestinationInfo where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Describes the destination of a record.
--
-- /See:/ 'newDestinationInfo' smart constructor.
data DestinationInfo = DestinationInfo'
  { -- | The destination service of the record.
    DestinationInfo -> Maybe Text
service :: Prelude.Maybe Prelude.Text,
    -- | The ID of the resource created at the destination.
    DestinationInfo -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (DestinationInfo -> DestinationInfo -> Bool
(DestinationInfo -> DestinationInfo -> Bool)
-> (DestinationInfo -> DestinationInfo -> Bool)
-> Eq DestinationInfo
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DestinationInfo -> DestinationInfo -> Bool
$c/= :: DestinationInfo -> DestinationInfo -> Bool
== :: DestinationInfo -> DestinationInfo -> Bool
$c== :: DestinationInfo -> DestinationInfo -> Bool
Prelude.Eq, ReadPrec [DestinationInfo]
ReadPrec DestinationInfo
Int -> ReadS DestinationInfo
ReadS [DestinationInfo]
(Int -> ReadS DestinationInfo)
-> ReadS [DestinationInfo]
-> ReadPrec DestinationInfo
-> ReadPrec [DestinationInfo]
-> Read DestinationInfo
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DestinationInfo]
$creadListPrec :: ReadPrec [DestinationInfo]
readPrec :: ReadPrec DestinationInfo
$creadPrec :: ReadPrec DestinationInfo
readList :: ReadS [DestinationInfo]
$creadList :: ReadS [DestinationInfo]
readsPrec :: Int -> ReadS DestinationInfo
$creadsPrec :: Int -> ReadS DestinationInfo
Prelude.Read, Int -> DestinationInfo -> ShowS
[DestinationInfo] -> ShowS
DestinationInfo -> String
(Int -> DestinationInfo -> ShowS)
-> (DestinationInfo -> String)
-> ([DestinationInfo] -> ShowS)
-> Show DestinationInfo
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DestinationInfo] -> ShowS
$cshowList :: [DestinationInfo] -> ShowS
show :: DestinationInfo -> String
$cshow :: DestinationInfo -> String
showsPrec :: Int -> DestinationInfo -> ShowS
$cshowsPrec :: Int -> DestinationInfo -> ShowS
Prelude.Show, (forall x. DestinationInfo -> Rep DestinationInfo x)
-> (forall x. Rep DestinationInfo x -> DestinationInfo)
-> Generic DestinationInfo
forall x. Rep DestinationInfo x -> DestinationInfo
forall x. DestinationInfo -> Rep DestinationInfo x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DestinationInfo x -> DestinationInfo
$cfrom :: forall x. DestinationInfo -> Rep DestinationInfo x
Prelude.Generic)

-- |
-- Create a value of 'DestinationInfo' 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:
--
-- 'service', 'destinationInfo_service' - The destination service of the record.
--
-- 'id', 'destinationInfo_id' - The ID of the resource created at the destination.
newDestinationInfo ::
  DestinationInfo
newDestinationInfo :: DestinationInfo
newDestinationInfo =
  DestinationInfo' :: Maybe Text -> Maybe Text -> DestinationInfo
DestinationInfo'
    { $sel:service:DestinationInfo' :: Maybe Text
service = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:DestinationInfo' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The destination service of the record.
destinationInfo_service :: Lens.Lens' DestinationInfo (Prelude.Maybe Prelude.Text)
destinationInfo_service :: (Maybe Text -> f (Maybe Text))
-> DestinationInfo -> f DestinationInfo
destinationInfo_service = (DestinationInfo -> Maybe Text)
-> (DestinationInfo -> Maybe Text -> DestinationInfo)
-> Lens DestinationInfo DestinationInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationInfo' {Maybe Text
service :: Maybe Text
$sel:service:DestinationInfo' :: DestinationInfo -> Maybe Text
service} -> Maybe Text
service) (\s :: DestinationInfo
s@DestinationInfo' {} Maybe Text
a -> DestinationInfo
s {$sel:service:DestinationInfo' :: Maybe Text
service = Maybe Text
a} :: DestinationInfo)

-- | The ID of the resource created at the destination.
destinationInfo_id :: Lens.Lens' DestinationInfo (Prelude.Maybe Prelude.Text)
destinationInfo_id :: (Maybe Text -> f (Maybe Text))
-> DestinationInfo -> f DestinationInfo
destinationInfo_id = (DestinationInfo -> Maybe Text)
-> (DestinationInfo -> Maybe Text -> DestinationInfo)
-> Lens DestinationInfo DestinationInfo (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationInfo' {Maybe Text
id :: Maybe Text
$sel:id:DestinationInfo' :: DestinationInfo -> Maybe Text
id} -> Maybe Text
id) (\s :: DestinationInfo
s@DestinationInfo' {} Maybe Text
a -> DestinationInfo
s {$sel:id:DestinationInfo' :: Maybe Text
id = Maybe Text
a} :: DestinationInfo)

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

instance Prelude.Hashable DestinationInfo

instance Prelude.NFData DestinationInfo