{-# 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.RebuildWorkspaces
(
RebuildWorkspaces (..),
newRebuildWorkspaces,
rebuildWorkspaces_rebuildWorkspaceRequests,
RebuildWorkspacesResponse (..),
newRebuildWorkspacesResponse,
rebuildWorkspacesResponse_failedRequests,
rebuildWorkspacesResponse_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 RebuildWorkspaces = RebuildWorkspaces'
{
RebuildWorkspaces -> NonEmpty RebuildRequest
rebuildWorkspaceRequests :: Prelude.NonEmpty RebuildRequest
}
deriving (RebuildWorkspaces -> RebuildWorkspaces -> Bool
(RebuildWorkspaces -> RebuildWorkspaces -> Bool)
-> (RebuildWorkspaces -> RebuildWorkspaces -> Bool)
-> Eq RebuildWorkspaces
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RebuildWorkspaces -> RebuildWorkspaces -> Bool
$c/= :: RebuildWorkspaces -> RebuildWorkspaces -> Bool
== :: RebuildWorkspaces -> RebuildWorkspaces -> Bool
$c== :: RebuildWorkspaces -> RebuildWorkspaces -> Bool
Prelude.Eq, ReadPrec [RebuildWorkspaces]
ReadPrec RebuildWorkspaces
Int -> ReadS RebuildWorkspaces
ReadS [RebuildWorkspaces]
(Int -> ReadS RebuildWorkspaces)
-> ReadS [RebuildWorkspaces]
-> ReadPrec RebuildWorkspaces
-> ReadPrec [RebuildWorkspaces]
-> Read RebuildWorkspaces
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RebuildWorkspaces]
$creadListPrec :: ReadPrec [RebuildWorkspaces]
readPrec :: ReadPrec RebuildWorkspaces
$creadPrec :: ReadPrec RebuildWorkspaces
readList :: ReadS [RebuildWorkspaces]
$creadList :: ReadS [RebuildWorkspaces]
readsPrec :: Int -> ReadS RebuildWorkspaces
$creadsPrec :: Int -> ReadS RebuildWorkspaces
Prelude.Read, Int -> RebuildWorkspaces -> ShowS
[RebuildWorkspaces] -> ShowS
RebuildWorkspaces -> String
(Int -> RebuildWorkspaces -> ShowS)
-> (RebuildWorkspaces -> String)
-> ([RebuildWorkspaces] -> ShowS)
-> Show RebuildWorkspaces
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RebuildWorkspaces] -> ShowS
$cshowList :: [RebuildWorkspaces] -> ShowS
show :: RebuildWorkspaces -> String
$cshow :: RebuildWorkspaces -> String
showsPrec :: Int -> RebuildWorkspaces -> ShowS
$cshowsPrec :: Int -> RebuildWorkspaces -> ShowS
Prelude.Show, (forall x. RebuildWorkspaces -> Rep RebuildWorkspaces x)
-> (forall x. Rep RebuildWorkspaces x -> RebuildWorkspaces)
-> Generic RebuildWorkspaces
forall x. Rep RebuildWorkspaces x -> RebuildWorkspaces
forall x. RebuildWorkspaces -> Rep RebuildWorkspaces x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RebuildWorkspaces x -> RebuildWorkspaces
$cfrom :: forall x. RebuildWorkspaces -> Rep RebuildWorkspaces x
Prelude.Generic)
newRebuildWorkspaces ::
Prelude.NonEmpty RebuildRequest ->
RebuildWorkspaces
newRebuildWorkspaces :: NonEmpty RebuildRequest -> RebuildWorkspaces
newRebuildWorkspaces NonEmpty RebuildRequest
pRebuildWorkspaceRequests_ =
RebuildWorkspaces' :: NonEmpty RebuildRequest -> RebuildWorkspaces
RebuildWorkspaces'
{ $sel:rebuildWorkspaceRequests:RebuildWorkspaces' :: NonEmpty RebuildRequest
rebuildWorkspaceRequests =
Tagged
(NonEmpty RebuildRequest) (Identity (NonEmpty RebuildRequest))
-> Tagged
(NonEmpty RebuildRequest) (Identity (NonEmpty RebuildRequest))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged
(NonEmpty RebuildRequest) (Identity (NonEmpty RebuildRequest))
-> Tagged
(NonEmpty RebuildRequest) (Identity (NonEmpty RebuildRequest)))
-> NonEmpty RebuildRequest -> NonEmpty RebuildRequest
forall t b. AReview t b -> b -> t
Lens.# NonEmpty RebuildRequest
pRebuildWorkspaceRequests_
}
rebuildWorkspaces_rebuildWorkspaceRequests :: Lens.Lens' RebuildWorkspaces (Prelude.NonEmpty RebuildRequest)
rebuildWorkspaces_rebuildWorkspaceRequests :: (NonEmpty RebuildRequest -> f (NonEmpty RebuildRequest))
-> RebuildWorkspaces -> f RebuildWorkspaces
rebuildWorkspaces_rebuildWorkspaceRequests = (RebuildWorkspaces -> NonEmpty RebuildRequest)
-> (RebuildWorkspaces
-> NonEmpty RebuildRequest -> RebuildWorkspaces)
-> Lens
RebuildWorkspaces
RebuildWorkspaces
(NonEmpty RebuildRequest)
(NonEmpty RebuildRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RebuildWorkspaces' {NonEmpty RebuildRequest
rebuildWorkspaceRequests :: NonEmpty RebuildRequest
$sel:rebuildWorkspaceRequests:RebuildWorkspaces' :: RebuildWorkspaces -> NonEmpty RebuildRequest
rebuildWorkspaceRequests} -> NonEmpty RebuildRequest
rebuildWorkspaceRequests) (\s :: RebuildWorkspaces
s@RebuildWorkspaces' {} NonEmpty RebuildRequest
a -> RebuildWorkspaces
s {$sel:rebuildWorkspaceRequests:RebuildWorkspaces' :: NonEmpty RebuildRequest
rebuildWorkspaceRequests = NonEmpty RebuildRequest
a} :: RebuildWorkspaces) ((NonEmpty RebuildRequest -> f (NonEmpty RebuildRequest))
-> RebuildWorkspaces -> f RebuildWorkspaces)
-> ((NonEmpty RebuildRequest -> f (NonEmpty RebuildRequest))
-> NonEmpty RebuildRequest -> f (NonEmpty RebuildRequest))
-> (NonEmpty RebuildRequest -> f (NonEmpty RebuildRequest))
-> RebuildWorkspaces
-> f RebuildWorkspaces
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty RebuildRequest -> f (NonEmpty RebuildRequest))
-> NonEmpty RebuildRequest -> f (NonEmpty RebuildRequest)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Core.AWSRequest RebuildWorkspaces where
type
AWSResponse RebuildWorkspaces =
RebuildWorkspacesResponse
request :: RebuildWorkspaces -> Request RebuildWorkspaces
request = Service -> RebuildWorkspaces -> Request RebuildWorkspaces
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RebuildWorkspaces
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RebuildWorkspaces)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse RebuildWorkspaces))
-> Logger
-> Service
-> Proxy RebuildWorkspaces
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse RebuildWorkspaces)))
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 -> RebuildWorkspacesResponse
RebuildWorkspacesResponse'
(Maybe [FailedWorkspaceChangeRequest]
-> Int -> RebuildWorkspacesResponse)
-> Either String (Maybe [FailedWorkspaceChangeRequest])
-> Either String (Int -> RebuildWorkspacesResponse)
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 -> RebuildWorkspacesResponse)
-> Either String Int -> Either String RebuildWorkspacesResponse
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 RebuildWorkspaces
instance Prelude.NFData RebuildWorkspaces
instance Core.ToHeaders RebuildWorkspaces where
toHeaders :: RebuildWorkspaces -> ResponseHeaders
toHeaders =
ResponseHeaders -> RebuildWorkspaces -> 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.RebuildWorkspaces" ::
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 RebuildWorkspaces where
toJSON :: RebuildWorkspaces -> Value
toJSON RebuildWorkspaces' {NonEmpty RebuildRequest
rebuildWorkspaceRequests :: NonEmpty RebuildRequest
$sel:rebuildWorkspaceRequests:RebuildWorkspaces' :: RebuildWorkspaces -> NonEmpty RebuildRequest
..} =
[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
"RebuildWorkspaceRequests"
Key -> NonEmpty RebuildRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Core..= NonEmpty RebuildRequest
rebuildWorkspaceRequests
)
]
)
instance Core.ToPath RebuildWorkspaces where
toPath :: RebuildWorkspaces -> ByteString
toPath = ByteString -> RebuildWorkspaces -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RebuildWorkspaces where
toQuery :: RebuildWorkspaces -> QueryString
toQuery = QueryString -> RebuildWorkspaces -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RebuildWorkspacesResponse = RebuildWorkspacesResponse'
{
RebuildWorkspacesResponse -> Maybe [FailedWorkspaceChangeRequest]
failedRequests :: Prelude.Maybe [FailedWorkspaceChangeRequest],
RebuildWorkspacesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RebuildWorkspacesResponse -> RebuildWorkspacesResponse -> Bool
(RebuildWorkspacesResponse -> RebuildWorkspacesResponse -> Bool)
-> (RebuildWorkspacesResponse -> RebuildWorkspacesResponse -> Bool)
-> Eq RebuildWorkspacesResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RebuildWorkspacesResponse -> RebuildWorkspacesResponse -> Bool
$c/= :: RebuildWorkspacesResponse -> RebuildWorkspacesResponse -> Bool
== :: RebuildWorkspacesResponse -> RebuildWorkspacesResponse -> Bool
$c== :: RebuildWorkspacesResponse -> RebuildWorkspacesResponse -> Bool
Prelude.Eq, ReadPrec [RebuildWorkspacesResponse]
ReadPrec RebuildWorkspacesResponse
Int -> ReadS RebuildWorkspacesResponse
ReadS [RebuildWorkspacesResponse]
(Int -> ReadS RebuildWorkspacesResponse)
-> ReadS [RebuildWorkspacesResponse]
-> ReadPrec RebuildWorkspacesResponse
-> ReadPrec [RebuildWorkspacesResponse]
-> Read RebuildWorkspacesResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RebuildWorkspacesResponse]
$creadListPrec :: ReadPrec [RebuildWorkspacesResponse]
readPrec :: ReadPrec RebuildWorkspacesResponse
$creadPrec :: ReadPrec RebuildWorkspacesResponse
readList :: ReadS [RebuildWorkspacesResponse]
$creadList :: ReadS [RebuildWorkspacesResponse]
readsPrec :: Int -> ReadS RebuildWorkspacesResponse
$creadsPrec :: Int -> ReadS RebuildWorkspacesResponse
Prelude.Read, Int -> RebuildWorkspacesResponse -> ShowS
[RebuildWorkspacesResponse] -> ShowS
RebuildWorkspacesResponse -> String
(Int -> RebuildWorkspacesResponse -> ShowS)
-> (RebuildWorkspacesResponse -> String)
-> ([RebuildWorkspacesResponse] -> ShowS)
-> Show RebuildWorkspacesResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RebuildWorkspacesResponse] -> ShowS
$cshowList :: [RebuildWorkspacesResponse] -> ShowS
show :: RebuildWorkspacesResponse -> String
$cshow :: RebuildWorkspacesResponse -> String
showsPrec :: Int -> RebuildWorkspacesResponse -> ShowS
$cshowsPrec :: Int -> RebuildWorkspacesResponse -> ShowS
Prelude.Show, (forall x.
RebuildWorkspacesResponse -> Rep RebuildWorkspacesResponse x)
-> (forall x.
Rep RebuildWorkspacesResponse x -> RebuildWorkspacesResponse)
-> Generic RebuildWorkspacesResponse
forall x.
Rep RebuildWorkspacesResponse x -> RebuildWorkspacesResponse
forall x.
RebuildWorkspacesResponse -> Rep RebuildWorkspacesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RebuildWorkspacesResponse x -> RebuildWorkspacesResponse
$cfrom :: forall x.
RebuildWorkspacesResponse -> Rep RebuildWorkspacesResponse x
Prelude.Generic)
newRebuildWorkspacesResponse ::
Prelude.Int ->
RebuildWorkspacesResponse
newRebuildWorkspacesResponse :: Int -> RebuildWorkspacesResponse
newRebuildWorkspacesResponse Int
pHttpStatus_ =
RebuildWorkspacesResponse' :: Maybe [FailedWorkspaceChangeRequest]
-> Int -> RebuildWorkspacesResponse
RebuildWorkspacesResponse'
{ $sel:failedRequests:RebuildWorkspacesResponse' :: Maybe [FailedWorkspaceChangeRequest]
failedRequests =
Maybe [FailedWorkspaceChangeRequest]
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:RebuildWorkspacesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
rebuildWorkspacesResponse_failedRequests :: Lens.Lens' RebuildWorkspacesResponse (Prelude.Maybe [FailedWorkspaceChangeRequest])
rebuildWorkspacesResponse_failedRequests :: (Maybe [FailedWorkspaceChangeRequest]
-> f (Maybe [FailedWorkspaceChangeRequest]))
-> RebuildWorkspacesResponse -> f RebuildWorkspacesResponse
rebuildWorkspacesResponse_failedRequests = (RebuildWorkspacesResponse -> Maybe [FailedWorkspaceChangeRequest])
-> (RebuildWorkspacesResponse
-> Maybe [FailedWorkspaceChangeRequest]
-> RebuildWorkspacesResponse)
-> Lens
RebuildWorkspacesResponse
RebuildWorkspacesResponse
(Maybe [FailedWorkspaceChangeRequest])
(Maybe [FailedWorkspaceChangeRequest])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RebuildWorkspacesResponse' {Maybe [FailedWorkspaceChangeRequest]
failedRequests :: Maybe [FailedWorkspaceChangeRequest]
$sel:failedRequests:RebuildWorkspacesResponse' :: RebuildWorkspacesResponse -> Maybe [FailedWorkspaceChangeRequest]
failedRequests} -> Maybe [FailedWorkspaceChangeRequest]
failedRequests) (\s :: RebuildWorkspacesResponse
s@RebuildWorkspacesResponse' {} Maybe [FailedWorkspaceChangeRequest]
a -> RebuildWorkspacesResponse
s {$sel:failedRequests:RebuildWorkspacesResponse' :: Maybe [FailedWorkspaceChangeRequest]
failedRequests = Maybe [FailedWorkspaceChangeRequest]
a} :: RebuildWorkspacesResponse) ((Maybe [FailedWorkspaceChangeRequest]
-> f (Maybe [FailedWorkspaceChangeRequest]))
-> RebuildWorkspacesResponse -> f RebuildWorkspacesResponse)
-> ((Maybe [FailedWorkspaceChangeRequest]
-> f (Maybe [FailedWorkspaceChangeRequest]))
-> Maybe [FailedWorkspaceChangeRequest]
-> f (Maybe [FailedWorkspaceChangeRequest]))
-> (Maybe [FailedWorkspaceChangeRequest]
-> f (Maybe [FailedWorkspaceChangeRequest]))
-> RebuildWorkspacesResponse
-> f RebuildWorkspacesResponse
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
rebuildWorkspacesResponse_httpStatus :: Lens.Lens' RebuildWorkspacesResponse Prelude.Int
rebuildWorkspacesResponse_httpStatus :: (Int -> f Int)
-> RebuildWorkspacesResponse -> f RebuildWorkspacesResponse
rebuildWorkspacesResponse_httpStatus = (RebuildWorkspacesResponse -> Int)
-> (RebuildWorkspacesResponse -> Int -> RebuildWorkspacesResponse)
-> Lens RebuildWorkspacesResponse RebuildWorkspacesResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RebuildWorkspacesResponse' {Int
httpStatus :: Int
$sel:httpStatus:RebuildWorkspacesResponse' :: RebuildWorkspacesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RebuildWorkspacesResponse
s@RebuildWorkspacesResponse' {} Int
a -> RebuildWorkspacesResponse
s {$sel:httpStatus:RebuildWorkspacesResponse' :: Int
httpStatus = Int
a} :: RebuildWorkspacesResponse)
instance Prelude.NFData RebuildWorkspacesResponse