{-# 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.DeleteRun
-- 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 the run, given the run ARN.
--
-- Deleting this resource does not stop an in-progress run.
module Amazonka.DeviceFarm.DeleteRun
  ( -- * Creating a Request
    DeleteRun (..),
    newDeleteRun,

    -- * Request Lenses
    deleteRun_arn,

    -- * Destructuring the Response
    DeleteRunResponse (..),
    newDeleteRunResponse,

    -- * Response Lenses
    deleteRunResponse_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 run operation.
--
-- /See:/ 'newDeleteRun' smart constructor.
data DeleteRun = DeleteRun'
  { -- | The Amazon Resource Name (ARN) for the run to delete.
    DeleteRun -> Text
arn :: Prelude.Text
  }
  deriving (DeleteRun -> DeleteRun -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteRun -> DeleteRun -> Bool
$c/= :: DeleteRun -> DeleteRun -> Bool
== :: DeleteRun -> DeleteRun -> Bool
$c== :: DeleteRun -> DeleteRun -> Bool
Prelude.Eq, ReadPrec [DeleteRun]
ReadPrec DeleteRun
Int -> ReadS DeleteRun
ReadS [DeleteRun]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteRun]
$creadListPrec :: ReadPrec [DeleteRun]
readPrec :: ReadPrec DeleteRun
$creadPrec :: ReadPrec DeleteRun
readList :: ReadS [DeleteRun]
$creadList :: ReadS [DeleteRun]
readsPrec :: Int -> ReadS DeleteRun
$creadsPrec :: Int -> ReadS DeleteRun
Prelude.Read, Int -> DeleteRun -> ShowS
[DeleteRun] -> ShowS
DeleteRun -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteRun] -> ShowS
$cshowList :: [DeleteRun] -> ShowS
show :: DeleteRun -> String
$cshow :: DeleteRun -> String
showsPrec :: Int -> DeleteRun -> ShowS
$cshowsPrec :: Int -> DeleteRun -> ShowS
Prelude.Show, forall x. Rep DeleteRun x -> DeleteRun
forall x. DeleteRun -> Rep DeleteRun x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteRun x -> DeleteRun
$cfrom :: forall x. DeleteRun -> Rep DeleteRun x
Prelude.Generic)

-- |
-- Create a value of 'DeleteRun' 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', 'deleteRun_arn' - The Amazon Resource Name (ARN) for the run to delete.
newDeleteRun ::
  -- | 'arn'
  Prelude.Text ->
  DeleteRun
newDeleteRun :: Text -> DeleteRun
newDeleteRun Text
pArn_ = DeleteRun' {$sel:arn:DeleteRun' :: Text
arn = Text
pArn_}

-- | The Amazon Resource Name (ARN) for the run to delete.
deleteRun_arn :: Lens.Lens' DeleteRun Prelude.Text
deleteRun_arn :: Lens' DeleteRun Text
deleteRun_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteRun' {Text
arn :: Text
$sel:arn:DeleteRun' :: DeleteRun -> Text
arn} -> Text
arn) (\s :: DeleteRun
s@DeleteRun' {} Text
a -> DeleteRun
s {$sel:arn:DeleteRun' :: Text
arn = Text
a} :: DeleteRun)

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

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

instance Data.ToHeaders DeleteRun where
  toHeaders :: DeleteRun -> 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.DeleteRun" ::
                          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 DeleteRun where
  toJSON :: DeleteRun -> Value
toJSON DeleteRun' {Text
arn :: Text
$sel:arn:DeleteRun' :: DeleteRun -> 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 DeleteRun where
  toPath :: DeleteRun -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

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

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

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