{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.MacieV2.CreateFindingsFilter
-- 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)
--
-- Creates and defines the criteria and other settings for a findings
-- filter.
module Amazonka.MacieV2.CreateFindingsFilter
  ( -- * Creating a Request
    CreateFindingsFilter (..),
    newCreateFindingsFilter,

    -- * Request Lenses
    createFindingsFilter_clientToken,
    createFindingsFilter_description,
    createFindingsFilter_tags,
    createFindingsFilter_position,
    createFindingsFilter_action,
    createFindingsFilter_findingCriteria,
    createFindingsFilter_name,

    -- * Destructuring the Response
    CreateFindingsFilterResponse (..),
    newCreateFindingsFilterResponse,

    -- * Response Lenses
    createFindingsFilterResponse_arn,
    createFindingsFilterResponse_id,
    createFindingsFilterResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.MacieV2.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateFindingsFilter' smart constructor.
data CreateFindingsFilter = CreateFindingsFilter'
  { -- | A unique, case-sensitive token that you provide to ensure the
    -- idempotency of the request.
    CreateFindingsFilter -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | A custom description of the filter. The description can contain as many
    -- as 512 characters.
    --
    -- We strongly recommend that you avoid including any sensitive data in the
    -- description of a filter. Other users of your account might be able to
    -- see the filter\'s description, depending on the actions that they\'re
    -- allowed to perform in Amazon Macie.
    CreateFindingsFilter -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A map of key-value pairs that specifies the tags to associate with the
    -- filter.
    --
    -- A findings filter can have a maximum of 50 tags. Each tag consists of a
    -- tag key and an associated tag value. The maximum length of a tag key is
    -- 128 characters. The maximum length of a tag value is 256 characters.
    CreateFindingsFilter -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The position of the filter in the list of saved filters on the Amazon
    -- Macie console. This value also determines the order in which the filter
    -- is applied to findings, relative to other filters that are also applied
    -- to the findings.
    CreateFindingsFilter -> Maybe Int
position :: Prelude.Maybe Prelude.Int,
    -- | The action to perform on findings that meet the filter criteria
    -- (findingCriteria). Valid values are: ARCHIVE, suppress (automatically
    -- archive) the findings; and, NOOP, don\'t perform any action on the
    -- findings.
    CreateFindingsFilter -> FindingsFilterAction
action :: FindingsFilterAction,
    -- | The criteria to use to filter findings.
    CreateFindingsFilter -> FindingCriteria
findingCriteria :: FindingCriteria,
    -- | A custom name for the filter. The name must contain at least 3
    -- characters and can contain as many as 64 characters.
    --
    -- We strongly recommend that you avoid including any sensitive data in the
    -- name of a filter. Other users of your account might be able to see the
    -- filter\'s name, depending on the actions that they\'re allowed to
    -- perform in Amazon Macie.
    CreateFindingsFilter -> Text
name :: Prelude.Text
  }
  deriving (CreateFindingsFilter -> CreateFindingsFilter -> Bool
(CreateFindingsFilter -> CreateFindingsFilter -> Bool)
-> (CreateFindingsFilter -> CreateFindingsFilter -> Bool)
-> Eq CreateFindingsFilter
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateFindingsFilter -> CreateFindingsFilter -> Bool
$c/= :: CreateFindingsFilter -> CreateFindingsFilter -> Bool
== :: CreateFindingsFilter -> CreateFindingsFilter -> Bool
$c== :: CreateFindingsFilter -> CreateFindingsFilter -> Bool
Prelude.Eq, ReadPrec [CreateFindingsFilter]
ReadPrec CreateFindingsFilter
Int -> ReadS CreateFindingsFilter
ReadS [CreateFindingsFilter]
(Int -> ReadS CreateFindingsFilter)
-> ReadS [CreateFindingsFilter]
-> ReadPrec CreateFindingsFilter
-> ReadPrec [CreateFindingsFilter]
-> Read CreateFindingsFilter
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateFindingsFilter]
$creadListPrec :: ReadPrec [CreateFindingsFilter]
readPrec :: ReadPrec CreateFindingsFilter
$creadPrec :: ReadPrec CreateFindingsFilter
readList :: ReadS [CreateFindingsFilter]
$creadList :: ReadS [CreateFindingsFilter]
readsPrec :: Int -> ReadS CreateFindingsFilter
$creadsPrec :: Int -> ReadS CreateFindingsFilter
Prelude.Read, Int -> CreateFindingsFilter -> ShowS
[CreateFindingsFilter] -> ShowS
CreateFindingsFilter -> String
(Int -> CreateFindingsFilter -> ShowS)
-> (CreateFindingsFilter -> String)
-> ([CreateFindingsFilter] -> ShowS)
-> Show CreateFindingsFilter
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateFindingsFilter] -> ShowS
$cshowList :: [CreateFindingsFilter] -> ShowS
show :: CreateFindingsFilter -> String
$cshow :: CreateFindingsFilter -> String
showsPrec :: Int -> CreateFindingsFilter -> ShowS
$cshowsPrec :: Int -> CreateFindingsFilter -> ShowS
Prelude.Show, (forall x. CreateFindingsFilter -> Rep CreateFindingsFilter x)
-> (forall x. Rep CreateFindingsFilter x -> CreateFindingsFilter)
-> Generic CreateFindingsFilter
forall x. Rep CreateFindingsFilter x -> CreateFindingsFilter
forall x. CreateFindingsFilter -> Rep CreateFindingsFilter x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateFindingsFilter x -> CreateFindingsFilter
$cfrom :: forall x. CreateFindingsFilter -> Rep CreateFindingsFilter x
Prelude.Generic)

-- |
-- Create a value of 'CreateFindingsFilter' 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:
--
-- 'clientToken', 'createFindingsFilter_clientToken' - A unique, case-sensitive token that you provide to ensure the
-- idempotency of the request.
--
-- 'description', 'createFindingsFilter_description' - A custom description of the filter. The description can contain as many
-- as 512 characters.
--
-- We strongly recommend that you avoid including any sensitive data in the
-- description of a filter. Other users of your account might be able to
-- see the filter\'s description, depending on the actions that they\'re
-- allowed to perform in Amazon Macie.
--
-- 'tags', 'createFindingsFilter_tags' - A map of key-value pairs that specifies the tags to associate with the
-- filter.
--
-- A findings filter can have a maximum of 50 tags. Each tag consists of a
-- tag key and an associated tag value. The maximum length of a tag key is
-- 128 characters. The maximum length of a tag value is 256 characters.
--
-- 'position', 'createFindingsFilter_position' - The position of the filter in the list of saved filters on the Amazon
-- Macie console. This value also determines the order in which the filter
-- is applied to findings, relative to other filters that are also applied
-- to the findings.
--
-- 'action', 'createFindingsFilter_action' - The action to perform on findings that meet the filter criteria
-- (findingCriteria). Valid values are: ARCHIVE, suppress (automatically
-- archive) the findings; and, NOOP, don\'t perform any action on the
-- findings.
--
-- 'findingCriteria', 'createFindingsFilter_findingCriteria' - The criteria to use to filter findings.
--
-- 'name', 'createFindingsFilter_name' - A custom name for the filter. The name must contain at least 3
-- characters and can contain as many as 64 characters.
--
-- We strongly recommend that you avoid including any sensitive data in the
-- name of a filter. Other users of your account might be able to see the
-- filter\'s name, depending on the actions that they\'re allowed to
-- perform in Amazon Macie.
newCreateFindingsFilter ::
  -- | 'action'
  FindingsFilterAction ->
  -- | 'findingCriteria'
  FindingCriteria ->
  -- | 'name'
  Prelude.Text ->
  CreateFindingsFilter
newCreateFindingsFilter :: FindingsFilterAction
-> FindingCriteria -> Text -> CreateFindingsFilter
newCreateFindingsFilter
  FindingsFilterAction
pAction_
  FindingCriteria
pFindingCriteria_
  Text
pName_ =
    CreateFindingsFilter' :: Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe Int
-> FindingsFilterAction
-> FindingCriteria
-> Text
-> CreateFindingsFilter
CreateFindingsFilter'
      { $sel:clientToken:CreateFindingsFilter' :: Maybe Text
clientToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateFindingsFilter' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateFindingsFilter' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:position:CreateFindingsFilter' :: Maybe Int
position = Maybe Int
forall a. Maybe a
Prelude.Nothing,
        $sel:action:CreateFindingsFilter' :: FindingsFilterAction
action = FindingsFilterAction
pAction_,
        $sel:findingCriteria:CreateFindingsFilter' :: FindingCriteria
findingCriteria = FindingCriteria
pFindingCriteria_,
        $sel:name:CreateFindingsFilter' :: Text
name = Text
pName_
      }

-- | A unique, case-sensitive token that you provide to ensure the
-- idempotency of the request.
createFindingsFilter_clientToken :: Lens.Lens' CreateFindingsFilter (Prelude.Maybe Prelude.Text)
createFindingsFilter_clientToken :: (Maybe Text -> f (Maybe Text))
-> CreateFindingsFilter -> f CreateFindingsFilter
createFindingsFilter_clientToken = (CreateFindingsFilter -> Maybe Text)
-> (CreateFindingsFilter -> Maybe Text -> CreateFindingsFilter)
-> Lens
     CreateFindingsFilter CreateFindingsFilter (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFindingsFilter' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateFindingsFilter' :: CreateFindingsFilter -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateFindingsFilter
s@CreateFindingsFilter' {} Maybe Text
a -> CreateFindingsFilter
s {$sel:clientToken:CreateFindingsFilter' :: Maybe Text
clientToken = Maybe Text
a} :: CreateFindingsFilter)

-- | A custom description of the filter. The description can contain as many
-- as 512 characters.
--
-- We strongly recommend that you avoid including any sensitive data in the
-- description of a filter. Other users of your account might be able to
-- see the filter\'s description, depending on the actions that they\'re
-- allowed to perform in Amazon Macie.
createFindingsFilter_description :: Lens.Lens' CreateFindingsFilter (Prelude.Maybe Prelude.Text)
createFindingsFilter_description :: (Maybe Text -> f (Maybe Text))
-> CreateFindingsFilter -> f CreateFindingsFilter
createFindingsFilter_description = (CreateFindingsFilter -> Maybe Text)
-> (CreateFindingsFilter -> Maybe Text -> CreateFindingsFilter)
-> Lens
     CreateFindingsFilter CreateFindingsFilter (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFindingsFilter' {Maybe Text
description :: Maybe Text
$sel:description:CreateFindingsFilter' :: CreateFindingsFilter -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateFindingsFilter
s@CreateFindingsFilter' {} Maybe Text
a -> CreateFindingsFilter
s {$sel:description:CreateFindingsFilter' :: Maybe Text
description = Maybe Text
a} :: CreateFindingsFilter)

-- | A map of key-value pairs that specifies the tags to associate with the
-- filter.
--
-- A findings filter can have a maximum of 50 tags. Each tag consists of a
-- tag key and an associated tag value. The maximum length of a tag key is
-- 128 characters. The maximum length of a tag value is 256 characters.
createFindingsFilter_tags :: Lens.Lens' CreateFindingsFilter (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createFindingsFilter_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateFindingsFilter -> f CreateFindingsFilter
createFindingsFilter_tags = (CreateFindingsFilter -> Maybe (HashMap Text Text))
-> (CreateFindingsFilter
    -> Maybe (HashMap Text Text) -> CreateFindingsFilter)
-> Lens
     CreateFindingsFilter
     CreateFindingsFilter
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFindingsFilter' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateFindingsFilter' :: CreateFindingsFilter -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateFindingsFilter
s@CreateFindingsFilter' {} Maybe (HashMap Text Text)
a -> CreateFindingsFilter
s {$sel:tags:CreateFindingsFilter' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateFindingsFilter) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateFindingsFilter -> f CreateFindingsFilter)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateFindingsFilter
-> f CreateFindingsFilter
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The position of the filter in the list of saved filters on the Amazon
-- Macie console. This value also determines the order in which the filter
-- is applied to findings, relative to other filters that are also applied
-- to the findings.
createFindingsFilter_position :: Lens.Lens' CreateFindingsFilter (Prelude.Maybe Prelude.Int)
createFindingsFilter_position :: (Maybe Int -> f (Maybe Int))
-> CreateFindingsFilter -> f CreateFindingsFilter
createFindingsFilter_position = (CreateFindingsFilter -> Maybe Int)
-> (CreateFindingsFilter -> Maybe Int -> CreateFindingsFilter)
-> Lens
     CreateFindingsFilter CreateFindingsFilter (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFindingsFilter' {Maybe Int
position :: Maybe Int
$sel:position:CreateFindingsFilter' :: CreateFindingsFilter -> Maybe Int
position} -> Maybe Int
position) (\s :: CreateFindingsFilter
s@CreateFindingsFilter' {} Maybe Int
a -> CreateFindingsFilter
s {$sel:position:CreateFindingsFilter' :: Maybe Int
position = Maybe Int
a} :: CreateFindingsFilter)

-- | The action to perform on findings that meet the filter criteria
-- (findingCriteria). Valid values are: ARCHIVE, suppress (automatically
-- archive) the findings; and, NOOP, don\'t perform any action on the
-- findings.
createFindingsFilter_action :: Lens.Lens' CreateFindingsFilter FindingsFilterAction
createFindingsFilter_action :: (FindingsFilterAction -> f FindingsFilterAction)
-> CreateFindingsFilter -> f CreateFindingsFilter
createFindingsFilter_action = (CreateFindingsFilter -> FindingsFilterAction)
-> (CreateFindingsFilter
    -> FindingsFilterAction -> CreateFindingsFilter)
-> Lens
     CreateFindingsFilter
     CreateFindingsFilter
     FindingsFilterAction
     FindingsFilterAction
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFindingsFilter' {FindingsFilterAction
action :: FindingsFilterAction
$sel:action:CreateFindingsFilter' :: CreateFindingsFilter -> FindingsFilterAction
action} -> FindingsFilterAction
action) (\s :: CreateFindingsFilter
s@CreateFindingsFilter' {} FindingsFilterAction
a -> CreateFindingsFilter
s {$sel:action:CreateFindingsFilter' :: FindingsFilterAction
action = FindingsFilterAction
a} :: CreateFindingsFilter)

-- | The criteria to use to filter findings.
createFindingsFilter_findingCriteria :: Lens.Lens' CreateFindingsFilter FindingCriteria
createFindingsFilter_findingCriteria :: (FindingCriteria -> f FindingCriteria)
-> CreateFindingsFilter -> f CreateFindingsFilter
createFindingsFilter_findingCriteria = (CreateFindingsFilter -> FindingCriteria)
-> (CreateFindingsFilter
    -> FindingCriteria -> CreateFindingsFilter)
-> Lens
     CreateFindingsFilter
     CreateFindingsFilter
     FindingCriteria
     FindingCriteria
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFindingsFilter' {FindingCriteria
findingCriteria :: FindingCriteria
$sel:findingCriteria:CreateFindingsFilter' :: CreateFindingsFilter -> FindingCriteria
findingCriteria} -> FindingCriteria
findingCriteria) (\s :: CreateFindingsFilter
s@CreateFindingsFilter' {} FindingCriteria
a -> CreateFindingsFilter
s {$sel:findingCriteria:CreateFindingsFilter' :: FindingCriteria
findingCriteria = FindingCriteria
a} :: CreateFindingsFilter)

-- | A custom name for the filter. The name must contain at least 3
-- characters and can contain as many as 64 characters.
--
-- We strongly recommend that you avoid including any sensitive data in the
-- name of a filter. Other users of your account might be able to see the
-- filter\'s name, depending on the actions that they\'re allowed to
-- perform in Amazon Macie.
createFindingsFilter_name :: Lens.Lens' CreateFindingsFilter Prelude.Text
createFindingsFilter_name :: (Text -> f Text) -> CreateFindingsFilter -> f CreateFindingsFilter
createFindingsFilter_name = (CreateFindingsFilter -> Text)
-> (CreateFindingsFilter -> Text -> CreateFindingsFilter)
-> Lens CreateFindingsFilter CreateFindingsFilter Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFindingsFilter' {Text
name :: Text
$sel:name:CreateFindingsFilter' :: CreateFindingsFilter -> Text
name} -> Text
name) (\s :: CreateFindingsFilter
s@CreateFindingsFilter' {} Text
a -> CreateFindingsFilter
s {$sel:name:CreateFindingsFilter' :: Text
name = Text
a} :: CreateFindingsFilter)

instance Core.AWSRequest CreateFindingsFilter where
  type
    AWSResponse CreateFindingsFilter =
      CreateFindingsFilterResponse
  request :: CreateFindingsFilter -> Request CreateFindingsFilter
request = Service -> CreateFindingsFilter -> Request CreateFindingsFilter
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateFindingsFilter
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateFindingsFilter)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateFindingsFilter))
-> Logger
-> Service
-> Proxy CreateFindingsFilter
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateFindingsFilter)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Maybe Text -> Int -> CreateFindingsFilterResponse
CreateFindingsFilterResponse'
            (Maybe Text -> Maybe Text -> Int -> CreateFindingsFilterResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> CreateFindingsFilterResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"arn")
            Either String (Maybe Text -> Int -> CreateFindingsFilterResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateFindingsFilterResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"id")
            Either String (Int -> CreateFindingsFilterResponse)
-> Either String Int -> Either String CreateFindingsFilterResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateFindingsFilter

instance Prelude.NFData CreateFindingsFilter

instance Core.ToHeaders CreateFindingsFilter where
  toHeaders :: CreateFindingsFilter -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateFindingsFilter -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateFindingsFilter where
  toJSON :: CreateFindingsFilter -> Value
toJSON CreateFindingsFilter' {Maybe Int
Maybe Text
Maybe (HashMap Text Text)
Text
FindingCriteria
FindingsFilterAction
name :: Text
findingCriteria :: FindingCriteria
action :: FindingsFilterAction
position :: Maybe Int
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
clientToken :: Maybe Text
$sel:name:CreateFindingsFilter' :: CreateFindingsFilter -> Text
$sel:findingCriteria:CreateFindingsFilter' :: CreateFindingsFilter -> FindingCriteria
$sel:action:CreateFindingsFilter' :: CreateFindingsFilter -> FindingsFilterAction
$sel:position:CreateFindingsFilter' :: CreateFindingsFilter -> Maybe Int
$sel:tags:CreateFindingsFilter' :: CreateFindingsFilter -> Maybe (HashMap Text Text)
$sel:description:CreateFindingsFilter' :: CreateFindingsFilter -> Maybe Text
$sel:clientToken:CreateFindingsFilter' :: CreateFindingsFilter -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"clientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
clientToken,
            (Text
"description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            (Text
"position" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
position,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"action" Text -> FindingsFilterAction -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= FindingsFilterAction
action),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"findingCriteria" Text -> FindingCriteria -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= FindingCriteria
findingCriteria),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
          ]
      )

instance Core.ToPath CreateFindingsFilter where
  toPath :: CreateFindingsFilter -> ByteString
toPath = ByteString -> CreateFindingsFilter -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/findingsfilters"

instance Core.ToQuery CreateFindingsFilter where
  toQuery :: CreateFindingsFilter -> QueryString
toQuery = QueryString -> CreateFindingsFilter -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateFindingsFilterResponse' smart constructor.
data CreateFindingsFilterResponse = CreateFindingsFilterResponse'
  { -- | The Amazon Resource Name (ARN) of the filter that was created.
    CreateFindingsFilterResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The unique identifier for the filter that was created.
    CreateFindingsFilterResponse -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateFindingsFilterResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateFindingsFilterResponse
-> CreateFindingsFilterResponse -> Bool
(CreateFindingsFilterResponse
 -> CreateFindingsFilterResponse -> Bool)
-> (CreateFindingsFilterResponse
    -> CreateFindingsFilterResponse -> Bool)
-> Eq CreateFindingsFilterResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateFindingsFilterResponse
-> CreateFindingsFilterResponse -> Bool
$c/= :: CreateFindingsFilterResponse
-> CreateFindingsFilterResponse -> Bool
== :: CreateFindingsFilterResponse
-> CreateFindingsFilterResponse -> Bool
$c== :: CreateFindingsFilterResponse
-> CreateFindingsFilterResponse -> Bool
Prelude.Eq, ReadPrec [CreateFindingsFilterResponse]
ReadPrec CreateFindingsFilterResponse
Int -> ReadS CreateFindingsFilterResponse
ReadS [CreateFindingsFilterResponse]
(Int -> ReadS CreateFindingsFilterResponse)
-> ReadS [CreateFindingsFilterResponse]
-> ReadPrec CreateFindingsFilterResponse
-> ReadPrec [CreateFindingsFilterResponse]
-> Read CreateFindingsFilterResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateFindingsFilterResponse]
$creadListPrec :: ReadPrec [CreateFindingsFilterResponse]
readPrec :: ReadPrec CreateFindingsFilterResponse
$creadPrec :: ReadPrec CreateFindingsFilterResponse
readList :: ReadS [CreateFindingsFilterResponse]
$creadList :: ReadS [CreateFindingsFilterResponse]
readsPrec :: Int -> ReadS CreateFindingsFilterResponse
$creadsPrec :: Int -> ReadS CreateFindingsFilterResponse
Prelude.Read, Int -> CreateFindingsFilterResponse -> ShowS
[CreateFindingsFilterResponse] -> ShowS
CreateFindingsFilterResponse -> String
(Int -> CreateFindingsFilterResponse -> ShowS)
-> (CreateFindingsFilterResponse -> String)
-> ([CreateFindingsFilterResponse] -> ShowS)
-> Show CreateFindingsFilterResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateFindingsFilterResponse] -> ShowS
$cshowList :: [CreateFindingsFilterResponse] -> ShowS
show :: CreateFindingsFilterResponse -> String
$cshow :: CreateFindingsFilterResponse -> String
showsPrec :: Int -> CreateFindingsFilterResponse -> ShowS
$cshowsPrec :: Int -> CreateFindingsFilterResponse -> ShowS
Prelude.Show, (forall x.
 CreateFindingsFilterResponse -> Rep CreateFindingsFilterResponse x)
-> (forall x.
    Rep CreateFindingsFilterResponse x -> CreateFindingsFilterResponse)
-> Generic CreateFindingsFilterResponse
forall x.
Rep CreateFindingsFilterResponse x -> CreateFindingsFilterResponse
forall x.
CreateFindingsFilterResponse -> Rep CreateFindingsFilterResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateFindingsFilterResponse x -> CreateFindingsFilterResponse
$cfrom :: forall x.
CreateFindingsFilterResponse -> Rep CreateFindingsFilterResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateFindingsFilterResponse' 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:
--
-- 'arn', 'createFindingsFilterResponse_arn' - The Amazon Resource Name (ARN) of the filter that was created.
--
-- 'id', 'createFindingsFilterResponse_id' - The unique identifier for the filter that was created.
--
-- 'httpStatus', 'createFindingsFilterResponse_httpStatus' - The response's http status code.
newCreateFindingsFilterResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateFindingsFilterResponse
newCreateFindingsFilterResponse :: Int -> CreateFindingsFilterResponse
newCreateFindingsFilterResponse Int
pHttpStatus_ =
  CreateFindingsFilterResponse' :: Maybe Text -> Maybe Text -> Int -> CreateFindingsFilterResponse
CreateFindingsFilterResponse'
    { $sel:arn:CreateFindingsFilterResponse' :: Maybe Text
arn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:CreateFindingsFilterResponse' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateFindingsFilterResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the filter that was created.
createFindingsFilterResponse_arn :: Lens.Lens' CreateFindingsFilterResponse (Prelude.Maybe Prelude.Text)
createFindingsFilterResponse_arn :: (Maybe Text -> f (Maybe Text))
-> CreateFindingsFilterResponse -> f CreateFindingsFilterResponse
createFindingsFilterResponse_arn = (CreateFindingsFilterResponse -> Maybe Text)
-> (CreateFindingsFilterResponse
    -> Maybe Text -> CreateFindingsFilterResponse)
-> Lens
     CreateFindingsFilterResponse
     CreateFindingsFilterResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFindingsFilterResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:CreateFindingsFilterResponse' :: CreateFindingsFilterResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CreateFindingsFilterResponse
s@CreateFindingsFilterResponse' {} Maybe Text
a -> CreateFindingsFilterResponse
s {$sel:arn:CreateFindingsFilterResponse' :: Maybe Text
arn = Maybe Text
a} :: CreateFindingsFilterResponse)

-- | The unique identifier for the filter that was created.
createFindingsFilterResponse_id :: Lens.Lens' CreateFindingsFilterResponse (Prelude.Maybe Prelude.Text)
createFindingsFilterResponse_id :: (Maybe Text -> f (Maybe Text))
-> CreateFindingsFilterResponse -> f CreateFindingsFilterResponse
createFindingsFilterResponse_id = (CreateFindingsFilterResponse -> Maybe Text)
-> (CreateFindingsFilterResponse
    -> Maybe Text -> CreateFindingsFilterResponse)
-> Lens
     CreateFindingsFilterResponse
     CreateFindingsFilterResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFindingsFilterResponse' {Maybe Text
id :: Maybe Text
$sel:id:CreateFindingsFilterResponse' :: CreateFindingsFilterResponse -> Maybe Text
id} -> Maybe Text
id) (\s :: CreateFindingsFilterResponse
s@CreateFindingsFilterResponse' {} Maybe Text
a -> CreateFindingsFilterResponse
s {$sel:id:CreateFindingsFilterResponse' :: Maybe Text
id = Maybe Text
a} :: CreateFindingsFilterResponse)

-- | The response's http status code.
createFindingsFilterResponse_httpStatus :: Lens.Lens' CreateFindingsFilterResponse Prelude.Int
createFindingsFilterResponse_httpStatus :: (Int -> f Int)
-> CreateFindingsFilterResponse -> f CreateFindingsFilterResponse
createFindingsFilterResponse_httpStatus = (CreateFindingsFilterResponse -> Int)
-> (CreateFindingsFilterResponse
    -> Int -> CreateFindingsFilterResponse)
-> Lens
     CreateFindingsFilterResponse CreateFindingsFilterResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFindingsFilterResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateFindingsFilterResponse' :: CreateFindingsFilterResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateFindingsFilterResponse
s@CreateFindingsFilterResponse' {} Int
a -> CreateFindingsFilterResponse
s {$sel:httpStatus:CreateFindingsFilterResponse' :: Int
httpStatus = Int
a} :: CreateFindingsFilterResponse)

instance Prelude.NFData CreateFindingsFilterResponse