{-# 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 #-}
module Amazonka.Inspector.AddAttributesToFindings
(
AddAttributesToFindings (..),
newAddAttributesToFindings,
addAttributesToFindings_findingArns,
addAttributesToFindings_attributes,
AddAttributesToFindingsResponse (..),
newAddAttributesToFindingsResponse,
addAttributesToFindingsResponse_httpStatus,
addAttributesToFindingsResponse_failedItems,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Inspector.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data AddAttributesToFindings = AddAttributesToFindings'
{
AddAttributesToFindings -> NonEmpty Text
findingArns :: Prelude.NonEmpty Prelude.Text,
AddAttributesToFindings -> [Attribute]
attributes :: [Attribute]
}
deriving (AddAttributesToFindings -> AddAttributesToFindings -> Bool
(AddAttributesToFindings -> AddAttributesToFindings -> Bool)
-> (AddAttributesToFindings -> AddAttributesToFindings -> Bool)
-> Eq AddAttributesToFindings
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddAttributesToFindings -> AddAttributesToFindings -> Bool
$c/= :: AddAttributesToFindings -> AddAttributesToFindings -> Bool
== :: AddAttributesToFindings -> AddAttributesToFindings -> Bool
$c== :: AddAttributesToFindings -> AddAttributesToFindings -> Bool
Prelude.Eq, ReadPrec [AddAttributesToFindings]
ReadPrec AddAttributesToFindings
Int -> ReadS AddAttributesToFindings
ReadS [AddAttributesToFindings]
(Int -> ReadS AddAttributesToFindings)
-> ReadS [AddAttributesToFindings]
-> ReadPrec AddAttributesToFindings
-> ReadPrec [AddAttributesToFindings]
-> Read AddAttributesToFindings
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddAttributesToFindings]
$creadListPrec :: ReadPrec [AddAttributesToFindings]
readPrec :: ReadPrec AddAttributesToFindings
$creadPrec :: ReadPrec AddAttributesToFindings
readList :: ReadS [AddAttributesToFindings]
$creadList :: ReadS [AddAttributesToFindings]
readsPrec :: Int -> ReadS AddAttributesToFindings
$creadsPrec :: Int -> ReadS AddAttributesToFindings
Prelude.Read, Int -> AddAttributesToFindings -> ShowS
[AddAttributesToFindings] -> ShowS
AddAttributesToFindings -> String
(Int -> AddAttributesToFindings -> ShowS)
-> (AddAttributesToFindings -> String)
-> ([AddAttributesToFindings] -> ShowS)
-> Show AddAttributesToFindings
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddAttributesToFindings] -> ShowS
$cshowList :: [AddAttributesToFindings] -> ShowS
show :: AddAttributesToFindings -> String
$cshow :: AddAttributesToFindings -> String
showsPrec :: Int -> AddAttributesToFindings -> ShowS
$cshowsPrec :: Int -> AddAttributesToFindings -> ShowS
Prelude.Show, (forall x.
AddAttributesToFindings -> Rep AddAttributesToFindings x)
-> (forall x.
Rep AddAttributesToFindings x -> AddAttributesToFindings)
-> Generic AddAttributesToFindings
forall x. Rep AddAttributesToFindings x -> AddAttributesToFindings
forall x. AddAttributesToFindings -> Rep AddAttributesToFindings x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AddAttributesToFindings x -> AddAttributesToFindings
$cfrom :: forall x. AddAttributesToFindings -> Rep AddAttributesToFindings x
Prelude.Generic)
newAddAttributesToFindings ::
Prelude.NonEmpty Prelude.Text ->
AddAttributesToFindings
newAddAttributesToFindings :: NonEmpty Text -> AddAttributesToFindings
newAddAttributesToFindings NonEmpty Text
pFindingArns_ =
AddAttributesToFindings' :: NonEmpty Text -> [Attribute] -> AddAttributesToFindings
AddAttributesToFindings'
{ $sel:findingArns:AddAttributesToFindings' :: NonEmpty Text
findingArns =
Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pFindingArns_,
$sel:attributes:AddAttributesToFindings' :: [Attribute]
attributes = [Attribute]
forall a. Monoid a => a
Prelude.mempty
}
addAttributesToFindings_findingArns :: Lens.Lens' AddAttributesToFindings (Prelude.NonEmpty Prelude.Text)
addAttributesToFindings_findingArns :: (NonEmpty Text -> f (NonEmpty Text))
-> AddAttributesToFindings -> f AddAttributesToFindings
addAttributesToFindings_findingArns = (AddAttributesToFindings -> NonEmpty Text)
-> (AddAttributesToFindings
-> NonEmpty Text -> AddAttributesToFindings)
-> Lens
AddAttributesToFindings
AddAttributesToFindings
(NonEmpty Text)
(NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddAttributesToFindings' {NonEmpty Text
findingArns :: NonEmpty Text
$sel:findingArns:AddAttributesToFindings' :: AddAttributesToFindings -> NonEmpty Text
findingArns} -> NonEmpty Text
findingArns) (\s :: AddAttributesToFindings
s@AddAttributesToFindings' {} NonEmpty Text
a -> AddAttributesToFindings
s {$sel:findingArns:AddAttributesToFindings' :: NonEmpty Text
findingArns = NonEmpty Text
a} :: AddAttributesToFindings) ((NonEmpty Text -> f (NonEmpty Text))
-> AddAttributesToFindings -> f AddAttributesToFindings)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> AddAttributesToFindings
-> f AddAttributesToFindings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
addAttributesToFindings_attributes :: Lens.Lens' AddAttributesToFindings [Attribute]
addAttributesToFindings_attributes :: ([Attribute] -> f [Attribute])
-> AddAttributesToFindings -> f AddAttributesToFindings
addAttributesToFindings_attributes = (AddAttributesToFindings -> [Attribute])
-> (AddAttributesToFindings
-> [Attribute] -> AddAttributesToFindings)
-> Lens
AddAttributesToFindings
AddAttributesToFindings
[Attribute]
[Attribute]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddAttributesToFindings' {[Attribute]
attributes :: [Attribute]
$sel:attributes:AddAttributesToFindings' :: AddAttributesToFindings -> [Attribute]
attributes} -> [Attribute]
attributes) (\s :: AddAttributesToFindings
s@AddAttributesToFindings' {} [Attribute]
a -> AddAttributesToFindings
s {$sel:attributes:AddAttributesToFindings' :: [Attribute]
attributes = [Attribute]
a} :: AddAttributesToFindings) (([Attribute] -> f [Attribute])
-> AddAttributesToFindings -> f AddAttributesToFindings)
-> (([Attribute] -> f [Attribute]) -> [Attribute] -> f [Attribute])
-> ([Attribute] -> f [Attribute])
-> AddAttributesToFindings
-> f AddAttributesToFindings
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Attribute] -> f [Attribute]) -> [Attribute] -> f [Attribute]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest AddAttributesToFindings where
type
AWSResponse AddAttributesToFindings =
AddAttributesToFindingsResponse
request :: AddAttributesToFindings -> Request AddAttributesToFindings
request = Service
-> AddAttributesToFindings -> Request AddAttributesToFindings
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AddAttributesToFindings
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AddAttributesToFindings)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AddAttributesToFindings))
-> Logger
-> Service
-> Proxy AddAttributesToFindings
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AddAttributesToFindings)))
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 ->
Int
-> HashMap Text FailedItemDetails
-> AddAttributesToFindingsResponse
AddAttributesToFindingsResponse'
(Int
-> HashMap Text FailedItemDetails
-> AddAttributesToFindingsResponse)
-> Either String Int
-> Either
String
(HashMap Text FailedItemDetails -> AddAttributesToFindingsResponse)
forall (f :: * -> *) a b. Functor 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))
Either
String
(HashMap Text FailedItemDetails -> AddAttributesToFindingsResponse)
-> Either String (HashMap Text FailedItemDetails)
-> Either String AddAttributesToFindingsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object
-> Text -> Either String (Maybe (HashMap Text FailedItemDetails))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"failedItems" Either String (Maybe (HashMap Text FailedItemDetails))
-> HashMap Text FailedItemDetails
-> Either String (HashMap Text FailedItemDetails)
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ HashMap Text FailedItemDetails
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable AddAttributesToFindings
instance Prelude.NFData AddAttributesToFindings
instance Core.ToHeaders AddAttributesToFindings where
toHeaders :: AddAttributesToFindings -> ResponseHeaders
toHeaders =
ResponseHeaders -> AddAttributesToFindings -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"InspectorService.AddAttributesToFindings" ::
Prelude.ByteString
),
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 AddAttributesToFindings where
toJSON :: AddAttributesToFindings -> Value
toJSON AddAttributesToFindings' {[Attribute]
NonEmpty Text
attributes :: [Attribute]
findingArns :: NonEmpty Text
$sel:attributes:AddAttributesToFindings' :: AddAttributesToFindings -> [Attribute]
$sel:findingArns:AddAttributesToFindings' :: AddAttributesToFindings -> NonEmpty Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"findingArns" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
findingArns),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"attributes" Text -> [Attribute] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Attribute]
attributes)
]
)
instance Core.ToPath AddAttributesToFindings where
toPath :: AddAttributesToFindings -> ByteString
toPath = ByteString -> AddAttributesToFindings -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery AddAttributesToFindings where
toQuery :: AddAttributesToFindings -> QueryString
toQuery = QueryString -> AddAttributesToFindings -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AddAttributesToFindingsResponse = AddAttributesToFindingsResponse'
{
AddAttributesToFindingsResponse -> Int
httpStatus :: Prelude.Int,
AddAttributesToFindingsResponse -> HashMap Text FailedItemDetails
failedItems :: Prelude.HashMap Prelude.Text FailedItemDetails
}
deriving (AddAttributesToFindingsResponse
-> AddAttributesToFindingsResponse -> Bool
(AddAttributesToFindingsResponse
-> AddAttributesToFindingsResponse -> Bool)
-> (AddAttributesToFindingsResponse
-> AddAttributesToFindingsResponse -> Bool)
-> Eq AddAttributesToFindingsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AddAttributesToFindingsResponse
-> AddAttributesToFindingsResponse -> Bool
$c/= :: AddAttributesToFindingsResponse
-> AddAttributesToFindingsResponse -> Bool
== :: AddAttributesToFindingsResponse
-> AddAttributesToFindingsResponse -> Bool
$c== :: AddAttributesToFindingsResponse
-> AddAttributesToFindingsResponse -> Bool
Prelude.Eq, ReadPrec [AddAttributesToFindingsResponse]
ReadPrec AddAttributesToFindingsResponse
Int -> ReadS AddAttributesToFindingsResponse
ReadS [AddAttributesToFindingsResponse]
(Int -> ReadS AddAttributesToFindingsResponse)
-> ReadS [AddAttributesToFindingsResponse]
-> ReadPrec AddAttributesToFindingsResponse
-> ReadPrec [AddAttributesToFindingsResponse]
-> Read AddAttributesToFindingsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AddAttributesToFindingsResponse]
$creadListPrec :: ReadPrec [AddAttributesToFindingsResponse]
readPrec :: ReadPrec AddAttributesToFindingsResponse
$creadPrec :: ReadPrec AddAttributesToFindingsResponse
readList :: ReadS [AddAttributesToFindingsResponse]
$creadList :: ReadS [AddAttributesToFindingsResponse]
readsPrec :: Int -> ReadS AddAttributesToFindingsResponse
$creadsPrec :: Int -> ReadS AddAttributesToFindingsResponse
Prelude.Read, Int -> AddAttributesToFindingsResponse -> ShowS
[AddAttributesToFindingsResponse] -> ShowS
AddAttributesToFindingsResponse -> String
(Int -> AddAttributesToFindingsResponse -> ShowS)
-> (AddAttributesToFindingsResponse -> String)
-> ([AddAttributesToFindingsResponse] -> ShowS)
-> Show AddAttributesToFindingsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AddAttributesToFindingsResponse] -> ShowS
$cshowList :: [AddAttributesToFindingsResponse] -> ShowS
show :: AddAttributesToFindingsResponse -> String
$cshow :: AddAttributesToFindingsResponse -> String
showsPrec :: Int -> AddAttributesToFindingsResponse -> ShowS
$cshowsPrec :: Int -> AddAttributesToFindingsResponse -> ShowS
Prelude.Show, (forall x.
AddAttributesToFindingsResponse
-> Rep AddAttributesToFindingsResponse x)
-> (forall x.
Rep AddAttributesToFindingsResponse x
-> AddAttributesToFindingsResponse)
-> Generic AddAttributesToFindingsResponse
forall x.
Rep AddAttributesToFindingsResponse x
-> AddAttributesToFindingsResponse
forall x.
AddAttributesToFindingsResponse
-> Rep AddAttributesToFindingsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AddAttributesToFindingsResponse x
-> AddAttributesToFindingsResponse
$cfrom :: forall x.
AddAttributesToFindingsResponse
-> Rep AddAttributesToFindingsResponse x
Prelude.Generic)
newAddAttributesToFindingsResponse ::
Prelude.Int ->
AddAttributesToFindingsResponse
newAddAttributesToFindingsResponse :: Int -> AddAttributesToFindingsResponse
newAddAttributesToFindingsResponse Int
pHttpStatus_ =
AddAttributesToFindingsResponse' :: Int
-> HashMap Text FailedItemDetails
-> AddAttributesToFindingsResponse
AddAttributesToFindingsResponse'
{ $sel:httpStatus:AddAttributesToFindingsResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:failedItems:AddAttributesToFindingsResponse' :: HashMap Text FailedItemDetails
failedItems = HashMap Text FailedItemDetails
forall a. Monoid a => a
Prelude.mempty
}
addAttributesToFindingsResponse_httpStatus :: Lens.Lens' AddAttributesToFindingsResponse Prelude.Int
addAttributesToFindingsResponse_httpStatus :: (Int -> f Int)
-> AddAttributesToFindingsResponse
-> f AddAttributesToFindingsResponse
addAttributesToFindingsResponse_httpStatus = (AddAttributesToFindingsResponse -> Int)
-> (AddAttributesToFindingsResponse
-> Int -> AddAttributesToFindingsResponse)
-> Lens
AddAttributesToFindingsResponse
AddAttributesToFindingsResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddAttributesToFindingsResponse' {Int
httpStatus :: Int
$sel:httpStatus:AddAttributesToFindingsResponse' :: AddAttributesToFindingsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AddAttributesToFindingsResponse
s@AddAttributesToFindingsResponse' {} Int
a -> AddAttributesToFindingsResponse
s {$sel:httpStatus:AddAttributesToFindingsResponse' :: Int
httpStatus = Int
a} :: AddAttributesToFindingsResponse)
addAttributesToFindingsResponse_failedItems :: Lens.Lens' AddAttributesToFindingsResponse (Prelude.HashMap Prelude.Text FailedItemDetails)
addAttributesToFindingsResponse_failedItems :: (HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails))
-> AddAttributesToFindingsResponse
-> f AddAttributesToFindingsResponse
addAttributesToFindingsResponse_failedItems = (AddAttributesToFindingsResponse -> HashMap Text FailedItemDetails)
-> (AddAttributesToFindingsResponse
-> HashMap Text FailedItemDetails
-> AddAttributesToFindingsResponse)
-> Lens
AddAttributesToFindingsResponse
AddAttributesToFindingsResponse
(HashMap Text FailedItemDetails)
(HashMap Text FailedItemDetails)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AddAttributesToFindingsResponse' {HashMap Text FailedItemDetails
failedItems :: HashMap Text FailedItemDetails
$sel:failedItems:AddAttributesToFindingsResponse' :: AddAttributesToFindingsResponse -> HashMap Text FailedItemDetails
failedItems} -> HashMap Text FailedItemDetails
failedItems) (\s :: AddAttributesToFindingsResponse
s@AddAttributesToFindingsResponse' {} HashMap Text FailedItemDetails
a -> AddAttributesToFindingsResponse
s {$sel:failedItems:AddAttributesToFindingsResponse' :: HashMap Text FailedItemDetails
failedItems = HashMap Text FailedItemDetails
a} :: AddAttributesToFindingsResponse) ((HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails))
-> AddAttributesToFindingsResponse
-> f AddAttributesToFindingsResponse)
-> ((HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails))
-> HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails))
-> (HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails))
-> AddAttributesToFindingsResponse
-> f AddAttributesToFindingsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails))
-> HashMap Text FailedItemDetails
-> f (HashMap Text FailedItemDetails)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance
Prelude.NFData
AddAttributesToFindingsResponse