{-# 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.GlobalAccelerator.Types.CustomRoutingAcceleratorAttributes
-- 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.GlobalAccelerator.Types.CustomRoutingAcceleratorAttributes 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

-- | Attributes of a custom routing accelerator.
--
-- /See:/ 'newCustomRoutingAcceleratorAttributes' smart constructor.
data CustomRoutingAcceleratorAttributes = CustomRoutingAcceleratorAttributes'
  { -- | Indicates whether flow logs are enabled. The default value is false. If
    -- the value is true, @FlowLogsS3Bucket@ and @FlowLogsS3Prefix@ must be
    -- specified.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/global-accelerator/latest/dg/monitoring-global-accelerator.flow-logs.html Flow logs>
    -- in the /Global Accelerator Developer Guide/.
    CustomRoutingAcceleratorAttributes -> Maybe Bool
flowLogsEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The name of the Amazon S3 bucket for the flow logs. Attribute is
    -- required if @FlowLogsEnabled@ is @true@. The bucket must exist and have
    -- a bucket policy that grants Global Accelerator permission to write to
    -- the bucket.
    CustomRoutingAcceleratorAttributes -> Maybe Text
flowLogsS3Bucket :: Prelude.Maybe Prelude.Text,
    -- | The prefix for the location in the Amazon S3 bucket for the flow logs.
    -- Attribute is required if @FlowLogsEnabled@ is @true@.
    --
    -- If you don’t specify a prefix, the flow logs are stored in the root of
    -- the bucket. If you specify slash (\/) for the S3 bucket prefix, the log
    -- file bucket folder structure will include a double slash (\/\/), like
    -- the following:
    --
    -- DOC-EXAMPLE-BUCKET\/\/AWSLogs\/aws_account_id
    CustomRoutingAcceleratorAttributes -> Maybe Text
flowLogsS3Prefix :: Prelude.Maybe Prelude.Text
  }
  deriving (CustomRoutingAcceleratorAttributes
-> CustomRoutingAcceleratorAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CustomRoutingAcceleratorAttributes
-> CustomRoutingAcceleratorAttributes -> Bool
$c/= :: CustomRoutingAcceleratorAttributes
-> CustomRoutingAcceleratorAttributes -> Bool
== :: CustomRoutingAcceleratorAttributes
-> CustomRoutingAcceleratorAttributes -> Bool
$c== :: CustomRoutingAcceleratorAttributes
-> CustomRoutingAcceleratorAttributes -> Bool
Prelude.Eq, ReadPrec [CustomRoutingAcceleratorAttributes]
ReadPrec CustomRoutingAcceleratorAttributes
Int -> ReadS CustomRoutingAcceleratorAttributes
ReadS [CustomRoutingAcceleratorAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CustomRoutingAcceleratorAttributes]
$creadListPrec :: ReadPrec [CustomRoutingAcceleratorAttributes]
readPrec :: ReadPrec CustomRoutingAcceleratorAttributes
$creadPrec :: ReadPrec CustomRoutingAcceleratorAttributes
readList :: ReadS [CustomRoutingAcceleratorAttributes]
$creadList :: ReadS [CustomRoutingAcceleratorAttributes]
readsPrec :: Int -> ReadS CustomRoutingAcceleratorAttributes
$creadsPrec :: Int -> ReadS CustomRoutingAcceleratorAttributes
Prelude.Read, Int -> CustomRoutingAcceleratorAttributes -> ShowS
[CustomRoutingAcceleratorAttributes] -> ShowS
CustomRoutingAcceleratorAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CustomRoutingAcceleratorAttributes] -> ShowS
$cshowList :: [CustomRoutingAcceleratorAttributes] -> ShowS
show :: CustomRoutingAcceleratorAttributes -> String
$cshow :: CustomRoutingAcceleratorAttributes -> String
showsPrec :: Int -> CustomRoutingAcceleratorAttributes -> ShowS
$cshowsPrec :: Int -> CustomRoutingAcceleratorAttributes -> ShowS
Prelude.Show, forall x.
Rep CustomRoutingAcceleratorAttributes x
-> CustomRoutingAcceleratorAttributes
forall x.
CustomRoutingAcceleratorAttributes
-> Rep CustomRoutingAcceleratorAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CustomRoutingAcceleratorAttributes x
-> CustomRoutingAcceleratorAttributes
$cfrom :: forall x.
CustomRoutingAcceleratorAttributes
-> Rep CustomRoutingAcceleratorAttributes x
Prelude.Generic)

-- |
-- Create a value of 'CustomRoutingAcceleratorAttributes' 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:
--
-- 'flowLogsEnabled', 'customRoutingAcceleratorAttributes_flowLogsEnabled' - Indicates whether flow logs are enabled. The default value is false. If
-- the value is true, @FlowLogsS3Bucket@ and @FlowLogsS3Prefix@ must be
-- specified.
--
-- For more information, see
-- <https://docs.aws.amazon.com/global-accelerator/latest/dg/monitoring-global-accelerator.flow-logs.html Flow logs>
-- in the /Global Accelerator Developer Guide/.
--
-- 'flowLogsS3Bucket', 'customRoutingAcceleratorAttributes_flowLogsS3Bucket' - The name of the Amazon S3 bucket for the flow logs. Attribute is
-- required if @FlowLogsEnabled@ is @true@. The bucket must exist and have
-- a bucket policy that grants Global Accelerator permission to write to
-- the bucket.
--
-- 'flowLogsS3Prefix', 'customRoutingAcceleratorAttributes_flowLogsS3Prefix' - The prefix for the location in the Amazon S3 bucket for the flow logs.
-- Attribute is required if @FlowLogsEnabled@ is @true@.
--
-- If you don’t specify a prefix, the flow logs are stored in the root of
-- the bucket. If you specify slash (\/) for the S3 bucket prefix, the log
-- file bucket folder structure will include a double slash (\/\/), like
-- the following:
--
-- DOC-EXAMPLE-BUCKET\/\/AWSLogs\/aws_account_id
newCustomRoutingAcceleratorAttributes ::
  CustomRoutingAcceleratorAttributes
newCustomRoutingAcceleratorAttributes :: CustomRoutingAcceleratorAttributes
newCustomRoutingAcceleratorAttributes =
  CustomRoutingAcceleratorAttributes'
    { $sel:flowLogsEnabled:CustomRoutingAcceleratorAttributes' :: Maybe Bool
flowLogsEnabled =
        forall a. Maybe a
Prelude.Nothing,
      $sel:flowLogsS3Bucket:CustomRoutingAcceleratorAttributes' :: Maybe Text
flowLogsS3Bucket = forall a. Maybe a
Prelude.Nothing,
      $sel:flowLogsS3Prefix:CustomRoutingAcceleratorAttributes' :: Maybe Text
flowLogsS3Prefix = forall a. Maybe a
Prelude.Nothing
    }

-- | Indicates whether flow logs are enabled. The default value is false. If
-- the value is true, @FlowLogsS3Bucket@ and @FlowLogsS3Prefix@ must be
-- specified.
--
-- For more information, see
-- <https://docs.aws.amazon.com/global-accelerator/latest/dg/monitoring-global-accelerator.flow-logs.html Flow logs>
-- in the /Global Accelerator Developer Guide/.
customRoutingAcceleratorAttributes_flowLogsEnabled :: Lens.Lens' CustomRoutingAcceleratorAttributes (Prelude.Maybe Prelude.Bool)
customRoutingAcceleratorAttributes_flowLogsEnabled :: Lens' CustomRoutingAcceleratorAttributes (Maybe Bool)
customRoutingAcceleratorAttributes_flowLogsEnabled = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomRoutingAcceleratorAttributes' {Maybe Bool
flowLogsEnabled :: Maybe Bool
$sel:flowLogsEnabled:CustomRoutingAcceleratorAttributes' :: CustomRoutingAcceleratorAttributes -> Maybe Bool
flowLogsEnabled} -> Maybe Bool
flowLogsEnabled) (\s :: CustomRoutingAcceleratorAttributes
s@CustomRoutingAcceleratorAttributes' {} Maybe Bool
a -> CustomRoutingAcceleratorAttributes
s {$sel:flowLogsEnabled:CustomRoutingAcceleratorAttributes' :: Maybe Bool
flowLogsEnabled = Maybe Bool
a} :: CustomRoutingAcceleratorAttributes)

-- | The name of the Amazon S3 bucket for the flow logs. Attribute is
-- required if @FlowLogsEnabled@ is @true@. The bucket must exist and have
-- a bucket policy that grants Global Accelerator permission to write to
-- the bucket.
customRoutingAcceleratorAttributes_flowLogsS3Bucket :: Lens.Lens' CustomRoutingAcceleratorAttributes (Prelude.Maybe Prelude.Text)
customRoutingAcceleratorAttributes_flowLogsS3Bucket :: Lens' CustomRoutingAcceleratorAttributes (Maybe Text)
customRoutingAcceleratorAttributes_flowLogsS3Bucket = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomRoutingAcceleratorAttributes' {Maybe Text
flowLogsS3Bucket :: Maybe Text
$sel:flowLogsS3Bucket:CustomRoutingAcceleratorAttributes' :: CustomRoutingAcceleratorAttributes -> Maybe Text
flowLogsS3Bucket} -> Maybe Text
flowLogsS3Bucket) (\s :: CustomRoutingAcceleratorAttributes
s@CustomRoutingAcceleratorAttributes' {} Maybe Text
a -> CustomRoutingAcceleratorAttributes
s {$sel:flowLogsS3Bucket:CustomRoutingAcceleratorAttributes' :: Maybe Text
flowLogsS3Bucket = Maybe Text
a} :: CustomRoutingAcceleratorAttributes)

-- | The prefix for the location in the Amazon S3 bucket for the flow logs.
-- Attribute is required if @FlowLogsEnabled@ is @true@.
--
-- If you don’t specify a prefix, the flow logs are stored in the root of
-- the bucket. If you specify slash (\/) for the S3 bucket prefix, the log
-- file bucket folder structure will include a double slash (\/\/), like
-- the following:
--
-- DOC-EXAMPLE-BUCKET\/\/AWSLogs\/aws_account_id
customRoutingAcceleratorAttributes_flowLogsS3Prefix :: Lens.Lens' CustomRoutingAcceleratorAttributes (Prelude.Maybe Prelude.Text)
customRoutingAcceleratorAttributes_flowLogsS3Prefix :: Lens' CustomRoutingAcceleratorAttributes (Maybe Text)
customRoutingAcceleratorAttributes_flowLogsS3Prefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CustomRoutingAcceleratorAttributes' {Maybe Text
flowLogsS3Prefix :: Maybe Text
$sel:flowLogsS3Prefix:CustomRoutingAcceleratorAttributes' :: CustomRoutingAcceleratorAttributes -> Maybe Text
flowLogsS3Prefix} -> Maybe Text
flowLogsS3Prefix) (\s :: CustomRoutingAcceleratorAttributes
s@CustomRoutingAcceleratorAttributes' {} Maybe Text
a -> CustomRoutingAcceleratorAttributes
s {$sel:flowLogsS3Prefix:CustomRoutingAcceleratorAttributes' :: Maybe Text
flowLogsS3Prefix = Maybe Text
a} :: CustomRoutingAcceleratorAttributes)

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

instance
  Prelude.Hashable
    CustomRoutingAcceleratorAttributes
  where
  hashWithSalt :: Int -> CustomRoutingAcceleratorAttributes -> Int
hashWithSalt
    Int
_salt
    CustomRoutingAcceleratorAttributes' {Maybe Bool
Maybe Text
flowLogsS3Prefix :: Maybe Text
flowLogsS3Bucket :: Maybe Text
flowLogsEnabled :: Maybe Bool
$sel:flowLogsS3Prefix:CustomRoutingAcceleratorAttributes' :: CustomRoutingAcceleratorAttributes -> Maybe Text
$sel:flowLogsS3Bucket:CustomRoutingAcceleratorAttributes' :: CustomRoutingAcceleratorAttributes -> Maybe Text
$sel:flowLogsEnabled:CustomRoutingAcceleratorAttributes' :: CustomRoutingAcceleratorAttributes -> Maybe Bool
..} =
      Int
_salt
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
flowLogsEnabled
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
flowLogsS3Bucket
        forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
flowLogsS3Prefix

instance
  Prelude.NFData
    CustomRoutingAcceleratorAttributes
  where
  rnf :: CustomRoutingAcceleratorAttributes -> ()
rnf CustomRoutingAcceleratorAttributes' {Maybe Bool
Maybe Text
flowLogsS3Prefix :: Maybe Text
flowLogsS3Bucket :: Maybe Text
flowLogsEnabled :: Maybe Bool
$sel:flowLogsS3Prefix:CustomRoutingAcceleratorAttributes' :: CustomRoutingAcceleratorAttributes -> Maybe Text
$sel:flowLogsS3Bucket:CustomRoutingAcceleratorAttributes' :: CustomRoutingAcceleratorAttributes -> Maybe Text
$sel:flowLogsEnabled:CustomRoutingAcceleratorAttributes' :: CustomRoutingAcceleratorAttributes -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
flowLogsEnabled
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
flowLogsS3Bucket
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
flowLogsS3Prefix