{-# 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.RobOMaker.DeleteRobot
-- 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)
--
-- Deletes a robot.
module Amazonka.RobOMaker.DeleteRobot
  ( -- * Creating a Request
    DeleteRobot (..),
    newDeleteRobot,

    -- * Request Lenses
    deleteRobot_robot,

    -- * Destructuring the Response
    DeleteRobotResponse (..),
    newDeleteRobotResponse,

    -- * Response Lenses
    deleteRobotResponse_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.RobOMaker.Types

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

-- |
-- Create a value of 'DeleteRobot' 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:
--
-- 'robot', 'deleteRobot_robot' - The Amazon Resource Name (ARN) of the robot.
newDeleteRobot ::
  -- | 'robot'
  Prelude.Text ->
  DeleteRobot
newDeleteRobot :: Text -> DeleteRobot
newDeleteRobot Text
pRobot_ =
  DeleteRobot' :: Text -> DeleteRobot
DeleteRobot' {$sel:robot:DeleteRobot' :: Text
robot = Text
pRobot_}

-- | The Amazon Resource Name (ARN) of the robot.
deleteRobot_robot :: Lens.Lens' DeleteRobot Prelude.Text
deleteRobot_robot :: (Text -> f Text) -> DeleteRobot -> f DeleteRobot
deleteRobot_robot = (DeleteRobot -> Text)
-> (DeleteRobot -> Text -> DeleteRobot)
-> Lens DeleteRobot DeleteRobot Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRobot' {Text
robot :: Text
$sel:robot:DeleteRobot' :: DeleteRobot -> Text
robot} -> Text
robot) (\s :: DeleteRobot
s@DeleteRobot' {} Text
a -> DeleteRobot
s {$sel:robot:DeleteRobot' :: Text
robot = Text
a} :: DeleteRobot)

instance Core.AWSRequest DeleteRobot where
  type AWSResponse DeleteRobot = DeleteRobotResponse
  request :: DeleteRobot -> Request DeleteRobot
request = Service -> DeleteRobot -> Request DeleteRobot
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteRobot
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteRobot)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteRobot))
-> Logger
-> Service
-> Proxy DeleteRobot
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteRobot)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteRobotResponse
DeleteRobotResponse'
            (Int -> DeleteRobotResponse)
-> Either String Int -> Either String DeleteRobotResponse
forall (f :: * -> *) a b. Functor 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 DeleteRobot

instance Prelude.NFData DeleteRobot

instance Core.ToHeaders DeleteRobot where
  toHeaders :: DeleteRobot -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteRobot -> 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.ToJSON DeleteRobot where
  toJSON :: DeleteRobot -> Value
toJSON DeleteRobot' {Text
robot :: Text
$sel:robot:DeleteRobot' :: DeleteRobot -> 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
"robot" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
robot)]
      )

instance Core.ToPath DeleteRobot where
  toPath :: DeleteRobot -> ByteString
toPath = ByteString -> DeleteRobot -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/deleteRobot"

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

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

-- |
-- Create a value of 'DeleteRobotResponse' 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:
--
-- 'httpStatus', 'deleteRobotResponse_httpStatus' - The response's http status code.
newDeleteRobotResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteRobotResponse
newDeleteRobotResponse :: Int -> DeleteRobotResponse
newDeleteRobotResponse Int
pHttpStatus_ =
  DeleteRobotResponse' :: Int -> DeleteRobotResponse
DeleteRobotResponse' {$sel:httpStatus:DeleteRobotResponse' :: Int
httpStatus = Int
pHttpStatus_}

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

instance Prelude.NFData DeleteRobotResponse