{-# 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-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- 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 qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.DirectConnect.Types
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
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]
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
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. 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'
    { $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 :: Lens' StopBgpFailoverTest Text
stopBgpFailoverTest_virtualInterfaceId = 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 :: (Service -> Service)
-> StopBgpFailoverTest -> Request StopBgpFailoverTest
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy StopBgpFailoverTest
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse StopBgpFailoverTest)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe VirtualInterfaceTestHistory
-> Int -> StopBgpFailoverTestResponse
StopBgpFailoverTestResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"virtualInterfaceTest")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable StopBgpFailoverTest where
  hashWithSalt :: Int -> StopBgpFailoverTest -> Int
hashWithSalt Int
_salt StopBgpFailoverTest' {Text
virtualInterfaceId :: Text
$sel:virtualInterfaceId:StopBgpFailoverTest' :: StopBgpFailoverTest -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
virtualInterfaceId

instance Prelude.NFData StopBgpFailoverTest where
  rnf :: StopBgpFailoverTest -> ()
rnf StopBgpFailoverTest' {Text
virtualInterfaceId :: Text
$sel:virtualInterfaceId:StopBgpFailoverTest' :: StopBgpFailoverTest -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
virtualInterfaceId

instance Data.ToHeaders StopBgpFailoverTest where
  toHeaders :: StopBgpFailoverTest -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"OvertureService.StopBgpFailoverTest" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON StopBgpFailoverTest where
  toJSON :: StopBgpFailoverTest -> Value
toJSON StopBgpFailoverTest' {Text
virtualInterfaceId :: Text
$sel:virtualInterfaceId:StopBgpFailoverTest' :: StopBgpFailoverTest -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"virtualInterfaceId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
virtualInterfaceId)
          ]
      )

instance Data.ToPath StopBgpFailoverTest where
  toPath :: StopBgpFailoverTest -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery StopBgpFailoverTest where
  toQuery :: StopBgpFailoverTest -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:virtualInterfaceTest:StopBgpFailoverTestResponse' :: Maybe VirtualInterfaceTestHistory
virtualInterfaceTest =
        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 :: Lens'
  StopBgpFailoverTestResponse (Maybe VirtualInterfaceTestHistory)
stopBgpFailoverTestResponse_virtualInterfaceTest = 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 :: Lens' StopBgpFailoverTestResponse Int
stopBgpFailoverTestResponse_httpStatus = 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 where
  rnf :: StopBgpFailoverTestResponse -> ()
rnf StopBgpFailoverTestResponse' {Int
Maybe VirtualInterfaceTestHistory
httpStatus :: Int
virtualInterfaceTest :: Maybe VirtualInterfaceTestHistory
$sel:httpStatus:StopBgpFailoverTestResponse' :: StopBgpFailoverTestResponse -> Int
$sel:virtualInterfaceTest:StopBgpFailoverTestResponse' :: StopBgpFailoverTestResponse -> Maybe VirtualInterfaceTestHistory
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe VirtualInterfaceTestHistory
virtualInterfaceTest
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus