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

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

-- | Attributes of a custom routing accelerator.
--
-- /See:/ 'newCustomRoutingAcceleratorAttributes' smart constructor.
data CustomRoutingAcceleratorAttributes = 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 -> Maybe Text
flowLogsS3Prefix :: Prelude.Maybe Prelude.Text,
    -- | 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 /AWS 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 AWS Global Accelerator permission to write
    -- to the bucket.
    CustomRoutingAcceleratorAttributes -> Maybe Text
flowLogsS3Bucket :: Prelude.Maybe Prelude.Text
  }
  deriving (CustomRoutingAcceleratorAttributes
-> CustomRoutingAcceleratorAttributes -> Bool
(CustomRoutingAcceleratorAttributes
 -> CustomRoutingAcceleratorAttributes -> Bool)
-> (CustomRoutingAcceleratorAttributes
    -> CustomRoutingAcceleratorAttributes -> Bool)
-> Eq CustomRoutingAcceleratorAttributes
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]
(Int -> ReadS CustomRoutingAcceleratorAttributes)
-> ReadS [CustomRoutingAcceleratorAttributes]
-> ReadPrec CustomRoutingAcceleratorAttributes
-> ReadPrec [CustomRoutingAcceleratorAttributes]
-> Read 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
(Int -> CustomRoutingAcceleratorAttributes -> ShowS)
-> (CustomRoutingAcceleratorAttributes -> String)
-> ([CustomRoutingAcceleratorAttributes] -> ShowS)
-> Show CustomRoutingAcceleratorAttributes
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.
 CustomRoutingAcceleratorAttributes
 -> Rep CustomRoutingAcceleratorAttributes x)
-> (forall x.
    Rep CustomRoutingAcceleratorAttributes x
    -> CustomRoutingAcceleratorAttributes)
-> Generic CustomRoutingAcceleratorAttributes
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:
--
-- '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
--
-- '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 /AWS 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 AWS Global Accelerator permission to write
-- to the bucket.
newCustomRoutingAcceleratorAttributes ::
  CustomRoutingAcceleratorAttributes
newCustomRoutingAcceleratorAttributes :: CustomRoutingAcceleratorAttributes
newCustomRoutingAcceleratorAttributes =
  CustomRoutingAcceleratorAttributes' :: Maybe Text
-> Maybe Bool -> Maybe Text -> CustomRoutingAcceleratorAttributes
CustomRoutingAcceleratorAttributes'
    { $sel:flowLogsS3Prefix:CustomRoutingAcceleratorAttributes' :: Maybe Text
flowLogsS3Prefix =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:flowLogsEnabled:CustomRoutingAcceleratorAttributes' :: Maybe Bool
flowLogsEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:flowLogsS3Bucket:CustomRoutingAcceleratorAttributes' :: Maybe Text
flowLogsS3Bucket = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> CustomRoutingAcceleratorAttributes
-> f CustomRoutingAcceleratorAttributes
customRoutingAcceleratorAttributes_flowLogsS3Prefix = (CustomRoutingAcceleratorAttributes -> Maybe Text)
-> (CustomRoutingAcceleratorAttributes
    -> Maybe Text -> CustomRoutingAcceleratorAttributes)
-> Lens
     CustomRoutingAcceleratorAttributes
     CustomRoutingAcceleratorAttributes
     (Maybe Text)
     (Maybe Text)
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)

-- | 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 /AWS Global Accelerator Developer Guide/.
customRoutingAcceleratorAttributes_flowLogsEnabled :: Lens.Lens' CustomRoutingAcceleratorAttributes (Prelude.Maybe Prelude.Bool)
customRoutingAcceleratorAttributes_flowLogsEnabled :: (Maybe Bool -> f (Maybe Bool))
-> CustomRoutingAcceleratorAttributes
-> f CustomRoutingAcceleratorAttributes
customRoutingAcceleratorAttributes_flowLogsEnabled = (CustomRoutingAcceleratorAttributes -> Maybe Bool)
-> (CustomRoutingAcceleratorAttributes
    -> Maybe Bool -> CustomRoutingAcceleratorAttributes)
-> Lens
     CustomRoutingAcceleratorAttributes
     CustomRoutingAcceleratorAttributes
     (Maybe Bool)
     (Maybe Bool)
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 AWS Global Accelerator permission to write
-- to the bucket.
customRoutingAcceleratorAttributes_flowLogsS3Bucket :: Lens.Lens' CustomRoutingAcceleratorAttributes (Prelude.Maybe Prelude.Text)
customRoutingAcceleratorAttributes_flowLogsS3Bucket :: (Maybe Text -> f (Maybe Text))
-> CustomRoutingAcceleratorAttributes
-> f CustomRoutingAcceleratorAttributes
customRoutingAcceleratorAttributes_flowLogsS3Bucket = (CustomRoutingAcceleratorAttributes -> Maybe Text)
-> (CustomRoutingAcceleratorAttributes
    -> Maybe Text -> CustomRoutingAcceleratorAttributes)
-> Lens
     CustomRoutingAcceleratorAttributes
     CustomRoutingAcceleratorAttributes
     (Maybe Text)
     (Maybe Text)
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)

instance
  Core.FromJSON
    CustomRoutingAcceleratorAttributes
  where
  parseJSON :: Value -> Parser CustomRoutingAcceleratorAttributes
parseJSON =
    String
-> (Object -> Parser CustomRoutingAcceleratorAttributes)
-> Value
-> Parser CustomRoutingAcceleratorAttributes
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"CustomRoutingAcceleratorAttributes"
      ( \Object
x ->
          Maybe Text
-> Maybe Bool -> Maybe Text -> CustomRoutingAcceleratorAttributes
CustomRoutingAcceleratorAttributes'
            (Maybe Text
 -> Maybe Bool -> Maybe Text -> CustomRoutingAcceleratorAttributes)
-> Parser (Maybe Text)
-> Parser
     (Maybe Bool -> Maybe Text -> CustomRoutingAcceleratorAttributes)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FlowLogsS3Prefix")
            Parser
  (Maybe Bool -> Maybe Text -> CustomRoutingAcceleratorAttributes)
-> Parser (Maybe Bool)
-> Parser (Maybe Text -> CustomRoutingAcceleratorAttributes)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FlowLogsEnabled")
            Parser (Maybe Text -> CustomRoutingAcceleratorAttributes)
-> Parser (Maybe Text) -> Parser CustomRoutingAcceleratorAttributes
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"FlowLogsS3Bucket")
      )

instance
  Prelude.Hashable
    CustomRoutingAcceleratorAttributes

instance
  Prelude.NFData
    CustomRoutingAcceleratorAttributes