{-# 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.Schemas.StopDiscoverer
-- 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 discoverer
module Amazonka.Schemas.StopDiscoverer
  ( -- * Creating a Request
    StopDiscoverer (..),
    newStopDiscoverer,

    -- * Request Lenses
    stopDiscoverer_discovererId,

    -- * Destructuring the Response
    StopDiscovererResponse (..),
    newStopDiscovererResponse,

    -- * Response Lenses
    stopDiscovererResponse_discovererId,
    stopDiscovererResponse_state,
    stopDiscovererResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Schemas.Types

-- | /See:/ 'newStopDiscoverer' smart constructor.
data StopDiscoverer = StopDiscoverer'
  { -- | The ID of the discoverer.
    StopDiscoverer -> Text
discovererId :: Prelude.Text
  }
  deriving (StopDiscoverer -> StopDiscoverer -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopDiscoverer -> StopDiscoverer -> Bool
$c/= :: StopDiscoverer -> StopDiscoverer -> Bool
== :: StopDiscoverer -> StopDiscoverer -> Bool
$c== :: StopDiscoverer -> StopDiscoverer -> Bool
Prelude.Eq, ReadPrec [StopDiscoverer]
ReadPrec StopDiscoverer
Int -> ReadS StopDiscoverer
ReadS [StopDiscoverer]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopDiscoverer]
$creadListPrec :: ReadPrec [StopDiscoverer]
readPrec :: ReadPrec StopDiscoverer
$creadPrec :: ReadPrec StopDiscoverer
readList :: ReadS [StopDiscoverer]
$creadList :: ReadS [StopDiscoverer]
readsPrec :: Int -> ReadS StopDiscoverer
$creadsPrec :: Int -> ReadS StopDiscoverer
Prelude.Read, Int -> StopDiscoverer -> ShowS
[StopDiscoverer] -> ShowS
StopDiscoverer -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopDiscoverer] -> ShowS
$cshowList :: [StopDiscoverer] -> ShowS
show :: StopDiscoverer -> String
$cshow :: StopDiscoverer -> String
showsPrec :: Int -> StopDiscoverer -> ShowS
$cshowsPrec :: Int -> StopDiscoverer -> ShowS
Prelude.Show, forall x. Rep StopDiscoverer x -> StopDiscoverer
forall x. StopDiscoverer -> Rep StopDiscoverer x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopDiscoverer x -> StopDiscoverer
$cfrom :: forall x. StopDiscoverer -> Rep StopDiscoverer x
Prelude.Generic)

-- |
-- Create a value of 'StopDiscoverer' 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:
--
-- 'discovererId', 'stopDiscoverer_discovererId' - The ID of the discoverer.
newStopDiscoverer ::
  -- | 'discovererId'
  Prelude.Text ->
  StopDiscoverer
newStopDiscoverer :: Text -> StopDiscoverer
newStopDiscoverer Text
pDiscovererId_ =
  StopDiscoverer' {$sel:discovererId:StopDiscoverer' :: Text
discovererId = Text
pDiscovererId_}

-- | The ID of the discoverer.
stopDiscoverer_discovererId :: Lens.Lens' StopDiscoverer Prelude.Text
stopDiscoverer_discovererId :: Lens' StopDiscoverer Text
stopDiscoverer_discovererId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopDiscoverer' {Text
discovererId :: Text
$sel:discovererId:StopDiscoverer' :: StopDiscoverer -> Text
discovererId} -> Text
discovererId) (\s :: StopDiscoverer
s@StopDiscoverer' {} Text
a -> StopDiscoverer
s {$sel:discovererId:StopDiscoverer' :: Text
discovererId = Text
a} :: StopDiscoverer)

instance Core.AWSRequest StopDiscoverer where
  type
    AWSResponse StopDiscoverer =
      StopDiscovererResponse
  request :: (Service -> Service) -> StopDiscoverer -> Request StopDiscoverer
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 StopDiscoverer
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopDiscoverer)))
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 Text
-> Maybe DiscovererState -> Int -> StopDiscovererResponse
StopDiscovererResponse'
            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
"DiscovererId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"State")
            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 StopDiscoverer where
  hashWithSalt :: Int -> StopDiscoverer -> Int
hashWithSalt Int
_salt StopDiscoverer' {Text
discovererId :: Text
$sel:discovererId:StopDiscoverer' :: StopDiscoverer -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
discovererId

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

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

instance Data.ToJSON StopDiscoverer where
  toJSON :: StopDiscoverer -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)

instance Data.ToPath StopDiscoverer where
  toPath :: StopDiscoverer -> ByteString
toPath StopDiscoverer' {Text
discovererId :: Text
$sel:discovererId:StopDiscoverer' :: StopDiscoverer -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/v1/discoverers/id/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
discovererId,
        ByteString
"/stop"
      ]

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

-- | /See:/ 'newStopDiscovererResponse' smart constructor.
data StopDiscovererResponse = StopDiscovererResponse'
  { -- | The ID of the discoverer.
    StopDiscovererResponse -> Maybe Text
discovererId :: Prelude.Maybe Prelude.Text,
    -- | The state of the discoverer.
    StopDiscovererResponse -> Maybe DiscovererState
state :: Prelude.Maybe DiscovererState,
    -- | The response's http status code.
    StopDiscovererResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (StopDiscovererResponse -> StopDiscovererResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopDiscovererResponse -> StopDiscovererResponse -> Bool
$c/= :: StopDiscovererResponse -> StopDiscovererResponse -> Bool
== :: StopDiscovererResponse -> StopDiscovererResponse -> Bool
$c== :: StopDiscovererResponse -> StopDiscovererResponse -> Bool
Prelude.Eq, ReadPrec [StopDiscovererResponse]
ReadPrec StopDiscovererResponse
Int -> ReadS StopDiscovererResponse
ReadS [StopDiscovererResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopDiscovererResponse]
$creadListPrec :: ReadPrec [StopDiscovererResponse]
readPrec :: ReadPrec StopDiscovererResponse
$creadPrec :: ReadPrec StopDiscovererResponse
readList :: ReadS [StopDiscovererResponse]
$creadList :: ReadS [StopDiscovererResponse]
readsPrec :: Int -> ReadS StopDiscovererResponse
$creadsPrec :: Int -> ReadS StopDiscovererResponse
Prelude.Read, Int -> StopDiscovererResponse -> ShowS
[StopDiscovererResponse] -> ShowS
StopDiscovererResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopDiscovererResponse] -> ShowS
$cshowList :: [StopDiscovererResponse] -> ShowS
show :: StopDiscovererResponse -> String
$cshow :: StopDiscovererResponse -> String
showsPrec :: Int -> StopDiscovererResponse -> ShowS
$cshowsPrec :: Int -> StopDiscovererResponse -> ShowS
Prelude.Show, forall x. Rep StopDiscovererResponse x -> StopDiscovererResponse
forall x. StopDiscovererResponse -> Rep StopDiscovererResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopDiscovererResponse x -> StopDiscovererResponse
$cfrom :: forall x. StopDiscovererResponse -> Rep StopDiscovererResponse x
Prelude.Generic)

-- |
-- Create a value of 'StopDiscovererResponse' 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:
--
-- 'discovererId', 'stopDiscovererResponse_discovererId' - The ID of the discoverer.
--
-- 'state', 'stopDiscovererResponse_state' - The state of the discoverer.
--
-- 'httpStatus', 'stopDiscovererResponse_httpStatus' - The response's http status code.
newStopDiscovererResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StopDiscovererResponse
newStopDiscovererResponse :: Int -> StopDiscovererResponse
newStopDiscovererResponse Int
pHttpStatus_ =
  StopDiscovererResponse'
    { $sel:discovererId:StopDiscovererResponse' :: Maybe Text
discovererId =
        forall a. Maybe a
Prelude.Nothing,
      $sel:state:StopDiscovererResponse' :: Maybe DiscovererState
state = forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:StopDiscovererResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ID of the discoverer.
stopDiscovererResponse_discovererId :: Lens.Lens' StopDiscovererResponse (Prelude.Maybe Prelude.Text)
stopDiscovererResponse_discovererId :: Lens' StopDiscovererResponse (Maybe Text)
stopDiscovererResponse_discovererId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopDiscovererResponse' {Maybe Text
discovererId :: Maybe Text
$sel:discovererId:StopDiscovererResponse' :: StopDiscovererResponse -> Maybe Text
discovererId} -> Maybe Text
discovererId) (\s :: StopDiscovererResponse
s@StopDiscovererResponse' {} Maybe Text
a -> StopDiscovererResponse
s {$sel:discovererId:StopDiscovererResponse' :: Maybe Text
discovererId = Maybe Text
a} :: StopDiscovererResponse)

-- | The state of the discoverer.
stopDiscovererResponse_state :: Lens.Lens' StopDiscovererResponse (Prelude.Maybe DiscovererState)
stopDiscovererResponse_state :: Lens' StopDiscovererResponse (Maybe DiscovererState)
stopDiscovererResponse_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopDiscovererResponse' {Maybe DiscovererState
state :: Maybe DiscovererState
$sel:state:StopDiscovererResponse' :: StopDiscovererResponse -> Maybe DiscovererState
state} -> Maybe DiscovererState
state) (\s :: StopDiscovererResponse
s@StopDiscovererResponse' {} Maybe DiscovererState
a -> StopDiscovererResponse
s {$sel:state:StopDiscovererResponse' :: Maybe DiscovererState
state = Maybe DiscovererState
a} :: StopDiscovererResponse)

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

instance Prelude.NFData StopDiscovererResponse where
  rnf :: StopDiscovererResponse -> ()
rnf StopDiscovererResponse' {Int
Maybe Text
Maybe DiscovererState
httpStatus :: Int
state :: Maybe DiscovererState
discovererId :: Maybe Text
$sel:httpStatus:StopDiscovererResponse' :: StopDiscovererResponse -> Int
$sel:state:StopDiscovererResponse' :: StopDiscovererResponse -> Maybe DiscovererState
$sel:discovererId:StopDiscovererResponse' :: StopDiscovererResponse -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
discovererId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DiscovererState
state
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus