{-# 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.CloudDirectory.DeleteTypedLinkFacet
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes a TypedLinkFacet. For more information, see
-- <https://docs.aws.amazon.com/clouddirectory/latest/developerguide/directory_objects_links.html#directory_objects_links_typedlink Typed Links>.
module Amazonka.CloudDirectory.DeleteTypedLinkFacet
  ( -- * Creating a Request
    DeleteTypedLinkFacet (..),
    newDeleteTypedLinkFacet,

    -- * Request Lenses
    deleteTypedLinkFacet_schemaArn,
    deleteTypedLinkFacet_name,

    -- * Destructuring the Response
    DeleteTypedLinkFacetResponse (..),
    newDeleteTypedLinkFacetResponse,

    -- * Response Lenses
    deleteTypedLinkFacetResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteTypedLinkFacet' smart constructor.
data DeleteTypedLinkFacet = DeleteTypedLinkFacet'
  { -- | The Amazon Resource Name (ARN) that is associated with the schema. For
    -- more information, see arns.
    DeleteTypedLinkFacet -> Text
schemaArn :: Prelude.Text,
    -- | The unique name of the typed link facet.
    DeleteTypedLinkFacet -> Text
name :: Prelude.Text
  }
  deriving (DeleteTypedLinkFacet -> DeleteTypedLinkFacet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteTypedLinkFacet -> DeleteTypedLinkFacet -> Bool
$c/= :: DeleteTypedLinkFacet -> DeleteTypedLinkFacet -> Bool
== :: DeleteTypedLinkFacet -> DeleteTypedLinkFacet -> Bool
$c== :: DeleteTypedLinkFacet -> DeleteTypedLinkFacet -> Bool
Prelude.Eq, ReadPrec [DeleteTypedLinkFacet]
ReadPrec DeleteTypedLinkFacet
Int -> ReadS DeleteTypedLinkFacet
ReadS [DeleteTypedLinkFacet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteTypedLinkFacet]
$creadListPrec :: ReadPrec [DeleteTypedLinkFacet]
readPrec :: ReadPrec DeleteTypedLinkFacet
$creadPrec :: ReadPrec DeleteTypedLinkFacet
readList :: ReadS [DeleteTypedLinkFacet]
$creadList :: ReadS [DeleteTypedLinkFacet]
readsPrec :: Int -> ReadS DeleteTypedLinkFacet
$creadsPrec :: Int -> ReadS DeleteTypedLinkFacet
Prelude.Read, Int -> DeleteTypedLinkFacet -> ShowS
[DeleteTypedLinkFacet] -> ShowS
DeleteTypedLinkFacet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteTypedLinkFacet] -> ShowS
$cshowList :: [DeleteTypedLinkFacet] -> ShowS
show :: DeleteTypedLinkFacet -> String
$cshow :: DeleteTypedLinkFacet -> String
showsPrec :: Int -> DeleteTypedLinkFacet -> ShowS
$cshowsPrec :: Int -> DeleteTypedLinkFacet -> ShowS
Prelude.Show, forall x. Rep DeleteTypedLinkFacet x -> DeleteTypedLinkFacet
forall x. DeleteTypedLinkFacet -> Rep DeleteTypedLinkFacet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteTypedLinkFacet x -> DeleteTypedLinkFacet
$cfrom :: forall x. DeleteTypedLinkFacet -> Rep DeleteTypedLinkFacet x
Prelude.Generic)

-- |
-- Create a value of 'DeleteTypedLinkFacet' 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:
--
-- 'schemaArn', 'deleteTypedLinkFacet_schemaArn' - The Amazon Resource Name (ARN) that is associated with the schema. For
-- more information, see arns.
--
-- 'name', 'deleteTypedLinkFacet_name' - The unique name of the typed link facet.
newDeleteTypedLinkFacet ::
  -- | 'schemaArn'
  Prelude.Text ->
  -- | 'name'
  Prelude.Text ->
  DeleteTypedLinkFacet
newDeleteTypedLinkFacet :: Text -> Text -> DeleteTypedLinkFacet
newDeleteTypedLinkFacet Text
pSchemaArn_ Text
pName_ =
  DeleteTypedLinkFacet'
    { $sel:schemaArn:DeleteTypedLinkFacet' :: Text
schemaArn = Text
pSchemaArn_,
      $sel:name:DeleteTypedLinkFacet' :: Text
name = Text
pName_
    }

-- | The Amazon Resource Name (ARN) that is associated with the schema. For
-- more information, see arns.
deleteTypedLinkFacet_schemaArn :: Lens.Lens' DeleteTypedLinkFacet Prelude.Text
deleteTypedLinkFacet_schemaArn :: Lens' DeleteTypedLinkFacet Text
deleteTypedLinkFacet_schemaArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteTypedLinkFacet' {Text
schemaArn :: Text
$sel:schemaArn:DeleteTypedLinkFacet' :: DeleteTypedLinkFacet -> Text
schemaArn} -> Text
schemaArn) (\s :: DeleteTypedLinkFacet
s@DeleteTypedLinkFacet' {} Text
a -> DeleteTypedLinkFacet
s {$sel:schemaArn:DeleteTypedLinkFacet' :: Text
schemaArn = Text
a} :: DeleteTypedLinkFacet)

-- | The unique name of the typed link facet.
deleteTypedLinkFacet_name :: Lens.Lens' DeleteTypedLinkFacet Prelude.Text
deleteTypedLinkFacet_name :: Lens' DeleteTypedLinkFacet Text
deleteTypedLinkFacet_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteTypedLinkFacet' {Text
name :: Text
$sel:name:DeleteTypedLinkFacet' :: DeleteTypedLinkFacet -> Text
name} -> Text
name) (\s :: DeleteTypedLinkFacet
s@DeleteTypedLinkFacet' {} Text
a -> DeleteTypedLinkFacet
s {$sel:name:DeleteTypedLinkFacet' :: Text
name = Text
a} :: DeleteTypedLinkFacet)

instance Core.AWSRequest DeleteTypedLinkFacet where
  type
    AWSResponse DeleteTypedLinkFacet =
      DeleteTypedLinkFacetResponse
  request :: (Service -> Service)
-> DeleteTypedLinkFacet -> Request DeleteTypedLinkFacet
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteTypedLinkFacet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteTypedLinkFacet)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteTypedLinkFacetResponse
DeleteTypedLinkFacetResponse'
            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))
      )

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

instance Prelude.NFData DeleteTypedLinkFacet where
  rnf :: DeleteTypedLinkFacet -> ()
rnf DeleteTypedLinkFacet' {Text
name :: Text
schemaArn :: Text
$sel:name:DeleteTypedLinkFacet' :: DeleteTypedLinkFacet -> Text
$sel:schemaArn:DeleteTypedLinkFacet' :: DeleteTypedLinkFacet -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
schemaArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name

instance Data.ToHeaders DeleteTypedLinkFacet where
  toHeaders :: DeleteTypedLinkFacet -> ResponseHeaders
toHeaders DeleteTypedLinkFacet' {Text
name :: Text
schemaArn :: Text
$sel:name:DeleteTypedLinkFacet' :: DeleteTypedLinkFacet -> Text
$sel:schemaArn:DeleteTypedLinkFacet' :: DeleteTypedLinkFacet -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [HeaderName
"x-amz-data-partition" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Text
schemaArn]

instance Data.ToJSON DeleteTypedLinkFacet where
  toJSON :: DeleteTypedLinkFacet -> Value
toJSON DeleteTypedLinkFacet' {Text
name :: Text
schemaArn :: Text
$sel:name:DeleteTypedLinkFacet' :: DeleteTypedLinkFacet -> Text
$sel:schemaArn:DeleteTypedLinkFacet' :: DeleteTypedLinkFacet -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"Name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)]
      )

instance Data.ToPath DeleteTypedLinkFacet where
  toPath :: DeleteTypedLinkFacet -> ByteString
toPath =
    forall a b. a -> b -> a
Prelude.const
      ByteString
"/amazonclouddirectory/2017-01-11/typedlink/facet/delete"

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

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

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

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

instance Prelude.NFData DeleteTypedLinkFacetResponse where
  rnf :: DeleteTypedLinkFacetResponse -> ()
rnf DeleteTypedLinkFacetResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteTypedLinkFacetResponse' :: DeleteTypedLinkFacetResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus