{-# 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.EC2.Types.DestinationOptionsRequest
-- 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.EC2.Types.DestinationOptionsRequest where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.EC2.Internal
import Amazonka.EC2.Types.DestinationFileFormat
import qualified Amazonka.Prelude as Prelude

-- | Describes the destination options for a flow log.
--
-- /See:/ 'newDestinationOptionsRequest' smart constructor.
data DestinationOptionsRequest = DestinationOptionsRequest'
  { -- | The format for the flow log. The default is @plain-text@.
    DestinationOptionsRequest -> Maybe DestinationFileFormat
fileFormat :: Prelude.Maybe DestinationFileFormat,
    -- | Indicates whether to use Hive-compatible prefixes for flow logs stored
    -- in Amazon S3. The default is @false@.
    DestinationOptionsRequest -> Maybe Bool
hiveCompatiblePartitions :: Prelude.Maybe Prelude.Bool,
    -- | Indicates whether to partition the flow log per hour. This reduces the
    -- cost and response time for queries. The default is @false@.
    DestinationOptionsRequest -> Maybe Bool
perHourPartition :: Prelude.Maybe Prelude.Bool
  }
  deriving (DestinationOptionsRequest -> DestinationOptionsRequest -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DestinationOptionsRequest -> DestinationOptionsRequest -> Bool
$c/= :: DestinationOptionsRequest -> DestinationOptionsRequest -> Bool
== :: DestinationOptionsRequest -> DestinationOptionsRequest -> Bool
$c== :: DestinationOptionsRequest -> DestinationOptionsRequest -> Bool
Prelude.Eq, ReadPrec [DestinationOptionsRequest]
ReadPrec DestinationOptionsRequest
Int -> ReadS DestinationOptionsRequest
ReadS [DestinationOptionsRequest]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DestinationOptionsRequest]
$creadListPrec :: ReadPrec [DestinationOptionsRequest]
readPrec :: ReadPrec DestinationOptionsRequest
$creadPrec :: ReadPrec DestinationOptionsRequest
readList :: ReadS [DestinationOptionsRequest]
$creadList :: ReadS [DestinationOptionsRequest]
readsPrec :: Int -> ReadS DestinationOptionsRequest
$creadsPrec :: Int -> ReadS DestinationOptionsRequest
Prelude.Read, Int -> DestinationOptionsRequest -> ShowS
[DestinationOptionsRequest] -> ShowS
DestinationOptionsRequest -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DestinationOptionsRequest] -> ShowS
$cshowList :: [DestinationOptionsRequest] -> ShowS
show :: DestinationOptionsRequest -> String
$cshow :: DestinationOptionsRequest -> String
showsPrec :: Int -> DestinationOptionsRequest -> ShowS
$cshowsPrec :: Int -> DestinationOptionsRequest -> ShowS
Prelude.Show, forall x.
Rep DestinationOptionsRequest x -> DestinationOptionsRequest
forall x.
DestinationOptionsRequest -> Rep DestinationOptionsRequest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DestinationOptionsRequest x -> DestinationOptionsRequest
$cfrom :: forall x.
DestinationOptionsRequest -> Rep DestinationOptionsRequest x
Prelude.Generic)

-- |
-- Create a value of 'DestinationOptionsRequest' 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:
--
-- 'fileFormat', 'destinationOptionsRequest_fileFormat' - The format for the flow log. The default is @plain-text@.
--
-- 'hiveCompatiblePartitions', 'destinationOptionsRequest_hiveCompatiblePartitions' - Indicates whether to use Hive-compatible prefixes for flow logs stored
-- in Amazon S3. The default is @false@.
--
-- 'perHourPartition', 'destinationOptionsRequest_perHourPartition' - Indicates whether to partition the flow log per hour. This reduces the
-- cost and response time for queries. The default is @false@.
newDestinationOptionsRequest ::
  DestinationOptionsRequest
newDestinationOptionsRequest :: DestinationOptionsRequest
newDestinationOptionsRequest =
  DestinationOptionsRequest'
    { $sel:fileFormat:DestinationOptionsRequest' :: Maybe DestinationFileFormat
fileFormat =
        forall a. Maybe a
Prelude.Nothing,
      $sel:hiveCompatiblePartitions:DestinationOptionsRequest' :: Maybe Bool
hiveCompatiblePartitions = forall a. Maybe a
Prelude.Nothing,
      $sel:perHourPartition:DestinationOptionsRequest' :: Maybe Bool
perHourPartition = forall a. Maybe a
Prelude.Nothing
    }

-- | The format for the flow log. The default is @plain-text@.
destinationOptionsRequest_fileFormat :: Lens.Lens' DestinationOptionsRequest (Prelude.Maybe DestinationFileFormat)
destinationOptionsRequest_fileFormat :: Lens' DestinationOptionsRequest (Maybe DestinationFileFormat)
destinationOptionsRequest_fileFormat = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationOptionsRequest' {Maybe DestinationFileFormat
fileFormat :: Maybe DestinationFileFormat
$sel:fileFormat:DestinationOptionsRequest' :: DestinationOptionsRequest -> Maybe DestinationFileFormat
fileFormat} -> Maybe DestinationFileFormat
fileFormat) (\s :: DestinationOptionsRequest
s@DestinationOptionsRequest' {} Maybe DestinationFileFormat
a -> DestinationOptionsRequest
s {$sel:fileFormat:DestinationOptionsRequest' :: Maybe DestinationFileFormat
fileFormat = Maybe DestinationFileFormat
a} :: DestinationOptionsRequest)

-- | Indicates whether to use Hive-compatible prefixes for flow logs stored
-- in Amazon S3. The default is @false@.
destinationOptionsRequest_hiveCompatiblePartitions :: Lens.Lens' DestinationOptionsRequest (Prelude.Maybe Prelude.Bool)
destinationOptionsRequest_hiveCompatiblePartitions :: Lens' DestinationOptionsRequest (Maybe Bool)
destinationOptionsRequest_hiveCompatiblePartitions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationOptionsRequest' {Maybe Bool
hiveCompatiblePartitions :: Maybe Bool
$sel:hiveCompatiblePartitions:DestinationOptionsRequest' :: DestinationOptionsRequest -> Maybe Bool
hiveCompatiblePartitions} -> Maybe Bool
hiveCompatiblePartitions) (\s :: DestinationOptionsRequest
s@DestinationOptionsRequest' {} Maybe Bool
a -> DestinationOptionsRequest
s {$sel:hiveCompatiblePartitions:DestinationOptionsRequest' :: Maybe Bool
hiveCompatiblePartitions = Maybe Bool
a} :: DestinationOptionsRequest)

-- | Indicates whether to partition the flow log per hour. This reduces the
-- cost and response time for queries. The default is @false@.
destinationOptionsRequest_perHourPartition :: Lens.Lens' DestinationOptionsRequest (Prelude.Maybe Prelude.Bool)
destinationOptionsRequest_perHourPartition :: Lens' DestinationOptionsRequest (Maybe Bool)
destinationOptionsRequest_perHourPartition = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DestinationOptionsRequest' {Maybe Bool
perHourPartition :: Maybe Bool
$sel:perHourPartition:DestinationOptionsRequest' :: DestinationOptionsRequest -> Maybe Bool
perHourPartition} -> Maybe Bool
perHourPartition) (\s :: DestinationOptionsRequest
s@DestinationOptionsRequest' {} Maybe Bool
a -> DestinationOptionsRequest
s {$sel:perHourPartition:DestinationOptionsRequest' :: Maybe Bool
perHourPartition = Maybe Bool
a} :: DestinationOptionsRequest)

instance Prelude.Hashable DestinationOptionsRequest where
  hashWithSalt :: Int -> DestinationOptionsRequest -> Int
hashWithSalt Int
_salt DestinationOptionsRequest' {Maybe Bool
Maybe DestinationFileFormat
perHourPartition :: Maybe Bool
hiveCompatiblePartitions :: Maybe Bool
fileFormat :: Maybe DestinationFileFormat
$sel:perHourPartition:DestinationOptionsRequest' :: DestinationOptionsRequest -> Maybe Bool
$sel:hiveCompatiblePartitions:DestinationOptionsRequest' :: DestinationOptionsRequest -> Maybe Bool
$sel:fileFormat:DestinationOptionsRequest' :: DestinationOptionsRequest -> Maybe DestinationFileFormat
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DestinationFileFormat
fileFormat
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
hiveCompatiblePartitions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
perHourPartition

instance Prelude.NFData DestinationOptionsRequest where
  rnf :: DestinationOptionsRequest -> ()
rnf DestinationOptionsRequest' {Maybe Bool
Maybe DestinationFileFormat
perHourPartition :: Maybe Bool
hiveCompatiblePartitions :: Maybe Bool
fileFormat :: Maybe DestinationFileFormat
$sel:perHourPartition:DestinationOptionsRequest' :: DestinationOptionsRequest -> Maybe Bool
$sel:hiveCompatiblePartitions:DestinationOptionsRequest' :: DestinationOptionsRequest -> Maybe Bool
$sel:fileFormat:DestinationOptionsRequest' :: DestinationOptionsRequest -> Maybe DestinationFileFormat
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe DestinationFileFormat
fileFormat
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
hiveCompatiblePartitions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
perHourPartition

instance Data.ToQuery DestinationOptionsRequest where
  toQuery :: DestinationOptionsRequest -> QueryString
toQuery DestinationOptionsRequest' {Maybe Bool
Maybe DestinationFileFormat
perHourPartition :: Maybe Bool
hiveCompatiblePartitions :: Maybe Bool
fileFormat :: Maybe DestinationFileFormat
$sel:perHourPartition:DestinationOptionsRequest' :: DestinationOptionsRequest -> Maybe Bool
$sel:hiveCompatiblePartitions:DestinationOptionsRequest' :: DestinationOptionsRequest -> Maybe Bool
$sel:fileFormat:DestinationOptionsRequest' :: DestinationOptionsRequest -> Maybe DestinationFileFormat
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"FileFormat" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe DestinationFileFormat
fileFormat,
        ByteString
"HiveCompatiblePartitions"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
hiveCompatiblePartitions,
        ByteString
"PerHourPartition" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
perHourPartition
      ]