{-# 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.DeviceFarm.DeleteDevicePool
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a device pool given the pool ARN. Does not allow deletion of
-- curated pools owned by the system.
module Amazonka.DeviceFarm.DeleteDevicePool
  ( -- * Creating a Request
    DeleteDevicePool (..),
    newDeleteDevicePool,

    -- * Request Lenses
    deleteDevicePool_arn,

    -- * Destructuring the Response
    DeleteDevicePoolResponse (..),
    newDeleteDevicePoolResponse,

    -- * Response Lenses
    deleteDevicePoolResponse_httpStatus,
  )
where

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

-- | Represents a request to the delete device pool operation.
--
-- /See:/ 'newDeleteDevicePool' smart constructor.
data DeleteDevicePool = DeleteDevicePool'
  { -- | Represents the Amazon Resource Name (ARN) of the Device Farm device pool
    -- to delete.
    DeleteDevicePool -> Text
arn :: Prelude.Text
  }
  deriving (DeleteDevicePool -> DeleteDevicePool -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteDevicePool -> DeleteDevicePool -> Bool
$c/= :: DeleteDevicePool -> DeleteDevicePool -> Bool
== :: DeleteDevicePool -> DeleteDevicePool -> Bool
$c== :: DeleteDevicePool -> DeleteDevicePool -> Bool
Prelude.Eq, ReadPrec [DeleteDevicePool]
ReadPrec DeleteDevicePool
Int -> ReadS DeleteDevicePool
ReadS [DeleteDevicePool]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteDevicePool]
$creadListPrec :: ReadPrec [DeleteDevicePool]
readPrec :: ReadPrec DeleteDevicePool
$creadPrec :: ReadPrec DeleteDevicePool
readList :: ReadS [DeleteDevicePool]
$creadList :: ReadS [DeleteDevicePool]
readsPrec :: Int -> ReadS DeleteDevicePool
$creadsPrec :: Int -> ReadS DeleteDevicePool
Prelude.Read, Int -> DeleteDevicePool -> ShowS
[DeleteDevicePool] -> ShowS
DeleteDevicePool -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteDevicePool] -> ShowS
$cshowList :: [DeleteDevicePool] -> ShowS
show :: DeleteDevicePool -> String
$cshow :: DeleteDevicePool -> String
showsPrec :: Int -> DeleteDevicePool -> ShowS
$cshowsPrec :: Int -> DeleteDevicePool -> ShowS
Prelude.Show, forall x. Rep DeleteDevicePool x -> DeleteDevicePool
forall x. DeleteDevicePool -> Rep DeleteDevicePool x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteDevicePool x -> DeleteDevicePool
$cfrom :: forall x. DeleteDevicePool -> Rep DeleteDevicePool x
Prelude.Generic)

-- |
-- Create a value of 'DeleteDevicePool' 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:
--
-- 'arn', 'deleteDevicePool_arn' - Represents the Amazon Resource Name (ARN) of the Device Farm device pool
-- to delete.
newDeleteDevicePool ::
  -- | 'arn'
  Prelude.Text ->
  DeleteDevicePool
newDeleteDevicePool :: Text -> DeleteDevicePool
newDeleteDevicePool Text
pArn_ =
  DeleteDevicePool' {$sel:arn:DeleteDevicePool' :: Text
arn = Text
pArn_}

-- | Represents the Amazon Resource Name (ARN) of the Device Farm device pool
-- to delete.
deleteDevicePool_arn :: Lens.Lens' DeleteDevicePool Prelude.Text
deleteDevicePool_arn :: Lens' DeleteDevicePool Text
deleteDevicePool_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteDevicePool' {Text
arn :: Text
$sel:arn:DeleteDevicePool' :: DeleteDevicePool -> Text
arn} -> Text
arn) (\s :: DeleteDevicePool
s@DeleteDevicePool' {} Text
a -> DeleteDevicePool
s {$sel:arn:DeleteDevicePool' :: Text
arn = Text
a} :: DeleteDevicePool)

instance Core.AWSRequest DeleteDevicePool where
  type
    AWSResponse DeleteDevicePool =
      DeleteDevicePoolResponse
  request :: (Service -> Service)
-> DeleteDevicePool -> Request DeleteDevicePool
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 DeleteDevicePool
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDevicePool)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteDevicePoolResponse
DeleteDevicePoolResponse'
            forall (f :: * -> *) a b. Functor 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 DeleteDevicePool where
  hashWithSalt :: Int -> DeleteDevicePool -> Int
hashWithSalt Int
_salt DeleteDevicePool' {Text
arn :: Text
$sel:arn:DeleteDevicePool' :: DeleteDevicePool -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
arn

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

instance Data.ToHeaders DeleteDevicePool where
  toHeaders :: DeleteDevicePool -> 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
"DeviceFarm_20150623.DeleteDevicePool" ::
                          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 DeleteDevicePool where
  toJSON :: DeleteDevicePool -> Value
toJSON DeleteDevicePool' {Text
arn :: Text
$sel:arn:DeleteDevicePool' :: DeleteDevicePool -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"arn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
arn)]
      )

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

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

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

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

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

instance Prelude.NFData DeleteDevicePoolResponse where
  rnf :: DeleteDevicePoolResponse -> ()
rnf DeleteDevicePoolResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteDevicePoolResponse' :: DeleteDevicePoolResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus