{-# 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.DirectConnect.StartBgpFailoverTest
(
StartBgpFailoverTest (..),
newStartBgpFailoverTest,
startBgpFailoverTest_bgpPeers,
startBgpFailoverTest_testDurationInMinutes,
startBgpFailoverTest_virtualInterfaceId,
StartBgpFailoverTestResponse (..),
newStartBgpFailoverTestResponse,
startBgpFailoverTestResponse_virtualInterfaceTest,
startBgpFailoverTestResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.DirectConnect.Types
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 StartBgpFailoverTest = StartBgpFailoverTest'
{
StartBgpFailoverTest -> Maybe [Text]
bgpPeers :: Prelude.Maybe [Prelude.Text],
StartBgpFailoverTest -> Maybe Int
testDurationInMinutes :: Prelude.Maybe Prelude.Int,
StartBgpFailoverTest -> Text
virtualInterfaceId :: Prelude.Text
}
deriving (StartBgpFailoverTest -> StartBgpFailoverTest -> Bool
(StartBgpFailoverTest -> StartBgpFailoverTest -> Bool)
-> (StartBgpFailoverTest -> StartBgpFailoverTest -> Bool)
-> Eq StartBgpFailoverTest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartBgpFailoverTest -> StartBgpFailoverTest -> Bool
$c/= :: StartBgpFailoverTest -> StartBgpFailoverTest -> Bool
== :: StartBgpFailoverTest -> StartBgpFailoverTest -> Bool
$c== :: StartBgpFailoverTest -> StartBgpFailoverTest -> Bool
Prelude.Eq, ReadPrec [StartBgpFailoverTest]
ReadPrec StartBgpFailoverTest
Int -> ReadS StartBgpFailoverTest
ReadS [StartBgpFailoverTest]
(Int -> ReadS StartBgpFailoverTest)
-> ReadS [StartBgpFailoverTest]
-> ReadPrec StartBgpFailoverTest
-> ReadPrec [StartBgpFailoverTest]
-> Read StartBgpFailoverTest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartBgpFailoverTest]
$creadListPrec :: ReadPrec [StartBgpFailoverTest]
readPrec :: ReadPrec StartBgpFailoverTest
$creadPrec :: ReadPrec StartBgpFailoverTest
readList :: ReadS [StartBgpFailoverTest]
$creadList :: ReadS [StartBgpFailoverTest]
readsPrec :: Int -> ReadS StartBgpFailoverTest
$creadsPrec :: Int -> ReadS StartBgpFailoverTest
Prelude.Read, Int -> StartBgpFailoverTest -> ShowS
[StartBgpFailoverTest] -> ShowS
StartBgpFailoverTest -> String
(Int -> StartBgpFailoverTest -> ShowS)
-> (StartBgpFailoverTest -> String)
-> ([StartBgpFailoverTest] -> ShowS)
-> Show StartBgpFailoverTest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartBgpFailoverTest] -> ShowS
$cshowList :: [StartBgpFailoverTest] -> ShowS
show :: StartBgpFailoverTest -> String
$cshow :: StartBgpFailoverTest -> String
showsPrec :: Int -> StartBgpFailoverTest -> ShowS
$cshowsPrec :: Int -> StartBgpFailoverTest -> ShowS
Prelude.Show, (forall x. StartBgpFailoverTest -> Rep StartBgpFailoverTest x)
-> (forall x. Rep StartBgpFailoverTest x -> StartBgpFailoverTest)
-> Generic StartBgpFailoverTest
forall x. Rep StartBgpFailoverTest x -> StartBgpFailoverTest
forall x. StartBgpFailoverTest -> Rep StartBgpFailoverTest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StartBgpFailoverTest x -> StartBgpFailoverTest
$cfrom :: forall x. StartBgpFailoverTest -> Rep StartBgpFailoverTest x
Prelude.Generic)
newStartBgpFailoverTest ::
Prelude.Text ->
StartBgpFailoverTest
newStartBgpFailoverTest :: Text -> StartBgpFailoverTest
newStartBgpFailoverTest Text
pVirtualInterfaceId_ =
StartBgpFailoverTest' :: Maybe [Text] -> Maybe Int -> Text -> StartBgpFailoverTest
StartBgpFailoverTest'
{ $sel:bgpPeers:StartBgpFailoverTest' :: Maybe [Text]
bgpPeers = Maybe [Text]
forall a. Maybe a
Prelude.Nothing,
$sel:testDurationInMinutes:StartBgpFailoverTest' :: Maybe Int
testDurationInMinutes = Maybe Int
forall a. Maybe a
Prelude.Nothing,
$sel:virtualInterfaceId:StartBgpFailoverTest' :: Text
virtualInterfaceId = Text
pVirtualInterfaceId_
}
startBgpFailoverTest_bgpPeers :: Lens.Lens' StartBgpFailoverTest (Prelude.Maybe [Prelude.Text])
startBgpFailoverTest_bgpPeers :: (Maybe [Text] -> f (Maybe [Text]))
-> StartBgpFailoverTest -> f StartBgpFailoverTest
startBgpFailoverTest_bgpPeers = (StartBgpFailoverTest -> Maybe [Text])
-> (StartBgpFailoverTest -> Maybe [Text] -> StartBgpFailoverTest)
-> Lens
StartBgpFailoverTest
StartBgpFailoverTest
(Maybe [Text])
(Maybe [Text])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartBgpFailoverTest' {Maybe [Text]
bgpPeers :: Maybe [Text]
$sel:bgpPeers:StartBgpFailoverTest' :: StartBgpFailoverTest -> Maybe [Text]
bgpPeers} -> Maybe [Text]
bgpPeers) (\s :: StartBgpFailoverTest
s@StartBgpFailoverTest' {} Maybe [Text]
a -> StartBgpFailoverTest
s {$sel:bgpPeers:StartBgpFailoverTest' :: Maybe [Text]
bgpPeers = Maybe [Text]
a} :: StartBgpFailoverTest) ((Maybe [Text] -> f (Maybe [Text]))
-> StartBgpFailoverTest -> f StartBgpFailoverTest)
-> ((Maybe [Text] -> f (Maybe [Text]))
-> Maybe [Text] -> f (Maybe [Text]))
-> (Maybe [Text] -> f (Maybe [Text]))
-> StartBgpFailoverTest
-> f StartBgpFailoverTest
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Text] [Text] [Text] [Text]
-> Iso (Maybe [Text]) (Maybe [Text]) (Maybe [Text]) (Maybe [Text])
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 [Text] [Text] [Text] [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
startBgpFailoverTest_testDurationInMinutes :: Lens.Lens' StartBgpFailoverTest (Prelude.Maybe Prelude.Int)
startBgpFailoverTest_testDurationInMinutes :: (Maybe Int -> f (Maybe Int))
-> StartBgpFailoverTest -> f StartBgpFailoverTest
startBgpFailoverTest_testDurationInMinutes = (StartBgpFailoverTest -> Maybe Int)
-> (StartBgpFailoverTest -> Maybe Int -> StartBgpFailoverTest)
-> Lens
StartBgpFailoverTest StartBgpFailoverTest (Maybe Int) (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartBgpFailoverTest' {Maybe Int
testDurationInMinutes :: Maybe Int
$sel:testDurationInMinutes:StartBgpFailoverTest' :: StartBgpFailoverTest -> Maybe Int
testDurationInMinutes} -> Maybe Int
testDurationInMinutes) (\s :: StartBgpFailoverTest
s@StartBgpFailoverTest' {} Maybe Int
a -> StartBgpFailoverTest
s {$sel:testDurationInMinutes:StartBgpFailoverTest' :: Maybe Int
testDurationInMinutes = Maybe Int
a} :: StartBgpFailoverTest)
startBgpFailoverTest_virtualInterfaceId :: Lens.Lens' StartBgpFailoverTest Prelude.Text
startBgpFailoverTest_virtualInterfaceId :: (Text -> f Text) -> StartBgpFailoverTest -> f StartBgpFailoverTest
startBgpFailoverTest_virtualInterfaceId = (StartBgpFailoverTest -> Text)
-> (StartBgpFailoverTest -> Text -> StartBgpFailoverTest)
-> Lens StartBgpFailoverTest StartBgpFailoverTest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartBgpFailoverTest' {Text
virtualInterfaceId :: Text
$sel:virtualInterfaceId:StartBgpFailoverTest' :: StartBgpFailoverTest -> Text
virtualInterfaceId} -> Text
virtualInterfaceId) (\s :: StartBgpFailoverTest
s@StartBgpFailoverTest' {} Text
a -> StartBgpFailoverTest
s {$sel:virtualInterfaceId:StartBgpFailoverTest' :: Text
virtualInterfaceId = Text
a} :: StartBgpFailoverTest)
instance Core.AWSRequest StartBgpFailoverTest where
type
AWSResponse StartBgpFailoverTest =
StartBgpFailoverTestResponse
request :: StartBgpFailoverTest -> Request StartBgpFailoverTest
request = Service -> StartBgpFailoverTest -> Request StartBgpFailoverTest
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy StartBgpFailoverTest
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartBgpFailoverTest)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse StartBgpFailoverTest))
-> Logger
-> Service
-> Proxy StartBgpFailoverTest
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse StartBgpFailoverTest)))
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 VirtualInterfaceTestHistory
-> Int -> StartBgpFailoverTestResponse
StartBgpFailoverTestResponse'
(Maybe VirtualInterfaceTestHistory
-> Int -> StartBgpFailoverTestResponse)
-> Either String (Maybe VirtualInterfaceTestHistory)
-> Either String (Int -> StartBgpFailoverTestResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe VirtualInterfaceTestHistory)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"virtualInterfaceTest")
Either String (Int -> StartBgpFailoverTestResponse)
-> Either String Int -> Either String StartBgpFailoverTestResponse
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 StartBgpFailoverTest
instance Prelude.NFData StartBgpFailoverTest
instance Core.ToHeaders StartBgpFailoverTest where
toHeaders :: StartBgpFailoverTest -> ResponseHeaders
toHeaders =
ResponseHeaders -> StartBgpFailoverTest -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"OvertureService.StartBgpFailoverTest" ::
Prelude.ByteString
),
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.ToJSON StartBgpFailoverTest where
toJSON :: StartBgpFailoverTest -> Value
toJSON StartBgpFailoverTest' {Maybe Int
Maybe [Text]
Text
virtualInterfaceId :: Text
testDurationInMinutes :: Maybe Int
bgpPeers :: Maybe [Text]
$sel:virtualInterfaceId:StartBgpFailoverTest' :: StartBgpFailoverTest -> Text
$sel:testDurationInMinutes:StartBgpFailoverTest' :: StartBgpFailoverTest -> Maybe Int
$sel:bgpPeers:StartBgpFailoverTest' :: StartBgpFailoverTest -> Maybe [Text]
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"bgpPeers" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Text] -> Pair) -> Maybe [Text] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
bgpPeers,
(Text
"testDurationInMinutes" Text -> Int -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Int -> Pair) -> Maybe Int -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Int
testDurationInMinutes,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
(Text
"virtualInterfaceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
virtualInterfaceId)
]
)
instance Core.ToPath StartBgpFailoverTest where
toPath :: StartBgpFailoverTest -> ByteString
toPath = ByteString -> StartBgpFailoverTest -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery StartBgpFailoverTest where
toQuery :: StartBgpFailoverTest -> QueryString
toQuery = QueryString -> StartBgpFailoverTest -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data StartBgpFailoverTestResponse = StartBgpFailoverTestResponse'
{
StartBgpFailoverTestResponse -> Maybe VirtualInterfaceTestHistory
virtualInterfaceTest :: Prelude.Maybe VirtualInterfaceTestHistory,
StartBgpFailoverTestResponse -> Int
httpStatus :: Prelude.Int
}
deriving (StartBgpFailoverTestResponse
-> StartBgpFailoverTestResponse -> Bool
(StartBgpFailoverTestResponse
-> StartBgpFailoverTestResponse -> Bool)
-> (StartBgpFailoverTestResponse
-> StartBgpFailoverTestResponse -> Bool)
-> Eq StartBgpFailoverTestResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartBgpFailoverTestResponse
-> StartBgpFailoverTestResponse -> Bool
$c/= :: StartBgpFailoverTestResponse
-> StartBgpFailoverTestResponse -> Bool
== :: StartBgpFailoverTestResponse
-> StartBgpFailoverTestResponse -> Bool
$c== :: StartBgpFailoverTestResponse
-> StartBgpFailoverTestResponse -> Bool
Prelude.Eq, ReadPrec [StartBgpFailoverTestResponse]
ReadPrec StartBgpFailoverTestResponse
Int -> ReadS StartBgpFailoverTestResponse
ReadS [StartBgpFailoverTestResponse]
(Int -> ReadS StartBgpFailoverTestResponse)
-> ReadS [StartBgpFailoverTestResponse]
-> ReadPrec StartBgpFailoverTestResponse
-> ReadPrec [StartBgpFailoverTestResponse]
-> Read StartBgpFailoverTestResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartBgpFailoverTestResponse]
$creadListPrec :: ReadPrec [StartBgpFailoverTestResponse]
readPrec :: ReadPrec StartBgpFailoverTestResponse
$creadPrec :: ReadPrec StartBgpFailoverTestResponse
readList :: ReadS [StartBgpFailoverTestResponse]
$creadList :: ReadS [StartBgpFailoverTestResponse]
readsPrec :: Int -> ReadS StartBgpFailoverTestResponse
$creadsPrec :: Int -> ReadS StartBgpFailoverTestResponse
Prelude.Read, Int -> StartBgpFailoverTestResponse -> ShowS
[StartBgpFailoverTestResponse] -> ShowS
StartBgpFailoverTestResponse -> String
(Int -> StartBgpFailoverTestResponse -> ShowS)
-> (StartBgpFailoverTestResponse -> String)
-> ([StartBgpFailoverTestResponse] -> ShowS)
-> Show StartBgpFailoverTestResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartBgpFailoverTestResponse] -> ShowS
$cshowList :: [StartBgpFailoverTestResponse] -> ShowS
show :: StartBgpFailoverTestResponse -> String
$cshow :: StartBgpFailoverTestResponse -> String
showsPrec :: Int -> StartBgpFailoverTestResponse -> ShowS
$cshowsPrec :: Int -> StartBgpFailoverTestResponse -> ShowS
Prelude.Show, (forall x.
StartBgpFailoverTestResponse -> Rep StartBgpFailoverTestResponse x)
-> (forall x.
Rep StartBgpFailoverTestResponse x -> StartBgpFailoverTestResponse)
-> Generic StartBgpFailoverTestResponse
forall x.
Rep StartBgpFailoverTestResponse x -> StartBgpFailoverTestResponse
forall x.
StartBgpFailoverTestResponse -> Rep StartBgpFailoverTestResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartBgpFailoverTestResponse x -> StartBgpFailoverTestResponse
$cfrom :: forall x.
StartBgpFailoverTestResponse -> Rep StartBgpFailoverTestResponse x
Prelude.Generic)
newStartBgpFailoverTestResponse ::
Prelude.Int ->
StartBgpFailoverTestResponse
newStartBgpFailoverTestResponse :: Int -> StartBgpFailoverTestResponse
newStartBgpFailoverTestResponse Int
pHttpStatus_ =
StartBgpFailoverTestResponse' :: Maybe VirtualInterfaceTestHistory
-> Int -> StartBgpFailoverTestResponse
StartBgpFailoverTestResponse'
{ $sel:virtualInterfaceTest:StartBgpFailoverTestResponse' :: Maybe VirtualInterfaceTestHistory
virtualInterfaceTest =
Maybe VirtualInterfaceTestHistory
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:StartBgpFailoverTestResponse' :: Int
httpStatus = Int
pHttpStatus_
}
startBgpFailoverTestResponse_virtualInterfaceTest :: Lens.Lens' StartBgpFailoverTestResponse (Prelude.Maybe VirtualInterfaceTestHistory)
startBgpFailoverTestResponse_virtualInterfaceTest :: (Maybe VirtualInterfaceTestHistory
-> f (Maybe VirtualInterfaceTestHistory))
-> StartBgpFailoverTestResponse -> f StartBgpFailoverTestResponse
startBgpFailoverTestResponse_virtualInterfaceTest = (StartBgpFailoverTestResponse -> Maybe VirtualInterfaceTestHistory)
-> (StartBgpFailoverTestResponse
-> Maybe VirtualInterfaceTestHistory
-> StartBgpFailoverTestResponse)
-> Lens
StartBgpFailoverTestResponse
StartBgpFailoverTestResponse
(Maybe VirtualInterfaceTestHistory)
(Maybe VirtualInterfaceTestHistory)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartBgpFailoverTestResponse' {Maybe VirtualInterfaceTestHistory
virtualInterfaceTest :: Maybe VirtualInterfaceTestHistory
$sel:virtualInterfaceTest:StartBgpFailoverTestResponse' :: StartBgpFailoverTestResponse -> Maybe VirtualInterfaceTestHistory
virtualInterfaceTest} -> Maybe VirtualInterfaceTestHistory
virtualInterfaceTest) (\s :: StartBgpFailoverTestResponse
s@StartBgpFailoverTestResponse' {} Maybe VirtualInterfaceTestHistory
a -> StartBgpFailoverTestResponse
s {$sel:virtualInterfaceTest:StartBgpFailoverTestResponse' :: Maybe VirtualInterfaceTestHistory
virtualInterfaceTest = Maybe VirtualInterfaceTestHistory
a} :: StartBgpFailoverTestResponse)
startBgpFailoverTestResponse_httpStatus :: Lens.Lens' StartBgpFailoverTestResponse Prelude.Int
startBgpFailoverTestResponse_httpStatus :: (Int -> f Int)
-> StartBgpFailoverTestResponse -> f StartBgpFailoverTestResponse
startBgpFailoverTestResponse_httpStatus = (StartBgpFailoverTestResponse -> Int)
-> (StartBgpFailoverTestResponse
-> Int -> StartBgpFailoverTestResponse)
-> Lens
StartBgpFailoverTestResponse StartBgpFailoverTestResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartBgpFailoverTestResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartBgpFailoverTestResponse' :: StartBgpFailoverTestResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StartBgpFailoverTestResponse
s@StartBgpFailoverTestResponse' {} Int
a -> StartBgpFailoverTestResponse
s {$sel:httpStatus:StartBgpFailoverTestResponse' :: Int
httpStatus = Int
a} :: StartBgpFailoverTestResponse)
instance Prelude.NFData StartBgpFailoverTestResponse