{-# 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.UpdateHost
(
UpdateHost (..),
newUpdateHost,
updateHost_providerEndpoint,
updateHost_vpcConfiguration,
updateHost_hostArn,
UpdateHostResponse (..),
newUpdateHostResponse,
updateHostResponse_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 UpdateHost = UpdateHost'
{
UpdateHost -> Maybe Text
providerEndpoint :: Prelude.Maybe Prelude.Text,
UpdateHost -> Maybe VpcConfiguration
vpcConfiguration :: Prelude.Maybe VpcConfiguration,
UpdateHost -> Text
hostArn :: Prelude.Text
}
deriving (UpdateHost -> UpdateHost -> Bool
(UpdateHost -> UpdateHost -> Bool)
-> (UpdateHost -> UpdateHost -> Bool) -> Eq UpdateHost
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateHost -> UpdateHost -> Bool
$c/= :: UpdateHost -> UpdateHost -> Bool
== :: UpdateHost -> UpdateHost -> Bool
$c== :: UpdateHost -> UpdateHost -> Bool
Prelude.Eq, ReadPrec [UpdateHost]
ReadPrec UpdateHost
Int -> ReadS UpdateHost
ReadS [UpdateHost]
(Int -> ReadS UpdateHost)
-> ReadS [UpdateHost]
-> ReadPrec UpdateHost
-> ReadPrec [UpdateHost]
-> Read UpdateHost
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateHost]
$creadListPrec :: ReadPrec [UpdateHost]
readPrec :: ReadPrec UpdateHost
$creadPrec :: ReadPrec UpdateHost
readList :: ReadS [UpdateHost]
$creadList :: ReadS [UpdateHost]
readsPrec :: Int -> ReadS UpdateHost
$creadsPrec :: Int -> ReadS UpdateHost
Prelude.Read, Int -> UpdateHost -> ShowS
[UpdateHost] -> ShowS
UpdateHost -> String
(Int -> UpdateHost -> ShowS)
-> (UpdateHost -> String)
-> ([UpdateHost] -> ShowS)
-> Show UpdateHost
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateHost] -> ShowS
$cshowList :: [UpdateHost] -> ShowS
show :: UpdateHost -> String
$cshow :: UpdateHost -> String
showsPrec :: Int -> UpdateHost -> ShowS
$cshowsPrec :: Int -> UpdateHost -> ShowS
Prelude.Show, (forall x. UpdateHost -> Rep UpdateHost x)
-> (forall x. Rep UpdateHost x -> UpdateHost) -> Generic UpdateHost
forall x. Rep UpdateHost x -> UpdateHost
forall x. UpdateHost -> Rep UpdateHost x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateHost x -> UpdateHost
$cfrom :: forall x. UpdateHost -> Rep UpdateHost x
Prelude.Generic)
newUpdateHost ::
Prelude.Text ->
UpdateHost
newUpdateHost :: Text -> UpdateHost
newUpdateHost Text
pHostArn_ =
UpdateHost' :: Maybe Text -> Maybe VpcConfiguration -> Text -> UpdateHost
UpdateHost'
{ $sel:providerEndpoint:UpdateHost' :: Maybe Text
providerEndpoint = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:vpcConfiguration:UpdateHost' :: Maybe VpcConfiguration
vpcConfiguration = Maybe VpcConfiguration
forall a. Maybe a
Prelude.Nothing,
$sel:hostArn:UpdateHost' :: Text
hostArn = Text
pHostArn_
}
updateHost_providerEndpoint :: Lens.Lens' UpdateHost (Prelude.Maybe Prelude.Text)
updateHost_providerEndpoint :: (Maybe Text -> f (Maybe Text)) -> UpdateHost -> f UpdateHost
updateHost_providerEndpoint = (UpdateHost -> Maybe Text)
-> (UpdateHost -> Maybe Text -> UpdateHost)
-> Lens UpdateHost UpdateHost (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateHost' {Maybe Text
providerEndpoint :: Maybe Text
$sel:providerEndpoint:UpdateHost' :: UpdateHost -> Maybe Text
providerEndpoint} -> Maybe Text
providerEndpoint) (\s :: UpdateHost
s@UpdateHost' {} Maybe Text
a -> UpdateHost
s {$sel:providerEndpoint:UpdateHost' :: Maybe Text
providerEndpoint = Maybe Text
a} :: UpdateHost)
updateHost_vpcConfiguration :: Lens.Lens' UpdateHost (Prelude.Maybe VpcConfiguration)
updateHost_vpcConfiguration :: (Maybe VpcConfiguration -> f (Maybe VpcConfiguration))
-> UpdateHost -> f UpdateHost
updateHost_vpcConfiguration = (UpdateHost -> Maybe VpcConfiguration)
-> (UpdateHost -> Maybe VpcConfiguration -> UpdateHost)
-> Lens
UpdateHost
UpdateHost
(Maybe VpcConfiguration)
(Maybe VpcConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateHost' {Maybe VpcConfiguration
vpcConfiguration :: Maybe VpcConfiguration
$sel:vpcConfiguration:UpdateHost' :: UpdateHost -> Maybe VpcConfiguration
vpcConfiguration} -> Maybe VpcConfiguration
vpcConfiguration) (\s :: UpdateHost
s@UpdateHost' {} Maybe VpcConfiguration
a -> UpdateHost
s {$sel:vpcConfiguration:UpdateHost' :: Maybe VpcConfiguration
vpcConfiguration = Maybe VpcConfiguration
a} :: UpdateHost)
updateHost_hostArn :: Lens.Lens' UpdateHost Prelude.Text
updateHost_hostArn :: (Text -> f Text) -> UpdateHost -> f UpdateHost
updateHost_hostArn = (UpdateHost -> Text)
-> (UpdateHost -> Text -> UpdateHost)
-> Lens UpdateHost UpdateHost Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateHost' {Text
hostArn :: Text
$sel:hostArn:UpdateHost' :: UpdateHost -> Text
hostArn} -> Text
hostArn) (\s :: UpdateHost
s@UpdateHost' {} Text
a -> UpdateHost
s {$sel:hostArn:UpdateHost' :: Text
hostArn = Text
a} :: UpdateHost)
instance Core.AWSRequest UpdateHost where
type AWSResponse UpdateHost = UpdateHostResponse
request :: UpdateHost -> Request UpdateHost
request = Service -> UpdateHost -> Request UpdateHost
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateHost
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateHost)))
response =
(Int
-> ResponseHeaders -> () -> Either String (AWSResponse UpdateHost))
-> Logger
-> Service
-> Proxy UpdateHost
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateHost)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> UpdateHostResponse
UpdateHostResponse'
(Int -> UpdateHostResponse)
-> Either String Int -> Either String UpdateHostResponse
forall (f :: * -> *) a b. Functor 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 UpdateHost
instance Prelude.NFData UpdateHost
instance Core.ToHeaders UpdateHost where
toHeaders :: UpdateHost -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateHost -> 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.UpdateHost" ::
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 UpdateHost where
toJSON :: UpdateHost -> Value
toJSON UpdateHost' {Maybe Text
Maybe VpcConfiguration
Text
hostArn :: Text
vpcConfiguration :: Maybe VpcConfiguration
providerEndpoint :: Maybe Text
$sel:hostArn:UpdateHost' :: UpdateHost -> Text
$sel:vpcConfiguration:UpdateHost' :: UpdateHost -> Maybe VpcConfiguration
$sel:providerEndpoint:UpdateHost' :: UpdateHost -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"ProviderEndpoint" 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
providerEndpoint,
(Text
"VpcConfiguration" Text -> VpcConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(VpcConfiguration -> Pair) -> Maybe VpcConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe VpcConfiguration
vpcConfiguration,
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 UpdateHost where
toPath :: UpdateHost -> ByteString
toPath = ByteString -> UpdateHost -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery UpdateHost where
toQuery :: UpdateHost -> QueryString
toQuery = QueryString -> UpdateHost -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateHostResponse = UpdateHostResponse'
{
UpdateHostResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateHostResponse -> UpdateHostResponse -> Bool
(UpdateHostResponse -> UpdateHostResponse -> Bool)
-> (UpdateHostResponse -> UpdateHostResponse -> Bool)
-> Eq UpdateHostResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateHostResponse -> UpdateHostResponse -> Bool
$c/= :: UpdateHostResponse -> UpdateHostResponse -> Bool
== :: UpdateHostResponse -> UpdateHostResponse -> Bool
$c== :: UpdateHostResponse -> UpdateHostResponse -> Bool
Prelude.Eq, ReadPrec [UpdateHostResponse]
ReadPrec UpdateHostResponse
Int -> ReadS UpdateHostResponse
ReadS [UpdateHostResponse]
(Int -> ReadS UpdateHostResponse)
-> ReadS [UpdateHostResponse]
-> ReadPrec UpdateHostResponse
-> ReadPrec [UpdateHostResponse]
-> Read UpdateHostResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateHostResponse]
$creadListPrec :: ReadPrec [UpdateHostResponse]
readPrec :: ReadPrec UpdateHostResponse
$creadPrec :: ReadPrec UpdateHostResponse
readList :: ReadS [UpdateHostResponse]
$creadList :: ReadS [UpdateHostResponse]
readsPrec :: Int -> ReadS UpdateHostResponse
$creadsPrec :: Int -> ReadS UpdateHostResponse
Prelude.Read, Int -> UpdateHostResponse -> ShowS
[UpdateHostResponse] -> ShowS
UpdateHostResponse -> String
(Int -> UpdateHostResponse -> ShowS)
-> (UpdateHostResponse -> String)
-> ([UpdateHostResponse] -> ShowS)
-> Show UpdateHostResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateHostResponse] -> ShowS
$cshowList :: [UpdateHostResponse] -> ShowS
show :: UpdateHostResponse -> String
$cshow :: UpdateHostResponse -> String
showsPrec :: Int -> UpdateHostResponse -> ShowS
$cshowsPrec :: Int -> UpdateHostResponse -> ShowS
Prelude.Show, (forall x. UpdateHostResponse -> Rep UpdateHostResponse x)
-> (forall x. Rep UpdateHostResponse x -> UpdateHostResponse)
-> Generic UpdateHostResponse
forall x. Rep UpdateHostResponse x -> UpdateHostResponse
forall x. UpdateHostResponse -> Rep UpdateHostResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateHostResponse x -> UpdateHostResponse
$cfrom :: forall x. UpdateHostResponse -> Rep UpdateHostResponse x
Prelude.Generic)
newUpdateHostResponse ::
Prelude.Int ->
UpdateHostResponse
newUpdateHostResponse :: Int -> UpdateHostResponse
newUpdateHostResponse Int
pHttpStatus_ =
UpdateHostResponse' :: Int -> UpdateHostResponse
UpdateHostResponse' {$sel:httpStatus:UpdateHostResponse' :: Int
httpStatus = Int
pHttpStatus_}
updateHostResponse_httpStatus :: Lens.Lens' UpdateHostResponse Prelude.Int
updateHostResponse_httpStatus :: (Int -> f Int) -> UpdateHostResponse -> f UpdateHostResponse
updateHostResponse_httpStatus = (UpdateHostResponse -> Int)
-> (UpdateHostResponse -> Int -> UpdateHostResponse)
-> Lens UpdateHostResponse UpdateHostResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateHostResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateHostResponse' :: UpdateHostResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateHostResponse
s@UpdateHostResponse' {} Int
a -> UpdateHostResponse
s {$sel:httpStatus:UpdateHostResponse' :: Int
httpStatus = Int
a} :: UpdateHostResponse)
instance Prelude.NFData UpdateHostResponse