{-# 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.IoTDeviceAdvisor.StopSuiteRun
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Stops a Device Advisor test suite run that is currently running.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions StopSuiteRun>
-- action.
module Amazonka.IoTDeviceAdvisor.StopSuiteRun
  ( -- * Creating a Request
    StopSuiteRun (..),
    newStopSuiteRun,

    -- * Request Lenses
    stopSuiteRun_suiteDefinitionId,
    stopSuiteRun_suiteRunId,

    -- * Destructuring the Response
    StopSuiteRunResponse (..),
    newStopSuiteRunResponse,

    -- * Response Lenses
    stopSuiteRunResponse_httpStatus,
  )
where

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

-- | /See:/ 'newStopSuiteRun' smart constructor.
data StopSuiteRun = StopSuiteRun'
  { -- | Suite definition ID of the test suite run to be stopped.
    StopSuiteRun -> Text
suiteDefinitionId :: Prelude.Text,
    -- | Suite run ID of the test suite run to be stopped.
    StopSuiteRun -> Text
suiteRunId :: Prelude.Text
  }
  deriving (StopSuiteRun -> StopSuiteRun -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopSuiteRun -> StopSuiteRun -> Bool
$c/= :: StopSuiteRun -> StopSuiteRun -> Bool
== :: StopSuiteRun -> StopSuiteRun -> Bool
$c== :: StopSuiteRun -> StopSuiteRun -> Bool
Prelude.Eq, ReadPrec [StopSuiteRun]
ReadPrec StopSuiteRun
Int -> ReadS StopSuiteRun
ReadS [StopSuiteRun]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopSuiteRun]
$creadListPrec :: ReadPrec [StopSuiteRun]
readPrec :: ReadPrec StopSuiteRun
$creadPrec :: ReadPrec StopSuiteRun
readList :: ReadS [StopSuiteRun]
$creadList :: ReadS [StopSuiteRun]
readsPrec :: Int -> ReadS StopSuiteRun
$creadsPrec :: Int -> ReadS StopSuiteRun
Prelude.Read, Int -> StopSuiteRun -> ShowS
[StopSuiteRun] -> ShowS
StopSuiteRun -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopSuiteRun] -> ShowS
$cshowList :: [StopSuiteRun] -> ShowS
show :: StopSuiteRun -> String
$cshow :: StopSuiteRun -> String
showsPrec :: Int -> StopSuiteRun -> ShowS
$cshowsPrec :: Int -> StopSuiteRun -> ShowS
Prelude.Show, forall x. Rep StopSuiteRun x -> StopSuiteRun
forall x. StopSuiteRun -> Rep StopSuiteRun x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopSuiteRun x -> StopSuiteRun
$cfrom :: forall x. StopSuiteRun -> Rep StopSuiteRun x
Prelude.Generic)

-- |
-- Create a value of 'StopSuiteRun' 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:
--
-- 'suiteDefinitionId', 'stopSuiteRun_suiteDefinitionId' - Suite definition ID of the test suite run to be stopped.
--
-- 'suiteRunId', 'stopSuiteRun_suiteRunId' - Suite run ID of the test suite run to be stopped.
newStopSuiteRun ::
  -- | 'suiteDefinitionId'
  Prelude.Text ->
  -- | 'suiteRunId'
  Prelude.Text ->
  StopSuiteRun
newStopSuiteRun :: Text -> Text -> StopSuiteRun
newStopSuiteRun Text
pSuiteDefinitionId_ Text
pSuiteRunId_ =
  StopSuiteRun'
    { $sel:suiteDefinitionId:StopSuiteRun' :: Text
suiteDefinitionId =
        Text
pSuiteDefinitionId_,
      $sel:suiteRunId:StopSuiteRun' :: Text
suiteRunId = Text
pSuiteRunId_
    }

-- | Suite definition ID of the test suite run to be stopped.
stopSuiteRun_suiteDefinitionId :: Lens.Lens' StopSuiteRun Prelude.Text
stopSuiteRun_suiteDefinitionId :: Lens' StopSuiteRun Text
stopSuiteRun_suiteDefinitionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopSuiteRun' {Text
suiteDefinitionId :: Text
$sel:suiteDefinitionId:StopSuiteRun' :: StopSuiteRun -> Text
suiteDefinitionId} -> Text
suiteDefinitionId) (\s :: StopSuiteRun
s@StopSuiteRun' {} Text
a -> StopSuiteRun
s {$sel:suiteDefinitionId:StopSuiteRun' :: Text
suiteDefinitionId = Text
a} :: StopSuiteRun)

-- | Suite run ID of the test suite run to be stopped.
stopSuiteRun_suiteRunId :: Lens.Lens' StopSuiteRun Prelude.Text
stopSuiteRun_suiteRunId :: Lens' StopSuiteRun Text
stopSuiteRun_suiteRunId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopSuiteRun' {Text
suiteRunId :: Text
$sel:suiteRunId:StopSuiteRun' :: StopSuiteRun -> Text
suiteRunId} -> Text
suiteRunId) (\s :: StopSuiteRun
s@StopSuiteRun' {} Text
a -> StopSuiteRun
s {$sel:suiteRunId:StopSuiteRun' :: Text
suiteRunId = Text
a} :: StopSuiteRun)

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

instance Prelude.NFData StopSuiteRun where
  rnf :: StopSuiteRun -> ()
rnf StopSuiteRun' {Text
suiteRunId :: Text
suiteDefinitionId :: Text
$sel:suiteRunId:StopSuiteRun' :: StopSuiteRun -> Text
$sel:suiteDefinitionId:StopSuiteRun' :: StopSuiteRun -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
suiteDefinitionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
suiteRunId

instance Data.ToHeaders StopSuiteRun where
  toHeaders :: StopSuiteRun -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON StopSuiteRun where
  toJSON :: StopSuiteRun -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)

instance Data.ToPath StopSuiteRun where
  toPath :: StopSuiteRun -> ByteString
toPath StopSuiteRun' {Text
suiteRunId :: Text
suiteDefinitionId :: Text
$sel:suiteRunId:StopSuiteRun' :: StopSuiteRun -> Text
$sel:suiteDefinitionId:StopSuiteRun' :: StopSuiteRun -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/suiteDefinitions/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
suiteDefinitionId,
        ByteString
"/suiteRuns/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
suiteRunId,
        ByteString
"/stop"
      ]

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

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

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

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

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