{-# 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.Greengrass.UpdateCoreDefinition
(
UpdateCoreDefinition (..),
newUpdateCoreDefinition,
updateCoreDefinition_name,
updateCoreDefinition_coreDefinitionId,
UpdateCoreDefinitionResponse (..),
newUpdateCoreDefinitionResponse,
updateCoreDefinitionResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.Greengrass.Types
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 UpdateCoreDefinition = UpdateCoreDefinition'
{
UpdateCoreDefinition -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
UpdateCoreDefinition -> Text
coreDefinitionId :: Prelude.Text
}
deriving (UpdateCoreDefinition -> UpdateCoreDefinition -> Bool
(UpdateCoreDefinition -> UpdateCoreDefinition -> Bool)
-> (UpdateCoreDefinition -> UpdateCoreDefinition -> Bool)
-> Eq UpdateCoreDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateCoreDefinition -> UpdateCoreDefinition -> Bool
$c/= :: UpdateCoreDefinition -> UpdateCoreDefinition -> Bool
== :: UpdateCoreDefinition -> UpdateCoreDefinition -> Bool
$c== :: UpdateCoreDefinition -> UpdateCoreDefinition -> Bool
Prelude.Eq, ReadPrec [UpdateCoreDefinition]
ReadPrec UpdateCoreDefinition
Int -> ReadS UpdateCoreDefinition
ReadS [UpdateCoreDefinition]
(Int -> ReadS UpdateCoreDefinition)
-> ReadS [UpdateCoreDefinition]
-> ReadPrec UpdateCoreDefinition
-> ReadPrec [UpdateCoreDefinition]
-> Read UpdateCoreDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateCoreDefinition]
$creadListPrec :: ReadPrec [UpdateCoreDefinition]
readPrec :: ReadPrec UpdateCoreDefinition
$creadPrec :: ReadPrec UpdateCoreDefinition
readList :: ReadS [UpdateCoreDefinition]
$creadList :: ReadS [UpdateCoreDefinition]
readsPrec :: Int -> ReadS UpdateCoreDefinition
$creadsPrec :: Int -> ReadS UpdateCoreDefinition
Prelude.Read, Int -> UpdateCoreDefinition -> ShowS
[UpdateCoreDefinition] -> ShowS
UpdateCoreDefinition -> String
(Int -> UpdateCoreDefinition -> ShowS)
-> (UpdateCoreDefinition -> String)
-> ([UpdateCoreDefinition] -> ShowS)
-> Show UpdateCoreDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateCoreDefinition] -> ShowS
$cshowList :: [UpdateCoreDefinition] -> ShowS
show :: UpdateCoreDefinition -> String
$cshow :: UpdateCoreDefinition -> String
showsPrec :: Int -> UpdateCoreDefinition -> ShowS
$cshowsPrec :: Int -> UpdateCoreDefinition -> ShowS
Prelude.Show, (forall x. UpdateCoreDefinition -> Rep UpdateCoreDefinition x)
-> (forall x. Rep UpdateCoreDefinition x -> UpdateCoreDefinition)
-> Generic UpdateCoreDefinition
forall x. Rep UpdateCoreDefinition x -> UpdateCoreDefinition
forall x. UpdateCoreDefinition -> Rep UpdateCoreDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateCoreDefinition x -> UpdateCoreDefinition
$cfrom :: forall x. UpdateCoreDefinition -> Rep UpdateCoreDefinition x
Prelude.Generic)
newUpdateCoreDefinition ::
Prelude.Text ->
UpdateCoreDefinition
newUpdateCoreDefinition :: Text -> UpdateCoreDefinition
newUpdateCoreDefinition Text
pCoreDefinitionId_ =
UpdateCoreDefinition' :: Maybe Text -> Text -> UpdateCoreDefinition
UpdateCoreDefinition'
{ $sel:name:UpdateCoreDefinition' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:coreDefinitionId:UpdateCoreDefinition' :: Text
coreDefinitionId = Text
pCoreDefinitionId_
}
updateCoreDefinition_name :: Lens.Lens' UpdateCoreDefinition (Prelude.Maybe Prelude.Text)
updateCoreDefinition_name :: (Maybe Text -> f (Maybe Text))
-> UpdateCoreDefinition -> f UpdateCoreDefinition
updateCoreDefinition_name = (UpdateCoreDefinition -> Maybe Text)
-> (UpdateCoreDefinition -> Maybe Text -> UpdateCoreDefinition)
-> Lens
UpdateCoreDefinition UpdateCoreDefinition (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCoreDefinition' {Maybe Text
name :: Maybe Text
$sel:name:UpdateCoreDefinition' :: UpdateCoreDefinition -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateCoreDefinition
s@UpdateCoreDefinition' {} Maybe Text
a -> UpdateCoreDefinition
s {$sel:name:UpdateCoreDefinition' :: Maybe Text
name = Maybe Text
a} :: UpdateCoreDefinition)
updateCoreDefinition_coreDefinitionId :: Lens.Lens' UpdateCoreDefinition Prelude.Text
updateCoreDefinition_coreDefinitionId :: (Text -> f Text) -> UpdateCoreDefinition -> f UpdateCoreDefinition
updateCoreDefinition_coreDefinitionId = (UpdateCoreDefinition -> Text)
-> (UpdateCoreDefinition -> Text -> UpdateCoreDefinition)
-> Lens UpdateCoreDefinition UpdateCoreDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCoreDefinition' {Text
coreDefinitionId :: Text
$sel:coreDefinitionId:UpdateCoreDefinition' :: UpdateCoreDefinition -> Text
coreDefinitionId} -> Text
coreDefinitionId) (\s :: UpdateCoreDefinition
s@UpdateCoreDefinition' {} Text
a -> UpdateCoreDefinition
s {$sel:coreDefinitionId:UpdateCoreDefinition' :: Text
coreDefinitionId = Text
a} :: UpdateCoreDefinition)
instance Core.AWSRequest UpdateCoreDefinition where
type
AWSResponse UpdateCoreDefinition =
UpdateCoreDefinitionResponse
request :: UpdateCoreDefinition -> Request UpdateCoreDefinition
request = Service -> UpdateCoreDefinition -> Request UpdateCoreDefinition
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateCoreDefinition
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateCoreDefinition)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateCoreDefinition))
-> Logger
-> Service
-> Proxy UpdateCoreDefinition
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateCoreDefinition)))
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 -> UpdateCoreDefinitionResponse
UpdateCoreDefinitionResponse'
(Int -> UpdateCoreDefinitionResponse)
-> Either String Int -> Either String UpdateCoreDefinitionResponse
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 UpdateCoreDefinition
instance Prelude.NFData UpdateCoreDefinition
instance Core.ToHeaders UpdateCoreDefinition where
toHeaders :: UpdateCoreDefinition -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateCoreDefinition -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Core.ToJSON UpdateCoreDefinition where
toJSON :: UpdateCoreDefinition -> Value
toJSON UpdateCoreDefinition' {Maybe Text
Text
coreDefinitionId :: Text
name :: Maybe Text
$sel:coreDefinitionId:UpdateCoreDefinition' :: UpdateCoreDefinition -> Text
$sel:name:UpdateCoreDefinition' :: UpdateCoreDefinition -> Maybe Text
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[(Text
"Name" 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
name]
)
instance Core.ToPath UpdateCoreDefinition where
toPath :: UpdateCoreDefinition -> ByteString
toPath UpdateCoreDefinition' {Maybe Text
Text
coreDefinitionId :: Text
name :: Maybe Text
$sel:coreDefinitionId:UpdateCoreDefinition' :: UpdateCoreDefinition -> Text
$sel:name:UpdateCoreDefinition' :: UpdateCoreDefinition -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/greengrass/definition/cores/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
coreDefinitionId
]
instance Core.ToQuery UpdateCoreDefinition where
toQuery :: UpdateCoreDefinition -> QueryString
toQuery = QueryString -> UpdateCoreDefinition -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateCoreDefinitionResponse = UpdateCoreDefinitionResponse'
{
UpdateCoreDefinitionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateCoreDefinitionResponse
-> UpdateCoreDefinitionResponse -> Bool
(UpdateCoreDefinitionResponse
-> UpdateCoreDefinitionResponse -> Bool)
-> (UpdateCoreDefinitionResponse
-> UpdateCoreDefinitionResponse -> Bool)
-> Eq UpdateCoreDefinitionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateCoreDefinitionResponse
-> UpdateCoreDefinitionResponse -> Bool
$c/= :: UpdateCoreDefinitionResponse
-> UpdateCoreDefinitionResponse -> Bool
== :: UpdateCoreDefinitionResponse
-> UpdateCoreDefinitionResponse -> Bool
$c== :: UpdateCoreDefinitionResponse
-> UpdateCoreDefinitionResponse -> Bool
Prelude.Eq, ReadPrec [UpdateCoreDefinitionResponse]
ReadPrec UpdateCoreDefinitionResponse
Int -> ReadS UpdateCoreDefinitionResponse
ReadS [UpdateCoreDefinitionResponse]
(Int -> ReadS UpdateCoreDefinitionResponse)
-> ReadS [UpdateCoreDefinitionResponse]
-> ReadPrec UpdateCoreDefinitionResponse
-> ReadPrec [UpdateCoreDefinitionResponse]
-> Read UpdateCoreDefinitionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateCoreDefinitionResponse]
$creadListPrec :: ReadPrec [UpdateCoreDefinitionResponse]
readPrec :: ReadPrec UpdateCoreDefinitionResponse
$creadPrec :: ReadPrec UpdateCoreDefinitionResponse
readList :: ReadS [UpdateCoreDefinitionResponse]
$creadList :: ReadS [UpdateCoreDefinitionResponse]
readsPrec :: Int -> ReadS UpdateCoreDefinitionResponse
$creadsPrec :: Int -> ReadS UpdateCoreDefinitionResponse
Prelude.Read, Int -> UpdateCoreDefinitionResponse -> ShowS
[UpdateCoreDefinitionResponse] -> ShowS
UpdateCoreDefinitionResponse -> String
(Int -> UpdateCoreDefinitionResponse -> ShowS)
-> (UpdateCoreDefinitionResponse -> String)
-> ([UpdateCoreDefinitionResponse] -> ShowS)
-> Show UpdateCoreDefinitionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateCoreDefinitionResponse] -> ShowS
$cshowList :: [UpdateCoreDefinitionResponse] -> ShowS
show :: UpdateCoreDefinitionResponse -> String
$cshow :: UpdateCoreDefinitionResponse -> String
showsPrec :: Int -> UpdateCoreDefinitionResponse -> ShowS
$cshowsPrec :: Int -> UpdateCoreDefinitionResponse -> ShowS
Prelude.Show, (forall x.
UpdateCoreDefinitionResponse -> Rep UpdateCoreDefinitionResponse x)
-> (forall x.
Rep UpdateCoreDefinitionResponse x -> UpdateCoreDefinitionResponse)
-> Generic UpdateCoreDefinitionResponse
forall x.
Rep UpdateCoreDefinitionResponse x -> UpdateCoreDefinitionResponse
forall x.
UpdateCoreDefinitionResponse -> Rep UpdateCoreDefinitionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateCoreDefinitionResponse x -> UpdateCoreDefinitionResponse
$cfrom :: forall x.
UpdateCoreDefinitionResponse -> Rep UpdateCoreDefinitionResponse x
Prelude.Generic)
newUpdateCoreDefinitionResponse ::
Prelude.Int ->
UpdateCoreDefinitionResponse
newUpdateCoreDefinitionResponse :: Int -> UpdateCoreDefinitionResponse
newUpdateCoreDefinitionResponse Int
pHttpStatus_ =
UpdateCoreDefinitionResponse' :: Int -> UpdateCoreDefinitionResponse
UpdateCoreDefinitionResponse'
{ $sel:httpStatus:UpdateCoreDefinitionResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateCoreDefinitionResponse_httpStatus :: Lens.Lens' UpdateCoreDefinitionResponse Prelude.Int
updateCoreDefinitionResponse_httpStatus :: (Int -> f Int)
-> UpdateCoreDefinitionResponse -> f UpdateCoreDefinitionResponse
updateCoreDefinitionResponse_httpStatus = (UpdateCoreDefinitionResponse -> Int)
-> (UpdateCoreDefinitionResponse
-> Int -> UpdateCoreDefinitionResponse)
-> Lens
UpdateCoreDefinitionResponse UpdateCoreDefinitionResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateCoreDefinitionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateCoreDefinitionResponse' :: UpdateCoreDefinitionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateCoreDefinitionResponse
s@UpdateCoreDefinitionResponse' {} Int
a -> UpdateCoreDefinitionResponse
s {$sel:httpStatus:UpdateCoreDefinitionResponse' :: Int
httpStatus = Int
a} :: UpdateCoreDefinitionResponse)
instance Prelude.NFData UpdateCoreDefinitionResponse