{-# 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-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 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 Amazonka.DeviceFarm.Types
import qualified Amazonka.Lens as Lens
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
(DeleteDevicePool -> DeleteDevicePool -> Bool)
-> (DeleteDevicePool -> DeleteDevicePool -> Bool)
-> Eq DeleteDevicePool
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]
(Int -> ReadS DeleteDevicePool)
-> ReadS [DeleteDevicePool]
-> ReadPrec DeleteDevicePool
-> ReadPrec [DeleteDevicePool]
-> Read 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
(Int -> DeleteDevicePool -> ShowS)
-> (DeleteDevicePool -> String)
-> ([DeleteDevicePool] -> ShowS)
-> Show DeleteDevicePool
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. DeleteDevicePool -> Rep DeleteDevicePool x)
-> (forall x. Rep DeleteDevicePool x -> DeleteDevicePool)
-> Generic DeleteDevicePool
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' :: Text -> DeleteDevicePool
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 :: (Text -> f Text) -> DeleteDevicePool -> f DeleteDevicePool
deleteDevicePool_arn = (DeleteDevicePool -> Text)
-> (DeleteDevicePool -> Text -> DeleteDevicePool)
-> Lens DeleteDevicePool DeleteDevicePool Text Text
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 :: DeleteDevicePool -> Request DeleteDevicePool
request = Service -> DeleteDevicePool -> Request DeleteDevicePool
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteDevicePool
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDevicePool)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteDevicePool))
-> Logger
-> Service
-> Proxy DeleteDevicePool
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteDevicePool)))
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 -> DeleteDevicePoolResponse
DeleteDevicePoolResponse'
            (Int -> DeleteDevicePoolResponse)
-> Either String Int -> Either String DeleteDevicePoolResponse
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 DeleteDevicePool

instance Prelude.NFData DeleteDevicePool

instance Core.ToHeaders DeleteDevicePool where
  toHeaders :: DeleteDevicePool -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteDevicePool -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"DeviceFarm_20150623.DeleteDevicePool" ::
                          Prelude.ByteString
                      ),
            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 DeleteDevicePool where
  toJSON :: DeleteDevicePool -> Value
toJSON DeleteDevicePool' {Text
arn :: Text
$sel:arn:DeleteDevicePool' :: DeleteDevicePool -> 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
"arn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
arn)]
      )

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

instance Core.ToQuery DeleteDevicePool where
  toQuery :: DeleteDevicePool -> QueryString
toQuery = QueryString -> DeleteDevicePool -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteDevicePoolResponse -> DeleteDevicePoolResponse -> Bool)
-> (DeleteDevicePoolResponse -> DeleteDevicePoolResponse -> Bool)
-> Eq DeleteDevicePoolResponse
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]
(Int -> ReadS DeleteDevicePoolResponse)
-> ReadS [DeleteDevicePoolResponse]
-> ReadPrec DeleteDevicePoolResponse
-> ReadPrec [DeleteDevicePoolResponse]
-> Read 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
(Int -> DeleteDevicePoolResponse -> ShowS)
-> (DeleteDevicePoolResponse -> String)
-> ([DeleteDevicePoolResponse] -> ShowS)
-> Show DeleteDevicePoolResponse
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.
 DeleteDevicePoolResponse -> Rep DeleteDevicePoolResponse x)
-> (forall x.
    Rep DeleteDevicePoolResponse x -> DeleteDevicePoolResponse)
-> Generic DeleteDevicePoolResponse
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' :: Int -> DeleteDevicePoolResponse
DeleteDevicePoolResponse'
    { $sel:httpStatus:DeleteDevicePoolResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteDevicePoolResponse_httpStatus :: Lens.Lens' DeleteDevicePoolResponse Prelude.Int
deleteDevicePoolResponse_httpStatus :: (Int -> f Int)
-> DeleteDevicePoolResponse -> f DeleteDevicePoolResponse
deleteDevicePoolResponse_httpStatus = (DeleteDevicePoolResponse -> Int)
-> (DeleteDevicePoolResponse -> Int -> DeleteDevicePoolResponse)
-> Lens DeleteDevicePoolResponse DeleteDevicePoolResponse Int Int
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