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

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

-- | A filter used to return reports with the status specified by the input
-- @status@ parameter.
--
-- /See:/ 'newReportFilter' smart constructor.
data ReportFilter = ReportFilter'
  { -- | The status used to filter reports. You can filter using one status only.
    ReportFilter -> Maybe ReportStatusType
status :: Prelude.Maybe ReportStatusType
  }
  deriving (ReportFilter -> ReportFilter -> Bool
(ReportFilter -> ReportFilter -> Bool)
-> (ReportFilter -> ReportFilter -> Bool) -> Eq ReportFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ReportFilter -> ReportFilter -> Bool
$c/= :: ReportFilter -> ReportFilter -> Bool
== :: ReportFilter -> ReportFilter -> Bool
$c== :: ReportFilter -> ReportFilter -> Bool
Prelude.Eq, ReadPrec [ReportFilter]
ReadPrec ReportFilter
Int -> ReadS ReportFilter
ReadS [ReportFilter]
(Int -> ReadS ReportFilter)
-> ReadS [ReportFilter]
-> ReadPrec ReportFilter
-> ReadPrec [ReportFilter]
-> Read ReportFilter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ReportFilter]
$creadListPrec :: ReadPrec [ReportFilter]
readPrec :: ReadPrec ReportFilter
$creadPrec :: ReadPrec ReportFilter
readList :: ReadS [ReportFilter]
$creadList :: ReadS [ReportFilter]
readsPrec :: Int -> ReadS ReportFilter
$creadsPrec :: Int -> ReadS ReportFilter
Prelude.Read, Int -> ReportFilter -> ShowS
[ReportFilter] -> ShowS
ReportFilter -> String
(Int -> ReportFilter -> ShowS)
-> (ReportFilter -> String)
-> ([ReportFilter] -> ShowS)
-> Show ReportFilter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ReportFilter] -> ShowS
$cshowList :: [ReportFilter] -> ShowS
show :: ReportFilter -> String
$cshow :: ReportFilter -> String
showsPrec :: Int -> ReportFilter -> ShowS
$cshowsPrec :: Int -> ReportFilter -> ShowS
Prelude.Show, (forall x. ReportFilter -> Rep ReportFilter x)
-> (forall x. Rep ReportFilter x -> ReportFilter)
-> Generic ReportFilter
forall x. Rep ReportFilter x -> ReportFilter
forall x. ReportFilter -> Rep ReportFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ReportFilter x -> ReportFilter
$cfrom :: forall x. ReportFilter -> Rep ReportFilter x
Prelude.Generic)

-- |
-- Create a value of 'ReportFilter' 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:
--
-- 'status', 'reportFilter_status' - The status used to filter reports. You can filter using one status only.
newReportFilter ::
  ReportFilter
newReportFilter :: ReportFilter
newReportFilter =
  ReportFilter' :: Maybe ReportStatusType -> ReportFilter
ReportFilter' {$sel:status:ReportFilter' :: Maybe ReportStatusType
status = Maybe ReportStatusType
forall a. Maybe a
Prelude.Nothing}

-- | The status used to filter reports. You can filter using one status only.
reportFilter_status :: Lens.Lens' ReportFilter (Prelude.Maybe ReportStatusType)
reportFilter_status :: (Maybe ReportStatusType -> f (Maybe ReportStatusType))
-> ReportFilter -> f ReportFilter
reportFilter_status = (ReportFilter -> Maybe ReportStatusType)
-> (ReportFilter -> Maybe ReportStatusType -> ReportFilter)
-> Lens
     ReportFilter
     ReportFilter
     (Maybe ReportStatusType)
     (Maybe ReportStatusType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ReportFilter' {Maybe ReportStatusType
status :: Maybe ReportStatusType
$sel:status:ReportFilter' :: ReportFilter -> Maybe ReportStatusType
status} -> Maybe ReportStatusType
status) (\s :: ReportFilter
s@ReportFilter' {} Maybe ReportStatusType
a -> ReportFilter
s {$sel:status:ReportFilter' :: Maybe ReportStatusType
status = Maybe ReportStatusType
a} :: ReportFilter)

instance Prelude.Hashable ReportFilter

instance Prelude.NFData ReportFilter

instance Core.ToJSON ReportFilter where
  toJSON :: ReportFilter -> Value
toJSON ReportFilter' {Maybe ReportStatusType
status :: Maybe ReportStatusType
$sel:status:ReportFilter' :: ReportFilter -> Maybe ReportStatusType
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"status" Text -> ReportStatusType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ReportStatusType -> Pair) -> Maybe ReportStatusType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ReportStatusType
status]
      )