{-# 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.GetHost
(
GetHost (..),
newGetHost,
getHost_hostArn,
GetHostResponse (..),
newGetHostResponse,
getHostResponse_status,
getHostResponse_providerEndpoint,
getHostResponse_providerType,
getHostResponse_name,
getHostResponse_vpcConfiguration,
getHostResponse_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 GetHost = GetHost'
{
GetHost -> Text
hostArn :: Prelude.Text
}
deriving (GetHost -> GetHost -> Bool
(GetHost -> GetHost -> Bool)
-> (GetHost -> GetHost -> Bool) -> Eq GetHost
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetHost -> GetHost -> Bool
$c/= :: GetHost -> GetHost -> Bool
== :: GetHost -> GetHost -> Bool
$c== :: GetHost -> GetHost -> Bool
Prelude.Eq, ReadPrec [GetHost]
ReadPrec GetHost
Int -> ReadS GetHost
ReadS [GetHost]
(Int -> ReadS GetHost)
-> ReadS [GetHost]
-> ReadPrec GetHost
-> ReadPrec [GetHost]
-> Read GetHost
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetHost]
$creadListPrec :: ReadPrec [GetHost]
readPrec :: ReadPrec GetHost
$creadPrec :: ReadPrec GetHost
readList :: ReadS [GetHost]
$creadList :: ReadS [GetHost]
readsPrec :: Int -> ReadS GetHost
$creadsPrec :: Int -> ReadS GetHost
Prelude.Read, Int -> GetHost -> ShowS
[GetHost] -> ShowS
GetHost -> String
(Int -> GetHost -> ShowS)
-> (GetHost -> String) -> ([GetHost] -> ShowS) -> Show GetHost
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetHost] -> ShowS
$cshowList :: [GetHost] -> ShowS
show :: GetHost -> String
$cshow :: GetHost -> String
showsPrec :: Int -> GetHost -> ShowS
$cshowsPrec :: Int -> GetHost -> ShowS
Prelude.Show, (forall x. GetHost -> Rep GetHost x)
-> (forall x. Rep GetHost x -> GetHost) -> Generic GetHost
forall x. Rep GetHost x -> GetHost
forall x. GetHost -> Rep GetHost x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetHost x -> GetHost
$cfrom :: forall x. GetHost -> Rep GetHost x
Prelude.Generic)
newGetHost ::
Prelude.Text ->
GetHost
newGetHost :: Text -> GetHost
newGetHost Text
pHostArn_ = GetHost' :: Text -> GetHost
GetHost' {$sel:hostArn:GetHost' :: Text
hostArn = Text
pHostArn_}
getHost_hostArn :: Lens.Lens' GetHost Prelude.Text
getHost_hostArn :: (Text -> f Text) -> GetHost -> f GetHost
getHost_hostArn = (GetHost -> Text)
-> (GetHost -> Text -> GetHost) -> Lens GetHost GetHost Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetHost' {Text
hostArn :: Text
$sel:hostArn:GetHost' :: GetHost -> Text
hostArn} -> Text
hostArn) (\s :: GetHost
s@GetHost' {} Text
a -> GetHost
s {$sel:hostArn:GetHost' :: Text
hostArn = Text
a} :: GetHost)
instance Core.AWSRequest GetHost where
type AWSResponse GetHost = GetHostResponse
request :: GetHost -> Request GetHost
request = Service -> GetHost -> Request GetHost
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy GetHost
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetHost)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse GetHost))
-> Logger
-> Service
-> Proxy GetHost
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse GetHost)))
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 Text
-> Maybe Text
-> Maybe ProviderType
-> Maybe Text
-> Maybe VpcConfiguration
-> Int
-> GetHostResponse
GetHostResponse'
(Maybe Text
-> Maybe Text
-> Maybe ProviderType
-> Maybe Text
-> Maybe VpcConfiguration
-> Int
-> GetHostResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe Text
-> Maybe ProviderType
-> Maybe Text
-> Maybe VpcConfiguration
-> Int
-> GetHostResponse)
forall (f :: * -> *) a b. Functor 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
"Status")
Either
String
(Maybe Text
-> Maybe ProviderType
-> Maybe Text
-> Maybe VpcConfiguration
-> Int
-> GetHostResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe ProviderType
-> Maybe Text -> Maybe VpcConfiguration -> Int -> GetHostResponse)
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
"ProviderEndpoint")
Either
String
(Maybe ProviderType
-> Maybe Text -> Maybe VpcConfiguration -> Int -> GetHostResponse)
-> Either String (Maybe ProviderType)
-> Either
String
(Maybe Text -> Maybe VpcConfiguration -> Int -> GetHostResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe ProviderType)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"ProviderType")
Either
String
(Maybe Text -> Maybe VpcConfiguration -> Int -> GetHostResponse)
-> Either String (Maybe Text)
-> Either String (Maybe VpcConfiguration -> Int -> GetHostResponse)
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
"Name")
Either String (Maybe VpcConfiguration -> Int -> GetHostResponse)
-> Either String (Maybe VpcConfiguration)
-> Either String (Int -> GetHostResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe VpcConfiguration)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"VpcConfiguration")
Either String (Int -> GetHostResponse)
-> Either String Int -> Either String GetHostResponse
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 GetHost
instance Prelude.NFData GetHost
instance Core.ToHeaders GetHost where
toHeaders :: GetHost -> ResponseHeaders
toHeaders =
ResponseHeaders -> GetHost -> 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.GetHost" ::
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 GetHost where
toJSON :: GetHost -> Value
toJSON GetHost' {Text
hostArn :: Text
$sel:hostArn:GetHost' :: GetHost -> Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"HostArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
hostArn)]
)
instance Core.ToPath GetHost where
toPath :: GetHost -> ByteString
toPath = ByteString -> GetHost -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery GetHost where
toQuery :: GetHost -> QueryString
toQuery = QueryString -> GetHost -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data GetHostResponse = GetHostResponse'
{
GetHostResponse -> Maybe Text
status :: Prelude.Maybe Prelude.Text,
GetHostResponse -> Maybe Text
providerEndpoint :: Prelude.Maybe Prelude.Text,
GetHostResponse -> Maybe ProviderType
providerType :: Prelude.Maybe ProviderType,
GetHostResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
GetHostResponse -> Maybe VpcConfiguration
vpcConfiguration :: Prelude.Maybe VpcConfiguration,
GetHostResponse -> Int
httpStatus :: Prelude.Int
}
deriving (GetHostResponse -> GetHostResponse -> Bool
(GetHostResponse -> GetHostResponse -> Bool)
-> (GetHostResponse -> GetHostResponse -> Bool)
-> Eq GetHostResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetHostResponse -> GetHostResponse -> Bool
$c/= :: GetHostResponse -> GetHostResponse -> Bool
== :: GetHostResponse -> GetHostResponse -> Bool
$c== :: GetHostResponse -> GetHostResponse -> Bool
Prelude.Eq, ReadPrec [GetHostResponse]
ReadPrec GetHostResponse
Int -> ReadS GetHostResponse
ReadS [GetHostResponse]
(Int -> ReadS GetHostResponse)
-> ReadS [GetHostResponse]
-> ReadPrec GetHostResponse
-> ReadPrec [GetHostResponse]
-> Read GetHostResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetHostResponse]
$creadListPrec :: ReadPrec [GetHostResponse]
readPrec :: ReadPrec GetHostResponse
$creadPrec :: ReadPrec GetHostResponse
readList :: ReadS [GetHostResponse]
$creadList :: ReadS [GetHostResponse]
readsPrec :: Int -> ReadS GetHostResponse
$creadsPrec :: Int -> ReadS GetHostResponse
Prelude.Read, Int -> GetHostResponse -> ShowS
[GetHostResponse] -> ShowS
GetHostResponse -> String
(Int -> GetHostResponse -> ShowS)
-> (GetHostResponse -> String)
-> ([GetHostResponse] -> ShowS)
-> Show GetHostResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetHostResponse] -> ShowS
$cshowList :: [GetHostResponse] -> ShowS
show :: GetHostResponse -> String
$cshow :: GetHostResponse -> String
showsPrec :: Int -> GetHostResponse -> ShowS
$cshowsPrec :: Int -> GetHostResponse -> ShowS
Prelude.Show, (forall x. GetHostResponse -> Rep GetHostResponse x)
-> (forall x. Rep GetHostResponse x -> GetHostResponse)
-> Generic GetHostResponse
forall x. Rep GetHostResponse x -> GetHostResponse
forall x. GetHostResponse -> Rep GetHostResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep GetHostResponse x -> GetHostResponse
$cfrom :: forall x. GetHostResponse -> Rep GetHostResponse x
Prelude.Generic)
newGetHostResponse ::
Prelude.Int ->
GetHostResponse
newGetHostResponse :: Int -> GetHostResponse
newGetHostResponse Int
pHttpStatus_ =
GetHostResponse' :: Maybe Text
-> Maybe Text
-> Maybe ProviderType
-> Maybe Text
-> Maybe VpcConfiguration
-> Int
-> GetHostResponse
GetHostResponse'
{ $sel:status:GetHostResponse' :: Maybe Text
status = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:providerEndpoint:GetHostResponse' :: Maybe Text
providerEndpoint = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:providerType:GetHostResponse' :: Maybe ProviderType
providerType = Maybe ProviderType
forall a. Maybe a
Prelude.Nothing,
$sel:name:GetHostResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:vpcConfiguration:GetHostResponse' :: Maybe VpcConfiguration
vpcConfiguration = Maybe VpcConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:GetHostResponse' :: Int
httpStatus = Int
pHttpStatus_
}
getHostResponse_status :: Lens.Lens' GetHostResponse (Prelude.Maybe Prelude.Text)
getHostResponse_status :: (Maybe Text -> f (Maybe Text))
-> GetHostResponse -> f GetHostResponse
getHostResponse_status = (GetHostResponse -> Maybe Text)
-> (GetHostResponse -> Maybe Text -> GetHostResponse)
-> Lens GetHostResponse GetHostResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetHostResponse' {Maybe Text
status :: Maybe Text
$sel:status:GetHostResponse' :: GetHostResponse -> Maybe Text
status} -> Maybe Text
status) (\s :: GetHostResponse
s@GetHostResponse' {} Maybe Text
a -> GetHostResponse
s {$sel:status:GetHostResponse' :: Maybe Text
status = Maybe Text
a} :: GetHostResponse)
getHostResponse_providerEndpoint :: Lens.Lens' GetHostResponse (Prelude.Maybe Prelude.Text)
getHostResponse_providerEndpoint :: (Maybe Text -> f (Maybe Text))
-> GetHostResponse -> f GetHostResponse
getHostResponse_providerEndpoint = (GetHostResponse -> Maybe Text)
-> (GetHostResponse -> Maybe Text -> GetHostResponse)
-> Lens GetHostResponse GetHostResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetHostResponse' {Maybe Text
providerEndpoint :: Maybe Text
$sel:providerEndpoint:GetHostResponse' :: GetHostResponse -> Maybe Text
providerEndpoint} -> Maybe Text
providerEndpoint) (\s :: GetHostResponse
s@GetHostResponse' {} Maybe Text
a -> GetHostResponse
s {$sel:providerEndpoint:GetHostResponse' :: Maybe Text
providerEndpoint = Maybe Text
a} :: GetHostResponse)
getHostResponse_providerType :: Lens.Lens' GetHostResponse (Prelude.Maybe ProviderType)
getHostResponse_providerType :: (Maybe ProviderType -> f (Maybe ProviderType))
-> GetHostResponse -> f GetHostResponse
getHostResponse_providerType = (GetHostResponse -> Maybe ProviderType)
-> (GetHostResponse -> Maybe ProviderType -> GetHostResponse)
-> Lens
GetHostResponse
GetHostResponse
(Maybe ProviderType)
(Maybe ProviderType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetHostResponse' {Maybe ProviderType
providerType :: Maybe ProviderType
$sel:providerType:GetHostResponse' :: GetHostResponse -> Maybe ProviderType
providerType} -> Maybe ProviderType
providerType) (\s :: GetHostResponse
s@GetHostResponse' {} Maybe ProviderType
a -> GetHostResponse
s {$sel:providerType:GetHostResponse' :: Maybe ProviderType
providerType = Maybe ProviderType
a} :: GetHostResponse)
getHostResponse_name :: Lens.Lens' GetHostResponse (Prelude.Maybe Prelude.Text)
getHostResponse_name :: (Maybe Text -> f (Maybe Text))
-> GetHostResponse -> f GetHostResponse
getHostResponse_name = (GetHostResponse -> Maybe Text)
-> (GetHostResponse -> Maybe Text -> GetHostResponse)
-> Lens GetHostResponse GetHostResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetHostResponse' {Maybe Text
name :: Maybe Text
$sel:name:GetHostResponse' :: GetHostResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: GetHostResponse
s@GetHostResponse' {} Maybe Text
a -> GetHostResponse
s {$sel:name:GetHostResponse' :: Maybe Text
name = Maybe Text
a} :: GetHostResponse)
getHostResponse_vpcConfiguration :: Lens.Lens' GetHostResponse (Prelude.Maybe VpcConfiguration)
getHostResponse_vpcConfiguration :: (Maybe VpcConfiguration -> f (Maybe VpcConfiguration))
-> GetHostResponse -> f GetHostResponse
getHostResponse_vpcConfiguration = (GetHostResponse -> Maybe VpcConfiguration)
-> (GetHostResponse -> Maybe VpcConfiguration -> GetHostResponse)
-> Lens
GetHostResponse
GetHostResponse
(Maybe VpcConfiguration)
(Maybe VpcConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetHostResponse' {Maybe VpcConfiguration
vpcConfiguration :: Maybe VpcConfiguration
$sel:vpcConfiguration:GetHostResponse' :: GetHostResponse -> Maybe VpcConfiguration
vpcConfiguration} -> Maybe VpcConfiguration
vpcConfiguration) (\s :: GetHostResponse
s@GetHostResponse' {} Maybe VpcConfiguration
a -> GetHostResponse
s {$sel:vpcConfiguration:GetHostResponse' :: Maybe VpcConfiguration
vpcConfiguration = Maybe VpcConfiguration
a} :: GetHostResponse)
getHostResponse_httpStatus :: Lens.Lens' GetHostResponse Prelude.Int
getHostResponse_httpStatus :: (Int -> f Int) -> GetHostResponse -> f GetHostResponse
getHostResponse_httpStatus = (GetHostResponse -> Int)
-> (GetHostResponse -> Int -> GetHostResponse)
-> Lens GetHostResponse GetHostResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetHostResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetHostResponse' :: GetHostResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetHostResponse
s@GetHostResponse' {} Int
a -> GetHostResponse
s {$sel:httpStatus:GetHostResponse' :: Int
httpStatus = Int
a} :: GetHostResponse)
instance Prelude.NFData GetHostResponse