{-# 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.FMS.GetViolationDetails
(
GetViolationDetails (..),
newGetViolationDetails,
getViolationDetails_policyId,
getViolationDetails_memberAccount,
getViolationDetails_resourceId,
getViolationDetails_resourceType,
GetViolationDetailsResponse (..),
newGetViolationDetailsResponse,
getViolationDetailsResponse_violationDetail,
getViolationDetailsResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.FMS.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 GetViolationDetails = GetViolationDetails'
{
GetViolationDetails -> Text
policyId :: Prelude.Text,
GetViolationDetails -> Text
memberAccount :: Prelude.Text,
GetViolationDetails -> Text
resourceId :: Prelude.Text,
GetViolationDetails -> Text
resourceType :: Prelude.Text
}
deriving (GetViolationDetails -> GetViolationDetails -> Bool
(GetViolationDetails -> GetViolationDetails -> Bool)
-> (GetViolationDetails -> GetViolationDetails -> Bool)
-> Eq GetViolationDetails
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetViolationDetails -> GetViolationDetails -> Bool
$c/= :: GetViolationDetails -> GetViolationDetails -> Bool
== :: GetViolationDetails -> GetViolationDetails -> Bool
$c== :: GetViolationDetails -> GetViolationDetails -> Bool
Prelude.Eq, ReadPrec [GetViolationDetails]
ReadPrec GetViolationDetails
Int -> ReadS GetViolationDetails
ReadS [GetViolationDetails]
(Int -> ReadS GetViolationDetails)
-> ReadS [GetViolationDetails]
-> ReadPrec GetViolationDetails
-> ReadPrec [GetViolationDetails]
-> Read GetViolationDetails
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetViolationDetails]
$creadListPrec :: ReadPrec [GetViolationDetails]
readPrec :: ReadPrec GetViolationDetails
$creadPrec :: ReadPrec GetViolationDetails
readList :: ReadS [GetViolationDetails]
$creadList :: ReadS [GetViolationDetails]
readsPrec :: Int -> ReadS GetViolationDetails
$creadsPrec :: Int -> ReadS GetViolationDetails
Prelude.Read, Int -> GetViolationDetails -> ShowS
[GetViolationDetails] -> ShowS
GetViolationDetails -> String
(Int -> GetViolationDetails -> ShowS)
-> (GetViolationDetails -> String)
-> ([GetViolationDetails] -> ShowS)
-> Show GetViolationDetails
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetViolationDetails] -> ShowS
$cshowList :: [GetViolationDetails] -> ShowS
show :: GetViolationDetails -> String
$cshow :: GetViolationDetails -> String
showsPrec :: Int -> GetViolationDetails -> ShowS
$cshowsPrec :: Int -> GetViolationDetails -> ShowS
Prelude.Show, (forall x. GetViolationDetails -> Rep GetViolationDetails x)
-> (forall x. Rep GetViolationDetails x -> GetViolationDetails)
-> Generic GetViolationDetails
forall x. Rep GetViolationDetails x -> GetViolationDetails
forall x. GetViolationDetails -> Rep GetViolationDetails x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetViolationDetails x -> GetViolationDetails
$cfrom :: forall x. GetViolationDetails -> Rep GetViolationDetails x
Prelude.Generic)
newGetViolationDetails ::
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
Prelude.Text ->
GetViolationDetails
newGetViolationDetails :: Text -> Text -> Text -> Text -> GetViolationDetails
newGetViolationDetails
Text
pPolicyId_
Text
pMemberAccount_
Text
pResourceId_
Text
pResourceType_ =
GetViolationDetails' :: Text -> Text -> Text -> Text -> GetViolationDetails
GetViolationDetails'
{ $sel:policyId:GetViolationDetails' :: Text
policyId = Text
pPolicyId_,
$sel:memberAccount:GetViolationDetails' :: Text
memberAccount = Text
pMemberAccount_,
$sel:resourceId:GetViolationDetails' :: Text
resourceId = Text
pResourceId_,
$sel:resourceType:GetViolationDetails' :: Text
resourceType = Text
pResourceType_
}
getViolationDetails_policyId :: Lens.Lens' GetViolationDetails Prelude.Text
getViolationDetails_policyId :: (Text -> f Text) -> GetViolationDetails -> f GetViolationDetails
getViolationDetails_policyId = (GetViolationDetails -> Text)
-> (GetViolationDetails -> Text -> GetViolationDetails)
-> Lens GetViolationDetails GetViolationDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetViolationDetails' {Text
policyId :: Text
$sel:policyId:GetViolationDetails' :: GetViolationDetails -> Text
policyId} -> Text
policyId) (\s :: GetViolationDetails
s@GetViolationDetails' {} Text
a -> GetViolationDetails
s {$sel:policyId:GetViolationDetails' :: Text
policyId = Text
a} :: GetViolationDetails)
getViolationDetails_memberAccount :: Lens.Lens' GetViolationDetails Prelude.Text
getViolationDetails_memberAccount :: (Text -> f Text) -> GetViolationDetails -> f GetViolationDetails
getViolationDetails_memberAccount = (GetViolationDetails -> Text)
-> (GetViolationDetails -> Text -> GetViolationDetails)
-> Lens GetViolationDetails GetViolationDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetViolationDetails' {Text
memberAccount :: Text
$sel:memberAccount:GetViolationDetails' :: GetViolationDetails -> Text
memberAccount} -> Text
memberAccount) (\s :: GetViolationDetails
s@GetViolationDetails' {} Text
a -> GetViolationDetails
s {$sel:memberAccount:GetViolationDetails' :: Text
memberAccount = Text
a} :: GetViolationDetails)
getViolationDetails_resourceId :: Lens.Lens' GetViolationDetails Prelude.Text
getViolationDetails_resourceId :: (Text -> f Text) -> GetViolationDetails -> f GetViolationDetails
getViolationDetails_resourceId = (GetViolationDetails -> Text)
-> (GetViolationDetails -> Text -> GetViolationDetails)
-> Lens GetViolationDetails GetViolationDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetViolationDetails' {Text
resourceId :: Text
$sel:resourceId:GetViolationDetails' :: GetViolationDetails -> Text
resourceId} -> Text
resourceId) (\s :: GetViolationDetails
s@GetViolationDetails' {} Text
a -> GetViolationDetails
s {$sel:resourceId:GetViolationDetails' :: Text
resourceId = Text
a} :: GetViolationDetails)
getViolationDetails_resourceType :: Lens.Lens' GetViolationDetails Prelude.Text
getViolationDetails_resourceType :: (Text -> f Text) -> GetViolationDetails -> f GetViolationDetails
getViolationDetails_resourceType = (GetViolationDetails -> Text)
-> (GetViolationDetails -> Text -> GetViolationDetails)
-> Lens GetViolationDetails GetViolationDetails Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetViolationDetails' {Text
resourceType :: Text
$sel:resourceType:GetViolationDetails' :: GetViolationDetails -> Text
resourceType} -> Text
resourceType) (\s :: GetViolationDetails
s@GetViolationDetails' {} Text
a -> GetViolationDetails
s {$sel:resourceType:GetViolationDetails' :: Text
resourceType = Text
a} :: GetViolationDetails)
instance Core.AWSRequest GetViolationDetails where
type
AWSResponse GetViolationDetails =
GetViolationDetailsResponse
request :: GetViolationDetails -> Request GetViolationDetails
request = Service -> GetViolationDetails -> Request GetViolationDetails
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetViolationDetails
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetViolationDetails)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetViolationDetails))
-> Logger
-> Service
-> Proxy GetViolationDetails
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetViolationDetails)))
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 ViolationDetail -> Int -> GetViolationDetailsResponse
GetViolationDetailsResponse'
(Maybe ViolationDetail -> Int -> GetViolationDetailsResponse)
-> Either String (Maybe ViolationDetail)
-> Either String (Int -> GetViolationDetailsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ViolationDetail)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ViolationDetail")
Either String (Int -> GetViolationDetailsResponse)
-> Either String Int -> Either String GetViolationDetailsResponse
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 GetViolationDetails
instance Prelude.NFData GetViolationDetails
instance Core.ToHeaders GetViolationDetails where
toHeaders :: GetViolationDetails -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetViolationDetails -> 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
"AWSFMS_20180101.GetViolationDetails" ::
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 GetViolationDetails where
toJSON :: GetViolationDetails -> Value
toJSON GetViolationDetails' {Text
resourceType :: Text
resourceId :: Text
memberAccount :: Text
policyId :: Text
$sel:resourceType:GetViolationDetails' :: GetViolationDetails -> Text
$sel:resourceId:GetViolationDetails' :: GetViolationDetails -> Text
$sel:memberAccount:GetViolationDetails' :: GetViolationDetails -> Text
$sel:policyId:GetViolationDetails' :: GetViolationDetails -> 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
"PolicyId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
policyId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"MemberAccount" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
memberAccount),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceId),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceType)
]
)
instance Core.ToPath GetViolationDetails where
toPath :: GetViolationDetails -> ByteString
toPath = ByteString -> GetViolationDetails -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetViolationDetails where
toQuery :: GetViolationDetails -> QueryString
toQuery = QueryString -> GetViolationDetails -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetViolationDetailsResponse = GetViolationDetailsResponse'
{
GetViolationDetailsResponse -> Maybe ViolationDetail
violationDetail :: Prelude.Maybe ViolationDetail,
GetViolationDetailsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetViolationDetailsResponse -> GetViolationDetailsResponse -> Bool
(GetViolationDetailsResponse
-> GetViolationDetailsResponse -> Bool)
-> (GetViolationDetailsResponse
-> GetViolationDetailsResponse -> Bool)
-> Eq GetViolationDetailsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetViolationDetailsResponse -> GetViolationDetailsResponse -> Bool
$c/= :: GetViolationDetailsResponse -> GetViolationDetailsResponse -> Bool
== :: GetViolationDetailsResponse -> GetViolationDetailsResponse -> Bool
$c== :: GetViolationDetailsResponse -> GetViolationDetailsResponse -> Bool
Prelude.Eq, ReadPrec [GetViolationDetailsResponse]
ReadPrec GetViolationDetailsResponse
Int -> ReadS GetViolationDetailsResponse
ReadS [GetViolationDetailsResponse]
(Int -> ReadS GetViolationDetailsResponse)
-> ReadS [GetViolationDetailsResponse]
-> ReadPrec GetViolationDetailsResponse
-> ReadPrec [GetViolationDetailsResponse]
-> Read GetViolationDetailsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetViolationDetailsResponse]
$creadListPrec :: ReadPrec [GetViolationDetailsResponse]
readPrec :: ReadPrec GetViolationDetailsResponse
$creadPrec :: ReadPrec GetViolationDetailsResponse
readList :: ReadS [GetViolationDetailsResponse]
$creadList :: ReadS [GetViolationDetailsResponse]
readsPrec :: Int -> ReadS GetViolationDetailsResponse
$creadsPrec :: Int -> ReadS GetViolationDetailsResponse
Prelude.Read, Int -> GetViolationDetailsResponse -> ShowS
[GetViolationDetailsResponse] -> ShowS
GetViolationDetailsResponse -> String
(Int -> GetViolationDetailsResponse -> ShowS)
-> (GetViolationDetailsResponse -> String)
-> ([GetViolationDetailsResponse] -> ShowS)
-> Show GetViolationDetailsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetViolationDetailsResponse] -> ShowS
$cshowList :: [GetViolationDetailsResponse] -> ShowS
show :: GetViolationDetailsResponse -> String
$cshow :: GetViolationDetailsResponse -> String
showsPrec :: Int -> GetViolationDetailsResponse -> ShowS
$cshowsPrec :: Int -> GetViolationDetailsResponse -> ShowS
Prelude.Show, (forall x.
GetViolationDetailsResponse -> Rep GetViolationDetailsResponse x)
-> (forall x.
Rep GetViolationDetailsResponse x -> GetViolationDetailsResponse)
-> Generic GetViolationDetailsResponse
forall x.
Rep GetViolationDetailsResponse x -> GetViolationDetailsResponse
forall x.
GetViolationDetailsResponse -> Rep GetViolationDetailsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetViolationDetailsResponse x -> GetViolationDetailsResponse
$cfrom :: forall x.
GetViolationDetailsResponse -> Rep GetViolationDetailsResponse x
Prelude.Generic)
newGetViolationDetailsResponse ::
Prelude.Int ->
GetViolationDetailsResponse
newGetViolationDetailsResponse :: Int -> GetViolationDetailsResponse
newGetViolationDetailsResponse Int
pHttpStatus_ =
GetViolationDetailsResponse' :: Maybe ViolationDetail -> Int -> GetViolationDetailsResponse
GetViolationDetailsResponse'
{ $sel:violationDetail:GetViolationDetailsResponse' :: Maybe ViolationDetail
violationDetail =
Maybe ViolationDetail
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetViolationDetailsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getViolationDetailsResponse_violationDetail :: Lens.Lens' GetViolationDetailsResponse (Prelude.Maybe ViolationDetail)
getViolationDetailsResponse_violationDetail :: (Maybe ViolationDetail -> f (Maybe ViolationDetail))
-> GetViolationDetailsResponse -> f GetViolationDetailsResponse
getViolationDetailsResponse_violationDetail = (GetViolationDetailsResponse -> Maybe ViolationDetail)
-> (GetViolationDetailsResponse
-> Maybe ViolationDetail -> GetViolationDetailsResponse)
-> Lens
GetViolationDetailsResponse
GetViolationDetailsResponse
(Maybe ViolationDetail)
(Maybe ViolationDetail)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetViolationDetailsResponse' {Maybe ViolationDetail
violationDetail :: Maybe ViolationDetail
$sel:violationDetail:GetViolationDetailsResponse' :: GetViolationDetailsResponse -> Maybe ViolationDetail
violationDetail} -> Maybe ViolationDetail
violationDetail) (\s :: GetViolationDetailsResponse
s@GetViolationDetailsResponse' {} Maybe ViolationDetail
a -> GetViolationDetailsResponse
s {$sel:violationDetail:GetViolationDetailsResponse' :: Maybe ViolationDetail
violationDetail = Maybe ViolationDetail
a} :: GetViolationDetailsResponse)
getViolationDetailsResponse_httpStatus :: Lens.Lens' GetViolationDetailsResponse Prelude.Int
getViolationDetailsResponse_httpStatus :: (Int -> f Int)
-> GetViolationDetailsResponse -> f GetViolationDetailsResponse
getViolationDetailsResponse_httpStatus = (GetViolationDetailsResponse -> Int)
-> (GetViolationDetailsResponse
-> Int -> GetViolationDetailsResponse)
-> Lens
GetViolationDetailsResponse GetViolationDetailsResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetViolationDetailsResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetViolationDetailsResponse' :: GetViolationDetailsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetViolationDetailsResponse
s@GetViolationDetailsResponse' {} Int
a -> GetViolationDetailsResponse
s {$sel:httpStatus:GetViolationDetailsResponse' :: Int
httpStatus = Int
a} :: GetViolationDetailsResponse)
instance Prelude.NFData GetViolationDetailsResponse