{-# 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.CodeBuild.Types.ResolvedArtifact
-- 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.CodeBuild.Types.ResolvedArtifact where

import Amazonka.CodeBuild.Types.ArtifactsType
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Represents a resolved build artifact. A resolved artifact is an artifact
-- that is built and deployed to the destination, such as Amazon S3.
--
-- /See:/ 'newResolvedArtifact' smart constructor.
data ResolvedArtifact = ResolvedArtifact'
  { -- | The location of the artifact.
    ResolvedArtifact -> Maybe Text
location :: Prelude.Maybe Prelude.Text,
    -- | The identifier of the artifact.
    ResolvedArtifact -> Maybe Text
identifier :: Prelude.Maybe Prelude.Text,
    -- | Specifies the type of artifact.
    ResolvedArtifact -> Maybe ArtifactsType
type' :: Prelude.Maybe ArtifactsType
  }
  deriving (ResolvedArtifact -> ResolvedArtifact -> Bool
(ResolvedArtifact -> ResolvedArtifact -> Bool)
-> (ResolvedArtifact -> ResolvedArtifact -> Bool)
-> Eq ResolvedArtifact
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResolvedArtifact -> ResolvedArtifact -> Bool
$c/= :: ResolvedArtifact -> ResolvedArtifact -> Bool
== :: ResolvedArtifact -> ResolvedArtifact -> Bool
$c== :: ResolvedArtifact -> ResolvedArtifact -> Bool
Prelude.Eq, ReadPrec [ResolvedArtifact]
ReadPrec ResolvedArtifact
Int -> ReadS ResolvedArtifact
ReadS [ResolvedArtifact]
(Int -> ReadS ResolvedArtifact)
-> ReadS [ResolvedArtifact]
-> ReadPrec ResolvedArtifact
-> ReadPrec [ResolvedArtifact]
-> Read ResolvedArtifact
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResolvedArtifact]
$creadListPrec :: ReadPrec [ResolvedArtifact]
readPrec :: ReadPrec ResolvedArtifact
$creadPrec :: ReadPrec ResolvedArtifact
readList :: ReadS [ResolvedArtifact]
$creadList :: ReadS [ResolvedArtifact]
readsPrec :: Int -> ReadS ResolvedArtifact
$creadsPrec :: Int -> ReadS ResolvedArtifact
Prelude.Read, Int -> ResolvedArtifact -> ShowS
[ResolvedArtifact] -> ShowS
ResolvedArtifact -> String
(Int -> ResolvedArtifact -> ShowS)
-> (ResolvedArtifact -> String)
-> ([ResolvedArtifact] -> ShowS)
-> Show ResolvedArtifact
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResolvedArtifact] -> ShowS
$cshowList :: [ResolvedArtifact] -> ShowS
show :: ResolvedArtifact -> String
$cshow :: ResolvedArtifact -> String
showsPrec :: Int -> ResolvedArtifact -> ShowS
$cshowsPrec :: Int -> ResolvedArtifact -> ShowS
Prelude.Show, (forall x. ResolvedArtifact -> Rep ResolvedArtifact x)
-> (forall x. Rep ResolvedArtifact x -> ResolvedArtifact)
-> Generic ResolvedArtifact
forall x. Rep ResolvedArtifact x -> ResolvedArtifact
forall x. ResolvedArtifact -> Rep ResolvedArtifact x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResolvedArtifact x -> ResolvedArtifact
$cfrom :: forall x. ResolvedArtifact -> Rep ResolvedArtifact x
Prelude.Generic)

-- |
-- Create a value of 'ResolvedArtifact' 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:
--
-- 'location', 'resolvedArtifact_location' - The location of the artifact.
--
-- 'identifier', 'resolvedArtifact_identifier' - The identifier of the artifact.
--
-- 'type'', 'resolvedArtifact_type' - Specifies the type of artifact.
newResolvedArtifact ::
  ResolvedArtifact
newResolvedArtifact :: ResolvedArtifact
newResolvedArtifact =
  ResolvedArtifact' :: Maybe Text -> Maybe Text -> Maybe ArtifactsType -> ResolvedArtifact
ResolvedArtifact'
    { $sel:location:ResolvedArtifact' :: Maybe Text
location = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:identifier:ResolvedArtifact' :: Maybe Text
identifier = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:type':ResolvedArtifact' :: Maybe ArtifactsType
type' = Maybe ArtifactsType
forall a. Maybe a
Prelude.Nothing
    }

-- | The location of the artifact.
resolvedArtifact_location :: Lens.Lens' ResolvedArtifact (Prelude.Maybe Prelude.Text)
resolvedArtifact_location :: (Maybe Text -> f (Maybe Text))
-> ResolvedArtifact -> f ResolvedArtifact
resolvedArtifact_location = (ResolvedArtifact -> Maybe Text)
-> (ResolvedArtifact -> Maybe Text -> ResolvedArtifact)
-> Lens ResolvedArtifact ResolvedArtifact (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolvedArtifact' {Maybe Text
location :: Maybe Text
$sel:location:ResolvedArtifact' :: ResolvedArtifact -> Maybe Text
location} -> Maybe Text
location) (\s :: ResolvedArtifact
s@ResolvedArtifact' {} Maybe Text
a -> ResolvedArtifact
s {$sel:location:ResolvedArtifact' :: Maybe Text
location = Maybe Text
a} :: ResolvedArtifact)

-- | The identifier of the artifact.
resolvedArtifact_identifier :: Lens.Lens' ResolvedArtifact (Prelude.Maybe Prelude.Text)
resolvedArtifact_identifier :: (Maybe Text -> f (Maybe Text))
-> ResolvedArtifact -> f ResolvedArtifact
resolvedArtifact_identifier = (ResolvedArtifact -> Maybe Text)
-> (ResolvedArtifact -> Maybe Text -> ResolvedArtifact)
-> Lens ResolvedArtifact ResolvedArtifact (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolvedArtifact' {Maybe Text
identifier :: Maybe Text
$sel:identifier:ResolvedArtifact' :: ResolvedArtifact -> Maybe Text
identifier} -> Maybe Text
identifier) (\s :: ResolvedArtifact
s@ResolvedArtifact' {} Maybe Text
a -> ResolvedArtifact
s {$sel:identifier:ResolvedArtifact' :: Maybe Text
identifier = Maybe Text
a} :: ResolvedArtifact)

-- | Specifies the type of artifact.
resolvedArtifact_type :: Lens.Lens' ResolvedArtifact (Prelude.Maybe ArtifactsType)
resolvedArtifact_type :: (Maybe ArtifactsType -> f (Maybe ArtifactsType))
-> ResolvedArtifact -> f ResolvedArtifact
resolvedArtifact_type = (ResolvedArtifact -> Maybe ArtifactsType)
-> (ResolvedArtifact -> Maybe ArtifactsType -> ResolvedArtifact)
-> Lens
     ResolvedArtifact
     ResolvedArtifact
     (Maybe ArtifactsType)
     (Maybe ArtifactsType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResolvedArtifact' {Maybe ArtifactsType
type' :: Maybe ArtifactsType
$sel:type':ResolvedArtifact' :: ResolvedArtifact -> Maybe ArtifactsType
type'} -> Maybe ArtifactsType
type') (\s :: ResolvedArtifact
s@ResolvedArtifact' {} Maybe ArtifactsType
a -> ResolvedArtifact
s {$sel:type':ResolvedArtifact' :: Maybe ArtifactsType
type' = Maybe ArtifactsType
a} :: ResolvedArtifact)

instance Core.FromJSON ResolvedArtifact where
  parseJSON :: Value -> Parser ResolvedArtifact
parseJSON =
    String
-> (Object -> Parser ResolvedArtifact)
-> Value
-> Parser ResolvedArtifact
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ResolvedArtifact"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe ArtifactsType -> ResolvedArtifact
ResolvedArtifact'
            (Maybe Text
 -> Maybe Text -> Maybe ArtifactsType -> ResolvedArtifact)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe ArtifactsType -> ResolvedArtifact)
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
"location")
            Parser (Maybe Text -> Maybe ArtifactsType -> ResolvedArtifact)
-> Parser (Maybe Text)
-> Parser (Maybe ArtifactsType -> ResolvedArtifact)
forall (f :: * -> *) a b. Applicative f => 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
"identifier")
            Parser (Maybe ArtifactsType -> ResolvedArtifact)
-> Parser (Maybe ArtifactsType) -> Parser ResolvedArtifact
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe ArtifactsType)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"type")
      )

instance Prelude.Hashable ResolvedArtifact

instance Prelude.NFData ResolvedArtifact