{-# 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.WorkSpaces.TerminateWorkspaces
(
TerminateWorkspaces (..),
newTerminateWorkspaces,
terminateWorkspaces_terminateWorkspaceRequests,
TerminateWorkspacesResponse (..),
newTerminateWorkspacesResponse,
terminateWorkspacesResponse_failedRequests,
terminateWorkspacesResponse_httpStatus,
)
where
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
import Amazonka.WorkSpaces.Types
data TerminateWorkspaces = TerminateWorkspaces'
{
TerminateWorkspaces -> NonEmpty TerminateRequest
terminateWorkspaceRequests :: Prelude.NonEmpty TerminateRequest
}
deriving (TerminateWorkspaces -> TerminateWorkspaces -> Bool
(TerminateWorkspaces -> TerminateWorkspaces -> Bool)
-> (TerminateWorkspaces -> TerminateWorkspaces -> Bool)
-> Eq TerminateWorkspaces
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TerminateWorkspaces -> TerminateWorkspaces -> Bool
$c/= :: TerminateWorkspaces -> TerminateWorkspaces -> Bool
== :: TerminateWorkspaces -> TerminateWorkspaces -> Bool
$c== :: TerminateWorkspaces -> TerminateWorkspaces -> Bool
Prelude.Eq, ReadPrec [TerminateWorkspaces]
ReadPrec TerminateWorkspaces
Int -> ReadS TerminateWorkspaces
ReadS [TerminateWorkspaces]
(Int -> ReadS TerminateWorkspaces)
-> ReadS [TerminateWorkspaces]
-> ReadPrec TerminateWorkspaces
-> ReadPrec [TerminateWorkspaces]
-> Read TerminateWorkspaces
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TerminateWorkspaces]
$creadListPrec :: ReadPrec [TerminateWorkspaces]
readPrec :: ReadPrec TerminateWorkspaces
$creadPrec :: ReadPrec TerminateWorkspaces
readList :: ReadS [TerminateWorkspaces]
$creadList :: ReadS [TerminateWorkspaces]
readsPrec :: Int -> ReadS TerminateWorkspaces
$creadsPrec :: Int -> ReadS TerminateWorkspaces
Prelude.Read, Int -> TerminateWorkspaces -> ShowS
[TerminateWorkspaces] -> ShowS
TerminateWorkspaces -> String
(Int -> TerminateWorkspaces -> ShowS)
-> (TerminateWorkspaces -> String)
-> ([TerminateWorkspaces] -> ShowS)
-> Show TerminateWorkspaces
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TerminateWorkspaces] -> ShowS
$cshowList :: [TerminateWorkspaces] -> ShowS
show :: TerminateWorkspaces -> String
$cshow :: TerminateWorkspaces -> String
showsPrec :: Int -> TerminateWorkspaces -> ShowS
$cshowsPrec :: Int -> TerminateWorkspaces -> ShowS
Prelude.Show, (forall x. TerminateWorkspaces -> Rep TerminateWorkspaces x)
-> (forall x. Rep TerminateWorkspaces x -> TerminateWorkspaces)
-> Generic TerminateWorkspaces
forall x. Rep TerminateWorkspaces x -> TerminateWorkspaces
forall x. TerminateWorkspaces -> Rep TerminateWorkspaces x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TerminateWorkspaces x -> TerminateWorkspaces
$cfrom :: forall x. TerminateWorkspaces -> Rep TerminateWorkspaces x
Prelude.Generic)
newTerminateWorkspaces ::
Prelude.NonEmpty TerminateRequest ->
TerminateWorkspaces
newTerminateWorkspaces :: NonEmpty TerminateRequest -> TerminateWorkspaces
newTerminateWorkspaces NonEmpty TerminateRequest
pTerminateWorkspaceRequests_ =
TerminateWorkspaces' :: NonEmpty TerminateRequest -> TerminateWorkspaces
TerminateWorkspaces'
{ $sel:terminateWorkspaceRequests:TerminateWorkspaces' :: NonEmpty TerminateRequest
terminateWorkspaceRequests =
Tagged
(NonEmpty TerminateRequest) (Identity (NonEmpty TerminateRequest))
-> Tagged
(NonEmpty TerminateRequest) (Identity (NonEmpty TerminateRequest))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty TerminateRequest) (Identity (NonEmpty TerminateRequest))
-> Tagged
(NonEmpty TerminateRequest) (Identity (NonEmpty TerminateRequest)))
-> NonEmpty TerminateRequest -> NonEmpty TerminateRequest
forall t b. AReview t b -> b -> t
Lens.# NonEmpty TerminateRequest
pTerminateWorkspaceRequests_
}
terminateWorkspaces_terminateWorkspaceRequests :: Lens.Lens' TerminateWorkspaces (Prelude.NonEmpty TerminateRequest)
terminateWorkspaces_terminateWorkspaceRequests :: (NonEmpty TerminateRequest -> f (NonEmpty TerminateRequest))
-> TerminateWorkspaces -> f TerminateWorkspaces
terminateWorkspaces_terminateWorkspaceRequests = (TerminateWorkspaces -> NonEmpty TerminateRequest)
-> (TerminateWorkspaces
-> NonEmpty TerminateRequest -> TerminateWorkspaces)
-> Lens
TerminateWorkspaces
TerminateWorkspaces
(NonEmpty TerminateRequest)
(NonEmpty TerminateRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TerminateWorkspaces' {NonEmpty TerminateRequest
terminateWorkspaceRequests :: NonEmpty TerminateRequest
$sel:terminateWorkspaceRequests:TerminateWorkspaces' :: TerminateWorkspaces -> NonEmpty TerminateRequest
terminateWorkspaceRequests} -> NonEmpty TerminateRequest
terminateWorkspaceRequests) (\s :: TerminateWorkspaces
s@TerminateWorkspaces' {} NonEmpty TerminateRequest
a -> TerminateWorkspaces
s {$sel:terminateWorkspaceRequests:TerminateWorkspaces' :: NonEmpty TerminateRequest
terminateWorkspaceRequests = NonEmpty TerminateRequest
a} :: TerminateWorkspaces) ((NonEmpty TerminateRequest -> f (NonEmpty TerminateRequest))
-> TerminateWorkspaces -> f TerminateWorkspaces)
-> ((NonEmpty TerminateRequest -> f (NonEmpty TerminateRequest))
-> NonEmpty TerminateRequest -> f (NonEmpty TerminateRequest))
-> (NonEmpty TerminateRequest -> f (NonEmpty TerminateRequest))
-> TerminateWorkspaces
-> f TerminateWorkspaces
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty TerminateRequest -> f (NonEmpty TerminateRequest))
-> NonEmpty TerminateRequest -> f (NonEmpty TerminateRequest)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest TerminateWorkspaces where
type
AWSResponse TerminateWorkspaces =
TerminateWorkspacesResponse
request :: TerminateWorkspaces -> Request TerminateWorkspaces
request = Service -> TerminateWorkspaces -> Request TerminateWorkspaces
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy TerminateWorkspaces
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse TerminateWorkspaces)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse TerminateWorkspaces))
-> Logger
-> Service
-> Proxy TerminateWorkspaces
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse TerminateWorkspaces)))
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 [FailedWorkspaceChangeRequest]
-> Int -> TerminateWorkspacesResponse
TerminateWorkspacesResponse'
(Maybe [FailedWorkspaceChangeRequest]
-> Int -> TerminateWorkspacesResponse)
-> Either String (Maybe [FailedWorkspaceChangeRequest])
-> Either String (Int -> TerminateWorkspacesResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object
-> Key
-> Either String (Maybe (Maybe [FailedWorkspaceChangeRequest]))
forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Core..?> Key
"FailedRequests" Either String (Maybe (Maybe [FailedWorkspaceChangeRequest]))
-> Maybe [FailedWorkspaceChangeRequest]
-> Either String (Maybe [FailedWorkspaceChangeRequest])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [FailedWorkspaceChangeRequest]
forall a. Monoid a => a
Prelude.mempty)
Either String (Int -> TerminateWorkspacesResponse)
-> Either String Int -> Either String TerminateWorkspacesResponse
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 TerminateWorkspaces
instance Prelude.NFData TerminateWorkspaces
instance Core.ToHeaders TerminateWorkspaces where
toHeaders :: TerminateWorkspaces -> ResponseHeaders
toHeaders =
ResponseHeaders -> TerminateWorkspaces -> 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
"WorkspacesService.TerminateWorkspaces" ::
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 TerminateWorkspaces where
toJSON :: TerminateWorkspaces -> Value
toJSON TerminateWorkspaces' {NonEmpty TerminateRequest
terminateWorkspaceRequests :: NonEmpty TerminateRequest
$sel:terminateWorkspaceRequests:TerminateWorkspaces' :: TerminateWorkspaces -> NonEmpty TerminateRequest
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
( Key
"TerminateWorkspaceRequests"
Key -> NonEmpty TerminateRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..= NonEmpty TerminateRequest
terminateWorkspaceRequests
)
]
)
instance Core.ToPath TerminateWorkspaces where
toPath :: TerminateWorkspaces -> ByteString
toPath = ByteString -> TerminateWorkspaces -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery TerminateWorkspaces where
toQuery :: TerminateWorkspaces -> QueryString
toQuery = QueryString -> TerminateWorkspaces -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data TerminateWorkspacesResponse = TerminateWorkspacesResponse'
{
TerminateWorkspacesResponse -> Maybe [FailedWorkspaceChangeRequest]
failedRequests :: Prelude.Maybe [FailedWorkspaceChangeRequest],
TerminateWorkspacesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (TerminateWorkspacesResponse -> TerminateWorkspacesResponse -> Bool
(TerminateWorkspacesResponse
-> TerminateWorkspacesResponse -> Bool)
-> (TerminateWorkspacesResponse
-> TerminateWorkspacesResponse -> Bool)
-> Eq TerminateWorkspacesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TerminateWorkspacesResponse -> TerminateWorkspacesResponse -> Bool
$c/= :: TerminateWorkspacesResponse -> TerminateWorkspacesResponse -> Bool
== :: TerminateWorkspacesResponse -> TerminateWorkspacesResponse -> Bool
$c== :: TerminateWorkspacesResponse -> TerminateWorkspacesResponse -> Bool
Prelude.Eq, ReadPrec [TerminateWorkspacesResponse]
ReadPrec TerminateWorkspacesResponse
Int -> ReadS TerminateWorkspacesResponse
ReadS [TerminateWorkspacesResponse]
(Int -> ReadS TerminateWorkspacesResponse)
-> ReadS [TerminateWorkspacesResponse]
-> ReadPrec TerminateWorkspacesResponse
-> ReadPrec [TerminateWorkspacesResponse]
-> Read TerminateWorkspacesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TerminateWorkspacesResponse]
$creadListPrec :: ReadPrec [TerminateWorkspacesResponse]
readPrec :: ReadPrec TerminateWorkspacesResponse
$creadPrec :: ReadPrec TerminateWorkspacesResponse
readList :: ReadS [TerminateWorkspacesResponse]
$creadList :: ReadS [TerminateWorkspacesResponse]
readsPrec :: Int -> ReadS TerminateWorkspacesResponse
$creadsPrec :: Int -> ReadS TerminateWorkspacesResponse
Prelude.Read, Int -> TerminateWorkspacesResponse -> ShowS
[TerminateWorkspacesResponse] -> ShowS
TerminateWorkspacesResponse -> String
(Int -> TerminateWorkspacesResponse -> ShowS)
-> (TerminateWorkspacesResponse -> String)
-> ([TerminateWorkspacesResponse] -> ShowS)
-> Show TerminateWorkspacesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TerminateWorkspacesResponse] -> ShowS
$cshowList :: [TerminateWorkspacesResponse] -> ShowS
show :: TerminateWorkspacesResponse -> String
$cshow :: TerminateWorkspacesResponse -> String
showsPrec :: Int -> TerminateWorkspacesResponse -> ShowS
$cshowsPrec :: Int -> TerminateWorkspacesResponse -> ShowS
Prelude.Show, (forall x.
TerminateWorkspacesResponse -> Rep TerminateWorkspacesResponse x)
-> (forall x.
Rep TerminateWorkspacesResponse x -> TerminateWorkspacesResponse)
-> Generic TerminateWorkspacesResponse
forall x.
Rep TerminateWorkspacesResponse x -> TerminateWorkspacesResponse
forall x.
TerminateWorkspacesResponse -> Rep TerminateWorkspacesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep TerminateWorkspacesResponse x -> TerminateWorkspacesResponse
$cfrom :: forall x.
TerminateWorkspacesResponse -> Rep TerminateWorkspacesResponse x
Prelude.Generic)
newTerminateWorkspacesResponse ::
Prelude.Int ->
TerminateWorkspacesResponse
newTerminateWorkspacesResponse :: Int -> TerminateWorkspacesResponse
newTerminateWorkspacesResponse Int
pHttpStatus_ =
TerminateWorkspacesResponse' :: Maybe [FailedWorkspaceChangeRequest]
-> Int -> TerminateWorkspacesResponse
TerminateWorkspacesResponse'
{ $sel:failedRequests:TerminateWorkspacesResponse' :: Maybe [FailedWorkspaceChangeRequest]
failedRequests =
Maybe [FailedWorkspaceChangeRequest]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:TerminateWorkspacesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
terminateWorkspacesResponse_failedRequests :: Lens.Lens' TerminateWorkspacesResponse (Prelude.Maybe [FailedWorkspaceChangeRequest])
terminateWorkspacesResponse_failedRequests :: (Maybe [FailedWorkspaceChangeRequest]
-> f (Maybe [FailedWorkspaceChangeRequest]))
-> TerminateWorkspacesResponse -> f TerminateWorkspacesResponse
terminateWorkspacesResponse_failedRequests = (TerminateWorkspacesResponse
-> Maybe [FailedWorkspaceChangeRequest])
-> (TerminateWorkspacesResponse
-> Maybe [FailedWorkspaceChangeRequest]
-> TerminateWorkspacesResponse)
-> Lens
TerminateWorkspacesResponse
TerminateWorkspacesResponse
(Maybe [FailedWorkspaceChangeRequest])
(Maybe [FailedWorkspaceChangeRequest])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TerminateWorkspacesResponse' {Maybe [FailedWorkspaceChangeRequest]
failedRequests :: Maybe [FailedWorkspaceChangeRequest]
$sel:failedRequests:TerminateWorkspacesResponse' :: TerminateWorkspacesResponse -> Maybe [FailedWorkspaceChangeRequest]
failedRequests} -> Maybe [FailedWorkspaceChangeRequest]
failedRequests) (\s :: TerminateWorkspacesResponse
s@TerminateWorkspacesResponse' {} Maybe [FailedWorkspaceChangeRequest]
a -> TerminateWorkspacesResponse
s {$sel:failedRequests:TerminateWorkspacesResponse' :: Maybe [FailedWorkspaceChangeRequest]
failedRequests = Maybe [FailedWorkspaceChangeRequest]
a} :: TerminateWorkspacesResponse) ((Maybe [FailedWorkspaceChangeRequest]
-> f (Maybe [FailedWorkspaceChangeRequest]))
-> TerminateWorkspacesResponse -> f TerminateWorkspacesResponse)
-> ((Maybe [FailedWorkspaceChangeRequest]
-> f (Maybe [FailedWorkspaceChangeRequest]))
-> Maybe [FailedWorkspaceChangeRequest]
-> f (Maybe [FailedWorkspaceChangeRequest]))
-> (Maybe [FailedWorkspaceChangeRequest]
-> f (Maybe [FailedWorkspaceChangeRequest]))
-> TerminateWorkspacesResponse
-> f TerminateWorkspacesResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
[FailedWorkspaceChangeRequest]
[FailedWorkspaceChangeRequest]
[FailedWorkspaceChangeRequest]
[FailedWorkspaceChangeRequest]
-> Iso
(Maybe [FailedWorkspaceChangeRequest])
(Maybe [FailedWorkspaceChangeRequest])
(Maybe [FailedWorkspaceChangeRequest])
(Maybe [FailedWorkspaceChangeRequest])
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
[FailedWorkspaceChangeRequest]
[FailedWorkspaceChangeRequest]
[FailedWorkspaceChangeRequest]
[FailedWorkspaceChangeRequest]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
terminateWorkspacesResponse_httpStatus :: Lens.Lens' TerminateWorkspacesResponse Prelude.Int
terminateWorkspacesResponse_httpStatus :: (Int -> f Int)
-> TerminateWorkspacesResponse -> f TerminateWorkspacesResponse
terminateWorkspacesResponse_httpStatus = (TerminateWorkspacesResponse -> Int)
-> (TerminateWorkspacesResponse
-> Int -> TerminateWorkspacesResponse)
-> Lens
TerminateWorkspacesResponse TerminateWorkspacesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TerminateWorkspacesResponse' {Int
httpStatus :: Int
$sel:httpStatus:TerminateWorkspacesResponse' :: TerminateWorkspacesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: TerminateWorkspacesResponse
s@TerminateWorkspacesResponse' {} Int
a -> TerminateWorkspacesResponse
s {$sel:httpStatus:TerminateWorkspacesResponse' :: Int
httpStatus = Int
a} :: TerminateWorkspacesResponse)
instance Prelude.NFData TerminateWorkspacesResponse