{-# 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 #-}
module Amazonka.GuardDuty.Types.UsageCriteria where
import qualified Amazonka.Core as Core
import Amazonka.GuardDuty.Types.DataSource
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data UsageCriteria = UsageCriteria'
{
UsageCriteria -> Maybe (NonEmpty Text)
accountIds :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
UsageCriteria -> Maybe [Text]
resources :: Prelude.Maybe [Prelude.Text],
UsageCriteria -> [DataSource]
dataSources :: [DataSource]
}
deriving (UsageCriteria -> UsageCriteria -> Bool
(UsageCriteria -> UsageCriteria -> Bool)
-> (UsageCriteria -> UsageCriteria -> Bool) -> Eq UsageCriteria
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UsageCriteria -> UsageCriteria -> Bool
$c/= :: UsageCriteria -> UsageCriteria -> Bool
== :: UsageCriteria -> UsageCriteria -> Bool
$c== :: UsageCriteria -> UsageCriteria -> Bool
Prelude.Eq, ReadPrec [UsageCriteria]
ReadPrec UsageCriteria
Int -> ReadS UsageCriteria
ReadS [UsageCriteria]
(Int -> ReadS UsageCriteria)
-> ReadS [UsageCriteria]
-> ReadPrec UsageCriteria
-> ReadPrec [UsageCriteria]
-> Read UsageCriteria
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UsageCriteria]
$creadListPrec :: ReadPrec [UsageCriteria]
readPrec :: ReadPrec UsageCriteria
$creadPrec :: ReadPrec UsageCriteria
readList :: ReadS [UsageCriteria]
$creadList :: ReadS [UsageCriteria]
readsPrec :: Int -> ReadS UsageCriteria
$creadsPrec :: Int -> ReadS UsageCriteria
Prelude.Read, Int -> UsageCriteria -> ShowS
[UsageCriteria] -> ShowS
UsageCriteria -> String
(Int -> UsageCriteria -> ShowS)
-> (UsageCriteria -> String)
-> ([UsageCriteria] -> ShowS)
-> Show UsageCriteria
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UsageCriteria] -> ShowS
$cshowList :: [UsageCriteria] -> ShowS
show :: UsageCriteria -> String
$cshow :: UsageCriteria -> String
showsPrec :: Int -> UsageCriteria -> ShowS
$cshowsPrec :: Int -> UsageCriteria -> ShowS
Prelude.Show, (forall x. UsageCriteria -> Rep UsageCriteria x)
-> (forall x. Rep UsageCriteria x -> UsageCriteria)
-> Generic UsageCriteria
forall x. Rep UsageCriteria x -> UsageCriteria
forall x. UsageCriteria -> Rep UsageCriteria x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UsageCriteria x -> UsageCriteria
$cfrom :: forall x. UsageCriteria -> Rep UsageCriteria x
Prelude.Generic)
newUsageCriteria ::
UsageCriteria
newUsageCriteria :: UsageCriteria
newUsageCriteria =
UsageCriteria' :: Maybe (NonEmpty Text)
-> Maybe [Text] -> [DataSource] -> UsageCriteria
UsageCriteria'
{ $sel:accountIds:UsageCriteria' :: Maybe (NonEmpty Text)
accountIds = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
$sel:resources:UsageCriteria' :: Maybe [Text]
resources = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:dataSources:UsageCriteria' :: [DataSource]
dataSources = [DataSource]
forall a. Monoid a => a
Prelude.mempty
}
usageCriteria_accountIds :: Lens.Lens' UsageCriteria (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
usageCriteria_accountIds :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> UsageCriteria -> f UsageCriteria
usageCriteria_accountIds = (UsageCriteria -> Maybe (NonEmpty Text))
-> (UsageCriteria -> Maybe (NonEmpty Text) -> UsageCriteria)
-> Lens
UsageCriteria
UsageCriteria
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageCriteria' {Maybe (NonEmpty Text)
accountIds :: Maybe (NonEmpty Text)
$sel:accountIds:UsageCriteria' :: UsageCriteria -> Maybe (NonEmpty Text)
accountIds} -> Maybe (NonEmpty Text)
accountIds) (\s :: UsageCriteria
s@UsageCriteria' {} Maybe (NonEmpty Text)
a -> UsageCriteria
s {$sel:accountIds:UsageCriteria' :: Maybe (NonEmpty Text)
accountIds = Maybe (NonEmpty Text)
a} :: UsageCriteria) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> UsageCriteria -> f UsageCriteria)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> UsageCriteria
-> f UsageCriteria
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty Text))
(Maybe (NonEmpty 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
(NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
usageCriteria_resources :: Lens.Lens' UsageCriteria (Prelude.Maybe [Prelude.Text])
usageCriteria_resources :: (Maybe [Text] -> f (Maybe [Text]))
-> UsageCriteria -> f UsageCriteria
usageCriteria_resources = (UsageCriteria -> Maybe [Text])
-> (UsageCriteria -> Maybe [Text] -> UsageCriteria)
-> Lens UsageCriteria UsageCriteria (Maybe [Text]) (Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageCriteria' {Maybe [Text]
resources :: Maybe [Text]
$sel:resources:UsageCriteria' :: UsageCriteria -> Maybe [Text]
resources} -> Maybe [Text]
resources) (\s :: UsageCriteria
s@UsageCriteria' {} Maybe [Text]
a -> UsageCriteria
s {$sel:resources:UsageCriteria' :: Maybe [Text]
resources = Maybe [Text]
a} :: UsageCriteria) ((Maybe [Text] -> f (Maybe [Text]))
-> UsageCriteria -> f UsageCriteria)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> UsageCriteria
-> f UsageCriteria
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
usageCriteria_dataSources :: Lens.Lens' UsageCriteria [DataSource]
usageCriteria_dataSources :: ([DataSource] -> f [DataSource])
-> UsageCriteria -> f UsageCriteria
usageCriteria_dataSources = (UsageCriteria -> [DataSource])
-> (UsageCriteria -> [DataSource] -> UsageCriteria)
-> Lens UsageCriteria UsageCriteria [DataSource] [DataSource]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UsageCriteria' {[DataSource]
dataSources :: [DataSource]
$sel:dataSources:UsageCriteria' :: UsageCriteria -> [DataSource]
dataSources} -> [DataSource]
dataSources) (\s :: UsageCriteria
s@UsageCriteria' {} [DataSource]
a -> UsageCriteria
s {$sel:dataSources:UsageCriteria' :: [DataSource]
dataSources = [DataSource]
a} :: UsageCriteria) (([DataSource] -> f [DataSource])
-> UsageCriteria -> f UsageCriteria)
-> (([DataSource] -> f [DataSource])
-> [DataSource] -> f [DataSource])
-> ([DataSource] -> f [DataSource])
-> UsageCriteria
-> f UsageCriteria
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([DataSource] -> f [DataSource]) -> [DataSource] -> f [DataSource]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.Hashable UsageCriteria
instance Prelude.NFData UsageCriteria
instance Core.ToJSON UsageCriteria where
toJSON :: UsageCriteria -> Value
toJSON UsageCriteria' {[DataSource]
Maybe [Text]
Maybe (NonEmpty Text)
dataSources :: [DataSource]
resources :: Maybe [Text]
accountIds :: Maybe (NonEmpty Text)
$sel:dataSources:UsageCriteria' :: UsageCriteria -> [DataSource]
$sel:resources:UsageCriteria' :: UsageCriteria -> Maybe [Text]
$sel:accountIds:UsageCriteria' :: UsageCriteria -> Maybe (NonEmpty Text)
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"accountIds" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
accountIds,
(Text
"resources" 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]
resources,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"dataSources" Text -> [DataSource] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [DataSource]
dataSources)
]
)