{-# 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.AcceleratorAttributes
-- 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.AcceleratorAttributes where

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

-- | Attributes of an accelerator.
--
-- /See:/ 'newAcceleratorAttributes' smart constructor.
data AcceleratorAttributes = AcceleratorAttributes'
  { -- | 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:
    --
    -- s3-bucket_name\/\/AWSLogs\/aws_account_id
    AcceleratorAttributes -> 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/.
    AcceleratorAttributes -> 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.
    AcceleratorAttributes -> Maybe Text
flowLogsS3Bucket :: Prelude.Maybe Prelude.Text
  }
  deriving (AcceleratorAttributes -> AcceleratorAttributes -> Bool
(AcceleratorAttributes -> AcceleratorAttributes -> Bool)
-> (AcceleratorAttributes -> AcceleratorAttributes -> Bool)
-> Eq AcceleratorAttributes
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AcceleratorAttributes -> AcceleratorAttributes -> Bool
$c/= :: AcceleratorAttributes -> AcceleratorAttributes -> Bool
== :: AcceleratorAttributes -> AcceleratorAttributes -> Bool
$c== :: AcceleratorAttributes -> AcceleratorAttributes -> Bool
Prelude.Eq, ReadPrec [AcceleratorAttributes]
ReadPrec AcceleratorAttributes
Int -> ReadS AcceleratorAttributes
ReadS [AcceleratorAttributes]
(Int -> ReadS AcceleratorAttributes)
-> ReadS [AcceleratorAttributes]
-> ReadPrec AcceleratorAttributes
-> ReadPrec [AcceleratorAttributes]
-> Read AcceleratorAttributes
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AcceleratorAttributes]
$creadListPrec :: ReadPrec [AcceleratorAttributes]
readPrec :: ReadPrec AcceleratorAttributes
$creadPrec :: ReadPrec AcceleratorAttributes
readList :: ReadS [AcceleratorAttributes]
$creadList :: ReadS [AcceleratorAttributes]
readsPrec :: Int -> ReadS AcceleratorAttributes
$creadsPrec :: Int -> ReadS AcceleratorAttributes
Prelude.Read, Int -> AcceleratorAttributes -> ShowS
[AcceleratorAttributes] -> ShowS
AcceleratorAttributes -> String
(Int -> AcceleratorAttributes -> ShowS)
-> (AcceleratorAttributes -> String)
-> ([AcceleratorAttributes] -> ShowS)
-> Show AcceleratorAttributes
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AcceleratorAttributes] -> ShowS
$cshowList :: [AcceleratorAttributes] -> ShowS
show :: AcceleratorAttributes -> String
$cshow :: AcceleratorAttributes -> String
showsPrec :: Int -> AcceleratorAttributes -> ShowS
$cshowsPrec :: Int -> AcceleratorAttributes -> ShowS
Prelude.Show, (forall x. AcceleratorAttributes -> Rep AcceleratorAttributes x)
-> (forall x. Rep AcceleratorAttributes x -> AcceleratorAttributes)
-> Generic AcceleratorAttributes
forall x. Rep AcceleratorAttributes x -> AcceleratorAttributes
forall x. AcceleratorAttributes -> Rep AcceleratorAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AcceleratorAttributes x -> AcceleratorAttributes
$cfrom :: forall x. AcceleratorAttributes -> Rep AcceleratorAttributes x
Prelude.Generic)

-- |
-- Create a value of 'AcceleratorAttributes' 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', 'acceleratorAttributes_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:
--
-- s3-bucket_name\/\/AWSLogs\/aws_account_id
--
-- 'flowLogsEnabled', 'acceleratorAttributes_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', 'acceleratorAttributes_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.
newAcceleratorAttributes ::
  AcceleratorAttributes
newAcceleratorAttributes :: AcceleratorAttributes
newAcceleratorAttributes =
  AcceleratorAttributes' :: Maybe Text -> Maybe Bool -> Maybe Text -> AcceleratorAttributes
AcceleratorAttributes'
    { $sel:flowLogsS3Prefix:AcceleratorAttributes' :: Maybe Text
flowLogsS3Prefix =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:flowLogsEnabled:AcceleratorAttributes' :: Maybe Bool
flowLogsEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:flowLogsS3Bucket:AcceleratorAttributes' :: 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:
--
-- s3-bucket_name\/\/AWSLogs\/aws_account_id
acceleratorAttributes_flowLogsS3Prefix :: Lens.Lens' AcceleratorAttributes (Prelude.Maybe Prelude.Text)
acceleratorAttributes_flowLogsS3Prefix :: (Maybe Text -> f (Maybe Text))
-> AcceleratorAttributes -> f AcceleratorAttributes
acceleratorAttributes_flowLogsS3Prefix = (AcceleratorAttributes -> Maybe Text)
-> (AcceleratorAttributes -> Maybe Text -> AcceleratorAttributes)
-> Lens
     AcceleratorAttributes
     AcceleratorAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceleratorAttributes' {Maybe Text
flowLogsS3Prefix :: Maybe Text
$sel:flowLogsS3Prefix:AcceleratorAttributes' :: AcceleratorAttributes -> Maybe Text
flowLogsS3Prefix} -> Maybe Text
flowLogsS3Prefix) (\s :: AcceleratorAttributes
s@AcceleratorAttributes' {} Maybe Text
a -> AcceleratorAttributes
s {$sel:flowLogsS3Prefix:AcceleratorAttributes' :: Maybe Text
flowLogsS3Prefix = Maybe Text
a} :: AcceleratorAttributes)

-- | 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/.
acceleratorAttributes_flowLogsEnabled :: Lens.Lens' AcceleratorAttributes (Prelude.Maybe Prelude.Bool)
acceleratorAttributes_flowLogsEnabled :: (Maybe Bool -> f (Maybe Bool))
-> AcceleratorAttributes -> f AcceleratorAttributes
acceleratorAttributes_flowLogsEnabled = (AcceleratorAttributes -> Maybe Bool)
-> (AcceleratorAttributes -> Maybe Bool -> AcceleratorAttributes)
-> Lens
     AcceleratorAttributes
     AcceleratorAttributes
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceleratorAttributes' {Maybe Bool
flowLogsEnabled :: Maybe Bool
$sel:flowLogsEnabled:AcceleratorAttributes' :: AcceleratorAttributes -> Maybe Bool
flowLogsEnabled} -> Maybe Bool
flowLogsEnabled) (\s :: AcceleratorAttributes
s@AcceleratorAttributes' {} Maybe Bool
a -> AcceleratorAttributes
s {$sel:flowLogsEnabled:AcceleratorAttributes' :: Maybe Bool
flowLogsEnabled = Maybe Bool
a} :: AcceleratorAttributes)

-- | 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.
acceleratorAttributes_flowLogsS3Bucket :: Lens.Lens' AcceleratorAttributes (Prelude.Maybe Prelude.Text)
acceleratorAttributes_flowLogsS3Bucket :: (Maybe Text -> f (Maybe Text))
-> AcceleratorAttributes -> f AcceleratorAttributes
acceleratorAttributes_flowLogsS3Bucket = (AcceleratorAttributes -> Maybe Text)
-> (AcceleratorAttributes -> Maybe Text -> AcceleratorAttributes)
-> Lens
     AcceleratorAttributes
     AcceleratorAttributes
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AcceleratorAttributes' {Maybe Text
flowLogsS3Bucket :: Maybe Text
$sel:flowLogsS3Bucket:AcceleratorAttributes' :: AcceleratorAttributes -> Maybe Text
flowLogsS3Bucket} -> Maybe Text
flowLogsS3Bucket) (\s :: AcceleratorAttributes
s@AcceleratorAttributes' {} Maybe Text
a -> AcceleratorAttributes
s {$sel:flowLogsS3Bucket:AcceleratorAttributes' :: Maybe Text
flowLogsS3Bucket = Maybe Text
a} :: AcceleratorAttributes)

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

instance Prelude.NFData AcceleratorAttributes