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

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.GuardDuty.Types.DestinationType
import Amazonka.GuardDuty.Types.PublishingStatus
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
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]
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
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. 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'
      { $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 :: Lens' Destination Text
destination_destinationId = 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 :: Lens' Destination DestinationType
destination_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 :: Lens' Destination PublishingStatus
destination_status = 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 Data.FromJSON Destination where
  parseJSON :: Value -> Parser Destination
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Destination"
      ( \Object
x ->
          Text -> DestinationType -> PublishingStatus -> Destination
Destination'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"destinationId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"destinationType")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"status")
      )

instance Prelude.Hashable Destination where
  hashWithSalt :: Int -> Destination -> Int
hashWithSalt Int
_salt Destination' {Text
DestinationType
PublishingStatus
status :: PublishingStatus
destinationType :: DestinationType
destinationId :: Text
$sel:status:Destination' :: Destination -> PublishingStatus
$sel:destinationType:Destination' :: Destination -> DestinationType
$sel:destinationId:Destination' :: Destination -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
destinationId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` DestinationType
destinationType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` PublishingStatus
status

instance Prelude.NFData Destination where
  rnf :: Destination -> ()
rnf Destination' {Text
DestinationType
PublishingStatus
status :: PublishingStatus
destinationType :: DestinationType
destinationId :: Text
$sel:status:Destination' :: Destination -> PublishingStatus
$sel:destinationType:Destination' :: Destination -> DestinationType
$sel:destinationId:Destination' :: Destination -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
destinationId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf DestinationType
destinationType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf PublishingStatus
status