{-# 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_nextToken,
listHosts_maxResults,
ListHostsResponse (..),
newListHostsResponse,
listHostsResponse_hosts,
listHostsResponse_nextToken,
listHostsResponse_httpStatus,
)
where
import Amazonka.CodeStarConnections.Types
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
data ListHosts = ListHosts'
{
ListHosts -> Maybe Text
nextToken :: Prelude.Maybe Prelude.Text,
ListHosts -> Maybe Natural
maxResults :: Prelude.Maybe Prelude.Natural
}
deriving (ListHosts -> ListHosts -> Bool
(ListHosts -> ListHosts -> Bool)
-> (ListHosts -> ListHosts -> Bool) -> Eq ListHosts
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]
(Int -> ReadS ListHosts)
-> ReadS [ListHosts]
-> ReadPrec ListHosts
-> ReadPrec [ListHosts]
-> Read 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
(Int -> ListHosts -> ShowS)
-> (ListHosts -> String)
-> ([ListHosts] -> ShowS)
-> Show ListHosts
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. ListHosts -> Rep ListHosts x)
-> (forall x. Rep ListHosts x -> ListHosts) -> Generic ListHosts
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' :: Maybe Text -> Maybe Natural -> ListHosts
ListHosts'
{ $sel:nextToken:ListHosts' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:maxResults:ListHosts' :: Maybe Natural
maxResults = Maybe Natural
forall a. Maybe a
Prelude.Nothing
}
listHosts_nextToken :: Lens.Lens' ListHosts (Prelude.Maybe Prelude.Text)
listHosts_nextToken :: (Maybe Text -> f (Maybe Text)) -> ListHosts -> f ListHosts
listHosts_nextToken = (ListHosts -> Maybe Text)
-> (ListHosts -> Maybe Text -> ListHosts)
-> Lens ListHosts ListHosts (Maybe Text) (Maybe Text)
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)
listHosts_maxResults :: Lens.Lens' ListHosts (Prelude.Maybe Prelude.Natural)
listHosts_maxResults :: (Maybe Natural -> f (Maybe Natural)) -> ListHosts -> f ListHosts
listHosts_maxResults = (ListHosts -> Maybe Natural)
-> (ListHosts -> Maybe Natural -> ListHosts)
-> Lens ListHosts ListHosts (Maybe Natural) (Maybe Natural)
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)
instance Core.AWSRequest ListHosts where
type AWSResponse ListHosts = ListHostsResponse
request :: ListHosts -> Request ListHosts
request = Service -> ListHosts -> Request ListHosts
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy ListHosts
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListHosts)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse ListHosts))
-> Logger
-> Service
-> Proxy ListHosts
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse ListHosts)))
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 [Host] -> Maybe Text -> Int -> ListHostsResponse
ListHostsResponse'
(Maybe [Host] -> Maybe Text -> Int -> ListHostsResponse)
-> Either String (Maybe [Host])
-> Either String (Maybe Text -> Int -> ListHostsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Host]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Hosts" Either String (Maybe (Maybe [Host]))
-> Maybe [Host] -> Either String (Maybe [Host])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Host]
forall a. Monoid a => a
Prelude.mempty)
Either String (Maybe Text -> Int -> ListHostsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> ListHostsResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"NextToken")
Either String (Int -> ListHostsResponse)
-> Either String Int -> Either String ListHostsResponse
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 ListHosts
instance Prelude.NFData ListHosts
instance Core.ToHeaders ListHosts where
toHeaders :: ListHosts -> ResponseHeaders
toHeaders =
ResponseHeaders -> ListHosts -> 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
"com.amazonaws.codestar.connections.CodeStar_connections_20191201.ListHosts" ::
Prelude.ByteString
),
HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON ListHosts where
toJSON :: ListHosts -> Value
toJSON ListHosts' {Maybe Natural
Maybe Text
maxResults :: Maybe Natural
nextToken :: Maybe Text
$sel:maxResults:ListHosts' :: ListHosts -> Maybe Natural
$sel:nextToken:ListHosts' :: ListHosts -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"NextToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
nextToken,
(Text
"MaxResults" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Natural -> Pair) -> Maybe Natural -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
maxResults
]
)
instance Core.ToPath ListHosts where
toPath :: ListHosts -> ByteString
toPath = ByteString -> ListHosts -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery ListHosts where
toQuery :: ListHosts -> QueryString
toQuery = QueryString -> ListHosts -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(ListHostsResponse -> ListHostsResponse -> Bool)
-> (ListHostsResponse -> ListHostsResponse -> Bool)
-> Eq ListHostsResponse
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]
(Int -> ReadS ListHostsResponse)
-> ReadS [ListHostsResponse]
-> ReadPrec ListHostsResponse
-> ReadPrec [ListHostsResponse]
-> Read 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
(Int -> ListHostsResponse -> ShowS)
-> (ListHostsResponse -> String)
-> ([ListHostsResponse] -> ShowS)
-> Show ListHostsResponse
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. ListHostsResponse -> Rep ListHostsResponse x)
-> (forall x. Rep ListHostsResponse x -> ListHostsResponse)
-> Generic ListHostsResponse
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' :: Maybe [Host] -> Maybe Text -> Int -> ListHostsResponse
ListHostsResponse'
{ $sel:hosts:ListHostsResponse' :: Maybe [Host]
hosts = Maybe [Host]
forall a. Maybe a
Prelude.Nothing,
$sel:nextToken:ListHostsResponse' :: Maybe Text
nextToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:ListHostsResponse' :: Int
httpStatus = Int
pHttpStatus_
}
listHostsResponse_hosts :: Lens.Lens' ListHostsResponse (Prelude.Maybe [Host])
listHostsResponse_hosts :: (Maybe [Host] -> f (Maybe [Host]))
-> ListHostsResponse -> f ListHostsResponse
listHostsResponse_hosts = (ListHostsResponse -> Maybe [Host])
-> (ListHostsResponse -> Maybe [Host] -> ListHostsResponse)
-> Lens
ListHostsResponse ListHostsResponse (Maybe [Host]) (Maybe [Host])
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) ((Maybe [Host] -> f (Maybe [Host]))
-> ListHostsResponse -> f ListHostsResponse)
-> ((Maybe [Host] -> f (Maybe [Host]))
-> Maybe [Host] -> f (Maybe [Host]))
-> (Maybe [Host] -> f (Maybe [Host]))
-> ListHostsResponse
-> f ListHostsResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Host] [Host] [Host] [Host]
-> Iso (Maybe [Host]) (Maybe [Host]) (Maybe [Host]) (Maybe [Host])
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 [Host] [Host] [Host] [Host]
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 :: (Maybe Text -> f (Maybe Text))
-> ListHostsResponse -> f ListHostsResponse
listHostsResponse_nextToken = (ListHostsResponse -> Maybe Text)
-> (ListHostsResponse -> Maybe Text -> ListHostsResponse)
-> Lens
ListHostsResponse ListHostsResponse (Maybe Text) (Maybe Text)
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 :: (Int -> f Int) -> ListHostsResponse -> f ListHostsResponse
listHostsResponse_httpStatus = (ListHostsResponse -> Int)
-> (ListHostsResponse -> Int -> ListHostsResponse)
-> Lens ListHostsResponse ListHostsResponse Int Int
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