{-# 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.IotTwinMaker.DeleteSyncJob
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Delete the SyncJob.
module Amazonka.IotTwinMaker.DeleteSyncJob
  ( -- * Creating a Request
    DeleteSyncJob (..),
    newDeleteSyncJob,

    -- * Request Lenses
    deleteSyncJob_workspaceId,
    deleteSyncJob_syncSource,

    -- * Destructuring the Response
    DeleteSyncJobResponse (..),
    newDeleteSyncJobResponse,

    -- * Response Lenses
    deleteSyncJobResponse_httpStatus,
    deleteSyncJobResponse_state,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IotTwinMaker.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDeleteSyncJob' smart constructor.
data DeleteSyncJob = DeleteSyncJob'
  { -- | The workspace Id.
    DeleteSyncJob -> Text
workspaceId :: Prelude.Text,
    -- | The sync source.
    --
    -- Currently the only supported syncSoucre is @SITEWISE @.
    DeleteSyncJob -> Text
syncSource :: Prelude.Text
  }
  deriving (DeleteSyncJob -> DeleteSyncJob -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteSyncJob -> DeleteSyncJob -> Bool
$c/= :: DeleteSyncJob -> DeleteSyncJob -> Bool
== :: DeleteSyncJob -> DeleteSyncJob -> Bool
$c== :: DeleteSyncJob -> DeleteSyncJob -> Bool
Prelude.Eq, ReadPrec [DeleteSyncJob]
ReadPrec DeleteSyncJob
Int -> ReadS DeleteSyncJob
ReadS [DeleteSyncJob]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteSyncJob]
$creadListPrec :: ReadPrec [DeleteSyncJob]
readPrec :: ReadPrec DeleteSyncJob
$creadPrec :: ReadPrec DeleteSyncJob
readList :: ReadS [DeleteSyncJob]
$creadList :: ReadS [DeleteSyncJob]
readsPrec :: Int -> ReadS DeleteSyncJob
$creadsPrec :: Int -> ReadS DeleteSyncJob
Prelude.Read, Int -> DeleteSyncJob -> ShowS
[DeleteSyncJob] -> ShowS
DeleteSyncJob -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteSyncJob] -> ShowS
$cshowList :: [DeleteSyncJob] -> ShowS
show :: DeleteSyncJob -> String
$cshow :: DeleteSyncJob -> String
showsPrec :: Int -> DeleteSyncJob -> ShowS
$cshowsPrec :: Int -> DeleteSyncJob -> ShowS
Prelude.Show, forall x. Rep DeleteSyncJob x -> DeleteSyncJob
forall x. DeleteSyncJob -> Rep DeleteSyncJob x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteSyncJob x -> DeleteSyncJob
$cfrom :: forall x. DeleteSyncJob -> Rep DeleteSyncJob x
Prelude.Generic)

-- |
-- Create a value of 'DeleteSyncJob' 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:
--
-- 'workspaceId', 'deleteSyncJob_workspaceId' - The workspace Id.
--
-- 'syncSource', 'deleteSyncJob_syncSource' - The sync source.
--
-- Currently the only supported syncSoucre is @SITEWISE @.
newDeleteSyncJob ::
  -- | 'workspaceId'
  Prelude.Text ->
  -- | 'syncSource'
  Prelude.Text ->
  DeleteSyncJob
newDeleteSyncJob :: Text -> Text -> DeleteSyncJob
newDeleteSyncJob Text
pWorkspaceId_ Text
pSyncSource_ =
  DeleteSyncJob'
    { $sel:workspaceId:DeleteSyncJob' :: Text
workspaceId = Text
pWorkspaceId_,
      $sel:syncSource:DeleteSyncJob' :: Text
syncSource = Text
pSyncSource_
    }

-- | The workspace Id.
deleteSyncJob_workspaceId :: Lens.Lens' DeleteSyncJob Prelude.Text
deleteSyncJob_workspaceId :: Lens' DeleteSyncJob Text
deleteSyncJob_workspaceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSyncJob' {Text
workspaceId :: Text
$sel:workspaceId:DeleteSyncJob' :: DeleteSyncJob -> Text
workspaceId} -> Text
workspaceId) (\s :: DeleteSyncJob
s@DeleteSyncJob' {} Text
a -> DeleteSyncJob
s {$sel:workspaceId:DeleteSyncJob' :: Text
workspaceId = Text
a} :: DeleteSyncJob)

-- | The sync source.
--
-- Currently the only supported syncSoucre is @SITEWISE @.
deleteSyncJob_syncSource :: Lens.Lens' DeleteSyncJob Prelude.Text
deleteSyncJob_syncSource :: Lens' DeleteSyncJob Text
deleteSyncJob_syncSource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSyncJob' {Text
syncSource :: Text
$sel:syncSource:DeleteSyncJob' :: DeleteSyncJob -> Text
syncSource} -> Text
syncSource) (\s :: DeleteSyncJob
s@DeleteSyncJob' {} Text
a -> DeleteSyncJob
s {$sel:syncSource:DeleteSyncJob' :: Text
syncSource = Text
a} :: DeleteSyncJob)

instance Core.AWSRequest DeleteSyncJob where
  type
    AWSResponse DeleteSyncJob =
      DeleteSyncJobResponse
  request :: (Service -> Service) -> DeleteSyncJob -> Request DeleteSyncJob
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 DeleteSyncJob
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteSyncJob)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> SyncJobState -> DeleteSyncJobResponse
DeleteSyncJobResponse'
            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))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"state")
      )

instance Prelude.Hashable DeleteSyncJob where
  hashWithSalt :: Int -> DeleteSyncJob -> Int
hashWithSalt Int
_salt DeleteSyncJob' {Text
syncSource :: Text
workspaceId :: Text
$sel:syncSource:DeleteSyncJob' :: DeleteSyncJob -> Text
$sel:workspaceId:DeleteSyncJob' :: DeleteSyncJob -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workspaceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
syncSource

instance Prelude.NFData DeleteSyncJob where
  rnf :: DeleteSyncJob -> ()
rnf DeleteSyncJob' {Text
syncSource :: Text
workspaceId :: Text
$sel:syncSource:DeleteSyncJob' :: DeleteSyncJob -> Text
$sel:workspaceId:DeleteSyncJob' :: DeleteSyncJob -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
workspaceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
syncSource

instance Data.ToHeaders DeleteSyncJob where
  toHeaders :: DeleteSyncJob -> 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 DeleteSyncJob where
  toPath :: DeleteSyncJob -> ByteString
toPath DeleteSyncJob' {Text
syncSource :: Text
workspaceId :: Text
$sel:syncSource:DeleteSyncJob' :: DeleteSyncJob -> Text
$sel:workspaceId:DeleteSyncJob' :: DeleteSyncJob -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/workspaces/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
workspaceId,
        ByteString
"/sync-jobs/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
syncSource
      ]

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

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

-- |
-- Create a value of 'DeleteSyncJobResponse' 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', 'deleteSyncJobResponse_httpStatus' - The response's http status code.
--
-- 'state', 'deleteSyncJobResponse_state' - The SyncJob response state.
newDeleteSyncJobResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'state'
  SyncJobState ->
  DeleteSyncJobResponse
newDeleteSyncJobResponse :: Int -> SyncJobState -> DeleteSyncJobResponse
newDeleteSyncJobResponse Int
pHttpStatus_ SyncJobState
pState_ =
  DeleteSyncJobResponse'
    { $sel:httpStatus:DeleteSyncJobResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:state:DeleteSyncJobResponse' :: SyncJobState
state = SyncJobState
pState_
    }

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

-- | The SyncJob response state.
deleteSyncJobResponse_state :: Lens.Lens' DeleteSyncJobResponse SyncJobState
deleteSyncJobResponse_state :: Lens' DeleteSyncJobResponse SyncJobState
deleteSyncJobResponse_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteSyncJobResponse' {SyncJobState
state :: SyncJobState
$sel:state:DeleteSyncJobResponse' :: DeleteSyncJobResponse -> SyncJobState
state} -> SyncJobState
state) (\s :: DeleteSyncJobResponse
s@DeleteSyncJobResponse' {} SyncJobState
a -> DeleteSyncJobResponse
s {$sel:state:DeleteSyncJobResponse' :: SyncJobState
state = SyncJobState
a} :: DeleteSyncJobResponse)

instance Prelude.NFData DeleteSyncJobResponse where
  rnf :: DeleteSyncJobResponse -> ()
rnf DeleteSyncJobResponse' {Int
SyncJobState
state :: SyncJobState
httpStatus :: Int
$sel:state:DeleteSyncJobResponse' :: DeleteSyncJobResponse -> SyncJobState
$sel:httpStatus:DeleteSyncJobResponse' :: DeleteSyncJobResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf SyncJobState
state