{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.Lightsail.Types.DestinationInfo where

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

-- | Describes the destination of a record.
--
-- /See:/ 'newDestinationInfo' smart constructor.
data DestinationInfo = DestinationInfo'
  { -- | The ID of the resource created at the destination.
    DestinationInfo -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The destination service of the record.
    DestinationInfo -> Maybe Text
service :: Prelude.Maybe Prelude.Text
  }
  deriving (DestinationInfo -> DestinationInfo -> Bool
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]
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
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. 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:
--
-- 'id', 'destinationInfo_id' - The ID of the resource created at the destination.
--
-- 'service', 'destinationInfo_service' - The destination service of the record.
newDestinationInfo ::
  DestinationInfo
newDestinationInfo :: DestinationInfo
newDestinationInfo =
  DestinationInfo'
    { $sel:id:DestinationInfo' :: Maybe Text
id = forall a. Maybe a
Prelude.Nothing,
      $sel:service:DestinationInfo' :: Maybe Text
service = forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the resource created at the destination.
destinationInfo_id :: Lens.Lens' DestinationInfo (Prelude.Maybe Prelude.Text)
destinationInfo_id :: Lens' DestinationInfo (Maybe Text)
destinationInfo_id = 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)

-- | The destination service of the record.
destinationInfo_service :: Lens.Lens' DestinationInfo (Prelude.Maybe Prelude.Text)
destinationInfo_service :: Lens' DestinationInfo (Maybe Text)
destinationInfo_service = 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)

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

instance Prelude.Hashable DestinationInfo where
  hashWithSalt :: Int -> DestinationInfo -> Int
hashWithSalt Int
_salt DestinationInfo' {Maybe Text
service :: Maybe Text
id :: Maybe Text
$sel:service:DestinationInfo' :: DestinationInfo -> Maybe Text
$sel:id:DestinationInfo' :: DestinationInfo -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
id
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
service

instance Prelude.NFData DestinationInfo where
  rnf :: DestinationInfo -> ()
rnf DestinationInfo' {Maybe Text
service :: Maybe Text
id :: Maybe Text
$sel:service:DestinationInfo' :: DestinationInfo -> Maybe Text
$sel:id:DestinationInfo' :: DestinationInfo -> Maybe Text
..} =
    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
service