{-# 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.Route53RecoveryControlConfig.ListSafetyRules
(
ListSafetyRules (..),
newListSafetyRules,
listSafetyRules_nextToken,
listSafetyRules_maxResults,
listSafetyRules_controlPanelArn,
ListSafetyRulesResponse (..),
newListSafetyRulesResponse,
listSafetyRulesResponse_nextToken,
listSafetyRulesResponse_safetyRules,
listSafetyRulesResponse_httpStatus,
)
where
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
import Amazonka.Route53RecoveryControlConfig.Types
data ListSafetyRules = ListSafetyRules'
{
ListSafetyRules -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListSafetyRules -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListSafetyRules -> Text
controlPanelArn :: Prelude.Text
}
deriving (ListSafetyRules -> ListSafetyRules -> Bool
(ListSafetyRules -> ListSafetyRules -> Bool)
-> (ListSafetyRules -> ListSafetyRules -> Bool)
-> Eq ListSafetyRules
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSafetyRules -> ListSafetyRules -> Bool
$c/= :: ListSafetyRules -> ListSafetyRules -> Bool
== :: ListSafetyRules -> ListSafetyRules -> Bool
$c== :: ListSafetyRules -> ListSafetyRules -> Bool
Prelude.Eq, ReadPrec [ListSafetyRules]
ReadPrec ListSafetyRules
Int -> ReadS ListSafetyRules
ReadS [ListSafetyRules]
(Int -> ReadS ListSafetyRules)
-> ReadS [ListSafetyRules]
-> ReadPrec ListSafetyRules
-> ReadPrec [ListSafetyRules]
-> Read ListSafetyRules
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSafetyRules]
$creadListPrec :: ReadPrec [ListSafetyRules]
readPrec :: ReadPrec ListSafetyRules
$creadPrec :: ReadPrec ListSafetyRules
readList :: ReadS [ListSafetyRules]
$creadList :: ReadS [ListSafetyRules]
readsPrec :: Int -> ReadS ListSafetyRules
$creadsPrec :: Int -> ReadS ListSafetyRules
Prelude.Read, Int -> ListSafetyRules -> ShowS
[ListSafetyRules] -> ShowS
ListSafetyRules -> String
(Int -> ListSafetyRules -> ShowS)
-> (ListSafetyRules -> String)
-> ([ListSafetyRules] -> ShowS)
-> Show ListSafetyRules
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSafetyRules] -> ShowS
$cshowList :: [ListSafetyRules] -> ShowS
show :: ListSafetyRules -> String
$cshow :: ListSafetyRules -> String
showsPrec :: Int -> ListSafetyRules -> ShowS
$cshowsPrec :: Int -> ListSafetyRules -> ShowS
Prelude.Show, (forall x. ListSafetyRules -> Rep ListSafetyRules x)
-> (forall x. Rep ListSafetyRules x -> ListSafetyRules)
-> Generic ListSafetyRules
forall x. Rep ListSafetyRules x -> ListSafetyRules
forall x. ListSafetyRules -> Rep ListSafetyRules x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSafetyRules x -> ListSafetyRules
$cfrom :: forall x. ListSafetyRules -> Rep ListSafetyRules x
Prelude.Generic)
newListSafetyRules ::
Prelude.Text ->
ListSafetyRules
newListSafetyRules :: Text -> ListSafetyRules
newListSafetyRules Text
pControlPanelArn_ =
ListSafetyRules' :: Maybe Text -> Maybe Natural -> Text -> ListSafetyRules
ListSafetyRules'
{ $sel:nextToken:ListSafetyRules' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListSafetyRules' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
$sel:controlPanelArn:ListSafetyRules' :: Text
controlPanelArn = Text
pControlPanelArn_
}
listSafetyRules_nextToken :: Lens.Lens' ListSafetyRules (Prelude.Maybe Prelude.Text)
listSafetyRules_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListSafetyRules -> f ListSafetyRules
listSafetyRules_nextToken = (ListSafetyRules -> Maybe Text)
-> (ListSafetyRules -> Maybe Text -> ListSafetyRules)
-> Lens ListSafetyRules ListSafetyRules (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSafetyRules' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSafetyRules' :: ListSafetyRules -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSafetyRules
s@ListSafetyRules' {} Maybe Text
a -> ListSafetyRules
s {$sel:nextToken:ListSafetyRules' :: Maybe Text
nextToken = Maybe Text
a} :: ListSafetyRules)
listSafetyRules_maxResults :: Lens.Lens' ListSafetyRules (Prelude.Maybe Prelude.Natural)
listSafetyRules_maxResults :: (Maybe Natural -> f (Maybe Natural))
-> ListSafetyRules -> f ListSafetyRules
listSafetyRules_maxResults = (ListSafetyRules -> Maybe Natural)
-> (ListSafetyRules -> Maybe Natural -> ListSafetyRules)
-> Lens
ListSafetyRules ListSafetyRules (Maybe Natural) (Maybe Natural)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSafetyRules' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListSafetyRules' :: ListSafetyRules -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListSafetyRules
s@ListSafetyRules' {} Maybe Natural
a -> ListSafetyRules
s {$sel:maxResults:ListSafetyRules' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListSafetyRules)
listSafetyRules_controlPanelArn :: Lens.Lens' ListSafetyRules Prelude.Text
listSafetyRules_controlPanelArn :: (Text -> f Text) -> ListSafetyRules -> f ListSafetyRules
listSafetyRules_controlPanelArn = (ListSafetyRules -> Text)
-> (ListSafetyRules -> Text -> ListSafetyRules)
-> Lens ListSafetyRules ListSafetyRules Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSafetyRules' {Text
controlPanelArn :: Text
$sel:controlPanelArn:ListSafetyRules' :: ListSafetyRules -> Text
controlPanelArn} -> Text
controlPanelArn) (\s :: ListSafetyRules
s@ListSafetyRules' {} Text
a -> ListSafetyRules
s {$sel:controlPanelArn:ListSafetyRules' :: Text
controlPanelArn = Text
a} :: ListSafetyRules)
instance Core.AWSRequest ListSafetyRules where
type
AWSResponse ListSafetyRules =
ListSafetyRulesResponse
request :: ListSafetyRules -> Request ListSafetyRules
request = Service -> ListSafetyRules -> Request ListSafetyRules
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
response :: Logger
-> Service
-> Proxy ListSafetyRules
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListSafetyRules)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListSafetyRules))
-> Logger
-> Service
-> Proxy ListSafetyRules
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListSafetyRules)))
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 [Rule] -> Int -> ListSafetyRulesResponse
ListSafetyRulesResponse'
(Maybe Text -> Maybe [Rule] -> Int -> ListSafetyRulesResponse)
-> Either String (Maybe Text)
-> Either String (Maybe [Rule] -> Int -> ListSafetyRulesResponse)
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
"NextToken")
Either String (Maybe [Rule] -> Int -> ListSafetyRulesResponse)
-> Either String (Maybe [Rule])
-> Either String (Int -> ListSafetyRulesResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe (Maybe [Rule]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"SafetyRules" Either String (Maybe (Maybe [Rule]))
-> Maybe [Rule] -> Either String (Maybe [Rule])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Rule]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> ListSafetyRulesResponse)
-> Either String Int -> Either String ListSafetyRulesResponse
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 ListSafetyRules
instance Prelude.NFData ListSafetyRules
instance Core.ToHeaders ListSafetyRules where
toHeaders :: ListSafetyRules -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListSafetyRules -> 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 ListSafetyRules where
toPath :: ListSafetyRules -> ByteString
toPath ListSafetyRules' {Maybe Natural
Maybe Text
Text
controlPanelArn :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:controlPanelArn:ListSafetyRules' :: ListSafetyRules -> Text
$sel:maxResults:ListSafetyRules' :: ListSafetyRules -> Maybe Natural
$sel:nextToken:ListSafetyRules' :: ListSafetyRules -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/controlpanel/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
controlPanelArn,
ByteString
"/safetyrules"
]
instance Core.ToQuery ListSafetyRules where
toQuery :: ListSafetyRules -> QueryString
toQuery ListSafetyRules' {Maybe Natural
Maybe Text
Text
controlPanelArn :: Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:controlPanelArn:ListSafetyRules' :: ListSafetyRules -> Text
$sel:maxResults:ListSafetyRules' :: ListSafetyRules -> Maybe Natural
$sel:nextToken:ListSafetyRules' :: ListSafetyRules -> Maybe Text
..} =
[QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"NextToken" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
nextToken,
ByteString
"MaxResults" ByteString -> Maybe Natural -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Natural
maxResults
]
data ListSafetyRulesResponse = ListSafetyRulesResponse'
{
ListSafetyRulesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListSafetyRulesResponse -> Maybe [Rule]
safetyRules :: Prelude.Maybe [Rule],
ListSafetyRulesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListSafetyRulesResponse -> ListSafetyRulesResponse -> Bool
(ListSafetyRulesResponse -> ListSafetyRulesResponse -> Bool)
-> (ListSafetyRulesResponse -> ListSafetyRulesResponse -> Bool)
-> Eq ListSafetyRulesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListSafetyRulesResponse -> ListSafetyRulesResponse -> Bool
$c/= :: ListSafetyRulesResponse -> ListSafetyRulesResponse -> Bool
== :: ListSafetyRulesResponse -> ListSafetyRulesResponse -> Bool
$c== :: ListSafetyRulesResponse -> ListSafetyRulesResponse -> Bool
Prelude.Eq, ReadPrec [ListSafetyRulesResponse]
ReadPrec ListSafetyRulesResponse
Int -> ReadS ListSafetyRulesResponse
ReadS [ListSafetyRulesResponse]
(Int -> ReadS ListSafetyRulesResponse)
-> ReadS [ListSafetyRulesResponse]
-> ReadPrec ListSafetyRulesResponse
-> ReadPrec [ListSafetyRulesResponse]
-> Read ListSafetyRulesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListSafetyRulesResponse]
$creadListPrec :: ReadPrec [ListSafetyRulesResponse]
readPrec :: ReadPrec ListSafetyRulesResponse
$creadPrec :: ReadPrec ListSafetyRulesResponse
readList :: ReadS [ListSafetyRulesResponse]
$creadList :: ReadS [ListSafetyRulesResponse]
readsPrec :: Int -> ReadS ListSafetyRulesResponse
$creadsPrec :: Int -> ReadS ListSafetyRulesResponse
Prelude.Read, Int -> ListSafetyRulesResponse -> ShowS
[ListSafetyRulesResponse] -> ShowS
ListSafetyRulesResponse -> String
(Int -> ListSafetyRulesResponse -> ShowS)
-> (ListSafetyRulesResponse -> String)
-> ([ListSafetyRulesResponse] -> ShowS)
-> Show ListSafetyRulesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListSafetyRulesResponse] -> ShowS
$cshowList :: [ListSafetyRulesResponse] -> ShowS
show :: ListSafetyRulesResponse -> String
$cshow :: ListSafetyRulesResponse -> String
showsPrec :: Int -> ListSafetyRulesResponse -> ShowS
$cshowsPrec :: Int -> ListSafetyRulesResponse -> ShowS
Prelude.Show, (forall x.
ListSafetyRulesResponse -> Rep ListSafetyRulesResponse x)
-> (forall x.
Rep ListSafetyRulesResponse x -> ListSafetyRulesResponse)
-> Generic ListSafetyRulesResponse
forall x. Rep ListSafetyRulesResponse x -> ListSafetyRulesResponse
forall x. ListSafetyRulesResponse -> Rep ListSafetyRulesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListSafetyRulesResponse x -> ListSafetyRulesResponse
$cfrom :: forall x. ListSafetyRulesResponse -> Rep ListSafetyRulesResponse x
Prelude.Generic)
newListSafetyRulesResponse ::
Prelude.Int ->
ListSafetyRulesResponse
newListSafetyRulesResponse :: Int -> ListSafetyRulesResponse
newListSafetyRulesResponse Int
pHttpStatus_ =
ListSafetyRulesResponse' :: Maybe Text -> Maybe [Rule] -> Int -> ListSafetyRulesResponse
ListSafetyRulesResponse'
{ $sel:nextToken:ListSafetyRulesResponse' :: Maybe Text
nextToken =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:safetyRules:ListSafetyRulesResponse' :: Maybe [Rule]
safetyRules = Maybe [Rule]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListSafetyRulesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listSafetyRulesResponse_nextToken :: Lens.Lens' ListSafetyRulesResponse (Prelude.Maybe Prelude.Text)
listSafetyRulesResponse_nextToken :: (Maybe Text -> f (Maybe Text))
-> ListSafetyRulesResponse -> f ListSafetyRulesResponse
listSafetyRulesResponse_nextToken = (ListSafetyRulesResponse -> Maybe Text)
-> (ListSafetyRulesResponse
-> Maybe Text -> ListSafetyRulesResponse)
-> Lens
ListSafetyRulesResponse
ListSafetyRulesResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSafetyRulesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListSafetyRulesResponse' :: ListSafetyRulesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListSafetyRulesResponse
s@ListSafetyRulesResponse' {} Maybe Text
a -> ListSafetyRulesResponse
s {$sel:nextToken:ListSafetyRulesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListSafetyRulesResponse)
listSafetyRulesResponse_safetyRules :: Lens.Lens' ListSafetyRulesResponse (Prelude.Maybe [Rule])
listSafetyRulesResponse_safetyRules :: (Maybe [Rule] -> f (Maybe [Rule]))
-> ListSafetyRulesResponse -> f ListSafetyRulesResponse
listSafetyRulesResponse_safetyRules = (ListSafetyRulesResponse -> Maybe [Rule])
-> (ListSafetyRulesResponse
-> Maybe [Rule] -> ListSafetyRulesResponse)
-> Lens
ListSafetyRulesResponse
ListSafetyRulesResponse
(Maybe [Rule])
(Maybe [Rule])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSafetyRulesResponse' {Maybe [Rule]
safetyRules :: Maybe [Rule]
$sel:safetyRules:ListSafetyRulesResponse' :: ListSafetyRulesResponse -> Maybe [Rule]
safetyRules} -> Maybe [Rule]
safetyRules) (\s :: ListSafetyRulesResponse
s@ListSafetyRulesResponse' {} Maybe [Rule]
a -> ListSafetyRulesResponse
s {$sel:safetyRules:ListSafetyRulesResponse' :: Maybe [Rule]
safetyRules = Maybe [Rule]
a} :: ListSafetyRulesResponse) ((Maybe [Rule] -> f (Maybe [Rule]))
-> ListSafetyRulesResponse -> f ListSafetyRulesResponse)
-> ((Maybe [Rule] -> f (Maybe [Rule]))
-> Maybe [Rule] -> f (Maybe [Rule]))
-> (Maybe [Rule] -> f (Maybe [Rule]))
-> ListSafetyRulesResponse
-> f ListSafetyRulesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Rule] [Rule] [Rule] [Rule]
-> Iso (Maybe [Rule]) (Maybe [Rule]) (Maybe [Rule]) (Maybe [Rule])
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 [Rule] [Rule] [Rule] [Rule]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listSafetyRulesResponse_httpStatus :: Lens.Lens' ListSafetyRulesResponse Prelude.Int
listSafetyRulesResponse_httpStatus :: (Int -> f Int)
-> ListSafetyRulesResponse -> f ListSafetyRulesResponse
listSafetyRulesResponse_httpStatus = (ListSafetyRulesResponse -> Int)
-> (ListSafetyRulesResponse -> Int -> ListSafetyRulesResponse)
-> Lens ListSafetyRulesResponse ListSafetyRulesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListSafetyRulesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListSafetyRulesResponse' :: ListSafetyRulesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListSafetyRulesResponse
s@ListSafetyRulesResponse' {} Int
a -> ListSafetyRulesResponse
s {$sel:httpStatus:ListSafetyRulesResponse' :: Int
httpStatus = Int
a} :: ListSafetyRulesResponse)
instance Prelude.NFData ListSafetyRulesResponse