{-# 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.AccessAnalyzer.GetArchiveRule
(
GetArchiveRule (..),
newGetArchiveRule,
getArchiveRule_analyzerName,
getArchiveRule_ruleName,
GetArchiveRuleResponse (..),
newGetArchiveRuleResponse,
getArchiveRuleResponse_httpStatus,
getArchiveRuleResponse_archiveRule,
)
where
import Amazonka.AccessAnalyzer.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 GetArchiveRule = GetArchiveRule'
{
GetArchiveRule -> Text
analyzerName :: Prelude.Text,
GetArchiveRule -> Text
ruleName :: Prelude.Text
}
deriving (GetArchiveRule -> GetArchiveRule -> Bool
(GetArchiveRule -> GetArchiveRule -> Bool)
-> (GetArchiveRule -> GetArchiveRule -> Bool) -> Eq GetArchiveRule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetArchiveRule -> GetArchiveRule -> Bool
$c/= :: GetArchiveRule -> GetArchiveRule -> Bool
== :: GetArchiveRule -> GetArchiveRule -> Bool
$c== :: GetArchiveRule -> GetArchiveRule -> Bool
Prelude.Eq, ReadPrec [GetArchiveRule]
ReadPrec GetArchiveRule
Int -> ReadS GetArchiveRule
ReadS [GetArchiveRule]
(Int -> ReadS GetArchiveRule)
-> ReadS [GetArchiveRule]
-> ReadPrec GetArchiveRule
-> ReadPrec [GetArchiveRule]
-> Read GetArchiveRule
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetArchiveRule]
$creadListPrec :: ReadPrec [GetArchiveRule]
readPrec :: ReadPrec GetArchiveRule
$creadPrec :: ReadPrec GetArchiveRule
readList :: ReadS [GetArchiveRule]
$creadList :: ReadS [GetArchiveRule]
readsPrec :: Int -> ReadS GetArchiveRule
$creadsPrec :: Int -> ReadS GetArchiveRule
Prelude.Read, Int -> GetArchiveRule -> ShowS
[GetArchiveRule] -> ShowS
GetArchiveRule -> String
(Int -> GetArchiveRule -> ShowS)
-> (GetArchiveRule -> String)
-> ([GetArchiveRule] -> ShowS)
-> Show GetArchiveRule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetArchiveRule] -> ShowS
$cshowList :: [GetArchiveRule] -> ShowS
show :: GetArchiveRule -> String
$cshow :: GetArchiveRule -> String
showsPrec :: Int -> GetArchiveRule -> ShowS
$cshowsPrec :: Int -> GetArchiveRule -> ShowS
Prelude.Show, (forall x. GetArchiveRule -> Rep GetArchiveRule x)
-> (forall x. Rep GetArchiveRule x -> GetArchiveRule)
-> Generic GetArchiveRule
forall x. Rep GetArchiveRule x -> GetArchiveRule
forall x. GetArchiveRule -> Rep GetArchiveRule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetArchiveRule x -> GetArchiveRule
$cfrom :: forall x. GetArchiveRule -> Rep GetArchiveRule x
Prelude.Generic)
newGetArchiveRule ::
Prelude.Text ->
Prelude.Text ->
GetArchiveRule
newGetArchiveRule :: Text -> Text -> GetArchiveRule
newGetArchiveRule Text
pAnalyzerName_ Text
pRuleName_ =
GetArchiveRule' :: Text -> Text -> GetArchiveRule
GetArchiveRule'
{ $sel:analyzerName:GetArchiveRule' :: Text
analyzerName = Text
pAnalyzerName_,
$sel:ruleName:GetArchiveRule' :: Text
ruleName = Text
pRuleName_
}
getArchiveRule_analyzerName :: Lens.Lens' GetArchiveRule Prelude.Text
getArchiveRule_analyzerName :: (Text -> f Text) -> GetArchiveRule -> f GetArchiveRule
getArchiveRule_analyzerName = (GetArchiveRule -> Text)
-> (GetArchiveRule -> Text -> GetArchiveRule)
-> Lens GetArchiveRule GetArchiveRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetArchiveRule' {Text
analyzerName :: Text
$sel:analyzerName:GetArchiveRule' :: GetArchiveRule -> Text
analyzerName} -> Text
analyzerName) (\s :: GetArchiveRule
s@GetArchiveRule' {} Text
a -> GetArchiveRule
s {$sel:analyzerName:GetArchiveRule' :: Text
analyzerName = Text
a} :: GetArchiveRule)
getArchiveRule_ruleName :: Lens.Lens' GetArchiveRule Prelude.Text
getArchiveRule_ruleName :: (Text -> f Text) -> GetArchiveRule -> f GetArchiveRule
getArchiveRule_ruleName = (GetArchiveRule -> Text)
-> (GetArchiveRule -> Text -> GetArchiveRule)
-> Lens GetArchiveRule GetArchiveRule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetArchiveRule' {Text
ruleName :: Text
$sel:ruleName:GetArchiveRule' :: GetArchiveRule -> Text
ruleName} -> Text
ruleName) (\s :: GetArchiveRule
s@GetArchiveRule' {} Text
a -> GetArchiveRule
s {$sel:ruleName:GetArchiveRule' :: Text
ruleName = Text
a} :: GetArchiveRule)
instance Core.AWSRequest GetArchiveRule where
type
AWSResponse GetArchiveRule =
GetArchiveRuleResponse
request :: GetArchiveRule -> Request GetArchiveRule
request = Service -> GetArchiveRule -> Request GetArchiveRule
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy GetArchiveRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetArchiveRule)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetArchiveRule))
-> Logger
-> Service
-> Proxy GetArchiveRule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetArchiveRule)))
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 -> ArchiveRuleSummary -> GetArchiveRuleResponse
GetArchiveRuleResponse'
(Int -> ArchiveRuleSummary -> GetArchiveRuleResponse)
-> Either String Int
-> Either String (ArchiveRuleSummary -> GetArchiveRuleResponse)
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 (ArchiveRuleSummary -> GetArchiveRuleResponse)
-> Either String ArchiveRuleSummary
-> Either String GetArchiveRuleResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String ArchiveRuleSummary
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"archiveRule")
)
instance Prelude.Hashable GetArchiveRule
instance Prelude.NFData GetArchiveRule
instance Core.ToHeaders GetArchiveRule where
toHeaders :: GetArchiveRule -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetArchiveRule -> 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 GetArchiveRule where
toPath :: GetArchiveRule -> ByteString
toPath GetArchiveRule' {Text
ruleName :: Text
analyzerName :: Text
$sel:ruleName:GetArchiveRule' :: GetArchiveRule -> Text
$sel:analyzerName:GetArchiveRule' :: GetArchiveRule -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/analyzer/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
analyzerName,
ByteString
"/archive-rule/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
ruleName
]
instance Core.ToQuery GetArchiveRule where
toQuery :: GetArchiveRule -> QueryString
toQuery = QueryString -> GetArchiveRule -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetArchiveRuleResponse = GetArchiveRuleResponse'
{
GetArchiveRuleResponse -> Int
httpStatus :: Prelude.Int,
GetArchiveRuleResponse -> ArchiveRuleSummary
archiveRule :: ArchiveRuleSummary
}
deriving (GetArchiveRuleResponse -> GetArchiveRuleResponse -> Bool
(GetArchiveRuleResponse -> GetArchiveRuleResponse -> Bool)
-> (GetArchiveRuleResponse -> GetArchiveRuleResponse -> Bool)
-> Eq GetArchiveRuleResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetArchiveRuleResponse -> GetArchiveRuleResponse -> Bool
$c/= :: GetArchiveRuleResponse -> GetArchiveRuleResponse -> Bool
== :: GetArchiveRuleResponse -> GetArchiveRuleResponse -> Bool
$c== :: GetArchiveRuleResponse -> GetArchiveRuleResponse -> Bool
Prelude.Eq, ReadPrec [GetArchiveRuleResponse]
ReadPrec GetArchiveRuleResponse
Int -> ReadS GetArchiveRuleResponse
ReadS [GetArchiveRuleResponse]
(Int -> ReadS GetArchiveRuleResponse)
-> ReadS [GetArchiveRuleResponse]
-> ReadPrec GetArchiveRuleResponse
-> ReadPrec [GetArchiveRuleResponse]
-> Read GetArchiveRuleResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetArchiveRuleResponse]
$creadListPrec :: ReadPrec [GetArchiveRuleResponse]
readPrec :: ReadPrec GetArchiveRuleResponse
$creadPrec :: ReadPrec GetArchiveRuleResponse
readList :: ReadS [GetArchiveRuleResponse]
$creadList :: ReadS [GetArchiveRuleResponse]
readsPrec :: Int -> ReadS GetArchiveRuleResponse
$creadsPrec :: Int -> ReadS GetArchiveRuleResponse
Prelude.Read, Int -> GetArchiveRuleResponse -> ShowS
[GetArchiveRuleResponse] -> ShowS
GetArchiveRuleResponse -> String
(Int -> GetArchiveRuleResponse -> ShowS)
-> (GetArchiveRuleResponse -> String)
-> ([GetArchiveRuleResponse] -> ShowS)
-> Show GetArchiveRuleResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetArchiveRuleResponse] -> ShowS
$cshowList :: [GetArchiveRuleResponse] -> ShowS
show :: GetArchiveRuleResponse -> String
$cshow :: GetArchiveRuleResponse -> String
showsPrec :: Int -> GetArchiveRuleResponse -> ShowS
$cshowsPrec :: Int -> GetArchiveRuleResponse -> ShowS
Prelude.Show, (forall x. GetArchiveRuleResponse -> Rep GetArchiveRuleResponse x)
-> (forall x.
Rep GetArchiveRuleResponse x -> GetArchiveRuleResponse)
-> Generic GetArchiveRuleResponse
forall x. Rep GetArchiveRuleResponse x -> GetArchiveRuleResponse
forall x. GetArchiveRuleResponse -> Rep GetArchiveRuleResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetArchiveRuleResponse x -> GetArchiveRuleResponse
$cfrom :: forall x. GetArchiveRuleResponse -> Rep GetArchiveRuleResponse x
Prelude.Generic)
newGetArchiveRuleResponse ::
Prelude.Int ->
ArchiveRuleSummary ->
GetArchiveRuleResponse
newGetArchiveRuleResponse :: Int -> ArchiveRuleSummary -> GetArchiveRuleResponse
newGetArchiveRuleResponse Int
pHttpStatus_ ArchiveRuleSummary
pArchiveRule_ =
GetArchiveRuleResponse' :: Int -> ArchiveRuleSummary -> GetArchiveRuleResponse
GetArchiveRuleResponse'
{ $sel:httpStatus:GetArchiveRuleResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:archiveRule:GetArchiveRuleResponse' :: ArchiveRuleSummary
archiveRule = ArchiveRuleSummary
pArchiveRule_
}
getArchiveRuleResponse_httpStatus :: Lens.Lens' GetArchiveRuleResponse Prelude.Int
getArchiveRuleResponse_httpStatus :: (Int -> f Int)
-> GetArchiveRuleResponse -> f GetArchiveRuleResponse
getArchiveRuleResponse_httpStatus = (GetArchiveRuleResponse -> Int)
-> (GetArchiveRuleResponse -> Int -> GetArchiveRuleResponse)
-> Lens GetArchiveRuleResponse GetArchiveRuleResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetArchiveRuleResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetArchiveRuleResponse' :: GetArchiveRuleResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetArchiveRuleResponse
s@GetArchiveRuleResponse' {} Int
a -> GetArchiveRuleResponse
s {$sel:httpStatus:GetArchiveRuleResponse' :: Int
httpStatus = Int
a} :: GetArchiveRuleResponse)
getArchiveRuleResponse_archiveRule :: Lens.Lens' GetArchiveRuleResponse ArchiveRuleSummary
getArchiveRuleResponse_archiveRule :: (ArchiveRuleSummary -> f ArchiveRuleSummary)
-> GetArchiveRuleResponse -> f GetArchiveRuleResponse
getArchiveRuleResponse_archiveRule = (GetArchiveRuleResponse -> ArchiveRuleSummary)
-> (GetArchiveRuleResponse
-> ArchiveRuleSummary -> GetArchiveRuleResponse)
-> Lens
GetArchiveRuleResponse
GetArchiveRuleResponse
ArchiveRuleSummary
ArchiveRuleSummary
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetArchiveRuleResponse' {ArchiveRuleSummary
archiveRule :: ArchiveRuleSummary
$sel:archiveRule:GetArchiveRuleResponse' :: GetArchiveRuleResponse -> ArchiveRuleSummary
archiveRule} -> ArchiveRuleSummary
archiveRule) (\s :: GetArchiveRuleResponse
s@GetArchiveRuleResponse' {} ArchiveRuleSummary
a -> GetArchiveRuleResponse
s {$sel:archiveRule:GetArchiveRuleResponse' :: ArchiveRuleSummary
archiveRule = ArchiveRuleSummary
a} :: GetArchiveRuleResponse)
instance Prelude.NFData GetArchiveRuleResponse