{-# 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.GuardDuty.Types.Destination
-- 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.GuardDuty.Types.Destination where

import qualified Amazonka.Core as Core
import Amazonka.GuardDuty.Types.DestinationType
import Amazonka.GuardDuty.Types.PublishingStatus
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Contains information about the publishing destination, including the ID,
-- type, and status.
--
-- /See:/ 'newDestination' smart constructor.
data Destination = Destination'
  { -- | The unique ID of the publishing destination.
    Destination -> Text
destinationId :: Prelude.Text,
    -- | The type of resource used for the publishing destination. Currently,
    -- only Amazon S3 buckets are supported.
    Destination -> DestinationType
destinationType :: DestinationType,
    -- | The status of the publishing destination.
    Destination -> PublishingStatus
status :: PublishingStatus
  }
  deriving (Destination -> Destination -> Bool
(Destination -> Destination -> Bool)
-> (Destination -> Destination -> Bool) -> Eq Destination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Destination -> Destination -> Bool
$c/= :: Destination -> Destination -> Bool
== :: Destination -> Destination -> Bool
$c== :: Destination -> Destination -> Bool
Prelude.Eq, ReadPrec [Destination]
ReadPrec Destination
Int -> ReadS Destination
ReadS [Destination]
(Int -> ReadS Destination)
-> ReadS [Destination]
-> ReadPrec Destination
-> ReadPrec [Destination]
-> Read Destination
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Destination]
$creadListPrec :: ReadPrec [Destination]
readPrec :: ReadPrec Destination
$creadPrec :: ReadPrec Destination
readList :: ReadS [Destination]
$creadList :: ReadS [Destination]
readsPrec :: Int -> ReadS Destination
$creadsPrec :: Int -> ReadS Destination
Prelude.Read, Int -> Destination -> ShowS
[Destination] -> ShowS
Destination -> String
(Int -> Destination -> ShowS)
-> (Destination -> String)
-> ([Destination] -> ShowS)
-> Show Destination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Destination] -> ShowS
$cshowList :: [Destination] -> ShowS
show :: Destination -> String
$cshow :: Destination -> String
showsPrec :: Int -> Destination -> ShowS
$cshowsPrec :: Int -> Destination -> ShowS
Prelude.Show, (forall x. Destination -> Rep Destination x)
-> (forall x. Rep Destination x -> Destination)
-> Generic Destination
forall x. Rep Destination x -> Destination
forall x. Destination -> Rep Destination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Destination x -> Destination
$cfrom :: forall x. Destination -> Rep Destination x
Prelude.Generic)

-- |
-- Create a value of 'Destination' 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:
--
-- 'destinationId', 'destination_destinationId' - The unique ID of the publishing destination.
--
-- 'destinationType', 'destination_destinationType' - The type of resource used for the publishing destination. Currently,
-- only Amazon S3 buckets are supported.
--
-- 'status', 'destination_status' - The status of the publishing destination.
newDestination ::
  -- | 'destinationId'
  Prelude.Text ->
  -- | 'destinationType'
  DestinationType ->
  -- | 'status'
  PublishingStatus ->
  Destination
newDestination :: Text -> DestinationType -> PublishingStatus -> Destination
newDestination
  Text
pDestinationId_
  DestinationType
pDestinationType_
  PublishingStatus
pStatus_ =
    Destination' :: Text -> DestinationType -> PublishingStatus -> Destination
Destination'
      { $sel:destinationId:Destination' :: Text
destinationId = Text
pDestinationId_,
        $sel:destinationType:Destination' :: DestinationType
destinationType = DestinationType
pDestinationType_,
        $sel:status:Destination' :: PublishingStatus
status = PublishingStatus
pStatus_
      }

-- | The unique ID of the publishing destination.
destination_destinationId :: Lens.Lens' Destination Prelude.Text
destination_destinationId :: (Text -> f Text) -> Destination -> f Destination
destination_destinationId = (Destination -> Text)
-> (Destination -> Text -> Destination)
-> Lens Destination Destination Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destination' {Text
destinationId :: Text
$sel:destinationId:Destination' :: Destination -> Text
destinationId} -> Text
destinationId) (\s :: Destination
s@Destination' {} Text
a -> Destination
s {$sel:destinationId:Destination' :: Text
destinationId = Text
a} :: Destination)

-- | The type of resource used for the publishing destination. Currently,
-- only Amazon S3 buckets are supported.
destination_destinationType :: Lens.Lens' Destination DestinationType
destination_destinationType :: (DestinationType -> f DestinationType)
-> Destination -> f Destination
destination_destinationType = (Destination -> DestinationType)
-> (Destination -> DestinationType -> Destination)
-> Lens Destination Destination DestinationType DestinationType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destination' {DestinationType
destinationType :: DestinationType
$sel:destinationType:Destination' :: Destination -> DestinationType
destinationType} -> DestinationType
destinationType) (\s :: Destination
s@Destination' {} DestinationType
a -> Destination
s {$sel:destinationType:Destination' :: DestinationType
destinationType = DestinationType
a} :: Destination)

-- | The status of the publishing destination.
destination_status :: Lens.Lens' Destination PublishingStatus
destination_status :: (PublishingStatus -> f PublishingStatus)
-> Destination -> f Destination
destination_status = (Destination -> PublishingStatus)
-> (Destination -> PublishingStatus -> Destination)
-> Lens Destination Destination PublishingStatus PublishingStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Destination' {PublishingStatus
status :: PublishingStatus
$sel:status:Destination' :: Destination -> PublishingStatus
status} -> PublishingStatus
status) (\s :: Destination
s@Destination' {} PublishingStatus
a -> Destination
s {$sel:status:Destination' :: PublishingStatus
status = PublishingStatus
a} :: Destination)

instance Core.FromJSON Destination where
  parseJSON :: Value -> Parser Destination
parseJSON =
    String
-> (Object -> Parser Destination) -> Value -> Parser Destination
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Destination"
      ( \Object
x ->
          Text -> DestinationType -> PublishingStatus -> Destination
Destination'
            (Text -> DestinationType -> PublishingStatus -> Destination)
-> Parser Text
-> Parser (DestinationType -> PublishingStatus -> Destination)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"destinationId")
            Parser (DestinationType -> PublishingStatus -> Destination)
-> Parser DestinationType
-> Parser (PublishingStatus -> Destination)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser DestinationType
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"destinationType")
            Parser (PublishingStatus -> Destination)
-> Parser PublishingStatus -> Parser Destination
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser PublishingStatus
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"status")
      )

instance Prelude.Hashable Destination

instance Prelude.NFData Destination