{-# 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.Backup.DescribeProtectedResource
(
DescribeProtectedResource (..),
newDescribeProtectedResource,
describeProtectedResource_resourceArn,
DescribeProtectedResourceResponse (..),
newDescribeProtectedResourceResponse,
describeProtectedResourceResponse_lastBackupTime,
describeProtectedResourceResponse_resourceArn,
describeProtectedResourceResponse_resourceType,
describeProtectedResourceResponse_httpStatus,
)
where
import Amazonka.Backup.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 DescribeProtectedResource = DescribeProtectedResource'
{
DescribeProtectedResource -> Text
resourceArn :: Prelude.Text
}
deriving (DescribeProtectedResource -> DescribeProtectedResource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeProtectedResource -> DescribeProtectedResource -> Bool
$c/= :: DescribeProtectedResource -> DescribeProtectedResource -> Bool
== :: DescribeProtectedResource -> DescribeProtectedResource -> Bool
$c== :: DescribeProtectedResource -> DescribeProtectedResource -> Bool
Prelude.Eq, ReadPrec [DescribeProtectedResource]
ReadPrec DescribeProtectedResource
Int -> ReadS DescribeProtectedResource
ReadS [DescribeProtectedResource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeProtectedResource]
$creadListPrec :: ReadPrec [DescribeProtectedResource]
readPrec :: ReadPrec DescribeProtectedResource
$creadPrec :: ReadPrec DescribeProtectedResource
readList :: ReadS [DescribeProtectedResource]
$creadList :: ReadS [DescribeProtectedResource]
readsPrec :: Int -> ReadS DescribeProtectedResource
$creadsPrec :: Int -> ReadS DescribeProtectedResource
Prelude.Read, Int -> DescribeProtectedResource -> ShowS
[DescribeProtectedResource] -> ShowS
DescribeProtectedResource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeProtectedResource] -> ShowS
$cshowList :: [DescribeProtectedResource] -> ShowS
show :: DescribeProtectedResource -> String
$cshow :: DescribeProtectedResource -> String
showsPrec :: Int -> DescribeProtectedResource -> ShowS
$cshowsPrec :: Int -> DescribeProtectedResource -> ShowS
Prelude.Show, forall x.
Rep DescribeProtectedResource x -> DescribeProtectedResource
forall x.
DescribeProtectedResource -> Rep DescribeProtectedResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeProtectedResource x -> DescribeProtectedResource
$cfrom :: forall x.
DescribeProtectedResource -> Rep DescribeProtectedResource x
Prelude.Generic)
newDescribeProtectedResource ::
Prelude.Text ->
DescribeProtectedResource
newDescribeProtectedResource :: Text -> DescribeProtectedResource
newDescribeProtectedResource Text
pResourceArn_ =
DescribeProtectedResource'
{ $sel:resourceArn:DescribeProtectedResource' :: Text
resourceArn =
Text
pResourceArn_
}
describeProtectedResource_resourceArn :: Lens.Lens' DescribeProtectedResource Prelude.Text
describeProtectedResource_resourceArn :: Lens' DescribeProtectedResource Text
describeProtectedResource_resourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeProtectedResource' {Text
resourceArn :: Text
$sel:resourceArn:DescribeProtectedResource' :: DescribeProtectedResource -> Text
resourceArn} -> Text
resourceArn) (\s :: DescribeProtectedResource
s@DescribeProtectedResource' {} Text
a -> DescribeProtectedResource
s {$sel:resourceArn:DescribeProtectedResource' :: Text
resourceArn = Text
a} :: DescribeProtectedResource)
instance Core.AWSRequest DescribeProtectedResource where
type
AWSResponse DescribeProtectedResource =
DescribeProtectedResourceResponse
request :: (Service -> Service)
-> DescribeProtectedResource -> Request DescribeProtectedResource
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DescribeProtectedResource
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeProtectedResource)))
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 POSIX
-> Maybe Text
-> Maybe Text
-> Int
-> DescribeProtectedResourceResponse
DescribeProtectedResourceResponse'
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
"LastBackupTime")
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
"ResourceArn")
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
"ResourceType")
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 DescribeProtectedResource where
hashWithSalt :: Int -> DescribeProtectedResource -> Int
hashWithSalt Int
_salt DescribeProtectedResource' {Text
resourceArn :: Text
$sel:resourceArn:DescribeProtectedResource' :: DescribeProtectedResource -> Text
..} =
Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resourceArn
instance Prelude.NFData DescribeProtectedResource where
rnf :: DescribeProtectedResource -> ()
rnf DescribeProtectedResource' {Text
resourceArn :: Text
$sel:resourceArn:DescribeProtectedResource' :: DescribeProtectedResource -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
resourceArn
instance Data.ToHeaders DescribeProtectedResource where
toHeaders :: DescribeProtectedResource -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath DescribeProtectedResource where
toPath :: DescribeProtectedResource -> ByteString
toPath DescribeProtectedResource' {Text
resourceArn :: Text
$sel:resourceArn:DescribeProtectedResource' :: DescribeProtectedResource -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/resources/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
resourceArn]
instance Data.ToQuery DescribeProtectedResource where
toQuery :: DescribeProtectedResource -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data DescribeProtectedResourceResponse = DescribeProtectedResourceResponse'
{
DescribeProtectedResourceResponse -> Maybe POSIX
lastBackupTime :: Prelude.Maybe Data.POSIX,
DescribeProtectedResourceResponse -> Maybe Text
resourceArn :: Prelude.Maybe Prelude.Text,
DescribeProtectedResourceResponse -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
DescribeProtectedResourceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeProtectedResourceResponse
-> DescribeProtectedResourceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeProtectedResourceResponse
-> DescribeProtectedResourceResponse -> Bool
$c/= :: DescribeProtectedResourceResponse
-> DescribeProtectedResourceResponse -> Bool
== :: DescribeProtectedResourceResponse
-> DescribeProtectedResourceResponse -> Bool
$c== :: DescribeProtectedResourceResponse
-> DescribeProtectedResourceResponse -> Bool
Prelude.Eq, ReadPrec [DescribeProtectedResourceResponse]
ReadPrec DescribeProtectedResourceResponse
Int -> ReadS DescribeProtectedResourceResponse
ReadS [DescribeProtectedResourceResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeProtectedResourceResponse]
$creadListPrec :: ReadPrec [DescribeProtectedResourceResponse]
readPrec :: ReadPrec DescribeProtectedResourceResponse
$creadPrec :: ReadPrec DescribeProtectedResourceResponse
readList :: ReadS [DescribeProtectedResourceResponse]
$creadList :: ReadS [DescribeProtectedResourceResponse]
readsPrec :: Int -> ReadS DescribeProtectedResourceResponse
$creadsPrec :: Int -> ReadS DescribeProtectedResourceResponse
Prelude.Read, Int -> DescribeProtectedResourceResponse -> ShowS
[DescribeProtectedResourceResponse] -> ShowS
DescribeProtectedResourceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeProtectedResourceResponse] -> ShowS
$cshowList :: [DescribeProtectedResourceResponse] -> ShowS
show :: DescribeProtectedResourceResponse -> String
$cshow :: DescribeProtectedResourceResponse -> String
showsPrec :: Int -> DescribeProtectedResourceResponse -> ShowS
$cshowsPrec :: Int -> DescribeProtectedResourceResponse -> ShowS
Prelude.Show, forall x.
Rep DescribeProtectedResourceResponse x
-> DescribeProtectedResourceResponse
forall x.
DescribeProtectedResourceResponse
-> Rep DescribeProtectedResourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeProtectedResourceResponse x
-> DescribeProtectedResourceResponse
$cfrom :: forall x.
DescribeProtectedResourceResponse
-> Rep DescribeProtectedResourceResponse x
Prelude.Generic)
newDescribeProtectedResourceResponse ::
Prelude.Int ->
DescribeProtectedResourceResponse
newDescribeProtectedResourceResponse :: Int -> DescribeProtectedResourceResponse
newDescribeProtectedResourceResponse Int
pHttpStatus_ =
DescribeProtectedResourceResponse'
{ $sel:lastBackupTime:DescribeProtectedResourceResponse' :: Maybe POSIX
lastBackupTime =
forall a. Maybe a
Prelude.Nothing,
$sel:resourceArn:DescribeProtectedResourceResponse' :: Maybe Text
resourceArn = forall a. Maybe a
Prelude.Nothing,
$sel:resourceType:DescribeProtectedResourceResponse' :: Maybe Text
resourceType = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeProtectedResourceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeProtectedResourceResponse_lastBackupTime :: Lens.Lens' DescribeProtectedResourceResponse (Prelude.Maybe Prelude.UTCTime)
describeProtectedResourceResponse_lastBackupTime :: Lens' DescribeProtectedResourceResponse (Maybe UTCTime)
describeProtectedResourceResponse_lastBackupTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeProtectedResourceResponse' {Maybe POSIX
lastBackupTime :: Maybe POSIX
$sel:lastBackupTime:DescribeProtectedResourceResponse' :: DescribeProtectedResourceResponse -> Maybe POSIX
lastBackupTime} -> Maybe POSIX
lastBackupTime) (\s :: DescribeProtectedResourceResponse
s@DescribeProtectedResourceResponse' {} Maybe POSIX
a -> DescribeProtectedResourceResponse
s {$sel:lastBackupTime:DescribeProtectedResourceResponse' :: Maybe POSIX
lastBackupTime = Maybe POSIX
a} :: DescribeProtectedResourceResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
describeProtectedResourceResponse_resourceArn :: Lens.Lens' DescribeProtectedResourceResponse (Prelude.Maybe Prelude.Text)
describeProtectedResourceResponse_resourceArn :: Lens' DescribeProtectedResourceResponse (Maybe Text)
describeProtectedResourceResponse_resourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeProtectedResourceResponse' {Maybe Text
resourceArn :: Maybe Text
$sel:resourceArn:DescribeProtectedResourceResponse' :: DescribeProtectedResourceResponse -> Maybe Text
resourceArn} -> Maybe Text
resourceArn) (\s :: DescribeProtectedResourceResponse
s@DescribeProtectedResourceResponse' {} Maybe Text
a -> DescribeProtectedResourceResponse
s {$sel:resourceArn:DescribeProtectedResourceResponse' :: Maybe Text
resourceArn = Maybe Text
a} :: DescribeProtectedResourceResponse)
describeProtectedResourceResponse_resourceType :: Lens.Lens' DescribeProtectedResourceResponse (Prelude.Maybe Prelude.Text)
describeProtectedResourceResponse_resourceType :: Lens' DescribeProtectedResourceResponse (Maybe Text)
describeProtectedResourceResponse_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeProtectedResourceResponse' {Maybe Text
resourceType :: Maybe Text
$sel:resourceType:DescribeProtectedResourceResponse' :: DescribeProtectedResourceResponse -> Maybe Text
resourceType} -> Maybe Text
resourceType) (\s :: DescribeProtectedResourceResponse
s@DescribeProtectedResourceResponse' {} Maybe Text
a -> DescribeProtectedResourceResponse
s {$sel:resourceType:DescribeProtectedResourceResponse' :: Maybe Text
resourceType = Maybe Text
a} :: DescribeProtectedResourceResponse)
describeProtectedResourceResponse_httpStatus :: Lens.Lens' DescribeProtectedResourceResponse Prelude.Int
describeProtectedResourceResponse_httpStatus :: Lens' DescribeProtectedResourceResponse Int
describeProtectedResourceResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeProtectedResourceResponse' {Int
httpStatus :: Int
$sel:httpStatus:DescribeProtectedResourceResponse' :: DescribeProtectedResourceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DescribeProtectedResourceResponse
s@DescribeProtectedResourceResponse' {} Int
a -> DescribeProtectedResourceResponse
s {$sel:httpStatus:DescribeProtectedResourceResponse' :: Int
httpStatus = Int
a} :: DescribeProtectedResourceResponse)
instance
Prelude.NFData
DescribeProtectedResourceResponse
where
rnf :: DescribeProtectedResourceResponse -> ()
rnf DescribeProtectedResourceResponse' {Int
Maybe Text
Maybe POSIX
httpStatus :: Int
resourceType :: Maybe Text
resourceArn :: Maybe Text
lastBackupTime :: Maybe POSIX
$sel:httpStatus:DescribeProtectedResourceResponse' :: DescribeProtectedResourceResponse -> Int
$sel:resourceType:DescribeProtectedResourceResponse' :: DescribeProtectedResourceResponse -> Maybe Text
$sel:resourceArn:DescribeProtectedResourceResponse' :: DescribeProtectedResourceResponse -> Maybe Text
$sel:lastBackupTime:DescribeProtectedResourceResponse' :: DescribeProtectedResourceResponse -> Maybe POSIX
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
lastBackupTime
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus