{-# 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.SageMakerGeoSpatial.StopEarthObservationJob
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Use this operation to stop an existing earth observation job.
module Amazonka.SageMakerGeoSpatial.StopEarthObservationJob
  ( -- * Creating a Request
    StopEarthObservationJob (..),
    newStopEarthObservationJob,

    -- * Request Lenses
    stopEarthObservationJob_arn,

    -- * Destructuring the Response
    StopEarthObservationJobResponse (..),
    newStopEarthObservationJobResponse,

    -- * Response Lenses
    stopEarthObservationJobResponse_httpStatus,
  )
where

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

-- | /See:/ 'newStopEarthObservationJob' smart constructor.
data StopEarthObservationJob = StopEarthObservationJob'
  { -- | The Amazon Resource Name (ARN) of the Earth Observation job being
    -- stopped.
    StopEarthObservationJob -> Text
arn :: Prelude.Text
  }
  deriving (StopEarthObservationJob -> StopEarthObservationJob -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StopEarthObservationJob -> StopEarthObservationJob -> Bool
$c/= :: StopEarthObservationJob -> StopEarthObservationJob -> Bool
== :: StopEarthObservationJob -> StopEarthObservationJob -> Bool
$c== :: StopEarthObservationJob -> StopEarthObservationJob -> Bool
Prelude.Eq, ReadPrec [StopEarthObservationJob]
ReadPrec StopEarthObservationJob
Int -> ReadS StopEarthObservationJob
ReadS [StopEarthObservationJob]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StopEarthObservationJob]
$creadListPrec :: ReadPrec [StopEarthObservationJob]
readPrec :: ReadPrec StopEarthObservationJob
$creadPrec :: ReadPrec StopEarthObservationJob
readList :: ReadS [StopEarthObservationJob]
$creadList :: ReadS [StopEarthObservationJob]
readsPrec :: Int -> ReadS StopEarthObservationJob
$creadsPrec :: Int -> ReadS StopEarthObservationJob
Prelude.Read, Int -> StopEarthObservationJob -> ShowS
[StopEarthObservationJob] -> ShowS
StopEarthObservationJob -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StopEarthObservationJob] -> ShowS
$cshowList :: [StopEarthObservationJob] -> ShowS
show :: StopEarthObservationJob -> String
$cshow :: StopEarthObservationJob -> String
showsPrec :: Int -> StopEarthObservationJob -> ShowS
$cshowsPrec :: Int -> StopEarthObservationJob -> ShowS
Prelude.Show, forall x. Rep StopEarthObservationJob x -> StopEarthObservationJob
forall x. StopEarthObservationJob -> Rep StopEarthObservationJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep StopEarthObservationJob x -> StopEarthObservationJob
$cfrom :: forall x. StopEarthObservationJob -> Rep StopEarthObservationJob x
Prelude.Generic)

-- |
-- Create a value of 'StopEarthObservationJob' 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', 'stopEarthObservationJob_arn' - The Amazon Resource Name (ARN) of the Earth Observation job being
-- stopped.
newStopEarthObservationJob ::
  -- | 'arn'
  Prelude.Text ->
  StopEarthObservationJob
newStopEarthObservationJob :: Text -> StopEarthObservationJob
newStopEarthObservationJob Text
pArn_ =
  StopEarthObservationJob' {$sel:arn:StopEarthObservationJob' :: Text
arn = Text
pArn_}

-- | The Amazon Resource Name (ARN) of the Earth Observation job being
-- stopped.
stopEarthObservationJob_arn :: Lens.Lens' StopEarthObservationJob Prelude.Text
stopEarthObservationJob_arn :: Lens' StopEarthObservationJob Text
stopEarthObservationJob_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StopEarthObservationJob' {Text
arn :: Text
$sel:arn:StopEarthObservationJob' :: StopEarthObservationJob -> Text
arn} -> Text
arn) (\s :: StopEarthObservationJob
s@StopEarthObservationJob' {} Text
a -> StopEarthObservationJob
s {$sel:arn:StopEarthObservationJob' :: Text
arn = Text
a} :: StopEarthObservationJob)

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

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

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

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

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

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

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

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