{-# 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.UpdateLoggerDefinition
(
UpdateLoggerDefinition (..),
newUpdateLoggerDefinition,
updateLoggerDefinition_name,
updateLoggerDefinition_loggerDefinitionId,
UpdateLoggerDefinitionResponse (..),
newUpdateLoggerDefinitionResponse,
updateLoggerDefinitionResponse_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 UpdateLoggerDefinition = UpdateLoggerDefinition'
{
UpdateLoggerDefinition -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
UpdateLoggerDefinition -> Text
loggerDefinitionId :: Prelude.Text
}
deriving (UpdateLoggerDefinition -> UpdateLoggerDefinition -> Bool
(UpdateLoggerDefinition -> UpdateLoggerDefinition -> Bool)
-> (UpdateLoggerDefinition -> UpdateLoggerDefinition -> Bool)
-> Eq UpdateLoggerDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateLoggerDefinition -> UpdateLoggerDefinition -> Bool
$c/= :: UpdateLoggerDefinition -> UpdateLoggerDefinition -> Bool
== :: UpdateLoggerDefinition -> UpdateLoggerDefinition -> Bool
$c== :: UpdateLoggerDefinition -> UpdateLoggerDefinition -> Bool
Prelude.Eq, ReadPrec [UpdateLoggerDefinition]
ReadPrec UpdateLoggerDefinition
Int -> ReadS UpdateLoggerDefinition
ReadS [UpdateLoggerDefinition]
(Int -> ReadS UpdateLoggerDefinition)
-> ReadS [UpdateLoggerDefinition]
-> ReadPrec UpdateLoggerDefinition
-> ReadPrec [UpdateLoggerDefinition]
-> Read UpdateLoggerDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateLoggerDefinition]
$creadListPrec :: ReadPrec [UpdateLoggerDefinition]
readPrec :: ReadPrec UpdateLoggerDefinition
$creadPrec :: ReadPrec UpdateLoggerDefinition
readList :: ReadS [UpdateLoggerDefinition]
$creadList :: ReadS [UpdateLoggerDefinition]
readsPrec :: Int -> ReadS UpdateLoggerDefinition
$creadsPrec :: Int -> ReadS UpdateLoggerDefinition
Prelude.Read, Int -> UpdateLoggerDefinition -> ShowS
[UpdateLoggerDefinition] -> ShowS
UpdateLoggerDefinition -> String
(Int -> UpdateLoggerDefinition -> ShowS)
-> (UpdateLoggerDefinition -> String)
-> ([UpdateLoggerDefinition] -> ShowS)
-> Show UpdateLoggerDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateLoggerDefinition] -> ShowS
$cshowList :: [UpdateLoggerDefinition] -> ShowS
show :: UpdateLoggerDefinition -> String
$cshow :: UpdateLoggerDefinition -> String
showsPrec :: Int -> UpdateLoggerDefinition -> ShowS
$cshowsPrec :: Int -> UpdateLoggerDefinition -> ShowS
Prelude.Show, (forall x. UpdateLoggerDefinition -> Rep UpdateLoggerDefinition x)
-> (forall x.
Rep UpdateLoggerDefinition x -> UpdateLoggerDefinition)
-> Generic UpdateLoggerDefinition
forall x. Rep UpdateLoggerDefinition x -> UpdateLoggerDefinition
forall x. UpdateLoggerDefinition -> Rep UpdateLoggerDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateLoggerDefinition x -> UpdateLoggerDefinition
$cfrom :: forall x. UpdateLoggerDefinition -> Rep UpdateLoggerDefinition x
Prelude.Generic)
newUpdateLoggerDefinition ::
Prelude.Text ->
UpdateLoggerDefinition
newUpdateLoggerDefinition :: Text -> UpdateLoggerDefinition
newUpdateLoggerDefinition Text
pLoggerDefinitionId_ =
UpdateLoggerDefinition' :: Maybe Text -> Text -> UpdateLoggerDefinition
UpdateLoggerDefinition'
{ $sel:name:UpdateLoggerDefinition' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:loggerDefinitionId:UpdateLoggerDefinition' :: Text
loggerDefinitionId = Text
pLoggerDefinitionId_
}
updateLoggerDefinition_name :: Lens.Lens' UpdateLoggerDefinition (Prelude.Maybe Prelude.Text)
updateLoggerDefinition_name :: (Maybe Text -> f (Maybe Text))
-> UpdateLoggerDefinition -> f UpdateLoggerDefinition
updateLoggerDefinition_name = (UpdateLoggerDefinition -> Maybe Text)
-> (UpdateLoggerDefinition -> Maybe Text -> UpdateLoggerDefinition)
-> Lens
UpdateLoggerDefinition
UpdateLoggerDefinition
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateLoggerDefinition' {Maybe Text
name :: Maybe Text
$sel:name:UpdateLoggerDefinition' :: UpdateLoggerDefinition -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateLoggerDefinition
s@UpdateLoggerDefinition' {} Maybe Text
a -> UpdateLoggerDefinition
s {$sel:name:UpdateLoggerDefinition' :: Maybe Text
name = Maybe Text
a} :: UpdateLoggerDefinition)
updateLoggerDefinition_loggerDefinitionId :: Lens.Lens' UpdateLoggerDefinition Prelude.Text
updateLoggerDefinition_loggerDefinitionId :: (Text -> f Text)
-> UpdateLoggerDefinition -> f UpdateLoggerDefinition
updateLoggerDefinition_loggerDefinitionId = (UpdateLoggerDefinition -> Text)
-> (UpdateLoggerDefinition -> Text -> UpdateLoggerDefinition)
-> Lens UpdateLoggerDefinition UpdateLoggerDefinition Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateLoggerDefinition' {Text
loggerDefinitionId :: Text
$sel:loggerDefinitionId:UpdateLoggerDefinition' :: UpdateLoggerDefinition -> Text
loggerDefinitionId} -> Text
loggerDefinitionId) (\s :: UpdateLoggerDefinition
s@UpdateLoggerDefinition' {} Text
a -> UpdateLoggerDefinition
s {$sel:loggerDefinitionId:UpdateLoggerDefinition' :: Text
loggerDefinitionId = Text
a} :: UpdateLoggerDefinition)
instance Core.AWSRequest UpdateLoggerDefinition where
type
AWSResponse UpdateLoggerDefinition =
UpdateLoggerDefinitionResponse
request :: UpdateLoggerDefinition -> Request UpdateLoggerDefinition
request = Service -> UpdateLoggerDefinition -> Request UpdateLoggerDefinition
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy UpdateLoggerDefinition
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateLoggerDefinition)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse UpdateLoggerDefinition))
-> Logger
-> Service
-> Proxy UpdateLoggerDefinition
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse UpdateLoggerDefinition)))
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 -> UpdateLoggerDefinitionResponse
UpdateLoggerDefinitionResponse'
(Int -> UpdateLoggerDefinitionResponse)
-> Either String Int
-> Either String UpdateLoggerDefinitionResponse
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 UpdateLoggerDefinition
instance Prelude.NFData UpdateLoggerDefinition
instance Core.ToHeaders UpdateLoggerDefinition where
toHeaders :: UpdateLoggerDefinition -> ResponseHeaders
toHeaders =
ResponseHeaders -> UpdateLoggerDefinition -> 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 UpdateLoggerDefinition where
toJSON :: UpdateLoggerDefinition -> Value
toJSON UpdateLoggerDefinition' {Maybe Text
Text
loggerDefinitionId :: Text
name :: Maybe Text
$sel:loggerDefinitionId:UpdateLoggerDefinition' :: UpdateLoggerDefinition -> Text
$sel:name:UpdateLoggerDefinition' :: UpdateLoggerDefinition -> 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 UpdateLoggerDefinition where
toPath :: UpdateLoggerDefinition -> ByteString
toPath UpdateLoggerDefinition' {Maybe Text
Text
loggerDefinitionId :: Text
name :: Maybe Text
$sel:loggerDefinitionId:UpdateLoggerDefinition' :: UpdateLoggerDefinition -> Text
$sel:name:UpdateLoggerDefinition' :: UpdateLoggerDefinition -> Maybe Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/greengrass/definition/loggers/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
loggerDefinitionId
]
instance Core.ToQuery UpdateLoggerDefinition where
toQuery :: UpdateLoggerDefinition -> QueryString
toQuery = QueryString -> UpdateLoggerDefinition -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data UpdateLoggerDefinitionResponse = UpdateLoggerDefinitionResponse'
{
UpdateLoggerDefinitionResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateLoggerDefinitionResponse
-> UpdateLoggerDefinitionResponse -> Bool
(UpdateLoggerDefinitionResponse
-> UpdateLoggerDefinitionResponse -> Bool)
-> (UpdateLoggerDefinitionResponse
-> UpdateLoggerDefinitionResponse -> Bool)
-> Eq UpdateLoggerDefinitionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateLoggerDefinitionResponse
-> UpdateLoggerDefinitionResponse -> Bool
$c/= :: UpdateLoggerDefinitionResponse
-> UpdateLoggerDefinitionResponse -> Bool
== :: UpdateLoggerDefinitionResponse
-> UpdateLoggerDefinitionResponse -> Bool
$c== :: UpdateLoggerDefinitionResponse
-> UpdateLoggerDefinitionResponse -> Bool
Prelude.Eq, ReadPrec [UpdateLoggerDefinitionResponse]
ReadPrec UpdateLoggerDefinitionResponse
Int -> ReadS UpdateLoggerDefinitionResponse
ReadS [UpdateLoggerDefinitionResponse]
(Int -> ReadS UpdateLoggerDefinitionResponse)
-> ReadS [UpdateLoggerDefinitionResponse]
-> ReadPrec UpdateLoggerDefinitionResponse
-> ReadPrec [UpdateLoggerDefinitionResponse]
-> Read UpdateLoggerDefinitionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateLoggerDefinitionResponse]
$creadListPrec :: ReadPrec [UpdateLoggerDefinitionResponse]
readPrec :: ReadPrec UpdateLoggerDefinitionResponse
$creadPrec :: ReadPrec UpdateLoggerDefinitionResponse
readList :: ReadS [UpdateLoggerDefinitionResponse]
$creadList :: ReadS [UpdateLoggerDefinitionResponse]
readsPrec :: Int -> ReadS UpdateLoggerDefinitionResponse
$creadsPrec :: Int -> ReadS UpdateLoggerDefinitionResponse
Prelude.Read, Int -> UpdateLoggerDefinitionResponse -> ShowS
[UpdateLoggerDefinitionResponse] -> ShowS
UpdateLoggerDefinitionResponse -> String
(Int -> UpdateLoggerDefinitionResponse -> ShowS)
-> (UpdateLoggerDefinitionResponse -> String)
-> ([UpdateLoggerDefinitionResponse] -> ShowS)
-> Show UpdateLoggerDefinitionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateLoggerDefinitionResponse] -> ShowS
$cshowList :: [UpdateLoggerDefinitionResponse] -> ShowS
show :: UpdateLoggerDefinitionResponse -> String
$cshow :: UpdateLoggerDefinitionResponse -> String
showsPrec :: Int -> UpdateLoggerDefinitionResponse -> ShowS
$cshowsPrec :: Int -> UpdateLoggerDefinitionResponse -> ShowS
Prelude.Show, (forall x.
UpdateLoggerDefinitionResponse
-> Rep UpdateLoggerDefinitionResponse x)
-> (forall x.
Rep UpdateLoggerDefinitionResponse x
-> UpdateLoggerDefinitionResponse)
-> Generic UpdateLoggerDefinitionResponse
forall x.
Rep UpdateLoggerDefinitionResponse x
-> UpdateLoggerDefinitionResponse
forall x.
UpdateLoggerDefinitionResponse
-> Rep UpdateLoggerDefinitionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateLoggerDefinitionResponse x
-> UpdateLoggerDefinitionResponse
$cfrom :: forall x.
UpdateLoggerDefinitionResponse
-> Rep UpdateLoggerDefinitionResponse x
Prelude.Generic)
newUpdateLoggerDefinitionResponse ::
Prelude.Int ->
UpdateLoggerDefinitionResponse
newUpdateLoggerDefinitionResponse :: Int -> UpdateLoggerDefinitionResponse
newUpdateLoggerDefinitionResponse Int
pHttpStatus_ =
UpdateLoggerDefinitionResponse' :: Int -> UpdateLoggerDefinitionResponse
UpdateLoggerDefinitionResponse'
{ $sel:httpStatus:UpdateLoggerDefinitionResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
updateLoggerDefinitionResponse_httpStatus :: Lens.Lens' UpdateLoggerDefinitionResponse Prelude.Int
updateLoggerDefinitionResponse_httpStatus :: (Int -> f Int)
-> UpdateLoggerDefinitionResponse
-> f UpdateLoggerDefinitionResponse
updateLoggerDefinitionResponse_httpStatus = (UpdateLoggerDefinitionResponse -> Int)
-> (UpdateLoggerDefinitionResponse
-> Int -> UpdateLoggerDefinitionResponse)
-> Lens
UpdateLoggerDefinitionResponse
UpdateLoggerDefinitionResponse
Int
Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateLoggerDefinitionResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateLoggerDefinitionResponse' :: UpdateLoggerDefinitionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateLoggerDefinitionResponse
s@UpdateLoggerDefinitionResponse' {} Int
a -> UpdateLoggerDefinitionResponse
s {$sel:httpStatus:UpdateLoggerDefinitionResponse' :: Int
httpStatus = Int
a} :: UpdateLoggerDefinitionResponse)
instance
Prelude.NFData
UpdateLoggerDefinitionResponse