{-# 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.ArtifactDetail
-- 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.ArtifactDetail where

import Amazonka.CodePipeline.Types.S3Location
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Artifact details for the action execution, such as the artifact
-- location.
--
-- /See:/ 'newArtifactDetail' smart constructor.
data ArtifactDetail = ArtifactDetail'
  { -- | The artifact object name for the action execution.
    ArtifactDetail -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The Amazon S3 artifact location for the action execution.
    ArtifactDetail -> Maybe S3Location
s3location :: Prelude.Maybe S3Location
  }
  deriving (ArtifactDetail -> ArtifactDetail -> Bool
(ArtifactDetail -> ArtifactDetail -> Bool)
-> (ArtifactDetail -> ArtifactDetail -> Bool) -> Eq ArtifactDetail
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ArtifactDetail -> ArtifactDetail -> Bool
$c/= :: ArtifactDetail -> ArtifactDetail -> Bool
== :: ArtifactDetail -> ArtifactDetail -> Bool
$c== :: ArtifactDetail -> ArtifactDetail -> Bool
Prelude.Eq, ReadPrec [ArtifactDetail]
ReadPrec ArtifactDetail
Int -> ReadS ArtifactDetail
ReadS [ArtifactDetail]
(Int -> ReadS ArtifactDetail)
-> ReadS [ArtifactDetail]
-> ReadPrec ArtifactDetail
-> ReadPrec [ArtifactDetail]
-> Read ArtifactDetail
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ArtifactDetail]
$creadListPrec :: ReadPrec [ArtifactDetail]
readPrec :: ReadPrec ArtifactDetail
$creadPrec :: ReadPrec ArtifactDetail
readList :: ReadS [ArtifactDetail]
$creadList :: ReadS [ArtifactDetail]
readsPrec :: Int -> ReadS ArtifactDetail
$creadsPrec :: Int -> ReadS ArtifactDetail
Prelude.Read, Int -> ArtifactDetail -> ShowS
[ArtifactDetail] -> ShowS
ArtifactDetail -> String
(Int -> ArtifactDetail -> ShowS)
-> (ArtifactDetail -> String)
-> ([ArtifactDetail] -> ShowS)
-> Show ArtifactDetail
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ArtifactDetail] -> ShowS
$cshowList :: [ArtifactDetail] -> ShowS
show :: ArtifactDetail -> String
$cshow :: ArtifactDetail -> String
showsPrec :: Int -> ArtifactDetail -> ShowS
$cshowsPrec :: Int -> ArtifactDetail -> ShowS
Prelude.Show, (forall x. ArtifactDetail -> Rep ArtifactDetail x)
-> (forall x. Rep ArtifactDetail x -> ArtifactDetail)
-> Generic ArtifactDetail
forall x. Rep ArtifactDetail x -> ArtifactDetail
forall x. ArtifactDetail -> Rep ArtifactDetail x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ArtifactDetail x -> ArtifactDetail
$cfrom :: forall x. ArtifactDetail -> Rep ArtifactDetail x
Prelude.Generic)

-- |
-- Create a value of 'ArtifactDetail' 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:
--
-- 'name', 'artifactDetail_name' - The artifact object name for the action execution.
--
-- 's3location', 'artifactDetail_s3location' - The Amazon S3 artifact location for the action execution.
newArtifactDetail ::
  ArtifactDetail
newArtifactDetail :: ArtifactDetail
newArtifactDetail =
  ArtifactDetail' :: Maybe Text -> Maybe S3Location -> ArtifactDetail
ArtifactDetail'
    { $sel:name:ArtifactDetail' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:s3location:ArtifactDetail' :: Maybe S3Location
s3location = Maybe S3Location
forall a. Maybe a
Prelude.Nothing
    }

-- | The artifact object name for the action execution.
artifactDetail_name :: Lens.Lens' ArtifactDetail (Prelude.Maybe Prelude.Text)
artifactDetail_name :: (Maybe Text -> f (Maybe Text))
-> ArtifactDetail -> f ArtifactDetail
artifactDetail_name = (ArtifactDetail -> Maybe Text)
-> (ArtifactDetail -> Maybe Text -> ArtifactDetail)
-> Lens ArtifactDetail ArtifactDetail (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArtifactDetail' {Maybe Text
name :: Maybe Text
$sel:name:ArtifactDetail' :: ArtifactDetail -> Maybe Text
name} -> Maybe Text
name) (\s :: ArtifactDetail
s@ArtifactDetail' {} Maybe Text
a -> ArtifactDetail
s {$sel:name:ArtifactDetail' :: Maybe Text
name = Maybe Text
a} :: ArtifactDetail)

-- | The Amazon S3 artifact location for the action execution.
artifactDetail_s3location :: Lens.Lens' ArtifactDetail (Prelude.Maybe S3Location)
artifactDetail_s3location :: (Maybe S3Location -> f (Maybe S3Location))
-> ArtifactDetail -> f ArtifactDetail
artifactDetail_s3location = (ArtifactDetail -> Maybe S3Location)
-> (ArtifactDetail -> Maybe S3Location -> ArtifactDetail)
-> Lens
     ArtifactDetail ArtifactDetail (Maybe S3Location) (Maybe S3Location)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArtifactDetail' {Maybe S3Location
s3location :: Maybe S3Location
$sel:s3location:ArtifactDetail' :: ArtifactDetail -> Maybe S3Location
s3location} -> Maybe S3Location
s3location) (\s :: ArtifactDetail
s@ArtifactDetail' {} Maybe S3Location
a -> ArtifactDetail
s {$sel:s3location:ArtifactDetail' :: Maybe S3Location
s3location = Maybe S3Location
a} :: ArtifactDetail)

instance Core.FromJSON ArtifactDetail where
  parseJSON :: Value -> Parser ArtifactDetail
parseJSON =
    String
-> (Object -> Parser ArtifactDetail)
-> Value
-> Parser ArtifactDetail
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ArtifactDetail"
      ( \Object
x ->
          Maybe Text -> Maybe S3Location -> ArtifactDetail
ArtifactDetail'
            (Maybe Text -> Maybe S3Location -> ArtifactDetail)
-> Parser (Maybe Text)
-> Parser (Maybe S3Location -> ArtifactDetail)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"name")
            Parser (Maybe S3Location -> ArtifactDetail)
-> Parser (Maybe S3Location) -> Parser ArtifactDetail
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe S3Location)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"s3location")
      )

instance Prelude.Hashable ArtifactDetail

instance Prelude.NFData ArtifactDetail