{-# 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.DeregisterRobot
-- 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)
--
-- Deregisters a robot.
module Amazonka.RobOMaker.DeregisterRobot
  ( -- * Creating a Request
    DeregisterRobot (..),
    newDeregisterRobot,

    -- * Request Lenses
    deregisterRobot_fleet,
    deregisterRobot_robot,

    -- * Destructuring the Response
    DeregisterRobotResponse (..),
    newDeregisterRobotResponse,

    -- * Response Lenses
    deregisterRobotResponse_robot,
    deregisterRobotResponse_fleet,
    deregisterRobotResponse_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:/ 'newDeregisterRobot' smart constructor.
data DeregisterRobot = DeregisterRobot'
  { -- | The Amazon Resource Name (ARN) of the fleet.
    DeregisterRobot -> Text
fleet :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the robot.
    DeregisterRobot -> Text
robot :: Prelude.Text
  }
  deriving (DeregisterRobot -> DeregisterRobot -> Bool
(DeregisterRobot -> DeregisterRobot -> Bool)
-> (DeregisterRobot -> DeregisterRobot -> Bool)
-> Eq DeregisterRobot
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeregisterRobot -> DeregisterRobot -> Bool
$c/= :: DeregisterRobot -> DeregisterRobot -> Bool
== :: DeregisterRobot -> DeregisterRobot -> Bool
$c== :: DeregisterRobot -> DeregisterRobot -> Bool
Prelude.Eq, ReadPrec [DeregisterRobot]
ReadPrec DeregisterRobot
Int -> ReadS DeregisterRobot
ReadS [DeregisterRobot]
(Int -> ReadS DeregisterRobot)
-> ReadS [DeregisterRobot]
-> ReadPrec DeregisterRobot
-> ReadPrec [DeregisterRobot]
-> Read DeregisterRobot
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeregisterRobot]
$creadListPrec :: ReadPrec [DeregisterRobot]
readPrec :: ReadPrec DeregisterRobot
$creadPrec :: ReadPrec DeregisterRobot
readList :: ReadS [DeregisterRobot]
$creadList :: ReadS [DeregisterRobot]
readsPrec :: Int -> ReadS DeregisterRobot
$creadsPrec :: Int -> ReadS DeregisterRobot
Prelude.Read, Int -> DeregisterRobot -> ShowS
[DeregisterRobot] -> ShowS
DeregisterRobot -> String
(Int -> DeregisterRobot -> ShowS)
-> (DeregisterRobot -> String)
-> ([DeregisterRobot] -> ShowS)
-> Show DeregisterRobot
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeregisterRobot] -> ShowS
$cshowList :: [DeregisterRobot] -> ShowS
show :: DeregisterRobot -> String
$cshow :: DeregisterRobot -> String
showsPrec :: Int -> DeregisterRobot -> ShowS
$cshowsPrec :: Int -> DeregisterRobot -> ShowS
Prelude.Show, (forall x. DeregisterRobot -> Rep DeregisterRobot x)
-> (forall x. Rep DeregisterRobot x -> DeregisterRobot)
-> Generic DeregisterRobot
forall x. Rep DeregisterRobot x -> DeregisterRobot
forall x. DeregisterRobot -> Rep DeregisterRobot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeregisterRobot x -> DeregisterRobot
$cfrom :: forall x. DeregisterRobot -> Rep DeregisterRobot x
Prelude.Generic)

-- |
-- Create a value of 'DeregisterRobot' 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:
--
-- 'fleet', 'deregisterRobot_fleet' - The Amazon Resource Name (ARN) of the fleet.
--
-- 'robot', 'deregisterRobot_robot' - The Amazon Resource Name (ARN) of the robot.
newDeregisterRobot ::
  -- | 'fleet'
  Prelude.Text ->
  -- | 'robot'
  Prelude.Text ->
  DeregisterRobot
newDeregisterRobot :: Text -> Text -> DeregisterRobot
newDeregisterRobot Text
pFleet_ Text
pRobot_ =
  DeregisterRobot' :: Text -> Text -> DeregisterRobot
DeregisterRobot' {$sel:fleet:DeregisterRobot' :: Text
fleet = Text
pFleet_, $sel:robot:DeregisterRobot' :: Text
robot = Text
pRobot_}

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

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

instance Core.AWSRequest DeregisterRobot where
  type
    AWSResponse DeregisterRobot =
      DeregisterRobotResponse
  request :: DeregisterRobot -> Request DeregisterRobot
request = Service -> DeregisterRobot -> Request DeregisterRobot
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeregisterRobot
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeregisterRobot)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeregisterRobot))
-> Logger
-> Service
-> Proxy DeregisterRobot
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeregisterRobot)))
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 Text -> Maybe Text -> Int -> DeregisterRobotResponse
DeregisterRobotResponse'
            (Maybe Text -> Maybe Text -> Int -> DeregisterRobotResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> DeregisterRobotResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"robot")
            Either String (Maybe Text -> Int -> DeregisterRobotResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeregisterRobotResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"fleet")
            Either String (Int -> DeregisterRobotResponse)
-> Either String Int -> Either String DeregisterRobotResponse
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 DeregisterRobot

instance Prelude.NFData DeregisterRobot

instance Core.ToHeaders DeregisterRobot where
  toHeaders :: DeregisterRobot -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeregisterRobot -> 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 DeregisterRobot where
  toJSON :: DeregisterRobot -> Value
toJSON DeregisterRobot' {Text
robot :: Text
fleet :: Text
$sel:robot:DeregisterRobot' :: DeregisterRobot -> Text
$sel:fleet:DeregisterRobot' :: DeregisterRobot -> 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
"fleet" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
fleet),
            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 DeregisterRobot where
  toPath :: DeregisterRobot -> ByteString
toPath = ByteString -> DeregisterRobot -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/deregisterRobot"

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

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

-- |
-- Create a value of 'DeregisterRobotResponse' 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', 'deregisterRobotResponse_robot' - The Amazon Resource Name (ARN) of the robot.
--
-- 'fleet', 'deregisterRobotResponse_fleet' - The Amazon Resource Name (ARN) of the fleet.
--
-- 'httpStatus', 'deregisterRobotResponse_httpStatus' - The response's http status code.
newDeregisterRobotResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeregisterRobotResponse
newDeregisterRobotResponse :: Int -> DeregisterRobotResponse
newDeregisterRobotResponse Int
pHttpStatus_ =
  DeregisterRobotResponse' :: Maybe Text -> Maybe Text -> Int -> DeregisterRobotResponse
DeregisterRobotResponse'
    { $sel:robot:DeregisterRobotResponse' :: Maybe Text
robot = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:fleet:DeregisterRobotResponse' :: Maybe Text
fleet = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeregisterRobotResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

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

instance Prelude.NFData DeregisterRobotResponse