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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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
(S3ArtifactLocation -> S3ArtifactLocation -> Bool)
-> (S3ArtifactLocation -> S3ArtifactLocation -> Bool)
-> Eq S3ArtifactLocation
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]
(Int -> ReadS S3ArtifactLocation)
-> ReadS [S3ArtifactLocation]
-> ReadPrec S3ArtifactLocation
-> ReadPrec [S3ArtifactLocation]
-> Read 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
(Int -> S3ArtifactLocation -> ShowS)
-> (S3ArtifactLocation -> String)
-> ([S3ArtifactLocation] -> ShowS)
-> Show S3ArtifactLocation
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. S3ArtifactLocation -> Rep S3ArtifactLocation x)
-> (forall x. Rep S3ArtifactLocation x -> S3ArtifactLocation)
-> Generic S3ArtifactLocation
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' :: Text -> Text -> S3ArtifactLocation
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 :: (Text -> f Text) -> S3ArtifactLocation -> f S3ArtifactLocation
s3ArtifactLocation_bucketName = (S3ArtifactLocation -> Text)
-> (S3ArtifactLocation -> Text -> S3ArtifactLocation)
-> Lens S3ArtifactLocation S3ArtifactLocation Text Text
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 :: (Text -> f Text) -> S3ArtifactLocation -> f S3ArtifactLocation
s3ArtifactLocation_objectKey = (S3ArtifactLocation -> Text)
-> (S3ArtifactLocation -> Text -> S3ArtifactLocation)
-> Lens S3ArtifactLocation S3ArtifactLocation Text Text
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 Core.FromJSON S3ArtifactLocation where
  parseJSON :: Value -> Parser S3ArtifactLocation
parseJSON =
    String
-> (Object -> Parser S3ArtifactLocation)
-> Value
-> Parser S3ArtifactLocation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"S3ArtifactLocation"
      ( \Object
x ->
          Text -> Text -> S3ArtifactLocation
S3ArtifactLocation'
            (Text -> Text -> S3ArtifactLocation)
-> Parser Text -> Parser (Text -> S3ArtifactLocation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"bucketName")
            Parser (Text -> S3ArtifactLocation)
-> Parser Text -> Parser S3ArtifactLocation
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"objectKey")
      )

instance Prelude.Hashable S3ArtifactLocation

instance Prelude.NFData S3ArtifactLocation