{-# 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-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 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 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

-- | /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
(DeleteTestGridProject -> DeleteTestGridProject -> Bool)
-> (DeleteTestGridProject -> DeleteTestGridProject -> Bool)
-> Eq DeleteTestGridProject
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]
(Int -> ReadS DeleteTestGridProject)
-> ReadS [DeleteTestGridProject]
-> ReadPrec DeleteTestGridProject
-> ReadPrec [DeleteTestGridProject]
-> Read 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
(Int -> DeleteTestGridProject -> ShowS)
-> (DeleteTestGridProject -> String)
-> ([DeleteTestGridProject] -> ShowS)
-> Show DeleteTestGridProject
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. DeleteTestGridProject -> Rep DeleteTestGridProject x)
-> (forall x. Rep DeleteTestGridProject x -> DeleteTestGridProject)
-> Generic DeleteTestGridProject
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' :: Text -> DeleteTestGridProject
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 :: (Text -> f Text)
-> DeleteTestGridProject -> f DeleteTestGridProject
deleteTestGridProject_projectArn = (DeleteTestGridProject -> Text)
-> (DeleteTestGridProject -> Text -> DeleteTestGridProject)
-> Lens DeleteTestGridProject DeleteTestGridProject Text Text
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 :: DeleteTestGridProject -> Request DeleteTestGridProject
request = Service -> DeleteTestGridProject -> Request DeleteTestGridProject
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteTestGridProject
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteTestGridProject)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteTestGridProject))
-> Logger
-> Service
-> Proxy DeleteTestGridProject
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteTestGridProject)))
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 -> DeleteTestGridProjectResponse
DeleteTestGridProjectResponse'
            (Int -> DeleteTestGridProjectResponse)
-> Either String Int -> Either String DeleteTestGridProjectResponse
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 DeleteTestGridProject

instance Prelude.NFData DeleteTestGridProject

instance Core.ToHeaders DeleteTestGridProject where
  toHeaders :: DeleteTestGridProject -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteTestGridProject -> 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.DeleteTestGridProject" ::
                          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 DeleteTestGridProject where
  toJSON :: DeleteTestGridProject -> Value
toJSON DeleteTestGridProject' {Text
projectArn :: Text
$sel:projectArn:DeleteTestGridProject' :: DeleteTestGridProject -> 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
"projectArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
projectArn)]
      )

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

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

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