{-# 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.Proton.UpdateService
(
UpdateService (..),
newUpdateService,
updateService_description,
updateService_spec,
updateService_name,
UpdateServiceResponse (..),
newUpdateServiceResponse,
updateServiceResponse_httpStatus,
updateServiceResponse_service,
)
where
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 Amazonka.Proton.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data UpdateService = UpdateService'
{
UpdateService -> Maybe (Sensitive Text)
description :: Prelude.Maybe (Data.Sensitive Prelude.Text),
UpdateService -> Maybe (Sensitive Text)
spec :: Prelude.Maybe (Data.Sensitive Prelude.Text),
UpdateService -> Text
name :: Prelude.Text
}
deriving (UpdateService -> UpdateService -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateService -> UpdateService -> Bool
$c/= :: UpdateService -> UpdateService -> Bool
== :: UpdateService -> UpdateService -> Bool
$c== :: UpdateService -> UpdateService -> Bool
Prelude.Eq, Int -> UpdateService -> ShowS
[UpdateService] -> ShowS
UpdateService -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateService] -> ShowS
$cshowList :: [UpdateService] -> ShowS
show :: UpdateService -> String
$cshow :: UpdateService -> String
showsPrec :: Int -> UpdateService -> ShowS
$cshowsPrec :: Int -> UpdateService -> ShowS
Prelude.Show, forall x. Rep UpdateService x -> UpdateService
forall x. UpdateService -> Rep UpdateService x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateService x -> UpdateService
$cfrom :: forall x. UpdateService -> Rep UpdateService x
Prelude.Generic)
newUpdateService ::
Prelude.Text ->
UpdateService
newUpdateService :: Text -> UpdateService
newUpdateService Text
pName_ =
UpdateService'
{ $sel:description:UpdateService' :: Maybe (Sensitive Text)
description = forall a. Maybe a
Prelude.Nothing,
$sel:spec:UpdateService' :: Maybe (Sensitive Text)
spec = forall a. Maybe a
Prelude.Nothing,
$sel:name:UpdateService' :: Text
name = Text
pName_
}
updateService_description :: Lens.Lens' UpdateService (Prelude.Maybe Prelude.Text)
updateService_description :: Lens' UpdateService (Maybe Text)
updateService_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateService' {Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:description:UpdateService' :: UpdateService -> Maybe (Sensitive Text)
description} -> Maybe (Sensitive Text)
description) (\s :: UpdateService
s@UpdateService' {} Maybe (Sensitive Text)
a -> UpdateService
s {$sel:description:UpdateService' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
a} :: UpdateService) 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 a. Iso' (Sensitive a) a
Data._Sensitive
updateService_spec :: Lens.Lens' UpdateService (Prelude.Maybe Prelude.Text)
updateService_spec :: Lens' UpdateService (Maybe Text)
updateService_spec = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateService' {Maybe (Sensitive Text)
spec :: Maybe (Sensitive Text)
$sel:spec:UpdateService' :: UpdateService -> Maybe (Sensitive Text)
spec} -> Maybe (Sensitive Text)
spec) (\s :: UpdateService
s@UpdateService' {} Maybe (Sensitive Text)
a -> UpdateService
s {$sel:spec:UpdateService' :: Maybe (Sensitive Text)
spec = Maybe (Sensitive Text)
a} :: UpdateService) 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 a. Iso' (Sensitive a) a
Data._Sensitive
updateService_name :: Lens.Lens' UpdateService Prelude.Text
updateService_name :: Lens' UpdateService Text
updateService_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateService' {Text
name :: Text
$sel:name:UpdateService' :: UpdateService -> Text
name} -> Text
name) (\s :: UpdateService
s@UpdateService' {} Text
a -> UpdateService
s {$sel:name:UpdateService' :: Text
name = Text
a} :: UpdateService)
instance Core.AWSRequest UpdateService where
type
AWSResponse UpdateService =
UpdateServiceResponse
request :: (Service -> Service) -> UpdateService -> Request UpdateService
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 UpdateService
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateService)))
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 ->
Int -> Service -> UpdateServiceResponse
UpdateServiceResponse'
forall (f :: * -> *) a b. Functor 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))
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"service")
)
instance Prelude.Hashable UpdateService where
hashWithSalt :: Int -> UpdateService -> Int
hashWithSalt Int
_salt UpdateService' {Maybe (Sensitive Text)
Text
name :: Text
spec :: Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:name:UpdateService' :: UpdateService -> Text
$sel:spec:UpdateService' :: UpdateService -> Maybe (Sensitive Text)
$sel:description:UpdateService' :: UpdateService -> Maybe (Sensitive Text)
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (Sensitive Text)
spec
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
name
instance Prelude.NFData UpdateService where
rnf :: UpdateService -> ()
rnf UpdateService' {Maybe (Sensitive Text)
Text
name :: Text
spec :: Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:name:UpdateService' :: UpdateService -> Text
$sel:spec:UpdateService' :: UpdateService -> Maybe (Sensitive Text)
$sel:description:UpdateService' :: UpdateService -> Maybe (Sensitive Text)
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (Sensitive Text)
spec
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
name
instance Data.ToHeaders UpdateService where
toHeaders :: UpdateService -> 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
"AwsProton20200720.UpdateService" ::
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 UpdateService where
toJSON :: UpdateService -> Value
toJSON UpdateService' {Maybe (Sensitive Text)
Text
name :: Text
spec :: Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:name:UpdateService' :: UpdateService -> Text
$sel:spec:UpdateService' :: UpdateService -> Maybe (Sensitive Text)
$sel:description:UpdateService' :: UpdateService -> Maybe (Sensitive Text)
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"description" 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 (Sensitive Text)
description,
(Key
"spec" 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 (Sensitive Text)
spec,
forall a. a -> Maybe a
Prelude.Just (Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
name)
]
)
instance Data.ToPath UpdateService where
toPath :: UpdateService -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Data.ToQuery UpdateService where
toQuery :: UpdateService -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateServiceResponse = UpdateServiceResponse'
{
UpdateServiceResponse -> Int
httpStatus :: Prelude.Int,
UpdateServiceResponse -> Service
service :: Service
}
deriving (UpdateServiceResponse -> UpdateServiceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateServiceResponse -> UpdateServiceResponse -> Bool
$c/= :: UpdateServiceResponse -> UpdateServiceResponse -> Bool
== :: UpdateServiceResponse -> UpdateServiceResponse -> Bool
$c== :: UpdateServiceResponse -> UpdateServiceResponse -> Bool
Prelude.Eq, Int -> UpdateServiceResponse -> ShowS
[UpdateServiceResponse] -> ShowS
UpdateServiceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateServiceResponse] -> ShowS
$cshowList :: [UpdateServiceResponse] -> ShowS
show :: UpdateServiceResponse -> String
$cshow :: UpdateServiceResponse -> String
showsPrec :: Int -> UpdateServiceResponse -> ShowS
$cshowsPrec :: Int -> UpdateServiceResponse -> ShowS
Prelude.Show, forall x. Rep UpdateServiceResponse x -> UpdateServiceResponse
forall x. UpdateServiceResponse -> Rep UpdateServiceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateServiceResponse x -> UpdateServiceResponse
$cfrom :: forall x. UpdateServiceResponse -> Rep UpdateServiceResponse x
Prelude.Generic)
newUpdateServiceResponse ::
Prelude.Int ->
Service ->
UpdateServiceResponse
newUpdateServiceResponse :: Int -> Service -> UpdateServiceResponse
newUpdateServiceResponse Int
pHttpStatus_ Service
pService_ =
UpdateServiceResponse'
{ $sel:httpStatus:UpdateServiceResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:service:UpdateServiceResponse' :: Service
service = Service
pService_
}
updateServiceResponse_httpStatus :: Lens.Lens' UpdateServiceResponse Prelude.Int
updateServiceResponse_httpStatus :: Lens' UpdateServiceResponse Int
updateServiceResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateServiceResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateServiceResponse' :: UpdateServiceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateServiceResponse
s@UpdateServiceResponse' {} Int
a -> UpdateServiceResponse
s {$sel:httpStatus:UpdateServiceResponse' :: Int
httpStatus = Int
a} :: UpdateServiceResponse)
updateServiceResponse_service :: Lens.Lens' UpdateServiceResponse Service
updateServiceResponse_service :: Lens' UpdateServiceResponse Service
updateServiceResponse_service = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateServiceResponse' {Service
service :: Service
$sel:service:UpdateServiceResponse' :: UpdateServiceResponse -> Service
service} -> Service
service) (\s :: UpdateServiceResponse
s@UpdateServiceResponse' {} Service
a -> UpdateServiceResponse
s {$sel:service:UpdateServiceResponse' :: Service
service = Service
a} :: UpdateServiceResponse)
instance Prelude.NFData UpdateServiceResponse where
rnf :: UpdateServiceResponse -> ()
rnf UpdateServiceResponse' {Int
Service
service :: Service
httpStatus :: Int
$sel:service:UpdateServiceResponse' :: UpdateServiceResponse -> Service
$sel:httpStatus:UpdateServiceResponse' :: UpdateServiceResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Service
service