{-# 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-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.AcceleratorAttributes 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 an accelerator.
--
-- /See:/ 'newAcceleratorAttributes' smart constructor.
data AcceleratorAttributes = 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 /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 Global Accelerator permission to write to
    -- the bucket.
    AcceleratorAttributes -> 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 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
  }
  deriving (AcceleratorAttributes -> AcceleratorAttributes -> Bool
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]
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
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. 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:
--
-- '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 /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 Global Accelerator permission to write to
-- the bucket.
--
-- '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 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
newAcceleratorAttributes ::
  AcceleratorAttributes
newAcceleratorAttributes :: AcceleratorAttributes
newAcceleratorAttributes =
  AcceleratorAttributes'
    { $sel:flowLogsEnabled:AcceleratorAttributes' :: Maybe Bool
flowLogsEnabled =
        forall a. Maybe a
Prelude.Nothing,
      $sel:flowLogsS3Bucket:AcceleratorAttributes' :: Maybe Text
flowLogsS3Bucket = forall a. Maybe a
Prelude.Nothing,
      $sel:flowLogsS3Prefix:AcceleratorAttributes' :: 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/.
acceleratorAttributes_flowLogsEnabled :: Lens.Lens' AcceleratorAttributes (Prelude.Maybe Prelude.Bool)
acceleratorAttributes_flowLogsEnabled :: Lens' AcceleratorAttributes (Maybe Bool)
acceleratorAttributes_flowLogsEnabled = 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 Global Accelerator permission to write to
-- the bucket.
acceleratorAttributes_flowLogsS3Bucket :: Lens.Lens' AcceleratorAttributes (Prelude.Maybe Prelude.Text)
acceleratorAttributes_flowLogsS3Bucket :: Lens' AcceleratorAttributes (Maybe Text)
acceleratorAttributes_flowLogsS3Bucket = 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)

-- | The prefix for the location in the Amazon S3 bucket for the flow logs.
-- Attribute is required if @FlowLogsEnabled@ is @true@.
--
-- 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 :: Lens' AcceleratorAttributes (Maybe Text)
acceleratorAttributes_flowLogsS3Prefix = 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)

instance Data.FromJSON AcceleratorAttributes where
  parseJSON :: Value -> Parser AcceleratorAttributes
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"AcceleratorAttributes"
      ( \Object
x ->
          Maybe Bool -> Maybe Text -> Maybe Text -> AcceleratorAttributes
AcceleratorAttributes'
            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 AcceleratorAttributes where
  hashWithSalt :: Int -> AcceleratorAttributes -> Int
hashWithSalt Int
_salt AcceleratorAttributes' {Maybe Bool
Maybe Text
flowLogsS3Prefix :: Maybe Text
flowLogsS3Bucket :: Maybe Text
flowLogsEnabled :: Maybe Bool
$sel:flowLogsS3Prefix:AcceleratorAttributes' :: AcceleratorAttributes -> Maybe Text
$sel:flowLogsS3Bucket:AcceleratorAttributes' :: AcceleratorAttributes -> Maybe Text
$sel:flowLogsEnabled:AcceleratorAttributes' :: AcceleratorAttributes -> 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 AcceleratorAttributes where
  rnf :: AcceleratorAttributes -> ()
rnf AcceleratorAttributes' {Maybe Bool
Maybe Text
flowLogsS3Prefix :: Maybe Text
flowLogsS3Bucket :: Maybe Text
flowLogsEnabled :: Maybe Bool
$sel:flowLogsS3Prefix:AcceleratorAttributes' :: AcceleratorAttributes -> Maybe Text
$sel:flowLogsS3Bucket:AcceleratorAttributes' :: AcceleratorAttributes -> Maybe Text
$sel:flowLogsEnabled:AcceleratorAttributes' :: AcceleratorAttributes -> 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