{-# 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.GroundStation.CancelContact
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Cancels a contact with a specified contact ID.
module Amazonka.GroundStation.CancelContact
  ( -- * Creating a Request
    CancelContact (..),
    newCancelContact,

    -- * Request Lenses
    cancelContact_contactId,

    -- * Destructuring the Response
    ContactIdResponse (..),
    newContactIdResponse,

    -- * Response Lenses
    contactIdResponse_contactId,
  )
where

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

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

-- |
-- Create a value of 'CancelContact' 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:
--
-- 'contactId', 'cancelContact_contactId' - UUID of a contact.
newCancelContact ::
  -- | 'contactId'
  Prelude.Text ->
  CancelContact
newCancelContact :: Text -> CancelContact
newCancelContact Text
pContactId_ =
  CancelContact' {$sel:contactId:CancelContact' :: Text
contactId = Text
pContactId_}

-- | UUID of a contact.
cancelContact_contactId :: Lens.Lens' CancelContact Prelude.Text
cancelContact_contactId :: Lens' CancelContact Text
cancelContact_contactId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CancelContact' {Text
contactId :: Text
$sel:contactId:CancelContact' :: CancelContact -> Text
contactId} -> Text
contactId) (\s :: CancelContact
s@CancelContact' {} Text
a -> CancelContact
s {$sel:contactId:CancelContact' :: Text
contactId = Text
a} :: CancelContact)

instance Core.AWSRequest CancelContact where
  type AWSResponse CancelContact = ContactIdResponse
  request :: (Service -> Service) -> CancelContact -> Request CancelContact
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 CancelContact
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CancelContact)))
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 -> forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)

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

instance Prelude.NFData CancelContact where
  rnf :: CancelContact -> ()
rnf CancelContact' {Text
contactId :: Text
$sel:contactId:CancelContact' :: CancelContact -> Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Text
contactId

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

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