{-# 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.CodeStarConnections.ListHosts
(
ListHosts (..),
newListHosts,
listHosts_maxResults,
listHosts_nextToken,
ListHostsResponse (..),
newListHostsResponse,
listHostsResponse_hosts,
listHostsResponse_nextToken,
listHostsResponse_httpStatus,
)
where
import Amazonka.CodeStarConnections.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 ListHosts = ListHosts'
{
ListHosts -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural,
ListHosts -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text
}
deriving (ListHosts -> ListHosts -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListHosts -> ListHosts -> Bool
$c/= :: ListHosts -> ListHosts -> Bool
== :: ListHosts -> ListHosts -> Bool
$c== :: ListHosts -> ListHosts -> Bool
Prelude.Eq, ReadPrec [ListHosts]
ReadPrec ListHosts
Int -> ReadS ListHosts
ReadS [ListHosts]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListHosts]
$creadListPrec :: ReadPrec [ListHosts]
readPrec :: ReadPrec ListHosts
$creadPrec :: ReadPrec ListHosts
readList :: ReadS [ListHosts]
$creadList :: ReadS [ListHosts]
readsPrec :: Int -> ReadS ListHosts
$creadsPrec :: Int -> ReadS ListHosts
Prelude.Read, Int -> ListHosts -> ShowS
[ListHosts] -> ShowS
ListHosts -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListHosts] -> ShowS
$cshowList :: [ListHosts] -> ShowS
show :: ListHosts -> String
$cshow :: ListHosts -> String
showsPrec :: Int -> ListHosts -> ShowS
$cshowsPrec :: Int -> ListHosts -> ShowS
Prelude.Show, forall x. Rep ListHosts x -> ListHosts
forall x. ListHosts -> Rep ListHosts x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListHosts x -> ListHosts
$cfrom :: forall x. ListHosts -> Rep ListHosts x
Prelude.Generic)
newListHosts ::
ListHosts
newListHosts :: ListHosts
newListHosts =
ListHosts'
{ $sel:maxResults:ListHosts' :: Maybe Natural
maxResults = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListHosts' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing
}
listHosts_maxResults :: Lens.Lens' ListHosts (Prelude.Maybe Prelude.Natural)
listHosts_maxResults :: Lens' ListHosts (Maybe Natural)
listHosts_maxResults = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHosts' {Maybe Natural
maxResults :: Maybe Natural
$sel:maxResults:ListHosts' :: ListHosts -> Maybe Natural
maxResults} -> Maybe Natural
maxResults) (\s :: ListHosts
s@ListHosts' {} Maybe Natural
a -> ListHosts
s {$sel:maxResults:ListHosts' :: Maybe Natural
maxResults = Maybe Natural
a} :: ListHosts)
listHosts_nextToken :: Lens.Lens' ListHosts (Prelude.Maybe Prelude.Text)
listHosts_nextToken :: Lens' ListHosts (Maybe Text)
listHosts_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHosts' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListHosts' :: ListHosts -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListHosts
s@ListHosts' {} Maybe Text
a -> ListHosts
s {$sel:nextToken:ListHosts' :: Maybe Text
nextToken = Maybe Text
a} :: ListHosts)
instance Core.AWSRequest ListHosts where
type AWSResponse ListHosts = ListHostsResponse
request :: (Service -> Service) -> ListHosts -> Request ListHosts
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 ListHosts
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListHosts)))
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 [Host] -> Maybe Text -> Int -> ListHostsResponse
ListHostsResponse'
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
"Hosts" 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 ListHosts where
hashWithSalt :: Int -> ListHosts -> Int
hashWithSalt Int
_salt ListHosts' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListHosts' :: ListHosts -> Maybe Text
$sel:maxResults:ListHosts' :: ListHosts -> 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 ListHosts where
rnf :: ListHosts -> ()
rnf ListHosts' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListHosts' :: ListHosts -> Maybe Text
$sel:maxResults:ListHosts' :: ListHosts -> 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 ListHosts where
toHeaders :: ListHosts -> 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
"com.amazonaws.codestar.connections.CodeStar_connections_20191201.ListHosts" ::
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 ListHosts where
toJSON :: ListHosts -> Value
toJSON ListHosts' {Maybe Natural
Maybe Text
nextToken :: Maybe Text
maxResults :: Maybe Natural
$sel:nextToken:ListHosts' :: ListHosts -> Maybe Text
$sel:maxResults:ListHosts' :: ListHosts -> 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 ListHosts where
toPath :: ListHosts -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery ListHosts where
toQuery :: ListHosts -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data ListHostsResponse = ListHostsResponse'
{
ListHostsResponse -> Maybe [Host]
hosts :: Prelude.Maybe [Host],
ListHostsResponse -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListHostsResponse -> Int
httpStatus :: Prelude.Int
}
deriving (ListHostsResponse -> ListHostsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ListHostsResponse -> ListHostsResponse -> Bool
$c/= :: ListHostsResponse -> ListHostsResponse -> Bool
== :: ListHostsResponse -> ListHostsResponse -> Bool
$c== :: ListHostsResponse -> ListHostsResponse -> Bool
Prelude.Eq, ReadPrec [ListHostsResponse]
ReadPrec ListHostsResponse
Int -> ReadS ListHostsResponse
ReadS [ListHostsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ListHostsResponse]
$creadListPrec :: ReadPrec [ListHostsResponse]
readPrec :: ReadPrec ListHostsResponse
$creadPrec :: ReadPrec ListHostsResponse
readList :: ReadS [ListHostsResponse]
$creadList :: ReadS [ListHostsResponse]
readsPrec :: Int -> ReadS ListHostsResponse
$creadsPrec :: Int -> ReadS ListHostsResponse
Prelude.Read, Int -> ListHostsResponse -> ShowS
[ListHostsResponse] -> ShowS
ListHostsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ListHostsResponse] -> ShowS
$cshowList :: [ListHostsResponse] -> ShowS
show :: ListHostsResponse -> String
$cshow :: ListHostsResponse -> String
showsPrec :: Int -> ListHostsResponse -> ShowS
$cshowsPrec :: Int -> ListHostsResponse -> ShowS
Prelude.Show, forall x. Rep ListHostsResponse x -> ListHostsResponse
forall x. ListHostsResponse -> Rep ListHostsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ListHostsResponse x -> ListHostsResponse
$cfrom :: forall x. ListHostsResponse -> Rep ListHostsResponse x
Prelude.Generic)
newListHostsResponse ::
Prelude.Int ->
ListHostsResponse
newListHostsResponse :: Int -> ListHostsResponse
newListHostsResponse Int
pHttpStatus_ =
ListHostsResponse'
{ $sel:hosts:ListHostsResponse' :: Maybe [Host]
hosts = forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListHostsResponse' :: Maybe Text
nextToken = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListHostsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listHostsResponse_hosts :: Lens.Lens' ListHostsResponse (Prelude.Maybe [Host])
listHostsResponse_hosts :: Lens' ListHostsResponse (Maybe [Host])
listHostsResponse_hosts = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHostsResponse' {Maybe [Host]
hosts :: Maybe [Host]
$sel:hosts:ListHostsResponse' :: ListHostsResponse -> Maybe [Host]
hosts} -> Maybe [Host]
hosts) (\s :: ListHostsResponse
s@ListHostsResponse' {} Maybe [Host]
a -> ListHostsResponse
s {$sel:hosts:ListHostsResponse' :: Maybe [Host]
hosts = Maybe [Host]
a} :: ListHostsResponse) 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
listHostsResponse_nextToken :: Lens.Lens' ListHostsResponse (Prelude.Maybe Prelude.Text)
listHostsResponse_nextToken :: Lens' ListHostsResponse (Maybe Text)
listHostsResponse_nextToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHostsResponse' {Maybe Text
nextToken :: Maybe Text
$sel:nextToken:ListHostsResponse' :: ListHostsResponse -> Maybe Text
nextToken} -> Maybe Text
nextToken) (\s :: ListHostsResponse
s@ListHostsResponse' {} Maybe Text
a -> ListHostsResponse
s {$sel:nextToken:ListHostsResponse' :: Maybe Text
nextToken = Maybe Text
a} :: ListHostsResponse)
listHostsResponse_httpStatus :: Lens.Lens' ListHostsResponse Prelude.Int
listHostsResponse_httpStatus :: Lens' ListHostsResponse Int
listHostsResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ListHostsResponse' {Int
httpStatus :: Int
$sel:httpStatus:ListHostsResponse' :: ListHostsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: ListHostsResponse
s@ListHostsResponse' {} Int
a -> ListHostsResponse
s {$sel:httpStatus:ListHostsResponse' :: Int
httpStatus = Int
a} :: ListHostsResponse)
instance Prelude.NFData ListHostsResponse where
rnf :: ListHostsResponse -> ()
rnf ListHostsResponse' {Int
Maybe [Host]
Maybe Text
httpStatus :: Int
nextToken :: Maybe Text
hosts :: Maybe [Host]
$sel:httpStatus:ListHostsResponse' :: ListHostsResponse -> Int
$sel:nextToken:ListHostsResponse' :: ListHostsResponse -> Maybe Text
$sel:hosts:ListHostsResponse' :: ListHostsResponse -> Maybe [Host]
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe [Host]
hosts
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