{-# 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.DeleteFlow -- 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 your application to delete an existing flow. Before deleting the -- flow, Amazon AppFlow validates the request by checking the flow -- configuration and status. You can delete flows one at a time. module Amazonka.AppFlow.DeleteFlow ( -- * Creating a Request DeleteFlow (..), newDeleteFlow, -- * Request Lenses deleteFlow_forceDelete, deleteFlow_flowName, -- * Destructuring the Response DeleteFlowResponse (..), newDeleteFlowResponse, -- * Response Lenses deleteFlowResponse_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:/ 'newDeleteFlow' smart constructor. data DeleteFlow = DeleteFlow' { -- | Indicates whether Amazon AppFlow should delete the flow, even if it is -- currently in use. DeleteFlow -> Maybe Bool forceDelete :: Prelude.Maybe Prelude.Bool, -- | The specified name of the flow. Spaces are not allowed. Use underscores -- (_) or hyphens (-) only. DeleteFlow -> Text flowName :: Prelude.Text } deriving (DeleteFlow -> DeleteFlow -> Bool (DeleteFlow -> DeleteFlow -> Bool) -> (DeleteFlow -> DeleteFlow -> Bool) -> Eq DeleteFlow forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: DeleteFlow -> DeleteFlow -> Bool $c/= :: DeleteFlow -> DeleteFlow -> Bool == :: DeleteFlow -> DeleteFlow -> Bool $c== :: DeleteFlow -> DeleteFlow -> Bool Prelude.Eq, ReadPrec [DeleteFlow] ReadPrec DeleteFlow Int -> ReadS DeleteFlow ReadS [DeleteFlow] (Int -> ReadS DeleteFlow) -> ReadS [DeleteFlow] -> ReadPrec DeleteFlow -> ReadPrec [DeleteFlow] -> Read DeleteFlow forall a. (Int -> ReadS a) -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a readListPrec :: ReadPrec [DeleteFlow] $creadListPrec :: ReadPrec [DeleteFlow] readPrec :: ReadPrec DeleteFlow $creadPrec :: ReadPrec DeleteFlow readList :: ReadS [DeleteFlow] $creadList :: ReadS [DeleteFlow] readsPrec :: Int -> ReadS DeleteFlow $creadsPrec :: Int -> ReadS DeleteFlow Prelude.Read, Int -> DeleteFlow -> ShowS [DeleteFlow] -> ShowS DeleteFlow -> String (Int -> DeleteFlow -> ShowS) -> (DeleteFlow -> String) -> ([DeleteFlow] -> ShowS) -> Show DeleteFlow forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [DeleteFlow] -> ShowS $cshowList :: [DeleteFlow] -> ShowS show :: DeleteFlow -> String $cshow :: DeleteFlow -> String showsPrec :: Int -> DeleteFlow -> ShowS $cshowsPrec :: Int -> DeleteFlow -> ShowS Prelude.Show, (forall x. DeleteFlow -> Rep DeleteFlow x) -> (forall x. Rep DeleteFlow x -> DeleteFlow) -> Generic DeleteFlow forall x. Rep DeleteFlow x -> DeleteFlow forall x. DeleteFlow -> Rep DeleteFlow x forall a. (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a $cto :: forall x. Rep DeleteFlow x -> DeleteFlow $cfrom :: forall x. DeleteFlow -> Rep DeleteFlow x Prelude.Generic) -- | -- Create a value of 'DeleteFlow' 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', 'deleteFlow_forceDelete' - Indicates whether Amazon AppFlow should delete the flow, even if it is -- currently in use. -- -- 'flowName', 'deleteFlow_flowName' - The specified name of the flow. Spaces are not allowed. Use underscores -- (_) or hyphens (-) only. newDeleteFlow :: -- | 'flowName' Prelude.Text -> DeleteFlow newDeleteFlow :: Text -> DeleteFlow newDeleteFlow Text pFlowName_ = DeleteFlow' :: Maybe Bool -> Text -> DeleteFlow DeleteFlow' { $sel:forceDelete:DeleteFlow' :: Maybe Bool forceDelete = Maybe Bool forall a. Maybe a Prelude.Nothing, $sel:flowName:DeleteFlow' :: Text flowName = Text pFlowName_ } -- | Indicates whether Amazon AppFlow should delete the flow, even if it is -- currently in use. deleteFlow_forceDelete :: Lens.Lens' DeleteFlow (Prelude.Maybe Prelude.Bool) deleteFlow_forceDelete :: (Maybe Bool -> f (Maybe Bool)) -> DeleteFlow -> f DeleteFlow deleteFlow_forceDelete = (DeleteFlow -> Maybe Bool) -> (DeleteFlow -> Maybe Bool -> DeleteFlow) -> Lens DeleteFlow DeleteFlow (Maybe Bool) (Maybe Bool) forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\DeleteFlow' {Maybe Bool forceDelete :: Maybe Bool $sel:forceDelete:DeleteFlow' :: DeleteFlow -> Maybe Bool forceDelete} -> Maybe Bool forceDelete) (\s :: DeleteFlow s@DeleteFlow' {} Maybe Bool a -> DeleteFlow s {$sel:forceDelete:DeleteFlow' :: Maybe Bool forceDelete = Maybe Bool a} :: DeleteFlow) -- | The specified name of the flow. Spaces are not allowed. Use underscores -- (_) or hyphens (-) only. deleteFlow_flowName :: Lens.Lens' DeleteFlow Prelude.Text deleteFlow_flowName :: (Text -> f Text) -> DeleteFlow -> f DeleteFlow deleteFlow_flowName = (DeleteFlow -> Text) -> (DeleteFlow -> Text -> DeleteFlow) -> Lens DeleteFlow DeleteFlow Text Text forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\DeleteFlow' {Text flowName :: Text $sel:flowName:DeleteFlow' :: DeleteFlow -> Text flowName} -> Text flowName) (\s :: DeleteFlow s@DeleteFlow' {} Text a -> DeleteFlow s {$sel:flowName:DeleteFlow' :: Text flowName = Text a} :: DeleteFlow) instance Core.AWSRequest DeleteFlow where type AWSResponse DeleteFlow = DeleteFlowResponse request :: DeleteFlow -> Request DeleteFlow request = Service -> DeleteFlow -> Request DeleteFlow forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a Request.postJSON Service defaultService response :: Logger -> Service -> Proxy DeleteFlow -> ClientResponse ClientBody -> m (Either Error (ClientResponse (AWSResponse DeleteFlow))) response = (Int -> ResponseHeaders -> () -> Either String (AWSResponse DeleteFlow)) -> Logger -> Service -> Proxy DeleteFlow -> ClientResponse ClientBody -> m (Either Error (ClientResponse (AWSResponse DeleteFlow))) 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 -> DeleteFlowResponse DeleteFlowResponse' (Int -> DeleteFlowResponse) -> Either String Int -> Either String DeleteFlowResponse 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 DeleteFlow instance Prelude.NFData DeleteFlow instance Core.ToHeaders DeleteFlow where toHeaders :: DeleteFlow -> ResponseHeaders toHeaders = ResponseHeaders -> DeleteFlow -> 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 DeleteFlow where toJSON :: DeleteFlow -> Value toJSON DeleteFlow' {Maybe Bool Text flowName :: Text forceDelete :: Maybe Bool $sel:flowName:DeleteFlow' :: DeleteFlow -> Text $sel:forceDelete:DeleteFlow' :: DeleteFlow -> 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 "flowName" Text -> Text -> Pair forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv Core..= Text flowName) ] ) instance Core.ToPath DeleteFlow where toPath :: DeleteFlow -> ByteString toPath = ByteString -> DeleteFlow -> ByteString forall a b. a -> b -> a Prelude.const ByteString "/delete-flow" instance Core.ToQuery DeleteFlow where toQuery :: DeleteFlow -> QueryString toQuery = QueryString -> DeleteFlow -> QueryString forall a b. a -> b -> a Prelude.const QueryString forall a. Monoid a => a Prelude.mempty -- | /See:/ 'newDeleteFlowResponse' smart constructor. data DeleteFlowResponse = DeleteFlowResponse' { -- | The response's http status code. DeleteFlowResponse -> Int httpStatus :: Prelude.Int } deriving (DeleteFlowResponse -> DeleteFlowResponse -> Bool (DeleteFlowResponse -> DeleteFlowResponse -> Bool) -> (DeleteFlowResponse -> DeleteFlowResponse -> Bool) -> Eq DeleteFlowResponse forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a /= :: DeleteFlowResponse -> DeleteFlowResponse -> Bool $c/= :: DeleteFlowResponse -> DeleteFlowResponse -> Bool == :: DeleteFlowResponse -> DeleteFlowResponse -> Bool $c== :: DeleteFlowResponse -> DeleteFlowResponse -> Bool Prelude.Eq, ReadPrec [DeleteFlowResponse] ReadPrec DeleteFlowResponse Int -> ReadS DeleteFlowResponse ReadS [DeleteFlowResponse] (Int -> ReadS DeleteFlowResponse) -> ReadS [DeleteFlowResponse] -> ReadPrec DeleteFlowResponse -> ReadPrec [DeleteFlowResponse] -> Read DeleteFlowResponse forall a. (Int -> ReadS a) -> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a readListPrec :: ReadPrec [DeleteFlowResponse] $creadListPrec :: ReadPrec [DeleteFlowResponse] readPrec :: ReadPrec DeleteFlowResponse $creadPrec :: ReadPrec DeleteFlowResponse readList :: ReadS [DeleteFlowResponse] $creadList :: ReadS [DeleteFlowResponse] readsPrec :: Int -> ReadS DeleteFlowResponse $creadsPrec :: Int -> ReadS DeleteFlowResponse Prelude.Read, Int -> DeleteFlowResponse -> ShowS [DeleteFlowResponse] -> ShowS DeleteFlowResponse -> String (Int -> DeleteFlowResponse -> ShowS) -> (DeleteFlowResponse -> String) -> ([DeleteFlowResponse] -> ShowS) -> Show DeleteFlowResponse forall a. (Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a showList :: [DeleteFlowResponse] -> ShowS $cshowList :: [DeleteFlowResponse] -> ShowS show :: DeleteFlowResponse -> String $cshow :: DeleteFlowResponse -> String showsPrec :: Int -> DeleteFlowResponse -> ShowS $cshowsPrec :: Int -> DeleteFlowResponse -> ShowS Prelude.Show, (forall x. DeleteFlowResponse -> Rep DeleteFlowResponse x) -> (forall x. Rep DeleteFlowResponse x -> DeleteFlowResponse) -> Generic DeleteFlowResponse forall x. Rep DeleteFlowResponse x -> DeleteFlowResponse forall x. DeleteFlowResponse -> Rep DeleteFlowResponse x forall a. (forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a $cto :: forall x. Rep DeleteFlowResponse x -> DeleteFlowResponse $cfrom :: forall x. DeleteFlowResponse -> Rep DeleteFlowResponse x Prelude.Generic) -- | -- Create a value of 'DeleteFlowResponse' 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', 'deleteFlowResponse_httpStatus' - The response's http status code. newDeleteFlowResponse :: -- | 'httpStatus' Prelude.Int -> DeleteFlowResponse newDeleteFlowResponse :: Int -> DeleteFlowResponse newDeleteFlowResponse Int pHttpStatus_ = DeleteFlowResponse' :: Int -> DeleteFlowResponse DeleteFlowResponse' {$sel:httpStatus:DeleteFlowResponse' :: Int httpStatus = Int pHttpStatus_} -- | The response's http status code. deleteFlowResponse_httpStatus :: Lens.Lens' DeleteFlowResponse Prelude.Int deleteFlowResponse_httpStatus :: (Int -> f Int) -> DeleteFlowResponse -> f DeleteFlowResponse deleteFlowResponse_httpStatus = (DeleteFlowResponse -> Int) -> (DeleteFlowResponse -> Int -> DeleteFlowResponse) -> Lens DeleteFlowResponse DeleteFlowResponse Int Int forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b Lens.lens (\DeleteFlowResponse' {Int httpStatus :: Int $sel:httpStatus:DeleteFlowResponse' :: DeleteFlowResponse -> Int httpStatus} -> Int httpStatus) (\s :: DeleteFlowResponse s@DeleteFlowResponse' {} Int a -> DeleteFlowResponse s {$sel:httpStatus:DeleteFlowResponse' :: Int httpStatus = Int a} :: DeleteFlowResponse) instance Prelude.NFData DeleteFlowResponse