{-# 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-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)
--
-- 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.Lens as Lens
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
(DeleteConnectorProfile -> DeleteConnectorProfile -> Bool)
-> (DeleteConnectorProfile -> DeleteConnectorProfile -> Bool)
-> Eq DeleteConnectorProfile
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]
(Int -> ReadS DeleteConnectorProfile)
-> ReadS [DeleteConnectorProfile]
-> ReadPrec DeleteConnectorProfile
-> ReadPrec [DeleteConnectorProfile]
-> Read 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
(Int -> DeleteConnectorProfile -> ShowS)
-> (DeleteConnectorProfile -> String)
-> ([DeleteConnectorProfile] -> ShowS)
-> Show DeleteConnectorProfile
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. DeleteConnectorProfile -> Rep DeleteConnectorProfile x)
-> (forall x.
    Rep DeleteConnectorProfile x -> DeleteConnectorProfile)
-> Generic DeleteConnectorProfile
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' :: Maybe Bool -> Text -> DeleteConnectorProfile
DeleteConnectorProfile'
    { $sel:forceDelete:DeleteConnectorProfile' :: Maybe Bool
forceDelete =
        Maybe Bool
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 :: (Maybe Bool -> f (Maybe Bool))
-> DeleteConnectorProfile -> f DeleteConnectorProfile
deleteConnectorProfile_forceDelete = (DeleteConnectorProfile -> Maybe Bool)
-> (DeleteConnectorProfile -> Maybe Bool -> DeleteConnectorProfile)
-> Lens
     DeleteConnectorProfile
     DeleteConnectorProfile
     (Maybe Bool)
     (Maybe Bool)
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 :: (Text -> f Text)
-> DeleteConnectorProfile -> f DeleteConnectorProfile
deleteConnectorProfile_connectorProfileName = (DeleteConnectorProfile -> Text)
-> (DeleteConnectorProfile -> Text -> DeleteConnectorProfile)
-> Lens DeleteConnectorProfile DeleteConnectorProfile Text Text
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 :: DeleteConnectorProfile -> Request DeleteConnectorProfile
request = Service -> DeleteConnectorProfile -> Request DeleteConnectorProfile
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteConnectorProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteConnectorProfile)))
response =
    (Int
 -> ResponseHeaders
 -> ()
 -> Either String (AWSResponse DeleteConnectorProfile))
-> Logger
-> Service
-> Proxy DeleteConnectorProfile
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteConnectorProfile)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteConnectorProfileResponse
DeleteConnectorProfileResponse'
            (Int -> DeleteConnectorProfileResponse)
-> Either String Int
-> Either String DeleteConnectorProfileResponse
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteConnectorProfile

instance Prelude.NFData DeleteConnectorProfile

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

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

instance Core.ToQuery DeleteConnectorProfile where
  toQuery :: DeleteConnectorProfile -> QueryString
toQuery = QueryString -> DeleteConnectorProfile -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteConnectorProfileResponse
 -> DeleteConnectorProfileResponse -> Bool)
-> (DeleteConnectorProfileResponse
    -> DeleteConnectorProfileResponse -> Bool)
-> Eq DeleteConnectorProfileResponse
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]
(Int -> ReadS DeleteConnectorProfileResponse)
-> ReadS [DeleteConnectorProfileResponse]
-> ReadPrec DeleteConnectorProfileResponse
-> ReadPrec [DeleteConnectorProfileResponse]
-> Read 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
(Int -> DeleteConnectorProfileResponse -> ShowS)
-> (DeleteConnectorProfileResponse -> String)
-> ([DeleteConnectorProfileResponse] -> ShowS)
-> Show DeleteConnectorProfileResponse
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.
 DeleteConnectorProfileResponse
 -> Rep DeleteConnectorProfileResponse x)
-> (forall x.
    Rep DeleteConnectorProfileResponse x
    -> DeleteConnectorProfileResponse)
-> Generic DeleteConnectorProfileResponse
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' :: Int -> DeleteConnectorProfileResponse
DeleteConnectorProfileResponse'
    { $sel:httpStatus:DeleteConnectorProfileResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

-- | The response's http status code.
deleteConnectorProfileResponse_httpStatus :: Lens.Lens' DeleteConnectorProfileResponse Prelude.Int
deleteConnectorProfileResponse_httpStatus :: (Int -> f Int)
-> DeleteConnectorProfileResponse
-> f DeleteConnectorProfileResponse
deleteConnectorProfileResponse_httpStatus = (DeleteConnectorProfileResponse -> Int)
-> (DeleteConnectorProfileResponse
    -> Int -> DeleteConnectorProfileResponse)
-> Lens
     DeleteConnectorProfileResponse
     DeleteConnectorProfileResponse
     Int
     Int
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