{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.DirectConnect.StopBgpFailoverTest
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Stops the virtual interface failover test.
module Amazonka.DirectConnect.StopBgpFailoverTest
  ( -- * Creating a Request
    StopBgpFailoverTest (..),
    newStopBgpFailoverTest,

    -- * Request Lenses
    stopBgpFailoverTest_virtualInterfaceId,

    -- * Destructuring the Response
    StopBgpFailoverTestResponse (..),
    newStopBgpFailoverTestResponse,

    -- * Response Lenses
    stopBgpFailoverTestResponse_virtualInterfaceTest,
    stopBgpFailoverTestResponse_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

-- | /See:/ 'newStopBgpFailoverTest' smart constructor.
data StopBgpFailoverTest = StopBgpFailoverTest'
  { -- | The ID of the virtual interface you no longer want to test.
    StopBgpFailoverTest -> Text
virtualInterfaceId :: Prelude.Text
  }
  deriving (StopBgpFailoverTest -> StopBgpFailoverTest -> Bool
(StopBgpFailoverTest -> StopBgpFailoverTest -> Bool)
-> (StopBgpFailoverTest -> StopBgpFailoverTest -> Bool)
-> Eq StopBgpFailoverTest
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopBgpFailoverTest -> StopBgpFailoverTest -> Bool
$c/= :: StopBgpFailoverTest -> StopBgpFailoverTest -> Bool
== :: StopBgpFailoverTest -> StopBgpFailoverTest -> Bool
$c== :: StopBgpFailoverTest -> StopBgpFailoverTest -> Bool
Prelude.Eq, ReadPrec [StopBgpFailoverTest]
ReadPrec StopBgpFailoverTest
Int -> ReadS StopBgpFailoverTest
ReadS [StopBgpFailoverTest]
(Int -> ReadS StopBgpFailoverTest)
-> ReadS [StopBgpFailoverTest]
-> ReadPrec StopBgpFailoverTest
-> ReadPrec [StopBgpFailoverTest]
-> Read StopBgpFailoverTest
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopBgpFailoverTest]
$creadListPrec :: ReadPrec [StopBgpFailoverTest]
readPrec :: ReadPrec StopBgpFailoverTest
$creadPrec :: ReadPrec StopBgpFailoverTest
readList :: ReadS [StopBgpFailoverTest]
$creadList :: ReadS [StopBgpFailoverTest]
readsPrec :: Int -> ReadS StopBgpFailoverTest
$creadsPrec :: Int -> ReadS StopBgpFailoverTest
Prelude.Read, Int -> StopBgpFailoverTest -> ShowS
[StopBgpFailoverTest] -> ShowS
StopBgpFailoverTest -> String
(Int -> StopBgpFailoverTest -> ShowS)
-> (StopBgpFailoverTest -> String)
-> ([StopBgpFailoverTest] -> ShowS)
-> Show StopBgpFailoverTest
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopBgpFailoverTest] -> ShowS
$cshowList :: [StopBgpFailoverTest] -> ShowS
show :: StopBgpFailoverTest -> String
$cshow :: StopBgpFailoverTest -> String
showsPrec :: Int -> StopBgpFailoverTest -> ShowS
$cshowsPrec :: Int -> StopBgpFailoverTest -> ShowS
Prelude.Show, (forall x. StopBgpFailoverTest -> Rep StopBgpFailoverTest x)
-> (forall x. Rep StopBgpFailoverTest x -> StopBgpFailoverTest)
-> Generic StopBgpFailoverTest
forall x. Rep StopBgpFailoverTest x -> StopBgpFailoverTest
forall x. StopBgpFailoverTest -> Rep StopBgpFailoverTest x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopBgpFailoverTest x -> StopBgpFailoverTest
$cfrom :: forall x. StopBgpFailoverTest -> Rep StopBgpFailoverTest x
Prelude.Generic)

-- |
-- Create a value of 'StopBgpFailoverTest' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'virtualInterfaceId', 'stopBgpFailoverTest_virtualInterfaceId' - The ID of the virtual interface you no longer want to test.
newStopBgpFailoverTest ::
  -- | 'virtualInterfaceId'
  Prelude.Text ->
  StopBgpFailoverTest
newStopBgpFailoverTest :: Text -> StopBgpFailoverTest
newStopBgpFailoverTest Text
pVirtualInterfaceId_ =
  StopBgpFailoverTest' :: Text -> StopBgpFailoverTest
StopBgpFailoverTest'
    { $sel:virtualInterfaceId:StopBgpFailoverTest' :: Text
virtualInterfaceId =
        Text
pVirtualInterfaceId_
    }

-- | The ID of the virtual interface you no longer want to test.
stopBgpFailoverTest_virtualInterfaceId :: Lens.Lens' StopBgpFailoverTest Prelude.Text
stopBgpFailoverTest_virtualInterfaceId :: (Text -> f Text) -> StopBgpFailoverTest -> f StopBgpFailoverTest
stopBgpFailoverTest_virtualInterfaceId = (StopBgpFailoverTest -> Text)
-> (StopBgpFailoverTest -> Text -> StopBgpFailoverTest)
-> Lens StopBgpFailoverTest StopBgpFailoverTest Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopBgpFailoverTest' {Text
virtualInterfaceId :: Text
$sel:virtualInterfaceId:StopBgpFailoverTest' :: StopBgpFailoverTest -> Text
virtualInterfaceId} -> Text
virtualInterfaceId) (\s :: StopBgpFailoverTest
s@StopBgpFailoverTest' {} Text
a -> StopBgpFailoverTest
s {$sel:virtualInterfaceId:StopBgpFailoverTest' :: Text
virtualInterfaceId = Text
a} :: StopBgpFailoverTest)

instance Core.AWSRequest StopBgpFailoverTest where
  type
    AWSResponse StopBgpFailoverTest =
      StopBgpFailoverTestResponse
  request :: StopBgpFailoverTest -> Request StopBgpFailoverTest
request = Service -> StopBgpFailoverTest -> Request StopBgpFailoverTest
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StopBgpFailoverTest
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopBgpFailoverTest)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse StopBgpFailoverTest))
-> Logger
-> Service
-> Proxy StopBgpFailoverTest
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopBgpFailoverTest)))
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 -> StopBgpFailoverTestResponse
StopBgpFailoverTestResponse'
            (Maybe VirtualInterfaceTestHistory
 -> Int -> StopBgpFailoverTestResponse)
-> Either String (Maybe VirtualInterfaceTestHistory)
-> Either String (Int -> StopBgpFailoverTestResponse)
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 -> StopBgpFailoverTestResponse)
-> Either String Int -> Either String StopBgpFailoverTestResponse
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 StopBgpFailoverTest

instance Prelude.NFData StopBgpFailoverTest

instance Core.ToHeaders StopBgpFailoverTest where
  toHeaders :: StopBgpFailoverTest -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StopBgpFailoverTest -> 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.StopBgpFailoverTest" ::
                          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 StopBgpFailoverTest where
  toJSON :: StopBgpFailoverTest -> Value
toJSON StopBgpFailoverTest' {Text
virtualInterfaceId :: Text
$sel:virtualInterfaceId:StopBgpFailoverTest' :: StopBgpFailoverTest -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ 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 StopBgpFailoverTest where
  toPath :: StopBgpFailoverTest -> ByteString
toPath = ByteString -> StopBgpFailoverTest -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery StopBgpFailoverTest where
  toQuery :: StopBgpFailoverTest -> QueryString
toQuery = QueryString -> StopBgpFailoverTest -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newStopBgpFailoverTestResponse' smart constructor.
data StopBgpFailoverTestResponse = StopBgpFailoverTestResponse'
  { -- | Information about the virtual interface failover test.
    StopBgpFailoverTestResponse -> Maybe VirtualInterfaceTestHistory
virtualInterfaceTest :: Prelude.Maybe VirtualInterfaceTestHistory,
    -- | The response's http status code.
    StopBgpFailoverTestResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StopBgpFailoverTestResponse -> StopBgpFailoverTestResponse -> Bool
(StopBgpFailoverTestResponse
 -> StopBgpFailoverTestResponse -> Bool)
-> (StopBgpFailoverTestResponse
    -> StopBgpFailoverTestResponse -> Bool)
-> Eq StopBgpFailoverTestResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopBgpFailoverTestResponse -> StopBgpFailoverTestResponse -> Bool
$c/= :: StopBgpFailoverTestResponse -> StopBgpFailoverTestResponse -> Bool
== :: StopBgpFailoverTestResponse -> StopBgpFailoverTestResponse -> Bool
$c== :: StopBgpFailoverTestResponse -> StopBgpFailoverTestResponse -> Bool
Prelude.Eq, ReadPrec [StopBgpFailoverTestResponse]
ReadPrec StopBgpFailoverTestResponse
Int -> ReadS StopBgpFailoverTestResponse
ReadS [StopBgpFailoverTestResponse]
(Int -> ReadS StopBgpFailoverTestResponse)
-> ReadS [StopBgpFailoverTestResponse]
-> ReadPrec StopBgpFailoverTestResponse
-> ReadPrec [StopBgpFailoverTestResponse]
-> Read StopBgpFailoverTestResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopBgpFailoverTestResponse]
$creadListPrec :: ReadPrec [StopBgpFailoverTestResponse]
readPrec :: ReadPrec StopBgpFailoverTestResponse
$creadPrec :: ReadPrec StopBgpFailoverTestResponse
readList :: ReadS [StopBgpFailoverTestResponse]
$creadList :: ReadS [StopBgpFailoverTestResponse]
readsPrec :: Int -> ReadS StopBgpFailoverTestResponse
$creadsPrec :: Int -> ReadS StopBgpFailoverTestResponse
Prelude.Read, Int -> StopBgpFailoverTestResponse -> ShowS
[StopBgpFailoverTestResponse] -> ShowS
StopBgpFailoverTestResponse -> String
(Int -> StopBgpFailoverTestResponse -> ShowS)
-> (StopBgpFailoverTestResponse -> String)
-> ([StopBgpFailoverTestResponse] -> ShowS)
-> Show StopBgpFailoverTestResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopBgpFailoverTestResponse] -> ShowS
$cshowList :: [StopBgpFailoverTestResponse] -> ShowS
show :: StopBgpFailoverTestResponse -> String
$cshow :: StopBgpFailoverTestResponse -> String
showsPrec :: Int -> StopBgpFailoverTestResponse -> ShowS
$cshowsPrec :: Int -> StopBgpFailoverTestResponse -> ShowS
Prelude.Show, (forall x.
 StopBgpFailoverTestResponse -> Rep StopBgpFailoverTestResponse x)
-> (forall x.
    Rep StopBgpFailoverTestResponse x -> StopBgpFailoverTestResponse)
-> Generic StopBgpFailoverTestResponse
forall x.
Rep StopBgpFailoverTestResponse x -> StopBgpFailoverTestResponse
forall x.
StopBgpFailoverTestResponse -> Rep StopBgpFailoverTestResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StopBgpFailoverTestResponse x -> StopBgpFailoverTestResponse
$cfrom :: forall x.
StopBgpFailoverTestResponse -> Rep StopBgpFailoverTestResponse x
Prelude.Generic)

-- |
-- Create a value of 'StopBgpFailoverTestResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'virtualInterfaceTest', 'stopBgpFailoverTestResponse_virtualInterfaceTest' - Information about the virtual interface failover test.
--
-- 'httpStatus', 'stopBgpFailoverTestResponse_httpStatus' - The response's http status code.
newStopBgpFailoverTestResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StopBgpFailoverTestResponse
newStopBgpFailoverTestResponse :: Int -> StopBgpFailoverTestResponse
newStopBgpFailoverTestResponse Int
pHttpStatus_ =
  StopBgpFailoverTestResponse' :: Maybe VirtualInterfaceTestHistory
-> Int -> StopBgpFailoverTestResponse
StopBgpFailoverTestResponse'
    { $sel:virtualInterfaceTest:StopBgpFailoverTestResponse' :: Maybe VirtualInterfaceTestHistory
virtualInterfaceTest =
        Maybe VirtualInterfaceTestHistory
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StopBgpFailoverTestResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the virtual interface failover test.
stopBgpFailoverTestResponse_virtualInterfaceTest :: Lens.Lens' StopBgpFailoverTestResponse (Prelude.Maybe VirtualInterfaceTestHistory)
stopBgpFailoverTestResponse_virtualInterfaceTest :: (Maybe VirtualInterfaceTestHistory
 -> f (Maybe VirtualInterfaceTestHistory))
-> StopBgpFailoverTestResponse -> f StopBgpFailoverTestResponse
stopBgpFailoverTestResponse_virtualInterfaceTest = (StopBgpFailoverTestResponse -> Maybe VirtualInterfaceTestHistory)
-> (StopBgpFailoverTestResponse
    -> Maybe VirtualInterfaceTestHistory
    -> StopBgpFailoverTestResponse)
-> Lens
     StopBgpFailoverTestResponse
     StopBgpFailoverTestResponse
     (Maybe VirtualInterfaceTestHistory)
     (Maybe VirtualInterfaceTestHistory)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopBgpFailoverTestResponse' {Maybe VirtualInterfaceTestHistory
virtualInterfaceTest :: Maybe VirtualInterfaceTestHistory
$sel:virtualInterfaceTest:StopBgpFailoverTestResponse' :: StopBgpFailoverTestResponse -> Maybe VirtualInterfaceTestHistory
virtualInterfaceTest} -> Maybe VirtualInterfaceTestHistory
virtualInterfaceTest) (\s :: StopBgpFailoverTestResponse
s@StopBgpFailoverTestResponse' {} Maybe VirtualInterfaceTestHistory
a -> StopBgpFailoverTestResponse
s {$sel:virtualInterfaceTest:StopBgpFailoverTestResponse' :: Maybe VirtualInterfaceTestHistory
virtualInterfaceTest = Maybe VirtualInterfaceTestHistory
a} :: StopBgpFailoverTestResponse)

-- | The response's http status code.
stopBgpFailoverTestResponse_httpStatus :: Lens.Lens' StopBgpFailoverTestResponse Prelude.Int
stopBgpFailoverTestResponse_httpStatus :: (Int -> f Int)
-> StopBgpFailoverTestResponse -> f StopBgpFailoverTestResponse
stopBgpFailoverTestResponse_httpStatus = (StopBgpFailoverTestResponse -> Int)
-> (StopBgpFailoverTestResponse
    -> Int -> StopBgpFailoverTestResponse)
-> Lens
     StopBgpFailoverTestResponse StopBgpFailoverTestResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopBgpFailoverTestResponse' {Int
httpStatus :: Int
$sel:httpStatus:StopBgpFailoverTestResponse' :: StopBgpFailoverTestResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: StopBgpFailoverTestResponse
s@StopBgpFailoverTestResponse' {} Int
a -> StopBgpFailoverTestResponse
s {$sel:httpStatus:StopBgpFailoverTestResponse' :: Int
httpStatus = Int
a} :: StopBgpFailoverTestResponse)

instance Prelude.NFData StopBgpFailoverTestResponse