{-# 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.SageMaker.DeregisterDevices
-- 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 the specified devices. After you deregister a device, you
-- will need to re-register the devices.
module Amazonka.SageMaker.DeregisterDevices
  ( -- * Creating a Request
    DeregisterDevices (..),
    newDeregisterDevices,

    -- * Request Lenses
    deregisterDevices_deviceFleetName,
    deregisterDevices_deviceNames,

    -- * Destructuring the Response
    DeregisterDevicesResponse (..),
    newDeregisterDevicesResponse,
  )
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.SageMaker.Types

-- | /See:/ 'newDeregisterDevices' smart constructor.
data DeregisterDevices = DeregisterDevices'
  { -- | The name of the fleet the devices belong to.
    DeregisterDevices -> Text
deviceFleetName :: Prelude.Text,
    -- | The unique IDs of the devices.
    DeregisterDevices -> [Text]
deviceNames :: [Prelude.Text]
  }
  deriving (DeregisterDevices -> DeregisterDevices -> Bool
(DeregisterDevices -> DeregisterDevices -> Bool)
-> (DeregisterDevices -> DeregisterDevices -> Bool)
-> Eq DeregisterDevices
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeregisterDevices -> DeregisterDevices -> Bool
$c/= :: DeregisterDevices -> DeregisterDevices -> Bool
== :: DeregisterDevices -> DeregisterDevices -> Bool
$c== :: DeregisterDevices -> DeregisterDevices -> Bool
Prelude.Eq, ReadPrec [DeregisterDevices]
ReadPrec DeregisterDevices
Int -> ReadS DeregisterDevices
ReadS [DeregisterDevices]
(Int -> ReadS DeregisterDevices)
-> ReadS [DeregisterDevices]
-> ReadPrec DeregisterDevices
-> ReadPrec [DeregisterDevices]
-> Read DeregisterDevices
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeregisterDevices]
$creadListPrec :: ReadPrec [DeregisterDevices]
readPrec :: ReadPrec DeregisterDevices
$creadPrec :: ReadPrec DeregisterDevices
readList :: ReadS [DeregisterDevices]
$creadList :: ReadS [DeregisterDevices]
readsPrec :: Int -> ReadS DeregisterDevices
$creadsPrec :: Int -> ReadS DeregisterDevices
Prelude.Read, Int -> DeregisterDevices -> ShowS
[DeregisterDevices] -> ShowS
DeregisterDevices -> String
(Int -> DeregisterDevices -> ShowS)
-> (DeregisterDevices -> String)
-> ([DeregisterDevices] -> ShowS)
-> Show DeregisterDevices
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeregisterDevices] -> ShowS
$cshowList :: [DeregisterDevices] -> ShowS
show :: DeregisterDevices -> String
$cshow :: DeregisterDevices -> String
showsPrec :: Int -> DeregisterDevices -> ShowS
$cshowsPrec :: Int -> DeregisterDevices -> ShowS
Prelude.Show, (forall x. DeregisterDevices -> Rep DeregisterDevices x)
-> (forall x. Rep DeregisterDevices x -> DeregisterDevices)
-> Generic DeregisterDevices
forall x. Rep DeregisterDevices x -> DeregisterDevices
forall x. DeregisterDevices -> Rep DeregisterDevices x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeregisterDevices x -> DeregisterDevices
$cfrom :: forall x. DeregisterDevices -> Rep DeregisterDevices x
Prelude.Generic)

-- |
-- Create a value of 'DeregisterDevices' 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:
--
-- 'deviceFleetName', 'deregisterDevices_deviceFleetName' - The name of the fleet the devices belong to.
--
-- 'deviceNames', 'deregisterDevices_deviceNames' - The unique IDs of the devices.
newDeregisterDevices ::
  -- | 'deviceFleetName'
  Prelude.Text ->
  DeregisterDevices
newDeregisterDevices :: Text -> DeregisterDevices
newDeregisterDevices Text
pDeviceFleetName_ =
  DeregisterDevices' :: Text -> [Text] -> DeregisterDevices
DeregisterDevices'
    { $sel:deviceFleetName:DeregisterDevices' :: Text
deviceFleetName =
        Text
pDeviceFleetName_,
      $sel:deviceNames:DeregisterDevices' :: [Text]
deviceNames = [Text]
forall a. Monoid a => a
Prelude.mempty
    }

-- | The name of the fleet the devices belong to.
deregisterDevices_deviceFleetName :: Lens.Lens' DeregisterDevices Prelude.Text
deregisterDevices_deviceFleetName :: (Text -> f Text) -> DeregisterDevices -> f DeregisterDevices
deregisterDevices_deviceFleetName = (DeregisterDevices -> Text)
-> (DeregisterDevices -> Text -> DeregisterDevices)
-> Lens DeregisterDevices DeregisterDevices Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterDevices' {Text
deviceFleetName :: Text
$sel:deviceFleetName:DeregisterDevices' :: DeregisterDevices -> Text
deviceFleetName} -> Text
deviceFleetName) (\s :: DeregisterDevices
s@DeregisterDevices' {} Text
a -> DeregisterDevices
s {$sel:deviceFleetName:DeregisterDevices' :: Text
deviceFleetName = Text
a} :: DeregisterDevices)

-- | The unique IDs of the devices.
deregisterDevices_deviceNames :: Lens.Lens' DeregisterDevices [Prelude.Text]
deregisterDevices_deviceNames :: ([Text] -> f [Text]) -> DeregisterDevices -> f DeregisterDevices
deregisterDevices_deviceNames = (DeregisterDevices -> [Text])
-> (DeregisterDevices -> [Text] -> DeregisterDevices)
-> Lens DeregisterDevices DeregisterDevices [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeregisterDevices' {[Text]
deviceNames :: [Text]
$sel:deviceNames:DeregisterDevices' :: DeregisterDevices -> [Text]
deviceNames} -> [Text]
deviceNames) (\s :: DeregisterDevices
s@DeregisterDevices' {} [Text]
a -> DeregisterDevices
s {$sel:deviceNames:DeregisterDevices' :: [Text]
deviceNames = [Text]
a} :: DeregisterDevices) (([Text] -> f [Text]) -> DeregisterDevices -> f DeregisterDevices)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> DeregisterDevices
-> f DeregisterDevices
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest DeregisterDevices where
  type
    AWSResponse DeregisterDevices =
      DeregisterDevicesResponse
  request :: DeregisterDevices -> Request DeregisterDevices
request = Service -> DeregisterDevices -> Request DeregisterDevices
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeregisterDevices
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeregisterDevices)))
response =
    AWSResponse DeregisterDevices
-> Logger
-> Service
-> Proxy DeregisterDevices
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeregisterDevices)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull AWSResponse DeregisterDevices
DeregisterDevicesResponse
DeregisterDevicesResponse'

instance Prelude.Hashable DeregisterDevices

instance Prelude.NFData DeregisterDevices

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

instance Core.ToJSON DeregisterDevices where
  toJSON :: DeregisterDevices -> Value
toJSON DeregisterDevices' {[Text]
Text
deviceNames :: [Text]
deviceFleetName :: Text
$sel:deviceNames:DeregisterDevices' :: DeregisterDevices -> [Text]
$sel:deviceFleetName:DeregisterDevices' :: DeregisterDevices -> 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
"DeviceFleetName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
deviceFleetName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DeviceNames" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
deviceNames)
          ]
      )

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

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

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

-- |
-- Create a value of 'DeregisterDevicesResponse' 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.
newDeregisterDevicesResponse ::
  DeregisterDevicesResponse
newDeregisterDevicesResponse :: DeregisterDevicesResponse
newDeregisterDevicesResponse =
  DeregisterDevicesResponse
DeregisterDevicesResponse'

instance Prelude.NFData DeregisterDevicesResponse