{-# 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-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)
--
-- Stops a Device Advisor test suite run that is currently running.
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 Amazonka.IoTDeviceAdvisor.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:/ '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
(StopSuiteRun -> StopSuiteRun -> Bool)
-> (StopSuiteRun -> StopSuiteRun -> Bool) -> Eq StopSuiteRun
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]
(Int -> ReadS StopSuiteRun)
-> ReadS [StopSuiteRun]
-> ReadPrec StopSuiteRun
-> ReadPrec [StopSuiteRun]
-> Read 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
(Int -> StopSuiteRun -> ShowS)
-> (StopSuiteRun -> String)
-> ([StopSuiteRun] -> ShowS)
-> Show StopSuiteRun
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. StopSuiteRun -> Rep StopSuiteRun x)
-> (forall x. Rep StopSuiteRun x -> StopSuiteRun)
-> Generic StopSuiteRun
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' :: Text -> Text -> StopSuiteRun
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 :: (Text -> f Text) -> StopSuiteRun -> f StopSuiteRun
stopSuiteRun_suiteDefinitionId = (StopSuiteRun -> Text)
-> (StopSuiteRun -> Text -> StopSuiteRun)
-> Lens StopSuiteRun StopSuiteRun Text Text
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 :: (Text -> f Text) -> StopSuiteRun -> f StopSuiteRun
stopSuiteRun_suiteRunId = (StopSuiteRun -> Text)
-> (StopSuiteRun -> Text -> StopSuiteRun)
-> Lens StopSuiteRun StopSuiteRun Text Text
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 :: StopSuiteRun -> Request StopSuiteRun
request = Service -> StopSuiteRun -> Request StopSuiteRun
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy StopSuiteRun
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopSuiteRun)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse StopSuiteRun))
-> Logger
-> Service
-> Proxy StopSuiteRun
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse StopSuiteRun)))
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 -> StopSuiteRunResponse
StopSuiteRunResponse'
            (Int -> StopSuiteRunResponse)
-> Either String Int -> Either String StopSuiteRunResponse
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 StopSuiteRun

instance Prelude.NFData StopSuiteRun

instance Core.ToHeaders StopSuiteRun where
  toHeaders :: StopSuiteRun -> ResponseHeaders
toHeaders =
    ResponseHeaders -> StopSuiteRun -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ 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 StopSuiteRun where
  toJSON :: StopSuiteRun -> Value
toJSON = Value -> StopSuiteRun -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)

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

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

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