{-# 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.ListVirtualMachines
(
ListVirtualMachines (..),
newListVirtualMachines,
listVirtualMachines_hypervisorArn,
listVirtualMachines_maxResults,
listVirtualMachines_nextToken,
ListVirtualMachinesResponse (..),
newListVirtualMachinesResponse,
listVirtualMachinesResponse_nextToken,
listVirtualMachinesResponse_virtualMachines,
listVirtualMachinesResponse_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 ListVirtualMachines = ListVirtualMachines'
{
ListVirtualMachines -> Maybe Text
hypervisorArn :: Prelude.Maybe Prelude.Text,
ListVirtualMachines -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListVirtualMachines -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListVirtualMachines -> ListVirtualMachines -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListVirtualMachines -> ListVirtualMachines -> Bool
$c/= :: ListVirtualMachines -> ListVirtualMachines -> Bool
== :: ListVirtualMachines -> ListVirtualMachines -> Bool
$c== :: ListVirtualMachines -> ListVirtualMachines -> Bool
Prelude.Eq, ReadPrec [ListVirtualMachines]
ReadPrec ListVirtualMachines
Int -> ReadS ListVirtualMachines
ReadS [ListVirtualMachines]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListVirtualMachines]
$creadListPrec :: ReadPrec [ListVirtualMachines]
readPrec :: ReadPrec ListVirtualMachines
$creadPrec :: ReadPrec ListVirtualMachines
readList :: ReadS [ListVirtualMachines]
$creadList :: ReadS [ListVirtualMachines]
readsPrec :: Int -> ReadS ListVirtualMachines
$creadsPrec :: Int -> ReadS ListVirtualMachines
Prelude.Read, Int -> ListVirtualMachines -> ShowS
[ListVirtualMachines] -> ShowS
ListVirtualMachines -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListVirtualMachines] -> ShowS
$cshowList :: [ListVirtualMachines] -> ShowS
show :: ListVirtualMachines -> String
$cshow :: ListVirtualMachines -> String
showsPrec :: Int -> ListVirtualMachines -> ShowS
$cshowsPrec :: Int -> ListVirtualMachines -> ShowS
Prelude.Show, forall x. Rep ListVirtualMachines x -> ListVirtualMachines
forall x. ListVirtualMachines -> Rep ListVirtualMachines x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListVirtualMachines x -> ListVirtualMachines
$cfrom :: forall x. ListVirtualMachines -> Rep ListVirtualMachines x
Prelude.Generic)
newListVirtualMachines ::
ListVirtualMachines
newListVirtualMachines :: ListVirtualMachines
newListVirtualMachines =
ListVirtualMachines'
{ $sel:hypervisorArn:ListVirtualMachines' :: Maybe Text
hypervisorArn =
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListVirtualMachines' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListVirtualMachines' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listVirtualMachines_hypervisorArn :: Lens.Lens' ListVirtualMachines (Prelude.Maybe Prelude.Text)
listVirtualMachines_hypervisorArn :: Lens' ListVirtualMachines (Maybe Text)
listVirtualMachines_hypervisorArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVirtualMachines' {Maybe Text
hypervisorArn :: Maybe Text
$sel:hypervisorArn:ListVirtualMachines' :: ListVirtualMachines -> Maybe Text
hypervisorArn} -> Maybe Text
hypervisorArn) (\s :: ListVirtualMachines
s@ListVirtualMachines' {} Maybe Text
a -> ListVirtualMachines
s {$sel:hypervisorArn:ListVirtualMachines' :: Maybe Text
hypervisorArn = Maybe Text
a} :: ListVirtualMachines)
listVirtualMachines_maxResults :: Lens.Lens' ListVirtualMachines (Prelude.Maybe Prelude.Natural)
listVirtualMachines_maxResults :: Lens' ListVirtualMachines (Maybe Natural)
listVirtualMachines_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVirtualMachines' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListVirtualMachines' :: ListVirtualMachines -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListVirtualMachines
s@ListVirtualMachines' {} Maybe Natural
a -> ListVirtualMachines
s {$sel:maxResults:ListVirtualMachines' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListVirtualMachines)
listVirtualMachines_nextToken :: Lens.Lens' ListVirtualMachines (Prelude.Maybe Prelude.Text)
listVirtualMachines_nextToken :: Lens' ListVirtualMachines (Maybe Text)
listVirtualMachines_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVirtualMachines' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListVirtualMachines' :: ListVirtualMachines -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListVirtualMachines
s@ListVirtualMachines' {} Maybe Text
a -> ListVirtualMachines
s {$sel:nextToken:ListVirtualMachines' :: Maybe Text
nextToken = Maybe Text
a} :: ListVirtualMachines)
instance Core.AWSPager ListVirtualMachines where
page :: ListVirtualMachines
-> AWSResponse ListVirtualMachines -> Maybe ListVirtualMachines
page ListVirtualMachines
rq AWSResponse ListVirtualMachines
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse ListVirtualMachines
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListVirtualMachinesResponse (Maybe Text)
listVirtualMachinesResponse_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 ListVirtualMachines
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListVirtualMachinesResponse (Maybe [VirtualMachine])
listVirtualMachinesResponse_virtualMachines
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.$ ListVirtualMachines
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' ListVirtualMachines (Maybe Text)
listVirtualMachines_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse ListVirtualMachines
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' ListVirtualMachinesResponse (Maybe Text)
listVirtualMachinesResponse_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 ListVirtualMachines where
type
AWSResponse ListVirtualMachines =
ListVirtualMachinesResponse
request :: (Service -> Service)
-> ListVirtualMachines -> Request ListVirtualMachines
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 ListVirtualMachines
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse ListVirtualMachines)))
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 Text
-> Maybe [VirtualMachine] -> Int -> ListVirtualMachinesResponse
ListVirtualMachinesResponse'
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
"NextToken")
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
"VirtualMachines"
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.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable ListVirtualMachines where
hashWithSalt :: Int -> ListVirtualMachines -> Int
hashWithSalt Int
_salt ListVirtualMachines' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
hypervisorArn :: Maybe Text
$sel:nextToken:ListVirtualMachines' :: ListVirtualMachines -> Maybe Text
$sel:maxResults:ListVirtualMachines' :: ListVirtualMachines -> Maybe Natural
$sel:hypervisorArn:ListVirtualMachines' :: ListVirtualMachines -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
hypervisorArn
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 ListVirtualMachines where
rnf :: ListVirtualMachines -> ()
rnf ListVirtualMachines' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
hypervisorArn :: Maybe Text
$sel:nextToken:ListVirtualMachines' :: ListVirtualMachines -> Maybe Text
$sel:maxResults:ListVirtualMachines' :: ListVirtualMachines -> Maybe Natural
$sel:hypervisorArn:ListVirtualMachines' :: ListVirtualMachines -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
hypervisorArn
seq :: forall a b. a -> b -> b
`Prelude.seq` 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 ListVirtualMachines where
toHeaders :: ListVirtualMachines -> 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.ListVirtualMachines" ::
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 ListVirtualMachines where
toJSON :: ListVirtualMachines -> Value
toJSON ListVirtualMachines' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
hypervisorArn :: Maybe Text
$sel:nextToken:ListVirtualMachines' :: ListVirtualMachines -> Maybe Text
$sel:maxResults:ListVirtualMachines' :: ListVirtualMachines -> Maybe Natural
$sel:hypervisorArn:ListVirtualMachines' :: ListVirtualMachines -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"HypervisorArn" 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
hypervisorArn,
(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 ListVirtualMachines where
toPath :: ListVirtualMachines -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListVirtualMachines where
toQuery :: ListVirtualMachines -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListVirtualMachinesResponse = ListVirtualMachinesResponse'
{
ListVirtualMachinesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListVirtualMachinesResponse -> Maybe [VirtualMachine]
virtualMachines :: Prelude.Maybe [VirtualMachine],
ListVirtualMachinesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListVirtualMachinesResponse -> ListVirtualMachinesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListVirtualMachinesResponse -> ListVirtualMachinesResponse -> Bool
$c/= :: ListVirtualMachinesResponse -> ListVirtualMachinesResponse -> Bool
== :: ListVirtualMachinesResponse -> ListVirtualMachinesResponse -> Bool
$c== :: ListVirtualMachinesResponse -> ListVirtualMachinesResponse -> Bool
Prelude.Eq, ReadPrec [ListVirtualMachinesResponse]
ReadPrec ListVirtualMachinesResponse
Int -> ReadS ListVirtualMachinesResponse
ReadS [ListVirtualMachinesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListVirtualMachinesResponse]
$creadListPrec :: ReadPrec [ListVirtualMachinesResponse]
readPrec :: ReadPrec ListVirtualMachinesResponse
$creadPrec :: ReadPrec ListVirtualMachinesResponse
readList :: ReadS [ListVirtualMachinesResponse]
$creadList :: ReadS [ListVirtualMachinesResponse]
readsPrec :: Int -> ReadS ListVirtualMachinesResponse
$creadsPrec :: Int -> ReadS ListVirtualMachinesResponse
Prelude.Read, Int -> ListVirtualMachinesResponse -> ShowS
[ListVirtualMachinesResponse] -> ShowS
ListVirtualMachinesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListVirtualMachinesResponse] -> ShowS
$cshowList :: [ListVirtualMachinesResponse] -> ShowS
show :: ListVirtualMachinesResponse -> String
$cshow :: ListVirtualMachinesResponse -> String
showsPrec :: Int -> ListVirtualMachinesResponse -> ShowS
$cshowsPrec :: Int -> ListVirtualMachinesResponse -> ShowS
Prelude.Show, forall x.
Rep ListVirtualMachinesResponse x -> ListVirtualMachinesResponse
forall x.
ListVirtualMachinesResponse -> Rep ListVirtualMachinesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ListVirtualMachinesResponse x -> ListVirtualMachinesResponse
$cfrom :: forall x.
ListVirtualMachinesResponse -> Rep ListVirtualMachinesResponse x
Prelude.Generic)
newListVirtualMachinesResponse ::
Prelude.Int ->
ListVirtualMachinesResponse
newListVirtualMachinesResponse :: Int -> ListVirtualMachinesResponse
newListVirtualMachinesResponse Int
pHttpStatus_ =
ListVirtualMachinesResponse'
{ $sel:nextToken:ListVirtualMachinesResponse' :: Maybe Text
nextToken =
forall a. Maybe a
Prelude.Nothing,
$sel:virtualMachines:ListVirtualMachinesResponse' :: Maybe [VirtualMachine]
virtualMachines = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListVirtualMachinesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listVirtualMachinesResponse_nextToken :: Lens.Lens' ListVirtualMachinesResponse (Prelude.Maybe Prelude.Text)
listVirtualMachinesResponse_nextToken :: Lens' ListVirtualMachinesResponse (Maybe Text)
listVirtualMachinesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVirtualMachinesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListVirtualMachinesResponse' :: ListVirtualMachinesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListVirtualMachinesResponse
s@ListVirtualMachinesResponse' {} Maybe Text
a -> ListVirtualMachinesResponse
s {$sel:nextToken:ListVirtualMachinesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListVirtualMachinesResponse)
listVirtualMachinesResponse_virtualMachines :: Lens.Lens' ListVirtualMachinesResponse (Prelude.Maybe [VirtualMachine])
listVirtualMachinesResponse_virtualMachines :: Lens' ListVirtualMachinesResponse (Maybe [VirtualMachine])
listVirtualMachinesResponse_virtualMachines = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVirtualMachinesResponse' {Maybe [VirtualMachine]
virtualMachines :: Maybe [VirtualMachine]
$sel:virtualMachines:ListVirtualMachinesResponse' :: ListVirtualMachinesResponse -> Maybe [VirtualMachine]
virtualMachines} -> Maybe [VirtualMachine]
virtualMachines) (\s :: ListVirtualMachinesResponse
s@ListVirtualMachinesResponse' {} Maybe [VirtualMachine]
a -> ListVirtualMachinesResponse
s {$sel:virtualMachines:ListVirtualMachinesResponse' :: Maybe [VirtualMachine]
virtualMachines = Maybe [VirtualMachine]
a} :: ListVirtualMachinesResponse) 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
listVirtualMachinesResponse_httpStatus :: Lens.Lens' ListVirtualMachinesResponse Prelude.Int
listVirtualMachinesResponse_httpStatus :: Lens' ListVirtualMachinesResponse Int
listVirtualMachinesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListVirtualMachinesResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListVirtualMachinesResponse' :: ListVirtualMachinesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListVirtualMachinesResponse
s@ListVirtualMachinesResponse' {} Int
a -> ListVirtualMachinesResponse
s {$sel:httpStatus:ListVirtualMachinesResponse' :: Int
httpStatus = Int
a} :: ListVirtualMachinesResponse)
instance Prelude.NFData ListVirtualMachinesResponse where
rnf :: ListVirtualMachinesResponse -> ()
rnf ListVirtualMachinesResponse' {Int
Maybe [VirtualMachine]
Maybe Text
httpStatus :: Int
virtualMachines :: Maybe [VirtualMachine]
nextToken :: Maybe Text
$sel:httpStatus:ListVirtualMachinesResponse' :: ListVirtualMachinesResponse -> Int
$sel:virtualMachines:ListVirtualMachinesResponse' :: ListVirtualMachinesResponse -> Maybe [VirtualMachine]
$sel:nextToken:ListVirtualMachinesResponse' :: ListVirtualMachinesResponse -> Maybe Text
..} =
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 Maybe [VirtualMachine]
virtualMachines
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus