{-# 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.BackupGateway.ListHypervisors
(
ListHypervisors (..),
newListHypervisors,
listHypervisors_maxResults,
listHypervisors_nextToken,
ListHypervisorsResponse (..),
newListHypervisorsResponse,
listHypervisorsResponse_hypervisors,
listHypervisorsResponse_nextToken,
listHypervisorsResponse_httpStatus,
)
where
import Amazonka.BackupGateway.Types
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data ListHypervisors = ListHypervisors'
{
ListHypervisors -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListHypervisors -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListHypervisors -> ListHypervisors -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListHypervisors -> ListHypervisors -> Bool
$c/= :: ListHypervisors -> ListHypervisors -> Bool
== :: ListHypervisors -> ListHypervisors -> Bool
$c== :: ListHypervisors -> ListHypervisors -> Bool
Prelude.Eq, ReadPrec [ListHypervisors]
ReadPrec ListHypervisors
Int -> ReadS ListHypervisors
ReadS [ListHypervisors]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListHypervisors]
$creadListPrec :: ReadPrec [ListHypervisors]
readPrec :: ReadPrec ListHypervisors
$creadPrec :: ReadPrec ListHypervisors
readList :: ReadS [ListHypervisors]
$creadList :: ReadS [ListHypervisors]
readsPrec :: Int -> ReadS ListHypervisors
$creadsPrec :: Int -> ReadS ListHypervisors
Prelude.Read, Int -> ListHypervisors -> ShowS
[ListHypervisors] -> ShowS
ListHypervisors -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListHypervisors] -> ShowS
$cshowList :: [ListHypervisors] -> ShowS
show :: ListHypervisors -> String
$cshow :: ListHypervisors -> String
showsPrec :: Int -> ListHypervisors -> ShowS
$cshowsPrec :: Int -> ListHypervisors -> ShowS
Prelude.Show, forall x. Rep ListHypervisors x -> ListHypervisors
forall x. ListHypervisors -> Rep ListHypervisors x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListHypervisors x -> ListHypervisors
$cfrom :: forall x. ListHypervisors -> Rep ListHypervisors x
Prelude.Generic)
newListHypervisors ::
ListHypervisors
newListHypervisors :: ListHypervisors
newListHypervisors =
ListHypervisors'
{ $sel:maxResults:ListHypervisors' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListHypervisors' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listHypervisors_maxResults :: Lens.Lens' ListHypervisors (Prelude.Maybe Prelude.Natural)
listHypervisors_maxResults :: Lens' ListHypervisors (Maybe Natural)
listHypervisors_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHypervisors' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListHypervisors' :: ListHypervisors -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListHypervisors
s@ListHypervisors' {} Maybe Natural
a -> ListHypervisors
s {$sel:maxResults:ListHypervisors' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListHypervisors)
listHypervisors_nextToken :: Lens.Lens' ListHypervisors (Prelude.Maybe Prelude.Text)
listHypervisors_nextToken :: Lens' ListHypervisors (Maybe Text)
listHypervisors_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHypervisors' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListHypervisors' :: ListHypervisors -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListHypervisors
s@ListHypervisors' {} Maybe Text
a -> ListHypervisors
s {$sel:nextToken:ListHypervisors' :: Maybe Text
nextToken = Maybe Text
a} :: ListHypervisors)
instance Core.AWSPager ListHypervisors where
page :: ListHypervisors
-> AWSResponse ListHypervisors -> Maybe ListHypervisors
page ListHypervisors
rq AWSResponse ListHypervisors
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListHypervisors
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListHypervisorsResponse (Maybe Text)
listHypervisorsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListHypervisors
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListHypervisorsResponse (Maybe [Hypervisor])
listHypervisorsResponse_hypervisors
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
) =
forall a. Maybe a
Prelude.Nothing
| Bool
Prelude.otherwise =
forall a. a -> Maybe a
Prelude.Just
forall a b. (a -> b) -> a -> b
Prelude.$ ListHypervisors
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListHypervisors (Maybe Text)
listHypervisors_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListHypervisors
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListHypervisorsResponse (Maybe Text)
listHypervisorsResponse_nextToken
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall a b. Prism (Maybe a) (Maybe b) a b
Lens._Just
instance Core.AWSRequest ListHypervisors where
type
AWSResponse ListHypervisors =
ListHypervisorsResponse
request :: (Service -> Service) -> ListHypervisors -> Request ListHypervisors
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ListHypervisors
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListHypervisors)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
( \Int
s ResponseHeaders
h Object
x ->
Maybe [Hypervisor] -> Maybe Text -> Int -> ListHypervisorsResponse
ListHypervisorsResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Hypervisors" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"NextToken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListHypervisors where
hashWithSalt :: Int -> ListHypervisors -> Int
hashWithSalt Int
_salt ListHypervisors' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListHypervisors' :: ListHypervisors -> Maybe Text
$sel:maxResults:ListHypervisors' :: ListHypervisors -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
instance Prelude.NFData ListHypervisors where
rnf :: ListHypervisors -> ()
rnf ListHypervisors' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListHypervisors' :: ListHypervisors -> Maybe Text
$sel:maxResults:ListHypervisors' :: ListHypervisors -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
maxResults
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
instance Data.ToHeaders ListHypervisors where
toHeaders :: ListHypervisors -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"BackupOnPremises_v20210101.ListHypervisors" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON ListHypervisors where
toJSON :: ListHypervisors -> Value
toJSON ListHypervisors' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListHypervisors' :: ListHypervisors -> Maybe Text
$sel:maxResults:ListHypervisors' :: ListHypervisors -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"MaxResults" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults,
(Key
"NextToken" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken
]
)
instance Data.ToPath ListHypervisors where
toPath :: ListHypervisors -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListHypervisors where
toQuery :: ListHypervisors -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListHypervisorsResponse = ListHypervisorsResponse'
{
ListHypervisorsResponse -> Maybe [Hypervisor]
hypervisors :: Prelude.Maybe [Hypervisor],
ListHypervisorsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListHypervisorsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListHypervisorsResponse -> ListHypervisorsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListHypervisorsResponse -> ListHypervisorsResponse -> Bool
$c/= :: ListHypervisorsResponse -> ListHypervisorsResponse -> Bool
== :: ListHypervisorsResponse -> ListHypervisorsResponse -> Bool
$c== :: ListHypervisorsResponse -> ListHypervisorsResponse -> Bool
Prelude.Eq, ReadPrec [ListHypervisorsResponse]
ReadPrec ListHypervisorsResponse
Int -> ReadS ListHypervisorsResponse
ReadS [ListHypervisorsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListHypervisorsResponse]
$creadListPrec :: ReadPrec [ListHypervisorsResponse]
readPrec :: ReadPrec ListHypervisorsResponse
$creadPrec :: ReadPrec ListHypervisorsResponse
readList :: ReadS [ListHypervisorsResponse]
$creadList :: ReadS [ListHypervisorsResponse]
readsPrec :: Int -> ReadS ListHypervisorsResponse
$creadsPrec :: Int -> ReadS ListHypervisorsResponse
Prelude.Read, Int -> ListHypervisorsResponse -> ShowS
[ListHypervisorsResponse] -> ShowS
ListHypervisorsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListHypervisorsResponse] -> ShowS
$cshowList :: [ListHypervisorsResponse] -> ShowS
show :: ListHypervisorsResponse -> String
$cshow :: ListHypervisorsResponse -> String
showsPrec :: Int -> ListHypervisorsResponse -> ShowS
$cshowsPrec :: Int -> ListHypervisorsResponse -> ShowS
Prelude.Show, forall x. Rep ListHypervisorsResponse x -> ListHypervisorsResponse
forall x. ListHypervisorsResponse -> Rep ListHypervisorsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListHypervisorsResponse x -> ListHypervisorsResponse
$cfrom :: forall x. ListHypervisorsResponse -> Rep ListHypervisorsResponse x
Prelude.Generic)
newListHypervisorsResponse ::
Prelude.Int ->
ListHypervisorsResponse
newListHypervisorsResponse :: Int -> ListHypervisorsResponse
newListHypervisorsResponse Int
pHttpStatus_ =
ListHypervisorsResponse'
{ $sel:hypervisors:ListHypervisorsResponse' :: Maybe [Hypervisor]
hypervisors =
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListHypervisorsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListHypervisorsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listHypervisorsResponse_hypervisors :: Lens.Lens' ListHypervisorsResponse (Prelude.Maybe [Hypervisor])
listHypervisorsResponse_hypervisors :: Lens' ListHypervisorsResponse (Maybe [Hypervisor])
listHypervisorsResponse_hypervisors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHypervisorsResponse' {Maybe [Hypervisor]
hypervisors :: Maybe [Hypervisor]
$sel:hypervisors:ListHypervisorsResponse' :: ListHypervisorsResponse -> Maybe [Hypervisor]
hypervisors} -> Maybe [Hypervisor]
hypervisors) (\s :: ListHypervisorsResponse
s@ListHypervisorsResponse' {} Maybe [Hypervisor]
a -> ListHypervisorsResponse
s {$sel:hypervisors:ListHypervisorsResponse' :: Maybe [Hypervisor]
hypervisors = Maybe [Hypervisor]
a} :: ListHypervisorsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
listHypervisorsResponse_nextToken :: Lens.Lens' ListHypervisorsResponse (Prelude.Maybe Prelude.Text)
listHypervisorsResponse_nextToken :: Lens' ListHypervisorsResponse (Maybe Text)
listHypervisorsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHypervisorsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListHypervisorsResponse' :: ListHypervisorsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListHypervisorsResponse
s@ListHypervisorsResponse' {} Maybe Text
a -> ListHypervisorsResponse
s {$sel:nextToken:ListHypervisorsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListHypervisorsResponse)
listHypervisorsResponse_httpStatus :: Lens.Lens' ListHypervisorsResponse Prelude.Int
listHypervisorsResponse_httpStatus :: Lens' ListHypervisorsResponse Int
listHypervisorsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHypervisorsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListHypervisorsResponse' :: ListHypervisorsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListHypervisorsResponse
s@ListHypervisorsResponse' {} Int
a -> ListHypervisorsResponse
s {$sel:httpStatus:ListHypervisorsResponse' :: Int
httpStatus = Int
a} :: ListHypervisorsResponse)
instance Prelude.NFData ListHypervisorsResponse where
rnf :: ListHypervisorsResponse -> ()
rnf ListHypervisorsResponse' {Int
Maybe [Hypervisor]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
hypervisors :: Maybe [Hypervisor]
$sel:httpStatus:ListHypervisorsResponse' :: ListHypervisorsResponse -> Int
$sel:nextToken:ListHypervisorsResponse' :: ListHypervisorsResponse -> Maybe Text
$sel:hypervisors:ListHypervisorsResponse' :: ListHypervisorsResponse -> Maybe [Hypervisor]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Hypervisor]
hypervisors
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
nextToken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus