{-# 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.NetworkManager.GetDevices
(
GetDevices (..),
newGetDevices,
getDevices_deviceIds,
getDevices_maxResults,
getDevices_nextToken,
getDevices_siteId,
getDevices_globalNetworkId,
GetDevicesResponse (..),
newGetDevicesResponse,
getDevicesResponse_devices,
getDevicesResponse_nextToken,
getDevicesResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.NetworkManager.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data GetDevices = GetDevices'
{
GetDevices -> Maybe [Text]
deviceIds :: Prelude.Maybe [Prelude.Text],
GetDevices -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
GetDevices -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetDevices -> Maybe Text
siteId :: Prelude.Maybe Prelude.Text,
GetDevices -> Text
globalNetworkId :: Prelude.Text
}
deriving (GetDevices -> GetDevices -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDevices -> GetDevices -> Bool
$c/= :: GetDevices -> GetDevices -> Bool
== :: GetDevices -> GetDevices -> Bool
$c== :: GetDevices -> GetDevices -> Bool
Prelude.Eq, ReadPrec [GetDevices]
ReadPrec GetDevices
Int -> ReadS GetDevices
ReadS [GetDevices]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetDevices]
$creadListPrec :: ReadPrec [GetDevices]
readPrec :: ReadPrec GetDevices
$creadPrec :: ReadPrec GetDevices
readList :: ReadS [GetDevices]
$creadList :: ReadS [GetDevices]
readsPrec :: Int -> ReadS GetDevices
$creadsPrec :: Int -> ReadS GetDevices
Prelude.Read, Int -> GetDevices -> ShowS
[GetDevices] -> ShowS
GetDevices -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDevices] -> ShowS
$cshowList :: [GetDevices] -> ShowS
show :: GetDevices -> String
$cshow :: GetDevices -> String
showsPrec :: Int -> GetDevices -> ShowS
$cshowsPrec :: Int -> GetDevices -> ShowS
Prelude.Show, forall x. Rep GetDevices x -> GetDevices
forall x. GetDevices -> Rep GetDevices x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDevices x -> GetDevices
$cfrom :: forall x. GetDevices -> Rep GetDevices x
Prelude.Generic)
newGetDevices ::
Prelude.Text ->
GetDevices
newGetDevices :: Text -> GetDevices
newGetDevices Text
pGlobalNetworkId_ =
GetDevices'
{ $sel:deviceIds:GetDevices' :: Maybe [Text]
deviceIds = forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:GetDevices' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetDevices' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:siteId:GetDevices' :: Maybe Text
siteId = forall a. Maybe a
Prelude.Nothing,
$sel:globalNetworkId:GetDevices' :: Text
globalNetworkId = Text
pGlobalNetworkId_
}
getDevices_deviceIds :: Lens.Lens' GetDevices (Prelude.Maybe [Prelude.Text])
getDevices_deviceIds :: Lens' GetDevices (Maybe [Text])
getDevices_deviceIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevices' {Maybe [Text]
deviceIds :: Maybe [Text]
$sel:deviceIds:GetDevices' :: GetDevices -> Maybe [Text]
deviceIds} -> Maybe [Text]
deviceIds) (\s :: GetDevices
s@GetDevices' {} Maybe [Text]
a -> GetDevices
s {$sel:deviceIds:GetDevices' :: Maybe [Text]
deviceIds = Maybe [Text]
a} :: GetDevices) 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
getDevices_maxResults :: Lens.Lens' GetDevices (Prelude.Maybe Prelude.Natural)
getDevices_maxResults :: Lens' GetDevices (Maybe Natural)
getDevices_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevices' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:GetDevices' :: GetDevices -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: GetDevices
s@GetDevices' {} Maybe Natural
a -> GetDevices
s {$sel:maxResults:GetDevices' :: Maybe Natural
maxResults = Maybe Natural
a} :: GetDevices)
getDevices_nextToken :: Lens.Lens' GetDevices (Prelude.Maybe Prelude.Text)
getDevices_nextToken :: Lens' GetDevices (Maybe Text)
getDevices_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevices' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetDevices' :: GetDevices -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetDevices
s@GetDevices' {} Maybe Text
a -> GetDevices
s {$sel:nextToken:GetDevices' :: Maybe Text
nextToken = Maybe Text
a} :: GetDevices)
getDevices_siteId :: Lens.Lens' GetDevices (Prelude.Maybe Prelude.Text)
getDevices_siteId :: Lens' GetDevices (Maybe Text)
getDevices_siteId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevices' {Maybe Text
siteId :: Maybe Text
$sel:siteId:GetDevices' :: GetDevices -> Maybe Text
siteId} -> Maybe Text
siteId) (\s :: GetDevices
s@GetDevices' {} Maybe Text
a -> GetDevices
s {$sel:siteId:GetDevices' :: Maybe Text
siteId = Maybe Text
a} :: GetDevices)
getDevices_globalNetworkId :: Lens.Lens' GetDevices Prelude.Text
getDevices_globalNetworkId :: Lens' GetDevices Text
getDevices_globalNetworkId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevices' {Text
globalNetworkId :: Text
$sel:globalNetworkId:GetDevices' :: GetDevices -> Text
globalNetworkId} -> Text
globalNetworkId) (\s :: GetDevices
s@GetDevices' {} Text
a -> GetDevices
s {$sel:globalNetworkId:GetDevices' :: Text
globalNetworkId = Text
a} :: GetDevices)
instance Core.AWSPager GetDevices where
page :: GetDevices -> AWSResponse GetDevices -> Maybe GetDevices
page GetDevices
rq AWSResponse GetDevices
rs
| forall a. AWSTruncated a => a -> Bool
Core.stop
( AWSResponse GetDevices
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetDevicesResponse (Maybe Text)
getDevicesResponse_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 GetDevices
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetDevicesResponse (Maybe [Device])
getDevicesResponse_devices
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.$ GetDevices
rq
forall a b. a -> (a -> b) -> b
Prelude.& Lens' GetDevices (Maybe Text)
getDevices_nextToken
forall s t a b. ASetter s t a b -> b -> s -> t
Lens..~ AWSResponse GetDevices
rs
forall s a. s -> Getting (First a) s a -> Maybe a
Lens.^? Lens' GetDevicesResponse (Maybe Text)
getDevicesResponse_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 GetDevices where
type AWSResponse GetDevices = GetDevicesResponse
request :: (Service -> Service) -> GetDevices -> Request GetDevices
request Service -> Service
overrides =
forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetDevices
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetDevices)))
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 [Device] -> Maybe Text -> Int -> GetDevicesResponse
GetDevicesResponse'
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
"Devices" 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 GetDevices where
hashWithSalt :: Int -> GetDevices -> Int
hashWithSalt Int
_salt GetDevices' {Maybe Natural
Maybe [Text]
Maybe Text
Text
globalNetworkId :: Text
siteId :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
deviceIds :: Maybe [Text]
$sel:globalNetworkId:GetDevices' :: GetDevices -> Text
$sel:siteId:GetDevices' :: GetDevices -> Maybe Text
$sel:nextToken:GetDevices' :: GetDevices -> Maybe Text
$sel:maxResults:GetDevices' :: GetDevices -> Maybe Natural
$sel:deviceIds:GetDevices' :: GetDevices -> Maybe [Text]
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
deviceIds
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
maxResults
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
nextToken
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
siteId
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
globalNetworkId
instance Prelude.NFData GetDevices where
rnf :: GetDevices -> ()
rnf GetDevices' {Maybe Natural
Maybe [Text]
Maybe Text
Text
globalNetworkId :: Text
siteId :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
deviceIds :: Maybe [Text]
$sel:globalNetworkId:GetDevices' :: GetDevices -> Text
$sel:siteId:GetDevices' :: GetDevices -> Maybe Text
$sel:nextToken:GetDevices' :: GetDevices -> Maybe Text
$sel:maxResults:GetDevices' :: GetDevices -> Maybe Natural
$sel:deviceIds:GetDevices' :: GetDevices -> Maybe [Text]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
deviceIds
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
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
siteId
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
globalNetworkId
instance Data.ToHeaders GetDevices where
toHeaders :: GetDevices -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToPath GetDevices where
toPath :: GetDevices -> ByteString
toPath GetDevices' {Maybe Natural
Maybe [Text]
Maybe Text
Text
globalNetworkId :: Text
siteId :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
deviceIds :: Maybe [Text]
$sel:globalNetworkId:GetDevices' :: GetDevices -> Text
$sel:siteId:GetDevices' :: GetDevices -> Maybe Text
$sel:nextToken:GetDevices' :: GetDevices -> Maybe Text
$sel:maxResults:GetDevices' :: GetDevices -> Maybe Natural
$sel:deviceIds:GetDevices' :: GetDevices -> Maybe [Text]
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/global-networks/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
globalNetworkId,
ByteString
"/devices"
]
instance Data.ToQuery GetDevices where
toQuery :: GetDevices -> QueryString
toQuery GetDevices' {Maybe Natural
Maybe [Text]
Maybe Text
Text
globalNetworkId :: Text
siteId :: Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
deviceIds :: Maybe [Text]
$sel:globalNetworkId:GetDevices' :: GetDevices -> Text
$sel:siteId:GetDevices' :: GetDevices -> Maybe Text
$sel:nextToken:GetDevices' :: GetDevices -> Maybe Text
$sel:maxResults:GetDevices' :: GetDevices -> Maybe Natural
$sel:deviceIds:GetDevices' :: GetDevices -> Maybe [Text]
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"deviceIds"
forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a. ToQuery a => a -> QueryString
Data.toQuery
(forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"member" forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
deviceIds),
ByteString
"maxResults" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Natural
maxResults,
ByteString
"nextToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
nextToken,
ByteString
"siteId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
siteId
]
data GetDevicesResponse = GetDevicesResponse'
{
GetDevicesResponse -> Maybe [Device]
devices :: Prelude.Maybe [Device],
GetDevicesResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
GetDevicesResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetDevicesResponse -> GetDevicesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetDevicesResponse -> GetDevicesResponse -> Bool
$c/= :: GetDevicesResponse -> GetDevicesResponse -> Bool
== :: GetDevicesResponse -> GetDevicesResponse -> Bool
$c== :: GetDevicesResponse -> GetDevicesResponse -> Bool
Prelude.Eq, Int -> GetDevicesResponse -> ShowS
[GetDevicesResponse] -> ShowS
GetDevicesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetDevicesResponse] -> ShowS
$cshowList :: [GetDevicesResponse] -> ShowS
show :: GetDevicesResponse -> String
$cshow :: GetDevicesResponse -> String
showsPrec :: Int -> GetDevicesResponse -> ShowS
$cshowsPrec :: Int -> GetDevicesResponse -> ShowS
Prelude.Show, forall x. Rep GetDevicesResponse x -> GetDevicesResponse
forall x. GetDevicesResponse -> Rep GetDevicesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetDevicesResponse x -> GetDevicesResponse
$cfrom :: forall x. GetDevicesResponse -> Rep GetDevicesResponse x
Prelude.Generic)
newGetDevicesResponse ::
Prelude.Int ->
GetDevicesResponse
newGetDevicesResponse :: Int -> GetDevicesResponse
newGetDevicesResponse Int
pHttpStatus_ =
GetDevicesResponse'
{ $sel:devices:GetDevicesResponse' :: Maybe [Device]
devices = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:GetDevicesResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetDevicesResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getDevicesResponse_devices :: Lens.Lens' GetDevicesResponse (Prelude.Maybe [Device])
getDevicesResponse_devices :: Lens' GetDevicesResponse (Maybe [Device])
getDevicesResponse_devices = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevicesResponse' {Maybe [Device]
devices :: Maybe [Device]
$sel:devices:GetDevicesResponse' :: GetDevicesResponse -> Maybe [Device]
devices} -> Maybe [Device]
devices) (\s :: GetDevicesResponse
s@GetDevicesResponse' {} Maybe [Device]
a -> GetDevicesResponse
s {$sel:devices:GetDevicesResponse' :: Maybe [Device]
devices = Maybe [Device]
a} :: GetDevicesResponse) 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
getDevicesResponse_nextToken :: Lens.Lens' GetDevicesResponse (Prelude.Maybe Prelude.Text)
getDevicesResponse_nextToken :: Lens' GetDevicesResponse (Maybe Text)
getDevicesResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevicesResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:GetDevicesResponse' :: GetDevicesResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: GetDevicesResponse
s@GetDevicesResponse' {} Maybe Text
a -> GetDevicesResponse
s {$sel:nextToken:GetDevicesResponse' :: Maybe Text
nextToken = Maybe Text
a} :: GetDevicesResponse)
getDevicesResponse_httpStatus :: Lens.Lens' GetDevicesResponse Prelude.Int
getDevicesResponse_httpStatus :: Lens' GetDevicesResponse Int
getDevicesResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetDevicesResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetDevicesResponse' :: GetDevicesResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetDevicesResponse
s@GetDevicesResponse' {} Int
a -> GetDevicesResponse
s {$sel:httpStatus:GetDevicesResponse' :: Int
httpStatus = Int
a} :: GetDevicesResponse)
instance Prelude.NFData GetDevicesResponse where
rnf :: GetDevicesResponse -> ()
rnf GetDevicesResponse' {Int
Maybe [Device]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
devices :: Maybe [Device]
$sel:httpStatus:GetDevicesResponse' :: GetDevicesResponse -> Int
$sel:nextToken:GetDevicesResponse' :: GetDevicesResponse -> Maybe Text
$sel:devices:GetDevicesResponse' :: GetDevicesResponse -> Maybe [Device]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Device]
devices
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