{-# 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.AppFlow.DeleteConnectorProfile
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Enables you to delete an existing connector profile.
module Amazonka.AppFlow.DeleteConnectorProfile
  ( -- * Creating a Request
    DeleteConnectorProfile (..),
    newDeleteConnectorProfile,

    -- * Request Lenses
    deleteConnectorProfile_forceDelete,
    deleteConnectorProfile_connectorProfileName,

    -- * Destructuring the Response
    DeleteConnectorProfileResponse (..),
    newDeleteConnectorProfileResponse,

    -- * Response Lenses
    deleteConnectorProfileResponse_httpStatus,
  )
where

import Amazonka.AppFlow.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:/ 'newDeleteConnectorProfile' smart constructor.
data DeleteConnectorProfile = DeleteConnectorProfile'
  { -- | Indicates whether Amazon AppFlow should delete the profile, even if it
    -- is currently in use in one or more flows.
    DeleteConnectorProfile -> Maybe Bool
forceDelete :: Prelude.Maybe Prelude.Bool,
    -- | The name of the connector profile. The name is unique for each
    -- @ConnectorProfile@ in your account.
    DeleteConnectorProfile -> Text
connectorProfileName :: Prelude.Text
  }
  deriving (DeleteConnectorProfile -> DeleteConnectorProfile -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteConnectorProfile -> DeleteConnectorProfile -> Bool
$c/= :: DeleteConnectorProfile -> DeleteConnectorProfile -> Bool
== :: DeleteConnectorProfile -> DeleteConnectorProfile -> Bool
$c== :: DeleteConnectorProfile -> DeleteConnectorProfile -> Bool
Prelude.Eq, ReadPrec [DeleteConnectorProfile]
ReadPrec DeleteConnectorProfile
Int -> ReadS DeleteConnectorProfile
ReadS [DeleteConnectorProfile]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteConnectorProfile]
$creadListPrec :: ReadPrec [DeleteConnectorProfile]
readPrec :: ReadPrec DeleteConnectorProfile
$creadPrec :: ReadPrec DeleteConnectorProfile
readList :: ReadS [DeleteConnectorProfile]
$creadList :: ReadS [DeleteConnectorProfile]
readsPrec :: Int -> ReadS DeleteConnectorProfile
$creadsPrec :: Int -> ReadS DeleteConnectorProfile
Prelude.Read, Int -> DeleteConnectorProfile -> ShowS
[DeleteConnectorProfile] -> ShowS
DeleteConnectorProfile -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteConnectorProfile] -> ShowS
$cshowList :: [DeleteConnectorProfile] -> ShowS
show :: DeleteConnectorProfile -> String
$cshow :: DeleteConnectorProfile -> String
showsPrec :: Int -> DeleteConnectorProfile -> ShowS
$cshowsPrec :: Int -> DeleteConnectorProfile -> ShowS
Prelude.Show, forall x. Rep DeleteConnectorProfile x -> DeleteConnectorProfile
forall x. DeleteConnectorProfile -> Rep DeleteConnectorProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteConnectorProfile x -> DeleteConnectorProfile
$cfrom :: forall x. DeleteConnectorProfile -> Rep DeleteConnectorProfile x
Prelude.Generic)

-- |
-- Create a value of 'DeleteConnectorProfile' 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:
--
-- 'forceDelete', 'deleteConnectorProfile_forceDelete' - Indicates whether Amazon AppFlow should delete the profile, even if it
-- is currently in use in one or more flows.
--
-- 'connectorProfileName', 'deleteConnectorProfile_connectorProfileName' - The name of the connector profile. The name is unique for each
-- @ConnectorProfile@ in your account.
newDeleteConnectorProfile ::
  -- | 'connectorProfileName'
  Prelude.Text ->
  DeleteConnectorProfile
newDeleteConnectorProfile :: Text -> DeleteConnectorProfile
newDeleteConnectorProfile Text
pConnectorProfileName_ =
  DeleteConnectorProfile'
    { $sel:forceDelete:DeleteConnectorProfile' :: Maybe Bool
forceDelete =
        forall a. Maybe a
Prelude.Nothing,
      $sel:connectorProfileName:DeleteConnectorProfile' :: Text
connectorProfileName = Text
pConnectorProfileName_
    }

-- | Indicates whether Amazon AppFlow should delete the profile, even if it
-- is currently in use in one or more flows.
deleteConnectorProfile_forceDelete :: Lens.Lens' DeleteConnectorProfile (Prelude.Maybe Prelude.Bool)
deleteConnectorProfile_forceDelete :: Lens' DeleteConnectorProfile (Maybe Bool)
deleteConnectorProfile_forceDelete = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteConnectorProfile' {Maybe Bool
forceDelete :: Maybe Bool
$sel:forceDelete:DeleteConnectorProfile' :: DeleteConnectorProfile -> Maybe Bool
forceDelete} -> Maybe Bool
forceDelete) (\s :: DeleteConnectorProfile
s@DeleteConnectorProfile' {} Maybe Bool
a -> DeleteConnectorProfile
s {$sel:forceDelete:DeleteConnectorProfile' :: Maybe Bool
forceDelete = Maybe Bool
a} :: DeleteConnectorProfile)

-- | The name of the connector profile. The name is unique for each
-- @ConnectorProfile@ in your account.
deleteConnectorProfile_connectorProfileName :: Lens.Lens' DeleteConnectorProfile Prelude.Text
deleteConnectorProfile_connectorProfileName :: Lens' DeleteConnectorProfile Text
deleteConnectorProfile_connectorProfileName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteConnectorProfile' {Text
connectorProfileName :: Text
$sel:connectorProfileName:DeleteConnectorProfile' :: DeleteConnectorProfile -> Text
connectorProfileName} -> Text
connectorProfileName) (\s :: DeleteConnectorProfile
s@DeleteConnectorProfile' {} Text
a -> DeleteConnectorProfile
s {$sel:connectorProfileName:DeleteConnectorProfile' :: Text
connectorProfileName = Text
a} :: DeleteConnectorProfile)

instance Core.AWSRequest DeleteConnectorProfile where
  type
    AWSResponse DeleteConnectorProfile =
      DeleteConnectorProfileResponse
  request :: (Service -> Service)
-> DeleteConnectorProfile -> Request DeleteConnectorProfile
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteConnectorProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteConnectorProfile)))
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 -> DeleteConnectorProfileResponse
DeleteConnectorProfileResponse'
            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 DeleteConnectorProfile where
  hashWithSalt :: Int -> DeleteConnectorProfile -> Int
hashWithSalt Int
_salt DeleteConnectorProfile' {Maybe Bool
Text
connectorProfileName :: Text
forceDelete :: Maybe Bool
$sel:connectorProfileName:DeleteConnectorProfile' :: DeleteConnectorProfile -> Text
$sel:forceDelete:DeleteConnectorProfile' :: DeleteConnectorProfile -> Maybe Bool
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
forceDelete
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
connectorProfileName

instance Prelude.NFData DeleteConnectorProfile where
  rnf :: DeleteConnectorProfile -> ()
rnf DeleteConnectorProfile' {Maybe Bool
Text
connectorProfileName :: Text
forceDelete :: Maybe Bool
$sel:connectorProfileName:DeleteConnectorProfile' :: DeleteConnectorProfile -> Text
$sel:forceDelete:DeleteConnectorProfile' :: DeleteConnectorProfile -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
forceDelete
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
connectorProfileName

instance Data.ToHeaders DeleteConnectorProfile where
  toHeaders :: DeleteConnectorProfile -> 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.ToJSON DeleteConnectorProfile where
  toJSON :: DeleteConnectorProfile -> Value
toJSON DeleteConnectorProfile' {Maybe Bool
Text
connectorProfileName :: Text
forceDelete :: Maybe Bool
$sel:connectorProfileName:DeleteConnectorProfile' :: DeleteConnectorProfile -> Text
$sel:forceDelete:DeleteConnectorProfile' :: DeleteConnectorProfile -> Maybe Bool
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"forceDelete" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
forceDelete,
            forall a. a -> Maybe a
Prelude.Just
              ( Key
"connectorProfileName"
                  forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
connectorProfileName
              )
          ]
      )

instance Data.ToPath DeleteConnectorProfile where
  toPath :: DeleteConnectorProfile -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/delete-connector-profile"

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

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

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

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

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