{-# 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-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)
--
-- 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 Amazonka.GroundStation.Types
import qualified Amazonka.Lens as Lens
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
(CancelContact -> CancelContact -> Bool)
-> (CancelContact -> CancelContact -> Bool) -> Eq CancelContact
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]
(Int -> ReadS CancelContact)
-> ReadS [CancelContact]
-> ReadPrec CancelContact
-> ReadPrec [CancelContact]
-> Read 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
(Int -> CancelContact -> ShowS)
-> (CancelContact -> String)
-> ([CancelContact] -> ShowS)
-> Show CancelContact
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. CancelContact -> Rep CancelContact x)
-> (forall x. Rep CancelContact x -> CancelContact)
-> Generic CancelContact
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' :: Text -> CancelContact
CancelContact' {$sel:contactId:CancelContact' :: Text
contactId = Text
pContactId_}

-- | UUID of a contact.
cancelContact_contactId :: Lens.Lens' CancelContact Prelude.Text
cancelContact_contactId :: (Text -> f Text) -> CancelContact -> f CancelContact
cancelContact_contactId = (CancelContact -> Text)
-> (CancelContact -> Text -> CancelContact)
-> Lens CancelContact CancelContact Text Text
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 :: CancelContact -> Request CancelContact
request = Service -> CancelContact -> Request CancelContact
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy CancelContact
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CancelContact)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CancelContact))
-> Logger
-> Service
-> Proxy CancelContact
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CancelContact)))
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 -> Object -> Either String ContactIdResponse
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)

instance Prelude.Hashable CancelContact

instance Prelude.NFData CancelContact

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

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