{-# 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.DeleteTestGridProject
-- 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 Selenium testing project and all content generated under it.
--
-- You cannot undo this operation.
--
-- You cannot delete a project if it has active sessions.
module Amazonka.DeviceFarm.DeleteTestGridProject
  ( -- * Creating a Request
    DeleteTestGridProject (..),
    newDeleteTestGridProject,

    -- * Request Lenses
    deleteTestGridProject_projectArn,

    -- * Destructuring the Response
    DeleteTestGridProjectResponse (..),
    newDeleteTestGridProjectResponse,

    -- * Response Lenses
    deleteTestGridProjectResponse_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

-- | /See:/ 'newDeleteTestGridProject' smart constructor.
data DeleteTestGridProject = DeleteTestGridProject'
  { -- | The ARN of the project to delete, from CreateTestGridProject or
    -- ListTestGridProjects.
    DeleteTestGridProject -> Text
projectArn :: Prelude.Text
  }
  deriving (DeleteTestGridProject -> DeleteTestGridProject -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteTestGridProject -> DeleteTestGridProject -> Bool
$c/= :: DeleteTestGridProject -> DeleteTestGridProject -> Bool
== :: DeleteTestGridProject -> DeleteTestGridProject -> Bool
$c== :: DeleteTestGridProject -> DeleteTestGridProject -> Bool
Prelude.Eq, ReadPrec [DeleteTestGridProject]
ReadPrec DeleteTestGridProject
Int -> ReadS DeleteTestGridProject
ReadS [DeleteTestGridProject]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteTestGridProject]
$creadListPrec :: ReadPrec [DeleteTestGridProject]
readPrec :: ReadPrec DeleteTestGridProject
$creadPrec :: ReadPrec DeleteTestGridProject
readList :: ReadS [DeleteTestGridProject]
$creadList :: ReadS [DeleteTestGridProject]
readsPrec :: Int -> ReadS DeleteTestGridProject
$creadsPrec :: Int -> ReadS DeleteTestGridProject
Prelude.Read, Int -> DeleteTestGridProject -> ShowS
[DeleteTestGridProject] -> ShowS
DeleteTestGridProject -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteTestGridProject] -> ShowS
$cshowList :: [DeleteTestGridProject] -> ShowS
show :: DeleteTestGridProject -> String
$cshow :: DeleteTestGridProject -> String
showsPrec :: Int -> DeleteTestGridProject -> ShowS
$cshowsPrec :: Int -> DeleteTestGridProject -> ShowS
Prelude.Show, forall x. Rep DeleteTestGridProject x -> DeleteTestGridProject
forall x. DeleteTestGridProject -> Rep DeleteTestGridProject x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteTestGridProject x -> DeleteTestGridProject
$cfrom :: forall x. DeleteTestGridProject -> Rep DeleteTestGridProject x
Prelude.Generic)

-- |
-- Create a value of 'DeleteTestGridProject' 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:
--
-- 'projectArn', 'deleteTestGridProject_projectArn' - The ARN of the project to delete, from CreateTestGridProject or
-- ListTestGridProjects.
newDeleteTestGridProject ::
  -- | 'projectArn'
  Prelude.Text ->
  DeleteTestGridProject
newDeleteTestGridProject :: Text -> DeleteTestGridProject
newDeleteTestGridProject Text
pProjectArn_ =
  DeleteTestGridProject' {$sel:projectArn:DeleteTestGridProject' :: Text
projectArn = Text
pProjectArn_}

-- | The ARN of the project to delete, from CreateTestGridProject or
-- ListTestGridProjects.
deleteTestGridProject_projectArn :: Lens.Lens' DeleteTestGridProject Prelude.Text
deleteTestGridProject_projectArn :: Lens' DeleteTestGridProject Text
deleteTestGridProject_projectArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteTestGridProject' {Text
projectArn :: Text
$sel:projectArn:DeleteTestGridProject' :: DeleteTestGridProject -> Text
projectArn} -> Text
projectArn) (\s :: DeleteTestGridProject
s@DeleteTestGridProject' {} Text
a -> DeleteTestGridProject
s {$sel:projectArn:DeleteTestGridProject' :: Text
projectArn = Text
a} :: DeleteTestGridProject)

instance Core.AWSRequest DeleteTestGridProject where
  type
    AWSResponse DeleteTestGridProject =
      DeleteTestGridProjectResponse
  request :: (Service -> Service)
-> DeleteTestGridProject -> Request DeleteTestGridProject
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 DeleteTestGridProject
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteTestGridProject)))
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 -> DeleteTestGridProjectResponse
DeleteTestGridProjectResponse'
            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 DeleteTestGridProject where
  hashWithSalt :: Int -> DeleteTestGridProject -> Int
hashWithSalt Int
_salt DeleteTestGridProject' {Text
projectArn :: Text
$sel:projectArn:DeleteTestGridProject' :: DeleteTestGridProject -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
projectArn

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

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

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

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

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

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

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

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