{-# 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.Batch.DeleteSchedulingPolicy
-- 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 specified scheduling policy.
--
-- You can\'t delete a scheduling policy that\'s used in any job queues.
module Amazonka.Batch.DeleteSchedulingPolicy
  ( -- * Creating a Request
    DeleteSchedulingPolicy (..),
    newDeleteSchedulingPolicy,

    -- * Request Lenses
    deleteSchedulingPolicy_arn,

    -- * Destructuring the Response
    DeleteSchedulingPolicyResponse (..),
    newDeleteSchedulingPolicyResponse,

    -- * Response Lenses
    deleteSchedulingPolicyResponse_httpStatus,
  )
where

import Amazonka.Batch.Types
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

-- | Contains the parameters for @DeleteSchedulingPolicy@.
--
-- /See:/ 'newDeleteSchedulingPolicy' smart constructor.
data DeleteSchedulingPolicy = DeleteSchedulingPolicy'
  { -- | The Amazon Resource Name (ARN) of the scheduling policy to delete.
    DeleteSchedulingPolicy -> Text
arn :: Prelude.Text
  }
  deriving (DeleteSchedulingPolicy -> DeleteSchedulingPolicy -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteSchedulingPolicy -> DeleteSchedulingPolicy -> Bool
$c/= :: DeleteSchedulingPolicy -> DeleteSchedulingPolicy -> Bool
== :: DeleteSchedulingPolicy -> DeleteSchedulingPolicy -> Bool
$c== :: DeleteSchedulingPolicy -> DeleteSchedulingPolicy -> Bool
Prelude.Eq, ReadPrec [DeleteSchedulingPolicy]
ReadPrec DeleteSchedulingPolicy
Int -> ReadS DeleteSchedulingPolicy
ReadS [DeleteSchedulingPolicy]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteSchedulingPolicy]
$creadListPrec :: ReadPrec [DeleteSchedulingPolicy]
readPrec :: ReadPrec DeleteSchedulingPolicy
$creadPrec :: ReadPrec DeleteSchedulingPolicy
readList :: ReadS [DeleteSchedulingPolicy]
$creadList :: ReadS [DeleteSchedulingPolicy]
readsPrec :: Int -> ReadS DeleteSchedulingPolicy
$creadsPrec :: Int -> ReadS DeleteSchedulingPolicy
Prelude.Read, Int -> DeleteSchedulingPolicy -> ShowS
[DeleteSchedulingPolicy] -> ShowS
DeleteSchedulingPolicy -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteSchedulingPolicy] -> ShowS
$cshowList :: [DeleteSchedulingPolicy] -> ShowS
show :: DeleteSchedulingPolicy -> String
$cshow :: DeleteSchedulingPolicy -> String
showsPrec :: Int -> DeleteSchedulingPolicy -> ShowS
$cshowsPrec :: Int -> DeleteSchedulingPolicy -> ShowS
Prelude.Show, forall x. Rep DeleteSchedulingPolicy x -> DeleteSchedulingPolicy
forall x. DeleteSchedulingPolicy -> Rep DeleteSchedulingPolicy x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteSchedulingPolicy x -> DeleteSchedulingPolicy
$cfrom :: forall x. DeleteSchedulingPolicy -> Rep DeleteSchedulingPolicy x
Prelude.Generic)

-- |
-- Create a value of 'DeleteSchedulingPolicy' 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', 'deleteSchedulingPolicy_arn' - The Amazon Resource Name (ARN) of the scheduling policy to delete.
newDeleteSchedulingPolicy ::
  -- | 'arn'
  Prelude.Text ->
  DeleteSchedulingPolicy
newDeleteSchedulingPolicy :: Text -> DeleteSchedulingPolicy
newDeleteSchedulingPolicy Text
pArn_ =
  DeleteSchedulingPolicy' {$sel:arn:DeleteSchedulingPolicy' :: Text
arn = Text
pArn_}

-- | The Amazon Resource Name (ARN) of the scheduling policy to delete.
deleteSchedulingPolicy_arn :: Lens.Lens' DeleteSchedulingPolicy Prelude.Text
deleteSchedulingPolicy_arn :: Lens' DeleteSchedulingPolicy Text
deleteSchedulingPolicy_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSchedulingPolicy' {Text
arn :: Text
$sel:arn:DeleteSchedulingPolicy' :: DeleteSchedulingPolicy -> Text
arn} -> Text
arn) (\s :: DeleteSchedulingPolicy
s@DeleteSchedulingPolicy' {} Text
a -> DeleteSchedulingPolicy
s {$sel:arn:DeleteSchedulingPolicy' :: Text
arn = Text
a} :: DeleteSchedulingPolicy)

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

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

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

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

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

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

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

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