{-# 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.CodePipeline.Types.S3ArtifactLocation
-- 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.CodePipeline.Types.S3ArtifactLocation 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

-- | The location of the S3 bucket that contains a revision.
--
-- /See:/ 'newS3ArtifactLocation' smart constructor.
data S3ArtifactLocation = S3ArtifactLocation'
  { -- | The name of the S3 bucket.
    S3ArtifactLocation -> Text
bucketName :: Prelude.Text,
    -- | The key of the object in the S3 bucket, which uniquely identifies the
    -- object in the bucket.
    S3ArtifactLocation -> Text
objectKey :: Prelude.Text
  }
  deriving (S3ArtifactLocation -> S3ArtifactLocation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3ArtifactLocation -> S3ArtifactLocation -> Bool
$c/= :: S3ArtifactLocation -> S3ArtifactLocation -> Bool
== :: S3ArtifactLocation -> S3ArtifactLocation -> Bool
$c== :: S3ArtifactLocation -> S3ArtifactLocation -> Bool
Prelude.Eq, ReadPrec [S3ArtifactLocation]
ReadPrec S3ArtifactLocation
Int -> ReadS S3ArtifactLocation
ReadS [S3ArtifactLocation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3ArtifactLocation]
$creadListPrec :: ReadPrec [S3ArtifactLocation]
readPrec :: ReadPrec S3ArtifactLocation
$creadPrec :: ReadPrec S3ArtifactLocation
readList :: ReadS [S3ArtifactLocation]
$creadList :: ReadS [S3ArtifactLocation]
readsPrec :: Int -> ReadS S3ArtifactLocation
$creadsPrec :: Int -> ReadS S3ArtifactLocation
Prelude.Read, Int -> S3ArtifactLocation -> ShowS
[S3ArtifactLocation] -> ShowS
S3ArtifactLocation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3ArtifactLocation] -> ShowS
$cshowList :: [S3ArtifactLocation] -> ShowS
show :: S3ArtifactLocation -> String
$cshow :: S3ArtifactLocation -> String
showsPrec :: Int -> S3ArtifactLocation -> ShowS
$cshowsPrec :: Int -> S3ArtifactLocation -> ShowS
Prelude.Show, forall x. Rep S3ArtifactLocation x -> S3ArtifactLocation
forall x. S3ArtifactLocation -> Rep S3ArtifactLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3ArtifactLocation x -> S3ArtifactLocation
$cfrom :: forall x. S3ArtifactLocation -> Rep S3ArtifactLocation x
Prelude.Generic)

-- |
-- Create a value of 'S3ArtifactLocation' 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:
--
-- 'bucketName', 's3ArtifactLocation_bucketName' - The name of the S3 bucket.
--
-- 'objectKey', 's3ArtifactLocation_objectKey' - The key of the object in the S3 bucket, which uniquely identifies the
-- object in the bucket.
newS3ArtifactLocation ::
  -- | 'bucketName'
  Prelude.Text ->
  -- | 'objectKey'
  Prelude.Text ->
  S3ArtifactLocation
newS3ArtifactLocation :: Text -> Text -> S3ArtifactLocation
newS3ArtifactLocation Text
pBucketName_ Text
pObjectKey_ =
  S3ArtifactLocation'
    { $sel:bucketName:S3ArtifactLocation' :: Text
bucketName = Text
pBucketName_,
      $sel:objectKey:S3ArtifactLocation' :: Text
objectKey = Text
pObjectKey_
    }

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

-- | The key of the object in the S3 bucket, which uniquely identifies the
-- object in the bucket.
s3ArtifactLocation_objectKey :: Lens.Lens' S3ArtifactLocation Prelude.Text
s3ArtifactLocation_objectKey :: Lens' S3ArtifactLocation Text
s3ArtifactLocation_objectKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3ArtifactLocation' {Text
objectKey :: Text
$sel:objectKey:S3ArtifactLocation' :: S3ArtifactLocation -> Text
objectKey} -> Text
objectKey) (\s :: S3ArtifactLocation
s@S3ArtifactLocation' {} Text
a -> S3ArtifactLocation
s {$sel:objectKey:S3ArtifactLocation' :: Text
objectKey = Text
a} :: S3ArtifactLocation)

instance Data.FromJSON S3ArtifactLocation where
  parseJSON :: Value -> Parser S3ArtifactLocation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"S3ArtifactLocation"
      ( \Object
x ->
          Text -> Text -> S3ArtifactLocation
S3ArtifactLocation'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"bucketName")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"objectKey")
      )

instance Prelude.Hashable S3ArtifactLocation where
  hashWithSalt :: Int -> S3ArtifactLocation -> Int
hashWithSalt Int
_salt S3ArtifactLocation' {Text
objectKey :: Text
bucketName :: Text
$sel:objectKey:S3ArtifactLocation' :: S3ArtifactLocation -> Text
$sel:bucketName:S3ArtifactLocation' :: S3ArtifactLocation -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
bucketName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
objectKey

instance Prelude.NFData S3ArtifactLocation where
  rnf :: S3ArtifactLocation -> ()
rnf S3ArtifactLocation' {Text
objectKey :: Text
bucketName :: Text
$sel:objectKey:S3ArtifactLocation' :: S3ArtifactLocation -> Text
$sel:bucketName:S3ArtifactLocation' :: S3ArtifactLocation -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
bucketName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
objectKey