{-# 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.Redshift.ModifyClusterSnapshotSchedule
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Modifies a snapshot schedule for a cluster.
module Amazonka.Redshift.ModifyClusterSnapshotSchedule
  ( -- * Creating a Request
    ModifyClusterSnapshotSchedule (..),
    newModifyClusterSnapshotSchedule,

    -- * Request Lenses
    modifyClusterSnapshotSchedule_disassociateSchedule,
    modifyClusterSnapshotSchedule_scheduleIdentifier,
    modifyClusterSnapshotSchedule_clusterIdentifier,

    -- * Destructuring the Response
    ModifyClusterSnapshotScheduleResponse (..),
    newModifyClusterSnapshotScheduleResponse,
  )
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 Amazonka.Redshift.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newModifyClusterSnapshotSchedule' smart constructor.
data ModifyClusterSnapshotSchedule = ModifyClusterSnapshotSchedule'
  { -- | A boolean to indicate whether to remove the assoiciation between the
    -- cluster and the schedule.
    ModifyClusterSnapshotSchedule -> Maybe Bool
disassociateSchedule :: Prelude.Maybe Prelude.Bool,
    -- | A unique alphanumeric identifier for the schedule that you want to
    -- associate with the cluster.
    ModifyClusterSnapshotSchedule -> Maybe Text
scheduleIdentifier :: Prelude.Maybe Prelude.Text,
    -- | A unique identifier for the cluster whose snapshot schedule you want to
    -- modify.
    ModifyClusterSnapshotSchedule -> Text
clusterIdentifier :: Prelude.Text
  }
  deriving (ModifyClusterSnapshotSchedule
-> ModifyClusterSnapshotSchedule -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyClusterSnapshotSchedule
-> ModifyClusterSnapshotSchedule -> Bool
$c/= :: ModifyClusterSnapshotSchedule
-> ModifyClusterSnapshotSchedule -> Bool
== :: ModifyClusterSnapshotSchedule
-> ModifyClusterSnapshotSchedule -> Bool
$c== :: ModifyClusterSnapshotSchedule
-> ModifyClusterSnapshotSchedule -> Bool
Prelude.Eq, ReadPrec [ModifyClusterSnapshotSchedule]
ReadPrec ModifyClusterSnapshotSchedule
Int -> ReadS ModifyClusterSnapshotSchedule
ReadS [ModifyClusterSnapshotSchedule]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyClusterSnapshotSchedule]
$creadListPrec :: ReadPrec [ModifyClusterSnapshotSchedule]
readPrec :: ReadPrec ModifyClusterSnapshotSchedule
$creadPrec :: ReadPrec ModifyClusterSnapshotSchedule
readList :: ReadS [ModifyClusterSnapshotSchedule]
$creadList :: ReadS [ModifyClusterSnapshotSchedule]
readsPrec :: Int -> ReadS ModifyClusterSnapshotSchedule
$creadsPrec :: Int -> ReadS ModifyClusterSnapshotSchedule
Prelude.Read, Int -> ModifyClusterSnapshotSchedule -> ShowS
[ModifyClusterSnapshotSchedule] -> ShowS
ModifyClusterSnapshotSchedule -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyClusterSnapshotSchedule] -> ShowS
$cshowList :: [ModifyClusterSnapshotSchedule] -> ShowS
show :: ModifyClusterSnapshotSchedule -> String
$cshow :: ModifyClusterSnapshotSchedule -> String
showsPrec :: Int -> ModifyClusterSnapshotSchedule -> ShowS
$cshowsPrec :: Int -> ModifyClusterSnapshotSchedule -> ShowS
Prelude.Show, forall x.
Rep ModifyClusterSnapshotSchedule x
-> ModifyClusterSnapshotSchedule
forall x.
ModifyClusterSnapshotSchedule
-> Rep ModifyClusterSnapshotSchedule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ModifyClusterSnapshotSchedule x
-> ModifyClusterSnapshotSchedule
$cfrom :: forall x.
ModifyClusterSnapshotSchedule
-> Rep ModifyClusterSnapshotSchedule x
Prelude.Generic)

-- |
-- Create a value of 'ModifyClusterSnapshotSchedule' 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:
--
-- 'disassociateSchedule', 'modifyClusterSnapshotSchedule_disassociateSchedule' - A boolean to indicate whether to remove the assoiciation between the
-- cluster and the schedule.
--
-- 'scheduleIdentifier', 'modifyClusterSnapshotSchedule_scheduleIdentifier' - A unique alphanumeric identifier for the schedule that you want to
-- associate with the cluster.
--
-- 'clusterIdentifier', 'modifyClusterSnapshotSchedule_clusterIdentifier' - A unique identifier for the cluster whose snapshot schedule you want to
-- modify.
newModifyClusterSnapshotSchedule ::
  -- | 'clusterIdentifier'
  Prelude.Text ->
  ModifyClusterSnapshotSchedule
newModifyClusterSnapshotSchedule :: Text -> ModifyClusterSnapshotSchedule
newModifyClusterSnapshotSchedule Text
pClusterIdentifier_ =
  ModifyClusterSnapshotSchedule'
    { $sel:disassociateSchedule:ModifyClusterSnapshotSchedule' :: Maybe Bool
disassociateSchedule =
        forall a. Maybe a
Prelude.Nothing,
      $sel:scheduleIdentifier:ModifyClusterSnapshotSchedule' :: Maybe Text
scheduleIdentifier = forall a. Maybe a
Prelude.Nothing,
      $sel:clusterIdentifier:ModifyClusterSnapshotSchedule' :: Text
clusterIdentifier = Text
pClusterIdentifier_
    }

-- | A boolean to indicate whether to remove the assoiciation between the
-- cluster and the schedule.
modifyClusterSnapshotSchedule_disassociateSchedule :: Lens.Lens' ModifyClusterSnapshotSchedule (Prelude.Maybe Prelude.Bool)
modifyClusterSnapshotSchedule_disassociateSchedule :: Lens' ModifyClusterSnapshotSchedule (Maybe Bool)
modifyClusterSnapshotSchedule_disassociateSchedule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyClusterSnapshotSchedule' {Maybe Bool
disassociateSchedule :: Maybe Bool
$sel:disassociateSchedule:ModifyClusterSnapshotSchedule' :: ModifyClusterSnapshotSchedule -> Maybe Bool
disassociateSchedule} -> Maybe Bool
disassociateSchedule) (\s :: ModifyClusterSnapshotSchedule
s@ModifyClusterSnapshotSchedule' {} Maybe Bool
a -> ModifyClusterSnapshotSchedule
s {$sel:disassociateSchedule:ModifyClusterSnapshotSchedule' :: Maybe Bool
disassociateSchedule = Maybe Bool
a} :: ModifyClusterSnapshotSchedule)

-- | A unique alphanumeric identifier for the schedule that you want to
-- associate with the cluster.
modifyClusterSnapshotSchedule_scheduleIdentifier :: Lens.Lens' ModifyClusterSnapshotSchedule (Prelude.Maybe Prelude.Text)
modifyClusterSnapshotSchedule_scheduleIdentifier :: Lens' ModifyClusterSnapshotSchedule (Maybe Text)
modifyClusterSnapshotSchedule_scheduleIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyClusterSnapshotSchedule' {Maybe Text
scheduleIdentifier :: Maybe Text
$sel:scheduleIdentifier:ModifyClusterSnapshotSchedule' :: ModifyClusterSnapshotSchedule -> Maybe Text
scheduleIdentifier} -> Maybe Text
scheduleIdentifier) (\s :: ModifyClusterSnapshotSchedule
s@ModifyClusterSnapshotSchedule' {} Maybe Text
a -> ModifyClusterSnapshotSchedule
s {$sel:scheduleIdentifier:ModifyClusterSnapshotSchedule' :: Maybe Text
scheduleIdentifier = Maybe Text
a} :: ModifyClusterSnapshotSchedule)

-- | A unique identifier for the cluster whose snapshot schedule you want to
-- modify.
modifyClusterSnapshotSchedule_clusterIdentifier :: Lens.Lens' ModifyClusterSnapshotSchedule Prelude.Text
modifyClusterSnapshotSchedule_clusterIdentifier :: Lens' ModifyClusterSnapshotSchedule Text
modifyClusterSnapshotSchedule_clusterIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyClusterSnapshotSchedule' {Text
clusterIdentifier :: Text
$sel:clusterIdentifier:ModifyClusterSnapshotSchedule' :: ModifyClusterSnapshotSchedule -> Text
clusterIdentifier} -> Text
clusterIdentifier) (\s :: ModifyClusterSnapshotSchedule
s@ModifyClusterSnapshotSchedule' {} Text
a -> ModifyClusterSnapshotSchedule
s {$sel:clusterIdentifier:ModifyClusterSnapshotSchedule' :: Text
clusterIdentifier = Text
a} :: ModifyClusterSnapshotSchedule)

instance
  Core.AWSRequest
    ModifyClusterSnapshotSchedule
  where
  type
    AWSResponse ModifyClusterSnapshotSchedule =
      ModifyClusterSnapshotScheduleResponse
  request :: (Service -> Service)
-> ModifyClusterSnapshotSchedule
-> Request ModifyClusterSnapshotSchedule
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ModifyClusterSnapshotSchedule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ModifyClusterSnapshotSchedule)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      ModifyClusterSnapshotScheduleResponse
ModifyClusterSnapshotScheduleResponse'

instance
  Prelude.Hashable
    ModifyClusterSnapshotSchedule
  where
  hashWithSalt :: Int -> ModifyClusterSnapshotSchedule -> Int
hashWithSalt Int
_salt ModifyClusterSnapshotSchedule' {Maybe Bool
Maybe Text
Text
clusterIdentifier :: Text
scheduleIdentifier :: Maybe Text
disassociateSchedule :: Maybe Bool
$sel:clusterIdentifier:ModifyClusterSnapshotSchedule' :: ModifyClusterSnapshotSchedule -> Text
$sel:scheduleIdentifier:ModifyClusterSnapshotSchedule' :: ModifyClusterSnapshotSchedule -> Maybe Text
$sel:disassociateSchedule:ModifyClusterSnapshotSchedule' :: ModifyClusterSnapshotSchedule -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
disassociateSchedule
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
scheduleIdentifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
clusterIdentifier

instance Prelude.NFData ModifyClusterSnapshotSchedule where
  rnf :: ModifyClusterSnapshotSchedule -> ()
rnf ModifyClusterSnapshotSchedule' {Maybe Bool
Maybe Text
Text
clusterIdentifier :: Text
scheduleIdentifier :: Maybe Text
disassociateSchedule :: Maybe Bool
$sel:clusterIdentifier:ModifyClusterSnapshotSchedule' :: ModifyClusterSnapshotSchedule -> Text
$sel:scheduleIdentifier:ModifyClusterSnapshotSchedule' :: ModifyClusterSnapshotSchedule -> Maybe Text
$sel:disassociateSchedule:ModifyClusterSnapshotSchedule' :: ModifyClusterSnapshotSchedule -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
disassociateSchedule
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
scheduleIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
clusterIdentifier

instance Data.ToHeaders ModifyClusterSnapshotSchedule where
  toHeaders :: ModifyClusterSnapshotSchedule -> [Header]
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

instance Data.ToPath ModifyClusterSnapshotSchedule where
  toPath :: ModifyClusterSnapshotSchedule -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Data.ToQuery ModifyClusterSnapshotSchedule where
  toQuery :: ModifyClusterSnapshotSchedule -> QueryString
toQuery ModifyClusterSnapshotSchedule' {Maybe Bool
Maybe Text
Text
clusterIdentifier :: Text
scheduleIdentifier :: Maybe Text
disassociateSchedule :: Maybe Bool
$sel:clusterIdentifier:ModifyClusterSnapshotSchedule' :: ModifyClusterSnapshotSchedule -> Text
$sel:scheduleIdentifier:ModifyClusterSnapshotSchedule' :: ModifyClusterSnapshotSchedule -> Maybe Text
$sel:disassociateSchedule:ModifyClusterSnapshotSchedule' :: ModifyClusterSnapshotSchedule -> Maybe Bool
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ( ByteString
"ModifyClusterSnapshotSchedule" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
        ByteString
"DisassociateSchedule" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
disassociateSchedule,
        ByteString
"ScheduleIdentifier" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
scheduleIdentifier,
        ByteString
"ClusterIdentifier" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
clusterIdentifier
      ]

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

-- |
-- Create a value of 'ModifyClusterSnapshotScheduleResponse' 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.
newModifyClusterSnapshotScheduleResponse ::
  ModifyClusterSnapshotScheduleResponse
newModifyClusterSnapshotScheduleResponse :: ModifyClusterSnapshotScheduleResponse
newModifyClusterSnapshotScheduleResponse =
  ModifyClusterSnapshotScheduleResponse
ModifyClusterSnapshotScheduleResponse'

instance
  Prelude.NFData
    ModifyClusterSnapshotScheduleResponse
  where
  rnf :: ModifyClusterSnapshotScheduleResponse -> ()
rnf ModifyClusterSnapshotScheduleResponse
_ = ()