{-# 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 #-}
module Amazonka.ECS.DeleteService
(
DeleteService (..),
newDeleteService,
deleteService_cluster,
deleteService_force,
deleteService_service,
DeleteServiceResponse (..),
newDeleteServiceResponse,
deleteServiceResponse_service,
deleteServiceResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.ECS.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
data DeleteService = DeleteService'
{
DeleteService -> Maybe Text
cluster :: Prelude.Maybe Prelude.Text,
DeleteService -> Maybe Bool
force :: Prelude.Maybe Prelude.Bool,
DeleteService -> Text
service :: Prelude.Text
}
deriving (DeleteService -> DeleteService -> Bool
(DeleteService -> DeleteService -> Bool)
-> (DeleteService -> DeleteService -> Bool) -> Eq DeleteService
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteService -> DeleteService -> Bool
$c/= :: DeleteService -> DeleteService -> Bool
== :: DeleteService -> DeleteService -> Bool
$c== :: DeleteService -> DeleteService -> Bool
Prelude.Eq, ReadPrec [DeleteService]
ReadPrec DeleteService
Int -> ReadS DeleteService
ReadS [DeleteService]
(Int -> ReadS DeleteService)
-> ReadS [DeleteService]
-> ReadPrec DeleteService
-> ReadPrec [DeleteService]
-> Read DeleteService
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteService]
$creadListPrec :: ReadPrec [DeleteService]
readPrec :: ReadPrec DeleteService
$creadPrec :: ReadPrec DeleteService
readList :: ReadS [DeleteService]
$creadList :: ReadS [DeleteService]
readsPrec :: Int -> ReadS DeleteService
$creadsPrec :: Int -> ReadS DeleteService
Prelude.Read, Int -> DeleteService -> ShowS
[DeleteService] -> ShowS
DeleteService -> String
(Int -> DeleteService -> ShowS)
-> (DeleteService -> String)
-> ([DeleteService] -> ShowS)
-> Show DeleteService
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteService] -> ShowS
$cshowList :: [DeleteService] -> ShowS
show :: DeleteService -> String
$cshow :: DeleteService -> String
showsPrec :: Int -> DeleteService -> ShowS
$cshowsPrec :: Int -> DeleteService -> ShowS
Prelude.Show, (forall x. DeleteService -> Rep DeleteService x)
-> (forall x. Rep DeleteService x -> DeleteService)
-> Generic DeleteService
forall x. Rep DeleteService x -> DeleteService
forall x. DeleteService -> Rep DeleteService x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteService x -> DeleteService
$cfrom :: forall x. DeleteService -> Rep DeleteService x
Prelude.Generic)
newDeleteService ::
Prelude.Text ->
DeleteService
newDeleteService :: Text -> DeleteService
newDeleteService Text
pService_ =
DeleteService' :: Maybe Text -> Maybe Bool -> Text -> DeleteService
DeleteService'
{ $sel:cluster:DeleteService' :: Maybe Text
cluster = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:force:DeleteService' :: Maybe Bool
force = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:service:DeleteService' :: Text
service = Text
pService_
}
deleteService_cluster :: Lens.Lens' DeleteService (Prelude.Maybe Prelude.Text)
deleteService_cluster :: (Maybe Text -> f (Maybe Text)) -> DeleteService -> f DeleteService
deleteService_cluster = (DeleteService -> Maybe Text)
-> (DeleteService -> Maybe Text -> DeleteService)
-> Lens DeleteService DeleteService (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteService' {Maybe Text
cluster :: Maybe Text
$sel:cluster:DeleteService' :: DeleteService -> Maybe Text
cluster} -> Maybe Text
cluster) (\s :: DeleteService
s@DeleteService' {} Maybe Text
a -> DeleteService
s {$sel:cluster:DeleteService' :: Maybe Text
cluster = Maybe Text
a} :: DeleteService)
deleteService_force :: Lens.Lens' DeleteService (Prelude.Maybe Prelude.Bool)
deleteService_force :: (Maybe Bool -> f (Maybe Bool)) -> DeleteService -> f DeleteService
deleteService_force = (DeleteService -> Maybe Bool)
-> (DeleteService -> Maybe Bool -> DeleteService)
-> Lens DeleteService DeleteService (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteService' {Maybe Bool
force :: Maybe Bool
$sel:force:DeleteService' :: DeleteService -> Maybe Bool
force} -> Maybe Bool
force) (\s :: DeleteService
s@DeleteService' {} Maybe Bool
a -> DeleteService
s {$sel:force:DeleteService' :: Maybe Bool
force = Maybe Bool
a} :: DeleteService)
deleteService_service :: Lens.Lens' DeleteService Prelude.Text
deleteService_service :: (Text -> f Text) -> DeleteService -> f DeleteService
deleteService_service = (DeleteService -> Text)
-> (DeleteService -> Text -> DeleteService)
-> Lens DeleteService DeleteService Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteService' {Text
service :: Text
$sel:service:DeleteService' :: DeleteService -> Text
service} -> Text
service) (\s :: DeleteService
s@DeleteService' {} Text
a -> DeleteService
s {$sel:service:DeleteService' :: Text
service = Text
a} :: DeleteService)
instance Core.AWSRequest DeleteService where
type
AWSResponse DeleteService =
DeleteServiceResponse
request :: DeleteService -> Request DeleteService
request = Service -> DeleteService -> Request DeleteService
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy DeleteService
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteService)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse DeleteService))
-> Logger
-> Service
-> Proxy DeleteService
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse DeleteService)))
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 ->
Maybe ContainerService -> Int -> DeleteServiceResponse
DeleteServiceResponse'
(Maybe ContainerService -> Int -> DeleteServiceResponse)
-> Either String (Maybe ContainerService)
-> Either String (Int -> DeleteServiceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe ContainerService)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"service")
Either String (Int -> DeleteServiceResponse)
-> Either String Int -> Either String DeleteServiceResponse
forall (f :: * -> *) a b. Applicative f => 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 DeleteService
instance Prelude.NFData DeleteService
instance Core.ToHeaders DeleteService where
toHeaders :: DeleteService -> ResponseHeaders
toHeaders =
ResponseHeaders -> DeleteService -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AmazonEC2ContainerServiceV20141113.DeleteService" ::
Prelude.ByteString
),
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 DeleteService where
toJSON :: DeleteService -> Value
toJSON DeleteService' {Maybe Bool
Maybe Text
Text
service :: Text
force :: Maybe Bool
cluster :: Maybe Text
$sel:service:DeleteService' :: DeleteService -> Text
$sel:force:DeleteService' :: DeleteService -> Maybe Bool
$sel:cluster:DeleteService' :: DeleteService -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"cluster" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
cluster,
(Text
"force" 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
force,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"service" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
service)
]
)
instance Core.ToPath DeleteService where
toPath :: DeleteService -> ByteString
toPath = ByteString -> DeleteService -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery DeleteService where
toQuery :: DeleteService -> QueryString
toQuery = QueryString -> DeleteService -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data DeleteServiceResponse = DeleteServiceResponse'
{
DeleteServiceResponse -> Maybe ContainerService
service :: Prelude.Maybe ContainerService,
DeleteServiceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (DeleteServiceResponse -> DeleteServiceResponse -> Bool
(DeleteServiceResponse -> DeleteServiceResponse -> Bool)
-> (DeleteServiceResponse -> DeleteServiceResponse -> Bool)
-> Eq DeleteServiceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteServiceResponse -> DeleteServiceResponse -> Bool
$c/= :: DeleteServiceResponse -> DeleteServiceResponse -> Bool
== :: DeleteServiceResponse -> DeleteServiceResponse -> Bool
$c== :: DeleteServiceResponse -> DeleteServiceResponse -> Bool
Prelude.Eq, ReadPrec [DeleteServiceResponse]
ReadPrec DeleteServiceResponse
Int -> ReadS DeleteServiceResponse
ReadS [DeleteServiceResponse]
(Int -> ReadS DeleteServiceResponse)
-> ReadS [DeleteServiceResponse]
-> ReadPrec DeleteServiceResponse
-> ReadPrec [DeleteServiceResponse]
-> Read DeleteServiceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteServiceResponse]
$creadListPrec :: ReadPrec [DeleteServiceResponse]
readPrec :: ReadPrec DeleteServiceResponse
$creadPrec :: ReadPrec DeleteServiceResponse
readList :: ReadS [DeleteServiceResponse]
$creadList :: ReadS [DeleteServiceResponse]
readsPrec :: Int -> ReadS DeleteServiceResponse
$creadsPrec :: Int -> ReadS DeleteServiceResponse
Prelude.Read, Int -> DeleteServiceResponse -> ShowS
[DeleteServiceResponse] -> ShowS
DeleteServiceResponse -> String
(Int -> DeleteServiceResponse -> ShowS)
-> (DeleteServiceResponse -> String)
-> ([DeleteServiceResponse] -> ShowS)
-> Show DeleteServiceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteServiceResponse] -> ShowS
$cshowList :: [DeleteServiceResponse] -> ShowS
show :: DeleteServiceResponse -> String
$cshow :: DeleteServiceResponse -> String
showsPrec :: Int -> DeleteServiceResponse -> ShowS
$cshowsPrec :: Int -> DeleteServiceResponse -> ShowS
Prelude.Show, (forall x. DeleteServiceResponse -> Rep DeleteServiceResponse x)
-> (forall x. Rep DeleteServiceResponse x -> DeleteServiceResponse)
-> Generic DeleteServiceResponse
forall x. Rep DeleteServiceResponse x -> DeleteServiceResponse
forall x. DeleteServiceResponse -> Rep DeleteServiceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteServiceResponse x -> DeleteServiceResponse
$cfrom :: forall x. DeleteServiceResponse -> Rep DeleteServiceResponse x
Prelude.Generic)
newDeleteServiceResponse ::
Prelude.Int ->
DeleteServiceResponse
newDeleteServiceResponse :: Int -> DeleteServiceResponse
newDeleteServiceResponse Int
pHttpStatus_ =
DeleteServiceResponse' :: Maybe ContainerService -> Int -> DeleteServiceResponse
DeleteServiceResponse'
{ $sel:service:DeleteServiceResponse' :: Maybe ContainerService
service = Maybe ContainerService
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:DeleteServiceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
deleteServiceResponse_service :: Lens.Lens' DeleteServiceResponse (Prelude.Maybe ContainerService)
deleteServiceResponse_service :: (Maybe ContainerService -> f (Maybe ContainerService))
-> DeleteServiceResponse -> f DeleteServiceResponse
deleteServiceResponse_service = (DeleteServiceResponse -> Maybe ContainerService)
-> (DeleteServiceResponse
-> Maybe ContainerService -> DeleteServiceResponse)
-> Lens
DeleteServiceResponse
DeleteServiceResponse
(Maybe ContainerService)
(Maybe ContainerService)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteServiceResponse' {Maybe ContainerService
service :: Maybe ContainerService
$sel:service:DeleteServiceResponse' :: DeleteServiceResponse -> Maybe ContainerService
service} -> Maybe ContainerService
service) (\s :: DeleteServiceResponse
s@DeleteServiceResponse' {} Maybe ContainerService
a -> DeleteServiceResponse
s {$sel:service:DeleteServiceResponse' :: Maybe ContainerService
service = Maybe ContainerService
a} :: DeleteServiceResponse)
deleteServiceResponse_httpStatus :: Lens.Lens' DeleteServiceResponse Prelude.Int
deleteServiceResponse_httpStatus :: (Int -> f Int) -> DeleteServiceResponse -> f DeleteServiceResponse
deleteServiceResponse_httpStatus = (DeleteServiceResponse -> Int)
-> (DeleteServiceResponse -> Int -> DeleteServiceResponse)
-> Lens DeleteServiceResponse DeleteServiceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteServiceResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteServiceResponse' :: DeleteServiceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: DeleteServiceResponse
s@DeleteServiceResponse' {} Int
a -> DeleteServiceResponse
s {$sel:httpStatus:DeleteServiceResponse' :: Int
httpStatus = Int
a} :: DeleteServiceResponse)
instance Prelude.NFData DeleteServiceResponse