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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the build badge for the build project.
--
-- /See:/ 'newProjectBadge' smart constructor.
data ProjectBadge = ProjectBadge'
  { -- | Set this to true to generate a publicly accessible URL for your
    -- project\'s build badge.
    ProjectBadge -> Maybe Bool
badgeEnabled :: Prelude.Maybe Prelude.Bool,
    -- | The publicly-accessible URL through which you can access the build badge
    -- for your project.
    ProjectBadge -> Maybe Text
badgeRequestUrl :: Prelude.Maybe Prelude.Text
  }
  deriving (ProjectBadge -> ProjectBadge -> Bool
(ProjectBadge -> ProjectBadge -> Bool)
-> (ProjectBadge -> ProjectBadge -> Bool) -> Eq ProjectBadge
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ProjectBadge -> ProjectBadge -> Bool
$c/= :: ProjectBadge -> ProjectBadge -> Bool
== :: ProjectBadge -> ProjectBadge -> Bool
$c== :: ProjectBadge -> ProjectBadge -> Bool
Prelude.Eq, ReadPrec [ProjectBadge]
ReadPrec ProjectBadge
Int -> ReadS ProjectBadge
ReadS [ProjectBadge]
(Int -> ReadS ProjectBadge)
-> ReadS [ProjectBadge]
-> ReadPrec ProjectBadge
-> ReadPrec [ProjectBadge]
-> Read ProjectBadge
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ProjectBadge]
$creadListPrec :: ReadPrec [ProjectBadge]
readPrec :: ReadPrec ProjectBadge
$creadPrec :: ReadPrec ProjectBadge
readList :: ReadS [ProjectBadge]
$creadList :: ReadS [ProjectBadge]
readsPrec :: Int -> ReadS ProjectBadge
$creadsPrec :: Int -> ReadS ProjectBadge
Prelude.Read, Int -> ProjectBadge -> ShowS
[ProjectBadge] -> ShowS
ProjectBadge -> String
(Int -> ProjectBadge -> ShowS)
-> (ProjectBadge -> String)
-> ([ProjectBadge] -> ShowS)
-> Show ProjectBadge
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ProjectBadge] -> ShowS
$cshowList :: [ProjectBadge] -> ShowS
show :: ProjectBadge -> String
$cshow :: ProjectBadge -> String
showsPrec :: Int -> ProjectBadge -> ShowS
$cshowsPrec :: Int -> ProjectBadge -> ShowS
Prelude.Show, (forall x. ProjectBadge -> Rep ProjectBadge x)
-> (forall x. Rep ProjectBadge x -> ProjectBadge)
-> Generic ProjectBadge
forall x. Rep ProjectBadge x -> ProjectBadge
forall x. ProjectBadge -> Rep ProjectBadge x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ProjectBadge x -> ProjectBadge
$cfrom :: forall x. ProjectBadge -> Rep ProjectBadge x
Prelude.Generic)

-- |
-- Create a value of 'ProjectBadge' 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:
--
-- 'badgeEnabled', 'projectBadge_badgeEnabled' - Set this to true to generate a publicly accessible URL for your
-- project\'s build badge.
--
-- 'badgeRequestUrl', 'projectBadge_badgeRequestUrl' - The publicly-accessible URL through which you can access the build badge
-- for your project.
newProjectBadge ::
  ProjectBadge
newProjectBadge :: ProjectBadge
newProjectBadge =
  ProjectBadge' :: Maybe Bool -> Maybe Text -> ProjectBadge
ProjectBadge'
    { $sel:badgeEnabled:ProjectBadge' :: Maybe Bool
badgeEnabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:badgeRequestUrl:ProjectBadge' :: Maybe Text
badgeRequestUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | Set this to true to generate a publicly accessible URL for your
-- project\'s build badge.
projectBadge_badgeEnabled :: Lens.Lens' ProjectBadge (Prelude.Maybe Prelude.Bool)
projectBadge_badgeEnabled :: (Maybe Bool -> f (Maybe Bool)) -> ProjectBadge -> f ProjectBadge
projectBadge_badgeEnabled = (ProjectBadge -> Maybe Bool)
-> (ProjectBadge -> Maybe Bool -> ProjectBadge)
-> Lens ProjectBadge ProjectBadge (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectBadge' {Maybe Bool
badgeEnabled :: Maybe Bool
$sel:badgeEnabled:ProjectBadge' :: ProjectBadge -> Maybe Bool
badgeEnabled} -> Maybe Bool
badgeEnabled) (\s :: ProjectBadge
s@ProjectBadge' {} Maybe Bool
a -> ProjectBadge
s {$sel:badgeEnabled:ProjectBadge' :: Maybe Bool
badgeEnabled = Maybe Bool
a} :: ProjectBadge)

-- | The publicly-accessible URL through which you can access the build badge
-- for your project.
projectBadge_badgeRequestUrl :: Lens.Lens' ProjectBadge (Prelude.Maybe Prelude.Text)
projectBadge_badgeRequestUrl :: (Maybe Text -> f (Maybe Text)) -> ProjectBadge -> f ProjectBadge
projectBadge_badgeRequestUrl = (ProjectBadge -> Maybe Text)
-> (ProjectBadge -> Maybe Text -> ProjectBadge)
-> Lens ProjectBadge ProjectBadge (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ProjectBadge' {Maybe Text
badgeRequestUrl :: Maybe Text
$sel:badgeRequestUrl:ProjectBadge' :: ProjectBadge -> Maybe Text
badgeRequestUrl} -> Maybe Text
badgeRequestUrl) (\s :: ProjectBadge
s@ProjectBadge' {} Maybe Text
a -> ProjectBadge
s {$sel:badgeRequestUrl:ProjectBadge' :: Maybe Text
badgeRequestUrl = Maybe Text
a} :: ProjectBadge)

instance Core.FromJSON ProjectBadge where
  parseJSON :: Value -> Parser ProjectBadge
parseJSON =
    String
-> (Object -> Parser ProjectBadge) -> Value -> Parser ProjectBadge
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ProjectBadge"
      ( \Object
x ->
          Maybe Bool -> Maybe Text -> ProjectBadge
ProjectBadge'
            (Maybe Bool -> Maybe Text -> ProjectBadge)
-> Parser (Maybe Bool) -> Parser (Maybe Text -> ProjectBadge)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Bool)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"badgeEnabled")
            Parser (Maybe Text -> ProjectBadge)
-> Parser (Maybe Text) -> Parser ProjectBadge
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
"badgeRequestUrl")
      )

instance Prelude.Hashable ProjectBadge

instance Prelude.NFData ProjectBadge