{-# 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.StorageGateway.DeleteSnapshotSchedule
-- 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)
--
-- Deletes a snapshot of a volume.
--
-- You can take snapshots of your gateway volumes on a scheduled or ad hoc
-- basis. This API action enables you to delete a snapshot schedule for a
-- volume. For more information, see
-- <https://docs.aws.amazon.com/storagegateway/latest/userguide/backing-up-volumes.html Backing up your volumes>.
-- In the @DeleteSnapshotSchedule@ request, you identify the volume by
-- providing its Amazon Resource Name (ARN). This operation is only
-- supported in stored and cached volume gateway types.
--
-- To list or delete a snapshot, you must use the Amazon EC2 API. For more
-- information, go to
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/API_DescribeSnapshots.html DescribeSnapshots>
-- in the /Amazon Elastic Compute Cloud API Reference/.
module Amazonka.StorageGateway.DeleteSnapshotSchedule
  ( -- * Creating a Request
    DeleteSnapshotSchedule (..),
    newDeleteSnapshotSchedule,

    -- * Request Lenses
    deleteSnapshotSchedule_volumeARN,

    -- * Destructuring the Response
    DeleteSnapshotScheduleResponse (..),
    newDeleteSnapshotScheduleResponse,

    -- * Response Lenses
    deleteSnapshotScheduleResponse_volumeARN,
    deleteSnapshotScheduleResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.StorageGateway.Types

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

-- |
-- Create a value of 'DeleteSnapshotSchedule' 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:
--
-- 'volumeARN', 'deleteSnapshotSchedule_volumeARN' - The volume which snapshot schedule to delete.
newDeleteSnapshotSchedule ::
  -- | 'volumeARN'
  Prelude.Text ->
  DeleteSnapshotSchedule
newDeleteSnapshotSchedule :: Text -> DeleteSnapshotSchedule
newDeleteSnapshotSchedule Text
pVolumeARN_ =
  DeleteSnapshotSchedule' :: Text -> DeleteSnapshotSchedule
DeleteSnapshotSchedule' {$sel:volumeARN:DeleteSnapshotSchedule' :: Text
volumeARN = Text
pVolumeARN_}

-- | The volume which snapshot schedule to delete.
deleteSnapshotSchedule_volumeARN :: Lens.Lens' DeleteSnapshotSchedule Prelude.Text
deleteSnapshotSchedule_volumeARN :: (Text -> f Text)
-> DeleteSnapshotSchedule -> f DeleteSnapshotSchedule
deleteSnapshotSchedule_volumeARN = (DeleteSnapshotSchedule -> Text)
-> (DeleteSnapshotSchedule -> Text -> DeleteSnapshotSchedule)
-> Lens DeleteSnapshotSchedule DeleteSnapshotSchedule Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSnapshotSchedule' {Text
volumeARN :: Text
$sel:volumeARN:DeleteSnapshotSchedule' :: DeleteSnapshotSchedule -> Text
volumeARN} -> Text
volumeARN) (\s :: DeleteSnapshotSchedule
s@DeleteSnapshotSchedule' {} Text
a -> DeleteSnapshotSchedule
s {$sel:volumeARN:DeleteSnapshotSchedule' :: Text
volumeARN = Text
a} :: DeleteSnapshotSchedule)

instance Core.AWSRequest DeleteSnapshotSchedule where
  type
    AWSResponse DeleteSnapshotSchedule =
      DeleteSnapshotScheduleResponse
  request :: DeleteSnapshotSchedule -> Request DeleteSnapshotSchedule
request = Service -> DeleteSnapshotSchedule -> Request DeleteSnapshotSchedule
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteSnapshotSchedule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteSnapshotSchedule)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteSnapshotSchedule))
-> Logger
-> Service
-> Proxy DeleteSnapshotSchedule
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteSnapshotSchedule)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> DeleteSnapshotScheduleResponse
DeleteSnapshotScheduleResponse'
            (Maybe Text -> Int -> DeleteSnapshotScheduleResponse)
-> Either String (Maybe Text)
-> Either String (Int -> DeleteSnapshotScheduleResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"VolumeARN")
            Either String (Int -> DeleteSnapshotScheduleResponse)
-> Either String Int
-> Either String DeleteSnapshotScheduleResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteSnapshotSchedule

instance Prelude.NFData DeleteSnapshotSchedule

instance Core.ToHeaders DeleteSnapshotSchedule where
  toHeaders :: DeleteSnapshotSchedule -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteSnapshotSchedule -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"StorageGateway_20130630.DeleteSnapshotSchedule" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON DeleteSnapshotSchedule where
  toJSON :: DeleteSnapshotSchedule -> Value
toJSON DeleteSnapshotSchedule' {Text
volumeARN :: Text
$sel:volumeARN:DeleteSnapshotSchedule' :: DeleteSnapshotSchedule -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"VolumeARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
volumeARN)]
      )

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

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

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

-- |
-- Create a value of 'DeleteSnapshotScheduleResponse' 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:
--
-- 'volumeARN', 'deleteSnapshotScheduleResponse_volumeARN' - The volume which snapshot schedule was deleted.
--
-- 'httpStatus', 'deleteSnapshotScheduleResponse_httpStatus' - The response's http status code.
newDeleteSnapshotScheduleResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteSnapshotScheduleResponse
newDeleteSnapshotScheduleResponse :: Int -> DeleteSnapshotScheduleResponse
newDeleteSnapshotScheduleResponse Int
pHttpStatus_ =
  DeleteSnapshotScheduleResponse' :: Maybe Text -> Int -> DeleteSnapshotScheduleResponse
DeleteSnapshotScheduleResponse'
    { $sel:volumeARN:DeleteSnapshotScheduleResponse' :: Maybe Text
volumeARN =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteSnapshotScheduleResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The volume which snapshot schedule was deleted.
deleteSnapshotScheduleResponse_volumeARN :: Lens.Lens' DeleteSnapshotScheduleResponse (Prelude.Maybe Prelude.Text)
deleteSnapshotScheduleResponse_volumeARN :: (Maybe Text -> f (Maybe Text))
-> DeleteSnapshotScheduleResponse
-> f DeleteSnapshotScheduleResponse
deleteSnapshotScheduleResponse_volumeARN = (DeleteSnapshotScheduleResponse -> Maybe Text)
-> (DeleteSnapshotScheduleResponse
    -> Maybe Text -> DeleteSnapshotScheduleResponse)
-> Lens
     DeleteSnapshotScheduleResponse
     DeleteSnapshotScheduleResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSnapshotScheduleResponse' {Maybe Text
volumeARN :: Maybe Text
$sel:volumeARN:DeleteSnapshotScheduleResponse' :: DeleteSnapshotScheduleResponse -> Maybe Text
volumeARN} -> Maybe Text
volumeARN) (\s :: DeleteSnapshotScheduleResponse
s@DeleteSnapshotScheduleResponse' {} Maybe Text
a -> DeleteSnapshotScheduleResponse
s {$sel:volumeARN:DeleteSnapshotScheduleResponse' :: Maybe Text
volumeARN = Maybe Text
a} :: DeleteSnapshotScheduleResponse)

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

instance
  Prelude.NFData
    DeleteSnapshotScheduleResponse