{-# 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.SSM.DeleteResourceDataSync
-- 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 resource data sync configuration. After the configuration is
-- deleted, changes to data on managed instances are no longer synced to or
-- from the target. Deleting a sync configuration doesn\'t delete data.
module Amazonka.SSM.DeleteResourceDataSync
  ( -- * Creating a Request
    DeleteResourceDataSync (..),
    newDeleteResourceDataSync,

    -- * Request Lenses
    deleteResourceDataSync_syncType,
    deleteResourceDataSync_syncName,

    -- * Destructuring the Response
    DeleteResourceDataSyncResponse (..),
    newDeleteResourceDataSyncResponse,

    -- * Response Lenses
    deleteResourceDataSyncResponse_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.SSM.Types

-- | /See:/ 'newDeleteResourceDataSync' smart constructor.
data DeleteResourceDataSync = DeleteResourceDataSync'
  { -- | Specify the type of resource data sync to delete.
    DeleteResourceDataSync -> Maybe Text
syncType :: Prelude.Maybe Prelude.Text,
    -- | The name of the configuration to delete.
    DeleteResourceDataSync -> Text
syncName :: Prelude.Text
  }
  deriving (DeleteResourceDataSync -> DeleteResourceDataSync -> Bool
(DeleteResourceDataSync -> DeleteResourceDataSync -> Bool)
-> (DeleteResourceDataSync -> DeleteResourceDataSync -> Bool)
-> Eq DeleteResourceDataSync
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteResourceDataSync -> DeleteResourceDataSync -> Bool
$c/= :: DeleteResourceDataSync -> DeleteResourceDataSync -> Bool
== :: DeleteResourceDataSync -> DeleteResourceDataSync -> Bool
$c== :: DeleteResourceDataSync -> DeleteResourceDataSync -> Bool
Prelude.Eq, ReadPrec [DeleteResourceDataSync]
ReadPrec DeleteResourceDataSync
Int -> ReadS DeleteResourceDataSync
ReadS [DeleteResourceDataSync]
(Int -> ReadS DeleteResourceDataSync)
-> ReadS [DeleteResourceDataSync]
-> ReadPrec DeleteResourceDataSync
-> ReadPrec [DeleteResourceDataSync]
-> Read DeleteResourceDataSync
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteResourceDataSync]
$creadListPrec :: ReadPrec [DeleteResourceDataSync]
readPrec :: ReadPrec DeleteResourceDataSync
$creadPrec :: ReadPrec DeleteResourceDataSync
readList :: ReadS [DeleteResourceDataSync]
$creadList :: ReadS [DeleteResourceDataSync]
readsPrec :: Int -> ReadS DeleteResourceDataSync
$creadsPrec :: Int -> ReadS DeleteResourceDataSync
Prelude.Read, Int -> DeleteResourceDataSync -> ShowS
[DeleteResourceDataSync] -> ShowS
DeleteResourceDataSync -> String
(Int -> DeleteResourceDataSync -> ShowS)
-> (DeleteResourceDataSync -> String)
-> ([DeleteResourceDataSync] -> ShowS)
-> Show DeleteResourceDataSync
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteResourceDataSync] -> ShowS
$cshowList :: [DeleteResourceDataSync] -> ShowS
show :: DeleteResourceDataSync -> String
$cshow :: DeleteResourceDataSync -> String
showsPrec :: Int -> DeleteResourceDataSync -> ShowS
$cshowsPrec :: Int -> DeleteResourceDataSync -> ShowS
Prelude.Show, (forall x. DeleteResourceDataSync -> Rep DeleteResourceDataSync x)
-> (forall x.
    Rep DeleteResourceDataSync x -> DeleteResourceDataSync)
-> Generic DeleteResourceDataSync
forall x. Rep DeleteResourceDataSync x -> DeleteResourceDataSync
forall x. DeleteResourceDataSync -> Rep DeleteResourceDataSync x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteResourceDataSync x -> DeleteResourceDataSync
$cfrom :: forall x. DeleteResourceDataSync -> Rep DeleteResourceDataSync x
Prelude.Generic)

-- |
-- Create a value of 'DeleteResourceDataSync' 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:
--
-- 'syncType', 'deleteResourceDataSync_syncType' - Specify the type of resource data sync to delete.
--
-- 'syncName', 'deleteResourceDataSync_syncName' - The name of the configuration to delete.
newDeleteResourceDataSync ::
  -- | 'syncName'
  Prelude.Text ->
  DeleteResourceDataSync
newDeleteResourceDataSync :: Text -> DeleteResourceDataSync
newDeleteResourceDataSync Text
pSyncName_ =
  DeleteResourceDataSync' :: Maybe Text -> Text -> DeleteResourceDataSync
DeleteResourceDataSync'
    { $sel:syncType:DeleteResourceDataSync' :: Maybe Text
syncType = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:syncName:DeleteResourceDataSync' :: Text
syncName = Text
pSyncName_
    }

-- | Specify the type of resource data sync to delete.
deleteResourceDataSync_syncType :: Lens.Lens' DeleteResourceDataSync (Prelude.Maybe Prelude.Text)
deleteResourceDataSync_syncType :: (Maybe Text -> f (Maybe Text))
-> DeleteResourceDataSync -> f DeleteResourceDataSync
deleteResourceDataSync_syncType = (DeleteResourceDataSync -> Maybe Text)
-> (DeleteResourceDataSync -> Maybe Text -> DeleteResourceDataSync)
-> Lens
     DeleteResourceDataSync
     DeleteResourceDataSync
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResourceDataSync' {Maybe Text
syncType :: Maybe Text
$sel:syncType:DeleteResourceDataSync' :: DeleteResourceDataSync -> Maybe Text
syncType} -> Maybe Text
syncType) (\s :: DeleteResourceDataSync
s@DeleteResourceDataSync' {} Maybe Text
a -> DeleteResourceDataSync
s {$sel:syncType:DeleteResourceDataSync' :: Maybe Text
syncType = Maybe Text
a} :: DeleteResourceDataSync)

-- | The name of the configuration to delete.
deleteResourceDataSync_syncName :: Lens.Lens' DeleteResourceDataSync Prelude.Text
deleteResourceDataSync_syncName :: (Text -> f Text)
-> DeleteResourceDataSync -> f DeleteResourceDataSync
deleteResourceDataSync_syncName = (DeleteResourceDataSync -> Text)
-> (DeleteResourceDataSync -> Text -> DeleteResourceDataSync)
-> Lens DeleteResourceDataSync DeleteResourceDataSync Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteResourceDataSync' {Text
syncName :: Text
$sel:syncName:DeleteResourceDataSync' :: DeleteResourceDataSync -> Text
syncName} -> Text
syncName) (\s :: DeleteResourceDataSync
s@DeleteResourceDataSync' {} Text
a -> DeleteResourceDataSync
s {$sel:syncName:DeleteResourceDataSync' :: Text
syncName = Text
a} :: DeleteResourceDataSync)

instance Core.AWSRequest DeleteResourceDataSync where
  type
    AWSResponse DeleteResourceDataSync =
      DeleteResourceDataSyncResponse
  request :: DeleteResourceDataSync -> Request DeleteResourceDataSync
request = Service -> DeleteResourceDataSync -> Request DeleteResourceDataSync
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteResourceDataSync
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteResourceDataSync)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteResourceDataSync))
-> Logger
-> Service
-> Proxy DeleteResourceDataSync
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteResourceDataSync)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteResourceDataSyncResponse
DeleteResourceDataSyncResponse'
            (Int -> DeleteResourceDataSyncResponse)
-> Either String Int
-> Either String DeleteResourceDataSyncResponse
forall (f :: * -> *) a b. Functor 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 DeleteResourceDataSync

instance Prelude.NFData DeleteResourceDataSync

instance Core.ToHeaders DeleteResourceDataSync where
  toHeaders :: DeleteResourceDataSync -> ResponseHeaders
toHeaders =
    ResponseHeaders -> DeleteResourceDataSync -> 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
"AmazonSSM.DeleteResourceDataSync" ::
                          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 DeleteResourceDataSync where
  toJSON :: DeleteResourceDataSync -> Value
toJSON DeleteResourceDataSync' {Maybe Text
Text
syncName :: Text
syncType :: Maybe Text
$sel:syncName:DeleteResourceDataSync' :: DeleteResourceDataSync -> Text
$sel:syncType:DeleteResourceDataSync' :: DeleteResourceDataSync -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"SyncType" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
syncType,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SyncName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
syncName)
          ]
      )

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

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

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

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

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

instance
  Prelude.NFData
    DeleteResourceDataSyncResponse