{-# 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-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)
--
-- 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.Lens as Lens
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
(ModifyClusterSnapshotSchedule
 -> ModifyClusterSnapshotSchedule -> Bool)
-> (ModifyClusterSnapshotSchedule
    -> ModifyClusterSnapshotSchedule -> Bool)
-> Eq ModifyClusterSnapshotSchedule
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]
(Int -> ReadS ModifyClusterSnapshotSchedule)
-> ReadS [ModifyClusterSnapshotSchedule]
-> ReadPrec ModifyClusterSnapshotSchedule
-> ReadPrec [ModifyClusterSnapshotSchedule]
-> Read 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
(Int -> ModifyClusterSnapshotSchedule -> ShowS)
-> (ModifyClusterSnapshotSchedule -> String)
-> ([ModifyClusterSnapshotSchedule] -> ShowS)
-> Show ModifyClusterSnapshotSchedule
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.
 ModifyClusterSnapshotSchedule
 -> Rep ModifyClusterSnapshotSchedule x)
-> (forall x.
    Rep ModifyClusterSnapshotSchedule x
    -> ModifyClusterSnapshotSchedule)
-> Generic ModifyClusterSnapshotSchedule
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' :: Maybe Bool -> Maybe Text -> Text -> ModifyClusterSnapshotSchedule
ModifyClusterSnapshotSchedule'
    { $sel:disassociateSchedule:ModifyClusterSnapshotSchedule' :: Maybe Bool
disassociateSchedule =
        Maybe Bool
forall a. Maybe a
Prelude.Nothing,
      $sel:scheduleIdentifier:ModifyClusterSnapshotSchedule' :: Maybe Text
scheduleIdentifier = Maybe Text
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 :: (Maybe Bool -> f (Maybe Bool))
-> ModifyClusterSnapshotSchedule -> f ModifyClusterSnapshotSchedule
modifyClusterSnapshotSchedule_disassociateSchedule = (ModifyClusterSnapshotSchedule -> Maybe Bool)
-> (ModifyClusterSnapshotSchedule
    -> Maybe Bool -> ModifyClusterSnapshotSchedule)
-> Lens
     ModifyClusterSnapshotSchedule
     ModifyClusterSnapshotSchedule
     (Maybe Bool)
     (Maybe Bool)
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 :: (Maybe Text -> f (Maybe Text))
-> ModifyClusterSnapshotSchedule -> f ModifyClusterSnapshotSchedule
modifyClusterSnapshotSchedule_scheduleIdentifier = (ModifyClusterSnapshotSchedule -> Maybe Text)
-> (ModifyClusterSnapshotSchedule
    -> Maybe Text -> ModifyClusterSnapshotSchedule)
-> Lens
     ModifyClusterSnapshotSchedule
     ModifyClusterSnapshotSchedule
     (Maybe Text)
     (Maybe Text)
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 :: (Text -> f Text)
-> ModifyClusterSnapshotSchedule -> f ModifyClusterSnapshotSchedule
modifyClusterSnapshotSchedule_clusterIdentifier = (ModifyClusterSnapshotSchedule -> Text)
-> (ModifyClusterSnapshotSchedule
    -> Text -> ModifyClusterSnapshotSchedule)
-> Lens
     ModifyClusterSnapshotSchedule
     ModifyClusterSnapshotSchedule
     Text
     Text
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 :: ModifyClusterSnapshotSchedule
-> Request ModifyClusterSnapshotSchedule
request = Service
-> ModifyClusterSnapshotSchedule
-> Request ModifyClusterSnapshotSchedule
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy ModifyClusterSnapshotSchedule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ModifyClusterSnapshotSchedule)))
response =
    AWSResponse ModifyClusterSnapshotSchedule
-> Logger
-> Service
-> Proxy ModifyClusterSnapshotSchedule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ModifyClusterSnapshotSchedule)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse ModifyClusterSnapshotSchedule
ModifyClusterSnapshotScheduleResponse
ModifyClusterSnapshotScheduleResponse'

instance
  Prelude.Hashable
    ModifyClusterSnapshotSchedule

instance Prelude.NFData ModifyClusterSnapshotSchedule

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

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

instance Core.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
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: ( ByteString
"ModifyClusterSnapshotSchedule" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2012-12-01" :: Prelude.ByteString),
        ByteString
"DisassociateSchedule" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
disassociateSchedule,
        ByteString
"ScheduleIdentifier" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
scheduleIdentifier,
        ByteString
"ClusterIdentifier" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
clusterIdentifier
      ]

-- | /See:/ 'newModifyClusterSnapshotScheduleResponse' smart constructor.
data ModifyClusterSnapshotScheduleResponse = ModifyClusterSnapshotScheduleResponse'
  {
  }
  deriving (ModifyClusterSnapshotScheduleResponse
-> ModifyClusterSnapshotScheduleResponse -> Bool
(ModifyClusterSnapshotScheduleResponse
 -> ModifyClusterSnapshotScheduleResponse -> Bool)
-> (ModifyClusterSnapshotScheduleResponse
    -> ModifyClusterSnapshotScheduleResponse -> Bool)
-> Eq ModifyClusterSnapshotScheduleResponse
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]
(Int -> ReadS ModifyClusterSnapshotScheduleResponse)
-> ReadS [ModifyClusterSnapshotScheduleResponse]
-> ReadPrec ModifyClusterSnapshotScheduleResponse
-> ReadPrec [ModifyClusterSnapshotScheduleResponse]
-> Read 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
(Int -> ModifyClusterSnapshotScheduleResponse -> ShowS)
-> (ModifyClusterSnapshotScheduleResponse -> String)
-> ([ModifyClusterSnapshotScheduleResponse] -> ShowS)
-> Show ModifyClusterSnapshotScheduleResponse
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.
 ModifyClusterSnapshotScheduleResponse
 -> Rep ModifyClusterSnapshotScheduleResponse x)
-> (forall x.
    Rep ModifyClusterSnapshotScheduleResponse x
    -> ModifyClusterSnapshotScheduleResponse)
-> Generic ModifyClusterSnapshotScheduleResponse
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