{-# 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_resourceType,
describeProtectedResourceResponse_lastBackupTime,
describeProtectedResourceResponse_resourceArn,
describeProtectedResourceResponse_httpStatus,
)
where
import Amazonka.Backup.Types
import qualified Amazonka.Core as Core
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 DescribeProtectedResource = DescribeProtectedResource'
{
DescribeProtectedResource -> Text
resourceArn :: Prelude.Text
}
deriving (DescribeProtectedResource -> DescribeProtectedResource -> Bool
(DescribeProtectedResource -> DescribeProtectedResource -> Bool)
-> (DescribeProtectedResource -> DescribeProtectedResource -> Bool)
-> Eq DescribeProtectedResource
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]
(Int -> ReadS DescribeProtectedResource)
-> ReadS [DescribeProtectedResource]
-> ReadPrec DescribeProtectedResource
-> ReadPrec [DescribeProtectedResource]
-> Read 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
(Int -> DescribeProtectedResource -> ShowS)
-> (DescribeProtectedResource -> String)
-> ([DescribeProtectedResource] -> ShowS)
-> Show DescribeProtectedResource
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.
DescribeProtectedResource -> Rep DescribeProtectedResource x)
-> (forall x.
Rep DescribeProtectedResource x -> DescribeProtectedResource)
-> Generic DescribeProtectedResource
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' :: Text -> DescribeProtectedResource
DescribeProtectedResource'
{ $sel:resourceArn:DescribeProtectedResource' :: Text
resourceArn =
Text
pResourceArn_
}
describeProtectedResource_resourceArn :: Lens.Lens' DescribeProtectedResource Prelude.Text
describeProtectedResource_resourceArn :: (Text -> f Text)
-> DescribeProtectedResource -> f DescribeProtectedResource
describeProtectedResource_resourceArn = (DescribeProtectedResource -> Text)
-> (DescribeProtectedResource -> Text -> DescribeProtectedResource)
-> Lens
DescribeProtectedResource DescribeProtectedResource Text Text
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 :: DescribeProtectedResource -> Request DescribeProtectedResource
request = Service
-> DescribeProtectedResource -> Request DescribeProtectedResource
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy DescribeProtectedResource
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeProtectedResource)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DescribeProtectedResource))
-> Logger
-> Service
-> Proxy DescribeProtectedResource
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse DescribeProtectedResource)))
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 Text
-> Maybe POSIX
-> Maybe Text
-> Int
-> DescribeProtectedResourceResponse
DescribeProtectedResourceResponse'
(Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Int
-> DescribeProtectedResourceResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe POSIX
-> Maybe Text -> Int -> DescribeProtectedResourceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResourceType")
Either
String
(Maybe POSIX
-> Maybe Text -> Int -> DescribeProtectedResourceResponse)
-> Either String (Maybe POSIX)
-> Either
String (Maybe Text -> Int -> DescribeProtectedResourceResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"LastBackupTime")
Either
String (Maybe Text -> Int -> DescribeProtectedResourceResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DescribeProtectedResourceResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ResourceArn")
Either String (Int -> DescribeProtectedResourceResponse)
-> Either String Int
-> Either String DescribeProtectedResourceResponse
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 DescribeProtectedResource
instance Prelude.NFData DescribeProtectedResource
instance Core.ToHeaders DescribeProtectedResource where
toHeaders :: DescribeProtectedResource -> ResponseHeaders
toHeaders =
ResponseHeaders -> DescribeProtectedResource -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.ToPath DescribeProtectedResource where
toPath :: DescribeProtectedResource -> ByteString
toPath DescribeProtectedResource' {Text
resourceArn :: Text
$sel:resourceArn:DescribeProtectedResource' :: DescribeProtectedResource -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ByteString
"/resources/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
resourceArn]
instance Core.ToQuery DescribeProtectedResource where
toQuery :: DescribeProtectedResource -> QueryString
toQuery = QueryString -> DescribeProtectedResource -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DescribeProtectedResourceResponse = DescribeProtectedResourceResponse'
{
DescribeProtectedResourceResponse -> Maybe Text
resourceType :: Prelude.Maybe Prelude.Text,
DescribeProtectedResourceResponse -> Maybe POSIX
lastBackupTime :: Prelude.Maybe Core.POSIX,
DescribeProtectedResourceResponse -> Maybe Text
resourceArn :: Prelude.Maybe Prelude.Text,
DescribeProtectedResourceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DescribeProtectedResourceResponse
-> DescribeProtectedResourceResponse -> Bool
(DescribeProtectedResourceResponse
-> DescribeProtectedResourceResponse -> Bool)
-> (DescribeProtectedResourceResponse
-> DescribeProtectedResourceResponse -> Bool)
-> Eq DescribeProtectedResourceResponse
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]
(Int -> ReadS DescribeProtectedResourceResponse)
-> ReadS [DescribeProtectedResourceResponse]
-> ReadPrec DescribeProtectedResourceResponse
-> ReadPrec [DescribeProtectedResourceResponse]
-> Read 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
(Int -> DescribeProtectedResourceResponse -> ShowS)
-> (DescribeProtectedResourceResponse -> String)
-> ([DescribeProtectedResourceResponse] -> ShowS)
-> Show DescribeProtectedResourceResponse
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.
DescribeProtectedResourceResponse
-> Rep DescribeProtectedResourceResponse x)
-> (forall x.
Rep DescribeProtectedResourceResponse x
-> DescribeProtectedResourceResponse)
-> Generic DescribeProtectedResourceResponse
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' :: Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Int
-> DescribeProtectedResourceResponse
DescribeProtectedResourceResponse'
{ $sel:resourceType:DescribeProtectedResourceResponse' :: Maybe Text
resourceType =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:lastBackupTime:DescribeProtectedResourceResponse' :: Maybe POSIX
lastBackupTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
$sel:resourceArn:DescribeProtectedResourceResponse' :: Maybe Text
resourceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DescribeProtectedResourceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
describeProtectedResourceResponse_resourceType :: Lens.Lens' DescribeProtectedResourceResponse (Prelude.Maybe Prelude.Text)
describeProtectedResourceResponse_resourceType :: (Maybe Text -> f (Maybe Text))
-> DescribeProtectedResourceResponse
-> f DescribeProtectedResourceResponse
describeProtectedResourceResponse_resourceType = (DescribeProtectedResourceResponse -> Maybe Text)
-> (DescribeProtectedResourceResponse
-> Maybe Text -> DescribeProtectedResourceResponse)
-> Lens
DescribeProtectedResourceResponse
DescribeProtectedResourceResponse
(Maybe Text)
(Maybe Text)
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_lastBackupTime :: Lens.Lens' DescribeProtectedResourceResponse (Prelude.Maybe Prelude.UTCTime)
describeProtectedResourceResponse_lastBackupTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeProtectedResourceResponse
-> f DescribeProtectedResourceResponse
describeProtectedResourceResponse_lastBackupTime = (DescribeProtectedResourceResponse -> Maybe POSIX)
-> (DescribeProtectedResourceResponse
-> Maybe POSIX -> DescribeProtectedResourceResponse)
-> Lens
DescribeProtectedResourceResponse
DescribeProtectedResourceResponse
(Maybe POSIX)
(Maybe POSIX)
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) ((Maybe POSIX -> f (Maybe POSIX))
-> DescribeProtectedResourceResponse
-> f DescribeProtectedResourceResponse)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
-> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DescribeProtectedResourceResponse
-> f DescribeProtectedResourceResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
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 POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time
describeProtectedResourceResponse_resourceArn :: Lens.Lens' DescribeProtectedResourceResponse (Prelude.Maybe Prelude.Text)
describeProtectedResourceResponse_resourceArn :: (Maybe Text -> f (Maybe Text))
-> DescribeProtectedResourceResponse
-> f DescribeProtectedResourceResponse
describeProtectedResourceResponse_resourceArn = (DescribeProtectedResourceResponse -> Maybe Text)
-> (DescribeProtectedResourceResponse
-> Maybe Text -> DescribeProtectedResourceResponse)
-> Lens
DescribeProtectedResourceResponse
DescribeProtectedResourceResponse
(Maybe Text)
(Maybe Text)
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_httpStatus :: Lens.Lens' DescribeProtectedResourceResponse Prelude.Int
describeProtectedResourceResponse_httpStatus :: (Int -> f Int)
-> DescribeProtectedResourceResponse
-> f DescribeProtectedResourceResponse
describeProtectedResourceResponse_httpStatus = (DescribeProtectedResourceResponse -> Int)
-> (DescribeProtectedResourceResponse
-> Int -> DescribeProtectedResourceResponse)
-> Lens
DescribeProtectedResourceResponse
DescribeProtectedResourceResponse
Int
Int
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