{-# 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.SSM.Types.S3OutputLocation
-- 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.SSM.Types.S3OutputLocation 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

-- | An S3 bucket where you want to store the results of this request.
--
-- /See:/ 'newS3OutputLocation' smart constructor.
data S3OutputLocation = S3OutputLocation'
  { -- | The name of the S3 bucket.
    S3OutputLocation -> Maybe Text
outputS3BucketName :: Prelude.Maybe Prelude.Text,
    -- | The S3 bucket subfolder.
    S3OutputLocation -> Maybe Text
outputS3KeyPrefix :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services Region of the S3 bucket.
    S3OutputLocation -> Maybe Text
outputS3Region :: Prelude.Maybe Prelude.Text
  }
  deriving (S3OutputLocation -> S3OutputLocation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3OutputLocation -> S3OutputLocation -> Bool
$c/= :: S3OutputLocation -> S3OutputLocation -> Bool
== :: S3OutputLocation -> S3OutputLocation -> Bool
$c== :: S3OutputLocation -> S3OutputLocation -> Bool
Prelude.Eq, ReadPrec [S3OutputLocation]
ReadPrec S3OutputLocation
Int -> ReadS S3OutputLocation
ReadS [S3OutputLocation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3OutputLocation]
$creadListPrec :: ReadPrec [S3OutputLocation]
readPrec :: ReadPrec S3OutputLocation
$creadPrec :: ReadPrec S3OutputLocation
readList :: ReadS [S3OutputLocation]
$creadList :: ReadS [S3OutputLocation]
readsPrec :: Int -> ReadS S3OutputLocation
$creadsPrec :: Int -> ReadS S3OutputLocation
Prelude.Read, Int -> S3OutputLocation -> ShowS
[S3OutputLocation] -> ShowS
S3OutputLocation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3OutputLocation] -> ShowS
$cshowList :: [S3OutputLocation] -> ShowS
show :: S3OutputLocation -> String
$cshow :: S3OutputLocation -> String
showsPrec :: Int -> S3OutputLocation -> ShowS
$cshowsPrec :: Int -> S3OutputLocation -> ShowS
Prelude.Show, forall x. Rep S3OutputLocation x -> S3OutputLocation
forall x. S3OutputLocation -> Rep S3OutputLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3OutputLocation x -> S3OutputLocation
$cfrom :: forall x. S3OutputLocation -> Rep S3OutputLocation x
Prelude.Generic)

-- |
-- Create a value of 'S3OutputLocation' 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:
--
-- 'outputS3BucketName', 's3OutputLocation_outputS3BucketName' - The name of the S3 bucket.
--
-- 'outputS3KeyPrefix', 's3OutputLocation_outputS3KeyPrefix' - The S3 bucket subfolder.
--
-- 'outputS3Region', 's3OutputLocation_outputS3Region' - The Amazon Web Services Region of the S3 bucket.
newS3OutputLocation ::
  S3OutputLocation
newS3OutputLocation :: S3OutputLocation
newS3OutputLocation =
  S3OutputLocation'
    { $sel:outputS3BucketName:S3OutputLocation' :: Maybe Text
outputS3BucketName =
        forall a. Maybe a
Prelude.Nothing,
      $sel:outputS3KeyPrefix:S3OutputLocation' :: Maybe Text
outputS3KeyPrefix = forall a. Maybe a
Prelude.Nothing,
      $sel:outputS3Region:S3OutputLocation' :: Maybe Text
outputS3Region = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the S3 bucket.
s3OutputLocation_outputS3BucketName :: Lens.Lens' S3OutputLocation (Prelude.Maybe Prelude.Text)
s3OutputLocation_outputS3BucketName :: Lens' S3OutputLocation (Maybe Text)
s3OutputLocation_outputS3BucketName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3OutputLocation' {Maybe Text
outputS3BucketName :: Maybe Text
$sel:outputS3BucketName:S3OutputLocation' :: S3OutputLocation -> Maybe Text
outputS3BucketName} -> Maybe Text
outputS3BucketName) (\s :: S3OutputLocation
s@S3OutputLocation' {} Maybe Text
a -> S3OutputLocation
s {$sel:outputS3BucketName:S3OutputLocation' :: Maybe Text
outputS3BucketName = Maybe Text
a} :: S3OutputLocation)

-- | The S3 bucket subfolder.
s3OutputLocation_outputS3KeyPrefix :: Lens.Lens' S3OutputLocation (Prelude.Maybe Prelude.Text)
s3OutputLocation_outputS3KeyPrefix :: Lens' S3OutputLocation (Maybe Text)
s3OutputLocation_outputS3KeyPrefix = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3OutputLocation' {Maybe Text
outputS3KeyPrefix :: Maybe Text
$sel:outputS3KeyPrefix:S3OutputLocation' :: S3OutputLocation -> Maybe Text
outputS3KeyPrefix} -> Maybe Text
outputS3KeyPrefix) (\s :: S3OutputLocation
s@S3OutputLocation' {} Maybe Text
a -> S3OutputLocation
s {$sel:outputS3KeyPrefix:S3OutputLocation' :: Maybe Text
outputS3KeyPrefix = Maybe Text
a} :: S3OutputLocation)

-- | The Amazon Web Services Region of the S3 bucket.
s3OutputLocation_outputS3Region :: Lens.Lens' S3OutputLocation (Prelude.Maybe Prelude.Text)
s3OutputLocation_outputS3Region :: Lens' S3OutputLocation (Maybe Text)
s3OutputLocation_outputS3Region = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3OutputLocation' {Maybe Text
outputS3Region :: Maybe Text
$sel:outputS3Region:S3OutputLocation' :: S3OutputLocation -> Maybe Text
outputS3Region} -> Maybe Text
outputS3Region) (\s :: S3OutputLocation
s@S3OutputLocation' {} Maybe Text
a -> S3OutputLocation
s {$sel:outputS3Region:S3OutputLocation' :: Maybe Text
outputS3Region = Maybe Text
a} :: S3OutputLocation)

instance Data.FromJSON S3OutputLocation where
  parseJSON :: Value -> Parser S3OutputLocation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"S3OutputLocation"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> S3OutputLocation
S3OutputLocation'
            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
"OutputS3BucketName")
            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
"OutputS3KeyPrefix")
            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
"OutputS3Region")
      )

instance Prelude.Hashable S3OutputLocation where
  hashWithSalt :: Int -> S3OutputLocation -> Int
hashWithSalt Int
_salt S3OutputLocation' {Maybe Text
outputS3Region :: Maybe Text
outputS3KeyPrefix :: Maybe Text
outputS3BucketName :: Maybe Text
$sel:outputS3Region:S3OutputLocation' :: S3OutputLocation -> Maybe Text
$sel:outputS3KeyPrefix:S3OutputLocation' :: S3OutputLocation -> Maybe Text
$sel:outputS3BucketName:S3OutputLocation' :: S3OutputLocation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
outputS3BucketName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
outputS3KeyPrefix
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
outputS3Region

instance Prelude.NFData S3OutputLocation where
  rnf :: S3OutputLocation -> ()
rnf S3OutputLocation' {Maybe Text
outputS3Region :: Maybe Text
outputS3KeyPrefix :: Maybe Text
outputS3BucketName :: Maybe Text
$sel:outputS3Region:S3OutputLocation' :: S3OutputLocation -> Maybe Text
$sel:outputS3KeyPrefix:S3OutputLocation' :: S3OutputLocation -> Maybe Text
$sel:outputS3BucketName:S3OutputLocation' :: S3OutputLocation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
outputS3BucketName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
outputS3KeyPrefix
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
outputS3Region

instance Data.ToJSON S3OutputLocation where
  toJSON :: S3OutputLocation -> Value
toJSON S3OutputLocation' {Maybe Text
outputS3Region :: Maybe Text
outputS3KeyPrefix :: Maybe Text
outputS3BucketName :: Maybe Text
$sel:outputS3Region:S3OutputLocation' :: S3OutputLocation -> Maybe Text
$sel:outputS3KeyPrefix:S3OutputLocation' :: S3OutputLocation -> Maybe Text
$sel:outputS3BucketName:S3OutputLocation' :: S3OutputLocation -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"OutputS3BucketName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
outputS3BucketName,
            (Key
"OutputS3KeyPrefix" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
outputS3KeyPrefix,
            (Key
"OutputS3Region" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
outputS3Region
          ]
      )