{-# 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.S3.Types.InventoryDestination
-- 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.S3.Types.InventoryDestination where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.S3.Internal
import Amazonka.S3.Types.InventoryS3BucketDestination

-- | Specifies the inventory configuration for an Amazon S3 bucket.
--
-- /See:/ 'newInventoryDestination' smart constructor.
data InventoryDestination = InventoryDestination'
  { -- | Contains the bucket name, file format, bucket owner (optional), and
    -- prefix (optional) where inventory results are published.
    InventoryDestination -> InventoryS3BucketDestination
s3BucketDestination :: InventoryS3BucketDestination
  }
  deriving (InventoryDestination -> InventoryDestination -> Bool
(InventoryDestination -> InventoryDestination -> Bool)
-> (InventoryDestination -> InventoryDestination -> Bool)
-> Eq InventoryDestination
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InventoryDestination -> InventoryDestination -> Bool
$c/= :: InventoryDestination -> InventoryDestination -> Bool
== :: InventoryDestination -> InventoryDestination -> Bool
$c== :: InventoryDestination -> InventoryDestination -> Bool
Prelude.Eq, Int -> InventoryDestination -> ShowS
[InventoryDestination] -> ShowS
InventoryDestination -> String
(Int -> InventoryDestination -> ShowS)
-> (InventoryDestination -> String)
-> ([InventoryDestination] -> ShowS)
-> Show InventoryDestination
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InventoryDestination] -> ShowS
$cshowList :: [InventoryDestination] -> ShowS
show :: InventoryDestination -> String
$cshow :: InventoryDestination -> String
showsPrec :: Int -> InventoryDestination -> ShowS
$cshowsPrec :: Int -> InventoryDestination -> ShowS
Prelude.Show, (forall x. InventoryDestination -> Rep InventoryDestination x)
-> (forall x. Rep InventoryDestination x -> InventoryDestination)
-> Generic InventoryDestination
forall x. Rep InventoryDestination x -> InventoryDestination
forall x. InventoryDestination -> Rep InventoryDestination x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InventoryDestination x -> InventoryDestination
$cfrom :: forall x. InventoryDestination -> Rep InventoryDestination x
Prelude.Generic)

-- |
-- Create a value of 'InventoryDestination' 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:
--
-- 's3BucketDestination', 'inventoryDestination_s3BucketDestination' - Contains the bucket name, file format, bucket owner (optional), and
-- prefix (optional) where inventory results are published.
newInventoryDestination ::
  -- | 's3BucketDestination'
  InventoryS3BucketDestination ->
  InventoryDestination
newInventoryDestination :: InventoryS3BucketDestination -> InventoryDestination
newInventoryDestination InventoryS3BucketDestination
pS3BucketDestination_ =
  InventoryDestination' :: InventoryS3BucketDestination -> InventoryDestination
InventoryDestination'
    { $sel:s3BucketDestination:InventoryDestination' :: InventoryS3BucketDestination
s3BucketDestination =
        InventoryS3BucketDestination
pS3BucketDestination_
    }

-- | Contains the bucket name, file format, bucket owner (optional), and
-- prefix (optional) where inventory results are published.
inventoryDestination_s3BucketDestination :: Lens.Lens' InventoryDestination InventoryS3BucketDestination
inventoryDestination_s3BucketDestination :: (InventoryS3BucketDestination -> f InventoryS3BucketDestination)
-> InventoryDestination -> f InventoryDestination
inventoryDestination_s3BucketDestination = (InventoryDestination -> InventoryS3BucketDestination)
-> (InventoryDestination
    -> InventoryS3BucketDestination -> InventoryDestination)
-> Lens
     InventoryDestination
     InventoryDestination
     InventoryS3BucketDestination
     InventoryS3BucketDestination
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InventoryDestination' {InventoryS3BucketDestination
s3BucketDestination :: InventoryS3BucketDestination
$sel:s3BucketDestination:InventoryDestination' :: InventoryDestination -> InventoryS3BucketDestination
s3BucketDestination} -> InventoryS3BucketDestination
s3BucketDestination) (\s :: InventoryDestination
s@InventoryDestination' {} InventoryS3BucketDestination
a -> InventoryDestination
s {$sel:s3BucketDestination:InventoryDestination' :: InventoryS3BucketDestination
s3BucketDestination = InventoryS3BucketDestination
a} :: InventoryDestination)

instance Core.FromXML InventoryDestination where
  parseXML :: [Node] -> Either String InventoryDestination
parseXML [Node]
x =
    InventoryS3BucketDestination -> InventoryDestination
InventoryDestination'
      (InventoryS3BucketDestination -> InventoryDestination)
-> Either String InventoryS3BucketDestination
-> Either String InventoryDestination
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String InventoryS3BucketDestination
forall a. FromXML a => [Node] -> Text -> Either String a
Core..@ Text
"S3BucketDestination")

instance Prelude.Hashable InventoryDestination

instance Prelude.NFData InventoryDestination

instance Core.ToXML InventoryDestination where
  toXML :: InventoryDestination -> XML
toXML InventoryDestination' {InventoryS3BucketDestination
s3BucketDestination :: InventoryS3BucketDestination
$sel:s3BucketDestination:InventoryDestination' :: InventoryDestination -> InventoryS3BucketDestination
..} =
    [XML] -> XML
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [Name
"S3BucketDestination" Name -> InventoryS3BucketDestination -> XML
forall a. ToXML a => Name -> a -> XML
Core.@= InventoryS3BucketDestination
s3BucketDestination]