{-# 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.Scheduler.DeleteSchedule
-- 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 schedule.
module Amazonka.Scheduler.DeleteSchedule
  ( -- * Creating a Request
    DeleteSchedule (..),
    newDeleteSchedule,

    -- * Request Lenses
    deleteSchedule_clientToken,
    deleteSchedule_groupName,
    deleteSchedule_name,

    -- * Destructuring the Response
    DeleteScheduleResponse (..),
    newDeleteScheduleResponse,

    -- * Response Lenses
    deleteScheduleResponse_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.Scheduler.Types

-- | /See:/ 'newDeleteSchedule' smart constructor.
data DeleteSchedule = DeleteSchedule'
  { -- | Unique, case-sensitive identifier you provide to ensure the idempotency
    -- of the request. If you do not specify a client token, EventBridge
    -- Scheduler uses a randomly generated token for the request to ensure
    -- idempotency.
    DeleteSchedule -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The name of the schedule group associated with this schedule. If you
    -- omit this, the default schedule group is used.
    DeleteSchedule -> Maybe Text
groupName :: Prelude.Maybe Prelude.Text,
    -- | The name of the schedule to delete.
    DeleteSchedule -> Text
name :: Prelude.Text
  }
  deriving (DeleteSchedule -> DeleteSchedule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteSchedule -> DeleteSchedule -> Bool
$c/= :: DeleteSchedule -> DeleteSchedule -> Bool
== :: DeleteSchedule -> DeleteSchedule -> Bool
$c== :: DeleteSchedule -> DeleteSchedule -> Bool
Prelude.Eq, ReadPrec [DeleteSchedule]
ReadPrec DeleteSchedule
Int -> ReadS DeleteSchedule
ReadS [DeleteSchedule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteSchedule]
$creadListPrec :: ReadPrec [DeleteSchedule]
readPrec :: ReadPrec DeleteSchedule
$creadPrec :: ReadPrec DeleteSchedule
readList :: ReadS [DeleteSchedule]
$creadList :: ReadS [DeleteSchedule]
readsPrec :: Int -> ReadS DeleteSchedule
$creadsPrec :: Int -> ReadS DeleteSchedule
Prelude.Read, Int -> DeleteSchedule -> ShowS
[DeleteSchedule] -> ShowS
DeleteSchedule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteSchedule] -> ShowS
$cshowList :: [DeleteSchedule] -> ShowS
show :: DeleteSchedule -> String
$cshow :: DeleteSchedule -> String
showsPrec :: Int -> DeleteSchedule -> ShowS
$cshowsPrec :: Int -> DeleteSchedule -> ShowS
Prelude.Show, forall x. Rep DeleteSchedule x -> DeleteSchedule
forall x. DeleteSchedule -> Rep DeleteSchedule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteSchedule x -> DeleteSchedule
$cfrom :: forall x. DeleteSchedule -> Rep DeleteSchedule x
Prelude.Generic)

-- |
-- Create a value of 'DeleteSchedule' 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:
--
-- 'clientToken', 'deleteSchedule_clientToken' - Unique, case-sensitive identifier you provide to ensure the idempotency
-- of the request. If you do not specify a client token, EventBridge
-- Scheduler uses a randomly generated token for the request to ensure
-- idempotency.
--
-- 'groupName', 'deleteSchedule_groupName' - The name of the schedule group associated with this schedule. If you
-- omit this, the default schedule group is used.
--
-- 'name', 'deleteSchedule_name' - The name of the schedule to delete.
newDeleteSchedule ::
  -- | 'name'
  Prelude.Text ->
  DeleteSchedule
newDeleteSchedule :: Text -> DeleteSchedule
newDeleteSchedule Text
pName_ =
  DeleteSchedule'
    { $sel:clientToken:DeleteSchedule' :: Maybe Text
clientToken = forall a. Maybe a
Prelude.Nothing,
      $sel:groupName:DeleteSchedule' :: Maybe Text
groupName = forall a. Maybe a
Prelude.Nothing,
      $sel:name:DeleteSchedule' :: Text
name = Text
pName_
    }

-- | Unique, case-sensitive identifier you provide to ensure the idempotency
-- of the request. If you do not specify a client token, EventBridge
-- Scheduler uses a randomly generated token for the request to ensure
-- idempotency.
deleteSchedule_clientToken :: Lens.Lens' DeleteSchedule (Prelude.Maybe Prelude.Text)
deleteSchedule_clientToken :: Lens' DeleteSchedule (Maybe Text)
deleteSchedule_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSchedule' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:DeleteSchedule' :: DeleteSchedule -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: DeleteSchedule
s@DeleteSchedule' {} Maybe Text
a -> DeleteSchedule
s {$sel:clientToken:DeleteSchedule' :: Maybe Text
clientToken = Maybe Text
a} :: DeleteSchedule)

-- | The name of the schedule group associated with this schedule. If you
-- omit this, the default schedule group is used.
deleteSchedule_groupName :: Lens.Lens' DeleteSchedule (Prelude.Maybe Prelude.Text)
deleteSchedule_groupName :: Lens' DeleteSchedule (Maybe Text)
deleteSchedule_groupName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSchedule' {Maybe Text
groupName :: Maybe Text
$sel:groupName:DeleteSchedule' :: DeleteSchedule -> Maybe Text
groupName} -> Maybe Text
groupName) (\s :: DeleteSchedule
s@DeleteSchedule' {} Maybe Text
a -> DeleteSchedule
s {$sel:groupName:DeleteSchedule' :: Maybe Text
groupName = Maybe Text
a} :: DeleteSchedule)

-- | The name of the schedule to delete.
deleteSchedule_name :: Lens.Lens' DeleteSchedule Prelude.Text
deleteSchedule_name :: Lens' DeleteSchedule Text
deleteSchedule_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSchedule' {Text
name :: Text
$sel:name:DeleteSchedule' :: DeleteSchedule -> Text
name} -> Text
name) (\s :: DeleteSchedule
s@DeleteSchedule' {} Text
a -> DeleteSchedule
s {$sel:name:DeleteSchedule' :: Text
name = Text
a} :: DeleteSchedule)

instance Core.AWSRequest DeleteSchedule where
  type
    AWSResponse DeleteSchedule =
      DeleteScheduleResponse
  request :: (Service -> Service) -> DeleteSchedule -> Request DeleteSchedule
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteSchedule
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteSchedule)))
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 -> DeleteScheduleResponse
DeleteScheduleResponse'
            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 DeleteSchedule where
  hashWithSalt :: Int -> DeleteSchedule -> Int
hashWithSalt Int
_salt DeleteSchedule' {Maybe Text
Text
name :: Text
groupName :: Maybe Text
clientToken :: Maybe Text
$sel:name:DeleteSchedule' :: DeleteSchedule -> Text
$sel:groupName:DeleteSchedule' :: DeleteSchedule -> Maybe Text
$sel:clientToken:DeleteSchedule' :: DeleteSchedule -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
groupName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name

instance Prelude.NFData DeleteSchedule where
  rnf :: DeleteSchedule -> ()
rnf DeleteSchedule' {Maybe Text
Text
name :: Text
groupName :: Maybe Text
clientToken :: Maybe Text
$sel:name:DeleteSchedule' :: DeleteSchedule -> Text
$sel:groupName:DeleteSchedule' :: DeleteSchedule -> Maybe Text
$sel:clientToken:DeleteSchedule' :: DeleteSchedule -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
groupName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name

instance Data.ToHeaders DeleteSchedule where
  toHeaders :: DeleteSchedule -> 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.ToPath DeleteSchedule where
  toPath :: DeleteSchedule -> ByteString
toPath DeleteSchedule' {Maybe Text
Text
name :: Text
groupName :: Maybe Text
clientToken :: Maybe Text
$sel:name:DeleteSchedule' :: DeleteSchedule -> Text
$sel:groupName:DeleteSchedule' :: DeleteSchedule -> Maybe Text
$sel:clientToken:DeleteSchedule' :: DeleteSchedule -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/schedules/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
name]

instance Data.ToQuery DeleteSchedule where
  toQuery :: DeleteSchedule -> QueryString
toQuery DeleteSchedule' {Maybe Text
Text
name :: Text
groupName :: Maybe Text
clientToken :: Maybe Text
$sel:name:DeleteSchedule' :: DeleteSchedule -> Text
$sel:groupName:DeleteSchedule' :: DeleteSchedule -> Maybe Text
$sel:clientToken:DeleteSchedule' :: DeleteSchedule -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"clientToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
clientToken,
        ByteString
"groupName" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
groupName
      ]

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

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

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

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