{-# 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.CloudWatchLogs.GetDataProtectionPolicy
(
GetDataProtectionPolicy (..),
newGetDataProtectionPolicy,
getDataProtectionPolicy_logGroupIdentifier,
GetDataProtectionPolicyResponse (..),
newGetDataProtectionPolicyResponse,
getDataProtectionPolicyResponse_lastUpdatedTime,
getDataProtectionPolicyResponse_logGroupIdentifier,
getDataProtectionPolicyResponse_policyDocument,
getDataProtectionPolicyResponse_httpStatus,
)
where
import Amazonka.CloudWatchLogs.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetDataProtectionPolicy = GetDataProtectionPolicy'
{
GetDataProtectionPolicy -> Text
logGroupIdentifier :: Prelude.Text
}
deriving (GetDataProtectionPolicy -> GetDataProtectionPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDataProtectionPolicy -> GetDataProtectionPolicy -> Bool
$c/= :: GetDataProtectionPolicy -> GetDataProtectionPolicy -> Bool
== :: GetDataProtectionPolicy -> GetDataProtectionPolicy -> Bool
$c== :: GetDataProtectionPolicy -> GetDataProtectionPolicy -> Bool
Prelude.Eq, ReadPrec [GetDataProtectionPolicy]
ReadPrec GetDataProtectionPolicy
Int -> ReadS GetDataProtectionPolicy
ReadS [GetDataProtectionPolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDataProtectionPolicy]
$creadListPrec :: ReadPrec [GetDataProtectionPolicy]
readPrec :: ReadPrec GetDataProtectionPolicy
$creadPrec :: ReadPrec GetDataProtectionPolicy
readList :: ReadS [GetDataProtectionPolicy]
$creadList :: ReadS [GetDataProtectionPolicy]
readsPrec :: Int -> ReadS GetDataProtectionPolicy
$creadsPrec :: Int -> ReadS GetDataProtectionPolicy
Prelude.Read, Int -> GetDataProtectionPolicy -> ShowS
[GetDataProtectionPolicy] -> ShowS
GetDataProtectionPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDataProtectionPolicy] -> ShowS
$cshowList :: [GetDataProtectionPolicy] -> ShowS
show :: GetDataProtectionPolicy -> String
$cshow :: GetDataProtectionPolicy -> String
showsPrec :: Int -> GetDataProtectionPolicy -> ShowS
$cshowsPrec :: Int -> GetDataProtectionPolicy -> ShowS
Prelude.Show, forall x. Rep GetDataProtectionPolicy x -> GetDataProtectionPolicy
forall x. GetDataProtectionPolicy -> Rep GetDataProtectionPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDataProtectionPolicy x -> GetDataProtectionPolicy
$cfrom :: forall x. GetDataProtectionPolicy -> Rep GetDataProtectionPolicy x
Prelude.Generic)
newGetDataProtectionPolicy ::
Prelude.Text ->
GetDataProtectionPolicy
newGetDataProtectionPolicy :: Text -> GetDataProtectionPolicy
newGetDataProtectionPolicy Text
pLogGroupIdentifier_ =
GetDataProtectionPolicy'
{ $sel:logGroupIdentifier:GetDataProtectionPolicy' :: Text
logGroupIdentifier =
Text
pLogGroupIdentifier_
}
getDataProtectionPolicy_logGroupIdentifier :: Lens.Lens' GetDataProtectionPolicy Prelude.Text
getDataProtectionPolicy_logGroupIdentifier :: Lens' GetDataProtectionPolicy Text
getDataProtectionPolicy_logGroupIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDataProtectionPolicy' {Text
logGroupIdentifier :: Text
$sel:logGroupIdentifier:GetDataProtectionPolicy' :: GetDataProtectionPolicy -> Text
logGroupIdentifier} -> Text
logGroupIdentifier) (\s :: GetDataProtectionPolicy
s@GetDataProtectionPolicy' {} Text
a -> GetDataProtectionPolicy
s {$sel:logGroupIdentifier:GetDataProtectionPolicy' :: Text
logGroupIdentifier = Text
a} :: GetDataProtectionPolicy)
instance Core.AWSRequest GetDataProtectionPolicy where
type
AWSResponse GetDataProtectionPolicy =
GetDataProtectionPolicyResponse
request :: (Service -> Service)
-> GetDataProtectionPolicy -> Request GetDataProtectionPolicy
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetDataProtectionPolicy
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse GetDataProtectionPolicy)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe Natural
-> Maybe Text
-> Maybe Text
-> Int
-> GetDataProtectionPolicyResponse
GetDataProtectionPolicyResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"lastUpdatedTime")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"logGroupIdentifier")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"policyDocument")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable GetDataProtectionPolicy where
hashWithSalt :: Int -> GetDataProtectionPolicy -> Int
hashWithSalt Int
_salt GetDataProtectionPolicy' {Text
logGroupIdentifier :: Text
$sel:logGroupIdentifier:GetDataProtectionPolicy' :: GetDataProtectionPolicy -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
logGroupIdentifier
instance Prelude.NFData GetDataProtectionPolicy where
rnf :: GetDataProtectionPolicy -> ()
rnf GetDataProtectionPolicy' {Text
logGroupIdentifier :: Text
$sel:logGroupIdentifier:GetDataProtectionPolicy' :: GetDataProtectionPolicy -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
logGroupIdentifier
instance Data.ToHeaders GetDataProtectionPolicy where
toHeaders :: GetDataProtectionPolicy -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"Logs_20140328.GetDataProtectionPolicy" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON GetDataProtectionPolicy where
toJSON :: GetDataProtectionPolicy -> Value
toJSON GetDataProtectionPolicy' {Text
logGroupIdentifier :: Text
$sel:logGroupIdentifier:GetDataProtectionPolicy' :: GetDataProtectionPolicy -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ forall a. a -> Maybe a
Prelude.Just
(Key
"logGroupIdentifier" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
logGroupIdentifier)
]
)
instance Data.ToPath GetDataProtectionPolicy where
toPath :: GetDataProtectionPolicy -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery GetDataProtectionPolicy where
toQuery :: GetDataProtectionPolicy -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data GetDataProtectionPolicyResponse = GetDataProtectionPolicyResponse'
{
GetDataProtectionPolicyResponse -> Maybe Natural
lastUpdatedTime :: Prelude.Maybe Prelude.Natural,
GetDataProtectionPolicyResponse -> Maybe Text
logGroupIdentifier :: Prelude.Maybe Prelude.Text,
GetDataProtectionPolicyResponse -> Maybe Text
policyDocument :: Prelude.Maybe Prelude.Text,
GetDataProtectionPolicyResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDataProtectionPolicyResponse
-> GetDataProtectionPolicyResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDataProtectionPolicyResponse
-> GetDataProtectionPolicyResponse -> Bool
$c/= :: GetDataProtectionPolicyResponse
-> GetDataProtectionPolicyResponse -> Bool
== :: GetDataProtectionPolicyResponse
-> GetDataProtectionPolicyResponse -> Bool
$c== :: GetDataProtectionPolicyResponse
-> GetDataProtectionPolicyResponse -> Bool
Prelude.Eq, ReadPrec [GetDataProtectionPolicyResponse]
ReadPrec GetDataProtectionPolicyResponse
Int -> ReadS GetDataProtectionPolicyResponse
ReadS [GetDataProtectionPolicyResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDataProtectionPolicyResponse]
$creadListPrec :: ReadPrec [GetDataProtectionPolicyResponse]
readPrec :: ReadPrec GetDataProtectionPolicyResponse
$creadPrec :: ReadPrec GetDataProtectionPolicyResponse
readList :: ReadS [GetDataProtectionPolicyResponse]
$creadList :: ReadS [GetDataProtectionPolicyResponse]
readsPrec :: Int -> ReadS GetDataProtectionPolicyResponse
$creadsPrec :: Int -> ReadS GetDataProtectionPolicyResponse
Prelude.Read, Int -> GetDataProtectionPolicyResponse -> ShowS
[GetDataProtectionPolicyResponse] -> ShowS
GetDataProtectionPolicyResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDataProtectionPolicyResponse] -> ShowS
$cshowList :: [GetDataProtectionPolicyResponse] -> ShowS
show :: GetDataProtectionPolicyResponse -> String
$cshow :: GetDataProtectionPolicyResponse -> String
showsPrec :: Int -> GetDataProtectionPolicyResponse -> ShowS
$cshowsPrec :: Int -> GetDataProtectionPolicyResponse -> ShowS
Prelude.Show, forall x.
Rep GetDataProtectionPolicyResponse x
-> GetDataProtectionPolicyResponse
forall x.
GetDataProtectionPolicyResponse
-> Rep GetDataProtectionPolicyResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetDataProtectionPolicyResponse x
-> GetDataProtectionPolicyResponse
$cfrom :: forall x.
GetDataProtectionPolicyResponse
-> Rep GetDataProtectionPolicyResponse x
Prelude.Generic)
newGetDataProtectionPolicyResponse ::
Prelude.Int ->
GetDataProtectionPolicyResponse
newGetDataProtectionPolicyResponse :: Int -> GetDataProtectionPolicyResponse
newGetDataProtectionPolicyResponse Int
pHttpStatus_ =
GetDataProtectionPolicyResponse'
{ $sel:lastUpdatedTime:GetDataProtectionPolicyResponse' :: Maybe Natural
lastUpdatedTime =
forall a. Maybe a
Prelude.Nothing,
$sel:logGroupIdentifier:GetDataProtectionPolicyResponse' :: Maybe Text
logGroupIdentifier = forall a. Maybe a
Prelude.Nothing,
$sel:policyDocument:GetDataProtectionPolicyResponse' :: Maybe Text
policyDocument = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDataProtectionPolicyResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDataProtectionPolicyResponse_lastUpdatedTime :: Lens.Lens' GetDataProtectionPolicyResponse (Prelude.Maybe Prelude.Natural)
getDataProtectionPolicyResponse_lastUpdatedTime :: Lens' GetDataProtectionPolicyResponse (Maybe Natural)
getDataProtectionPolicyResponse_lastUpdatedTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDataProtectionPolicyResponse' {Maybe Natural
lastUpdatedTime :: Maybe Natural
$sel:lastUpdatedTime:GetDataProtectionPolicyResponse' :: GetDataProtectionPolicyResponse -> Maybe Natural
lastUpdatedTime} -> Maybe Natural
lastUpdatedTime) (\s :: GetDataProtectionPolicyResponse
s@GetDataProtectionPolicyResponse' {} Maybe Natural
a -> GetDataProtectionPolicyResponse
s {$sel:lastUpdatedTime:GetDataProtectionPolicyResponse' :: Maybe Natural
lastUpdatedTime = Maybe Natural
a} :: GetDataProtectionPolicyResponse)
getDataProtectionPolicyResponse_logGroupIdentifier :: Lens.Lens' GetDataProtectionPolicyResponse (Prelude.Maybe Prelude.Text)
getDataProtectionPolicyResponse_logGroupIdentifier :: Lens' GetDataProtectionPolicyResponse (Maybe Text)
getDataProtectionPolicyResponse_logGroupIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDataProtectionPolicyResponse' {Maybe Text
logGroupIdentifier :: Maybe Text
$sel:logGroupIdentifier:GetDataProtectionPolicyResponse' :: GetDataProtectionPolicyResponse -> Maybe Text
logGroupIdentifier} -> Maybe Text
logGroupIdentifier) (\s :: GetDataProtectionPolicyResponse
s@GetDataProtectionPolicyResponse' {} Maybe Text
a -> GetDataProtectionPolicyResponse
s {$sel:logGroupIdentifier:GetDataProtectionPolicyResponse' :: Maybe Text
logGroupIdentifier = Maybe Text
a} :: GetDataProtectionPolicyResponse)
getDataProtectionPolicyResponse_policyDocument :: Lens.Lens' GetDataProtectionPolicyResponse (Prelude.Maybe Prelude.Text)
getDataProtectionPolicyResponse_policyDocument :: Lens' GetDataProtectionPolicyResponse (Maybe Text)
getDataProtectionPolicyResponse_policyDocument = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDataProtectionPolicyResponse' {Maybe Text
policyDocument :: Maybe Text
$sel:policyDocument:GetDataProtectionPolicyResponse' :: GetDataProtectionPolicyResponse -> Maybe Text
policyDocument} -> Maybe Text
policyDocument) (\s :: GetDataProtectionPolicyResponse
s@GetDataProtectionPolicyResponse' {} Maybe Text
a -> GetDataProtectionPolicyResponse
s {$sel:policyDocument:GetDataProtectionPolicyResponse' :: Maybe Text
policyDocument = Maybe Text
a} :: GetDataProtectionPolicyResponse)
getDataProtectionPolicyResponse_httpStatus :: Lens.Lens' GetDataProtectionPolicyResponse Prelude.Int
getDataProtectionPolicyResponse_httpStatus :: Lens' GetDataProtectionPolicyResponse Int
getDataProtectionPolicyResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDataProtectionPolicyResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDataProtectionPolicyResponse' :: GetDataProtectionPolicyResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDataProtectionPolicyResponse
s@GetDataProtectionPolicyResponse' {} Int
a -> GetDataProtectionPolicyResponse
s {$sel:httpStatus:GetDataProtectionPolicyResponse' :: Int
httpStatus = Int
a} :: GetDataProtectionPolicyResponse)
instance
Prelude.NFData
GetDataProtectionPolicyResponse
where
rnf :: GetDataProtectionPolicyResponse -> ()
rnf GetDataProtectionPolicyResponse' {Int
Maybe Natural
Maybe Text
httpStatus :: Int
policyDocument :: Maybe Text
logGroupIdentifier :: Maybe Text
lastUpdatedTime :: Maybe Natural
$sel:httpStatus:GetDataProtectionPolicyResponse' :: GetDataProtectionPolicyResponse -> Int
$sel:policyDocument:GetDataProtectionPolicyResponse' :: GetDataProtectionPolicyResponse -> Maybe Text
$sel:logGroupIdentifier:GetDataProtectionPolicyResponse' :: GetDataProtectionPolicyResponse -> Maybe Text
$sel:lastUpdatedTime:GetDataProtectionPolicyResponse' :: GetDataProtectionPolicyResponse -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
lastUpdatedTime
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
logGroupIdentifier
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
policyDocument
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus