{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Greengrass.CreateLoggerDefinition
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a logger definition. You may provide the initial version of the
-- logger definition now or use \'\'CreateLoggerDefinitionVersion\'\' at a
-- later time.
module Amazonka.Greengrass.CreateLoggerDefinition
  ( -- * Creating a Request
    CreateLoggerDefinition (..),
    newCreateLoggerDefinition,

    -- * Request Lenses
    createLoggerDefinition_amznClientToken,
    createLoggerDefinition_initialVersion,
    createLoggerDefinition_name,
    createLoggerDefinition_tags,

    -- * Destructuring the Response
    CreateLoggerDefinitionResponse (..),
    newCreateLoggerDefinitionResponse,

    -- * Response Lenses
    createLoggerDefinitionResponse_latestVersionArn,
    createLoggerDefinitionResponse_arn,
    createLoggerDefinitionResponse_name,
    createLoggerDefinitionResponse_creationTimestamp,
    createLoggerDefinitionResponse_id,
    createLoggerDefinitionResponse_latestVersion,
    createLoggerDefinitionResponse_lastUpdatedTimestamp,
    createLoggerDefinitionResponse_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

-- | /See:/ 'newCreateLoggerDefinition' smart constructor.
data CreateLoggerDefinition = CreateLoggerDefinition'
  { -- | A client token used to correlate requests and responses.
    CreateLoggerDefinition -> Maybe Text
amznClientToken :: Prelude.Maybe Prelude.Text,
    -- | Information about the initial version of the logger definition.
    CreateLoggerDefinition -> Maybe LoggerDefinitionVersion
initialVersion :: Prelude.Maybe LoggerDefinitionVersion,
    -- | The name of the logger definition.
    CreateLoggerDefinition -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Tag(s) to add to the new resource.
    CreateLoggerDefinition -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (CreateLoggerDefinition -> CreateLoggerDefinition -> Bool
(CreateLoggerDefinition -> CreateLoggerDefinition -> Bool)
-> (CreateLoggerDefinition -> CreateLoggerDefinition -> Bool)
-> Eq CreateLoggerDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLoggerDefinition -> CreateLoggerDefinition -> Bool
$c/= :: CreateLoggerDefinition -> CreateLoggerDefinition -> Bool
== :: CreateLoggerDefinition -> CreateLoggerDefinition -> Bool
$c== :: CreateLoggerDefinition -> CreateLoggerDefinition -> Bool
Prelude.Eq, ReadPrec [CreateLoggerDefinition]
ReadPrec CreateLoggerDefinition
Int -> ReadS CreateLoggerDefinition
ReadS [CreateLoggerDefinition]
(Int -> ReadS CreateLoggerDefinition)
-> ReadS [CreateLoggerDefinition]
-> ReadPrec CreateLoggerDefinition
-> ReadPrec [CreateLoggerDefinition]
-> Read CreateLoggerDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLoggerDefinition]
$creadListPrec :: ReadPrec [CreateLoggerDefinition]
readPrec :: ReadPrec CreateLoggerDefinition
$creadPrec :: ReadPrec CreateLoggerDefinition
readList :: ReadS [CreateLoggerDefinition]
$creadList :: ReadS [CreateLoggerDefinition]
readsPrec :: Int -> ReadS CreateLoggerDefinition
$creadsPrec :: Int -> ReadS CreateLoggerDefinition
Prelude.Read, Int -> CreateLoggerDefinition -> ShowS
[CreateLoggerDefinition] -> ShowS
CreateLoggerDefinition -> String
(Int -> CreateLoggerDefinition -> ShowS)
-> (CreateLoggerDefinition -> String)
-> ([CreateLoggerDefinition] -> ShowS)
-> Show CreateLoggerDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLoggerDefinition] -> ShowS
$cshowList :: [CreateLoggerDefinition] -> ShowS
show :: CreateLoggerDefinition -> String
$cshow :: CreateLoggerDefinition -> String
showsPrec :: Int -> CreateLoggerDefinition -> ShowS
$cshowsPrec :: Int -> CreateLoggerDefinition -> ShowS
Prelude.Show, (forall x. CreateLoggerDefinition -> Rep CreateLoggerDefinition x)
-> (forall x.
    Rep CreateLoggerDefinition x -> CreateLoggerDefinition)
-> Generic CreateLoggerDefinition
forall x. Rep CreateLoggerDefinition x -> CreateLoggerDefinition
forall x. CreateLoggerDefinition -> Rep CreateLoggerDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateLoggerDefinition x -> CreateLoggerDefinition
$cfrom :: forall x. CreateLoggerDefinition -> Rep CreateLoggerDefinition x
Prelude.Generic)

-- |
-- Create a value of 'CreateLoggerDefinition' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'amznClientToken', 'createLoggerDefinition_amznClientToken' - A client token used to correlate requests and responses.
--
-- 'initialVersion', 'createLoggerDefinition_initialVersion' - Information about the initial version of the logger definition.
--
-- 'name', 'createLoggerDefinition_name' - The name of the logger definition.
--
-- 'tags', 'createLoggerDefinition_tags' - Tag(s) to add to the new resource.
newCreateLoggerDefinition ::
  CreateLoggerDefinition
newCreateLoggerDefinition :: CreateLoggerDefinition
newCreateLoggerDefinition =
  CreateLoggerDefinition' :: Maybe Text
-> Maybe LoggerDefinitionVersion
-> Maybe Text
-> Maybe (HashMap Text Text)
-> CreateLoggerDefinition
CreateLoggerDefinition'
    { $sel:amznClientToken:CreateLoggerDefinition' :: Maybe Text
amznClientToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:initialVersion:CreateLoggerDefinition' :: Maybe LoggerDefinitionVersion
initialVersion = Maybe LoggerDefinitionVersion
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateLoggerDefinition' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateLoggerDefinition' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

-- | A client token used to correlate requests and responses.
createLoggerDefinition_amznClientToken :: Lens.Lens' CreateLoggerDefinition (Prelude.Maybe Prelude.Text)
createLoggerDefinition_amznClientToken :: (Maybe Text -> f (Maybe Text))
-> CreateLoggerDefinition -> f CreateLoggerDefinition
createLoggerDefinition_amznClientToken = (CreateLoggerDefinition -> Maybe Text)
-> (CreateLoggerDefinition -> Maybe Text -> CreateLoggerDefinition)
-> Lens
     CreateLoggerDefinition
     CreateLoggerDefinition
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoggerDefinition' {Maybe Text
amznClientToken :: Maybe Text
$sel:amznClientToken:CreateLoggerDefinition' :: CreateLoggerDefinition -> Maybe Text
amznClientToken} -> Maybe Text
amznClientToken) (\s :: CreateLoggerDefinition
s@CreateLoggerDefinition' {} Maybe Text
a -> CreateLoggerDefinition
s {$sel:amznClientToken:CreateLoggerDefinition' :: Maybe Text
amznClientToken = Maybe Text
a} :: CreateLoggerDefinition)

-- | Information about the initial version of the logger definition.
createLoggerDefinition_initialVersion :: Lens.Lens' CreateLoggerDefinition (Prelude.Maybe LoggerDefinitionVersion)
createLoggerDefinition_initialVersion :: (Maybe LoggerDefinitionVersion
 -> f (Maybe LoggerDefinitionVersion))
-> CreateLoggerDefinition -> f CreateLoggerDefinition
createLoggerDefinition_initialVersion = (CreateLoggerDefinition -> Maybe LoggerDefinitionVersion)
-> (CreateLoggerDefinition
    -> Maybe LoggerDefinitionVersion -> CreateLoggerDefinition)
-> Lens
     CreateLoggerDefinition
     CreateLoggerDefinition
     (Maybe LoggerDefinitionVersion)
     (Maybe LoggerDefinitionVersion)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoggerDefinition' {Maybe LoggerDefinitionVersion
initialVersion :: Maybe LoggerDefinitionVersion
$sel:initialVersion:CreateLoggerDefinition' :: CreateLoggerDefinition -> Maybe LoggerDefinitionVersion
initialVersion} -> Maybe LoggerDefinitionVersion
initialVersion) (\s :: CreateLoggerDefinition
s@CreateLoggerDefinition' {} Maybe LoggerDefinitionVersion
a -> CreateLoggerDefinition
s {$sel:initialVersion:CreateLoggerDefinition' :: Maybe LoggerDefinitionVersion
initialVersion = Maybe LoggerDefinitionVersion
a} :: CreateLoggerDefinition)

-- | The name of the logger definition.
createLoggerDefinition_name :: Lens.Lens' CreateLoggerDefinition (Prelude.Maybe Prelude.Text)
createLoggerDefinition_name :: (Maybe Text -> f (Maybe Text))
-> CreateLoggerDefinition -> f CreateLoggerDefinition
createLoggerDefinition_name = (CreateLoggerDefinition -> Maybe Text)
-> (CreateLoggerDefinition -> Maybe Text -> CreateLoggerDefinition)
-> Lens
     CreateLoggerDefinition
     CreateLoggerDefinition
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoggerDefinition' {Maybe Text
name :: Maybe Text
$sel:name:CreateLoggerDefinition' :: CreateLoggerDefinition -> Maybe Text
name} -> Maybe Text
name) (\s :: CreateLoggerDefinition
s@CreateLoggerDefinition' {} Maybe Text
a -> CreateLoggerDefinition
s {$sel:name:CreateLoggerDefinition' :: Maybe Text
name = Maybe Text
a} :: CreateLoggerDefinition)

-- | Tag(s) to add to the new resource.
createLoggerDefinition_tags :: Lens.Lens' CreateLoggerDefinition (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createLoggerDefinition_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateLoggerDefinition -> f CreateLoggerDefinition
createLoggerDefinition_tags = (CreateLoggerDefinition -> Maybe (HashMap Text Text))
-> (CreateLoggerDefinition
    -> Maybe (HashMap Text Text) -> CreateLoggerDefinition)
-> Lens
     CreateLoggerDefinition
     CreateLoggerDefinition
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoggerDefinition' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateLoggerDefinition' :: CreateLoggerDefinition -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateLoggerDefinition
s@CreateLoggerDefinition' {} Maybe (HashMap Text Text)
a -> CreateLoggerDefinition
s {$sel:tags:CreateLoggerDefinition' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateLoggerDefinition) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateLoggerDefinition -> f CreateLoggerDefinition)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateLoggerDefinition
-> f CreateLoggerDefinition
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest CreateLoggerDefinition where
  type
    AWSResponse CreateLoggerDefinition =
      CreateLoggerDefinitionResponse
  request :: CreateLoggerDefinition -> Request CreateLoggerDefinition
request = Service -> CreateLoggerDefinition -> Request CreateLoggerDefinition
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateLoggerDefinition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateLoggerDefinition)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateLoggerDefinition))
-> Logger
-> Service
-> Proxy CreateLoggerDefinition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateLoggerDefinition)))
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 Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateLoggerDefinitionResponse
CreateLoggerDefinitionResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> CreateLoggerDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateLoggerDefinitionResponse)
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
"LatestVersionArn")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateLoggerDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateLoggerDefinitionResponse)
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
"Arn")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateLoggerDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateLoggerDefinitionResponse)
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 Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateLoggerDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateLoggerDefinitionResponse)
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
"CreationTimestamp")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateLoggerDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text -> Maybe Text -> Int -> CreateLoggerDefinitionResponse)
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
"Id")
            Either
  String
  (Maybe Text -> Maybe Text -> Int -> CreateLoggerDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> CreateLoggerDefinitionResponse)
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
"LatestVersion")
            Either String (Maybe Text -> Int -> CreateLoggerDefinitionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateLoggerDefinitionResponse)
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
"LastUpdatedTimestamp")
            Either String (Int -> CreateLoggerDefinitionResponse)
-> Either String Int
-> Either String CreateLoggerDefinitionResponse
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 CreateLoggerDefinition

instance Prelude.NFData CreateLoggerDefinition

instance Core.ToHeaders CreateLoggerDefinition where
  toHeaders :: CreateLoggerDefinition -> ResponseHeaders
toHeaders CreateLoggerDefinition' {Maybe Text
Maybe (HashMap Text Text)
Maybe LoggerDefinitionVersion
tags :: Maybe (HashMap Text Text)
name :: Maybe Text
initialVersion :: Maybe LoggerDefinitionVersion
amznClientToken :: Maybe Text
$sel:tags:CreateLoggerDefinition' :: CreateLoggerDefinition -> Maybe (HashMap Text Text)
$sel:name:CreateLoggerDefinition' :: CreateLoggerDefinition -> Maybe Text
$sel:initialVersion:CreateLoggerDefinition' :: CreateLoggerDefinition -> Maybe LoggerDefinitionVersion
$sel:amznClientToken:CreateLoggerDefinition' :: CreateLoggerDefinition -> Maybe Text
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"X-Amzn-Client-Token" HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
amznClientToken,
        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 CreateLoggerDefinition where
  toJSON :: CreateLoggerDefinition -> Value
toJSON CreateLoggerDefinition' {Maybe Text
Maybe (HashMap Text Text)
Maybe LoggerDefinitionVersion
tags :: Maybe (HashMap Text Text)
name :: Maybe Text
initialVersion :: Maybe LoggerDefinitionVersion
amznClientToken :: Maybe Text
$sel:tags:CreateLoggerDefinition' :: CreateLoggerDefinition -> Maybe (HashMap Text Text)
$sel:name:CreateLoggerDefinition' :: CreateLoggerDefinition -> Maybe Text
$sel:initialVersion:CreateLoggerDefinition' :: CreateLoggerDefinition -> Maybe LoggerDefinitionVersion
$sel:amznClientToken:CreateLoggerDefinition' :: CreateLoggerDefinition -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"InitialVersion" Text -> LoggerDefinitionVersion -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (LoggerDefinitionVersion -> Pair)
-> Maybe LoggerDefinitionVersion -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe LoggerDefinitionVersion
initialVersion,
            (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,
            (Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags
          ]
      )

instance Core.ToPath CreateLoggerDefinition where
  toPath :: CreateLoggerDefinition -> ByteString
toPath =
    ByteString -> CreateLoggerDefinition -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/greengrass/definition/loggers"

instance Core.ToQuery CreateLoggerDefinition where
  toQuery :: CreateLoggerDefinition -> QueryString
toQuery = QueryString -> CreateLoggerDefinition -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateLoggerDefinitionResponse' smart constructor.
data CreateLoggerDefinitionResponse = CreateLoggerDefinitionResponse'
  { -- | The ARN of the latest version associated with the definition.
    CreateLoggerDefinitionResponse -> Maybe Text
latestVersionArn :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the definition.
    CreateLoggerDefinitionResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The name of the definition.
    CreateLoggerDefinitionResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The time, in milliseconds since the epoch, when the definition was
    -- created.
    CreateLoggerDefinitionResponse -> Maybe Text
creationTimestamp :: Prelude.Maybe Prelude.Text,
    -- | The ID of the definition.
    CreateLoggerDefinitionResponse -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The ID of the latest version associated with the definition.
    CreateLoggerDefinitionResponse -> Maybe Text
latestVersion :: Prelude.Maybe Prelude.Text,
    -- | The time, in milliseconds since the epoch, when the definition was last
    -- updated.
    CreateLoggerDefinitionResponse -> Maybe Text
lastUpdatedTimestamp :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateLoggerDefinitionResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateLoggerDefinitionResponse
-> CreateLoggerDefinitionResponse -> Bool
(CreateLoggerDefinitionResponse
 -> CreateLoggerDefinitionResponse -> Bool)
-> (CreateLoggerDefinitionResponse
    -> CreateLoggerDefinitionResponse -> Bool)
-> Eq CreateLoggerDefinitionResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLoggerDefinitionResponse
-> CreateLoggerDefinitionResponse -> Bool
$c/= :: CreateLoggerDefinitionResponse
-> CreateLoggerDefinitionResponse -> Bool
== :: CreateLoggerDefinitionResponse
-> CreateLoggerDefinitionResponse -> Bool
$c== :: CreateLoggerDefinitionResponse
-> CreateLoggerDefinitionResponse -> Bool
Prelude.Eq, ReadPrec [CreateLoggerDefinitionResponse]
ReadPrec CreateLoggerDefinitionResponse
Int -> ReadS CreateLoggerDefinitionResponse
ReadS [CreateLoggerDefinitionResponse]
(Int -> ReadS CreateLoggerDefinitionResponse)
-> ReadS [CreateLoggerDefinitionResponse]
-> ReadPrec CreateLoggerDefinitionResponse
-> ReadPrec [CreateLoggerDefinitionResponse]
-> Read CreateLoggerDefinitionResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLoggerDefinitionResponse]
$creadListPrec :: ReadPrec [CreateLoggerDefinitionResponse]
readPrec :: ReadPrec CreateLoggerDefinitionResponse
$creadPrec :: ReadPrec CreateLoggerDefinitionResponse
readList :: ReadS [CreateLoggerDefinitionResponse]
$creadList :: ReadS [CreateLoggerDefinitionResponse]
readsPrec :: Int -> ReadS CreateLoggerDefinitionResponse
$creadsPrec :: Int -> ReadS CreateLoggerDefinitionResponse
Prelude.Read, Int -> CreateLoggerDefinitionResponse -> ShowS
[CreateLoggerDefinitionResponse] -> ShowS
CreateLoggerDefinitionResponse -> String
(Int -> CreateLoggerDefinitionResponse -> ShowS)
-> (CreateLoggerDefinitionResponse -> String)
-> ([CreateLoggerDefinitionResponse] -> ShowS)
-> Show CreateLoggerDefinitionResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLoggerDefinitionResponse] -> ShowS
$cshowList :: [CreateLoggerDefinitionResponse] -> ShowS
show :: CreateLoggerDefinitionResponse -> String
$cshow :: CreateLoggerDefinitionResponse -> String
showsPrec :: Int -> CreateLoggerDefinitionResponse -> ShowS
$cshowsPrec :: Int -> CreateLoggerDefinitionResponse -> ShowS
Prelude.Show, (forall x.
 CreateLoggerDefinitionResponse
 -> Rep CreateLoggerDefinitionResponse x)
-> (forall x.
    Rep CreateLoggerDefinitionResponse x
    -> CreateLoggerDefinitionResponse)
-> Generic CreateLoggerDefinitionResponse
forall x.
Rep CreateLoggerDefinitionResponse x
-> CreateLoggerDefinitionResponse
forall x.
CreateLoggerDefinitionResponse
-> Rep CreateLoggerDefinitionResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateLoggerDefinitionResponse x
-> CreateLoggerDefinitionResponse
$cfrom :: forall x.
CreateLoggerDefinitionResponse
-> Rep CreateLoggerDefinitionResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateLoggerDefinitionResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'latestVersionArn', 'createLoggerDefinitionResponse_latestVersionArn' - The ARN of the latest version associated with the definition.
--
-- 'arn', 'createLoggerDefinitionResponse_arn' - The ARN of the definition.
--
-- 'name', 'createLoggerDefinitionResponse_name' - The name of the definition.
--
-- 'creationTimestamp', 'createLoggerDefinitionResponse_creationTimestamp' - The time, in milliseconds since the epoch, when the definition was
-- created.
--
-- 'id', 'createLoggerDefinitionResponse_id' - The ID of the definition.
--
-- 'latestVersion', 'createLoggerDefinitionResponse_latestVersion' - The ID of the latest version associated with the definition.
--
-- 'lastUpdatedTimestamp', 'createLoggerDefinitionResponse_lastUpdatedTimestamp' - The time, in milliseconds since the epoch, when the definition was last
-- updated.
--
-- 'httpStatus', 'createLoggerDefinitionResponse_httpStatus' - The response's http status code.
newCreateLoggerDefinitionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateLoggerDefinitionResponse
newCreateLoggerDefinitionResponse :: Int -> CreateLoggerDefinitionResponse
newCreateLoggerDefinitionResponse Int
pHttpStatus_ =
  CreateLoggerDefinitionResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateLoggerDefinitionResponse
CreateLoggerDefinitionResponse'
    { $sel:latestVersionArn:CreateLoggerDefinitionResponse' :: Maybe Text
latestVersionArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:CreateLoggerDefinitionResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateLoggerDefinitionResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimestamp:CreateLoggerDefinitionResponse' :: Maybe Text
creationTimestamp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:CreateLoggerDefinitionResponse' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:latestVersion:CreateLoggerDefinitionResponse' :: Maybe Text
latestVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimestamp:CreateLoggerDefinitionResponse' :: Maybe Text
lastUpdatedTimestamp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateLoggerDefinitionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the latest version associated with the definition.
createLoggerDefinitionResponse_latestVersionArn :: Lens.Lens' CreateLoggerDefinitionResponse (Prelude.Maybe Prelude.Text)
createLoggerDefinitionResponse_latestVersionArn :: (Maybe Text -> f (Maybe Text))
-> CreateLoggerDefinitionResponse
-> f CreateLoggerDefinitionResponse
createLoggerDefinitionResponse_latestVersionArn = (CreateLoggerDefinitionResponse -> Maybe Text)
-> (CreateLoggerDefinitionResponse
    -> Maybe Text -> CreateLoggerDefinitionResponse)
-> Lens
     CreateLoggerDefinitionResponse
     CreateLoggerDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoggerDefinitionResponse' {Maybe Text
latestVersionArn :: Maybe Text
$sel:latestVersionArn:CreateLoggerDefinitionResponse' :: CreateLoggerDefinitionResponse -> Maybe Text
latestVersionArn} -> Maybe Text
latestVersionArn) (\s :: CreateLoggerDefinitionResponse
s@CreateLoggerDefinitionResponse' {} Maybe Text
a -> CreateLoggerDefinitionResponse
s {$sel:latestVersionArn:CreateLoggerDefinitionResponse' :: Maybe Text
latestVersionArn = Maybe Text
a} :: CreateLoggerDefinitionResponse)

-- | The ARN of the definition.
createLoggerDefinitionResponse_arn :: Lens.Lens' CreateLoggerDefinitionResponse (Prelude.Maybe Prelude.Text)
createLoggerDefinitionResponse_arn :: (Maybe Text -> f (Maybe Text))
-> CreateLoggerDefinitionResponse
-> f CreateLoggerDefinitionResponse
createLoggerDefinitionResponse_arn = (CreateLoggerDefinitionResponse -> Maybe Text)
-> (CreateLoggerDefinitionResponse
    -> Maybe Text -> CreateLoggerDefinitionResponse)
-> Lens
     CreateLoggerDefinitionResponse
     CreateLoggerDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoggerDefinitionResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:CreateLoggerDefinitionResponse' :: CreateLoggerDefinitionResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CreateLoggerDefinitionResponse
s@CreateLoggerDefinitionResponse' {} Maybe Text
a -> CreateLoggerDefinitionResponse
s {$sel:arn:CreateLoggerDefinitionResponse' :: Maybe Text
arn = Maybe Text
a} :: CreateLoggerDefinitionResponse)

-- | The name of the definition.
createLoggerDefinitionResponse_name :: Lens.Lens' CreateLoggerDefinitionResponse (Prelude.Maybe Prelude.Text)
createLoggerDefinitionResponse_name :: (Maybe Text -> f (Maybe Text))
-> CreateLoggerDefinitionResponse
-> f CreateLoggerDefinitionResponse
createLoggerDefinitionResponse_name = (CreateLoggerDefinitionResponse -> Maybe Text)
-> (CreateLoggerDefinitionResponse
    -> Maybe Text -> CreateLoggerDefinitionResponse)
-> Lens
     CreateLoggerDefinitionResponse
     CreateLoggerDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoggerDefinitionResponse' {Maybe Text
name :: Maybe Text
$sel:name:CreateLoggerDefinitionResponse' :: CreateLoggerDefinitionResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: CreateLoggerDefinitionResponse
s@CreateLoggerDefinitionResponse' {} Maybe Text
a -> CreateLoggerDefinitionResponse
s {$sel:name:CreateLoggerDefinitionResponse' :: Maybe Text
name = Maybe Text
a} :: CreateLoggerDefinitionResponse)

-- | The time, in milliseconds since the epoch, when the definition was
-- created.
createLoggerDefinitionResponse_creationTimestamp :: Lens.Lens' CreateLoggerDefinitionResponse (Prelude.Maybe Prelude.Text)
createLoggerDefinitionResponse_creationTimestamp :: (Maybe Text -> f (Maybe Text))
-> CreateLoggerDefinitionResponse
-> f CreateLoggerDefinitionResponse
createLoggerDefinitionResponse_creationTimestamp = (CreateLoggerDefinitionResponse -> Maybe Text)
-> (CreateLoggerDefinitionResponse
    -> Maybe Text -> CreateLoggerDefinitionResponse)
-> Lens
     CreateLoggerDefinitionResponse
     CreateLoggerDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoggerDefinitionResponse' {Maybe Text
creationTimestamp :: Maybe Text
$sel:creationTimestamp:CreateLoggerDefinitionResponse' :: CreateLoggerDefinitionResponse -> Maybe Text
creationTimestamp} -> Maybe Text
creationTimestamp) (\s :: CreateLoggerDefinitionResponse
s@CreateLoggerDefinitionResponse' {} Maybe Text
a -> CreateLoggerDefinitionResponse
s {$sel:creationTimestamp:CreateLoggerDefinitionResponse' :: Maybe Text
creationTimestamp = Maybe Text
a} :: CreateLoggerDefinitionResponse)

-- | The ID of the definition.
createLoggerDefinitionResponse_id :: Lens.Lens' CreateLoggerDefinitionResponse (Prelude.Maybe Prelude.Text)
createLoggerDefinitionResponse_id :: (Maybe Text -> f (Maybe Text))
-> CreateLoggerDefinitionResponse
-> f CreateLoggerDefinitionResponse
createLoggerDefinitionResponse_id = (CreateLoggerDefinitionResponse -> Maybe Text)
-> (CreateLoggerDefinitionResponse
    -> Maybe Text -> CreateLoggerDefinitionResponse)
-> Lens
     CreateLoggerDefinitionResponse
     CreateLoggerDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoggerDefinitionResponse' {Maybe Text
id :: Maybe Text
$sel:id:CreateLoggerDefinitionResponse' :: CreateLoggerDefinitionResponse -> Maybe Text
id} -> Maybe Text
id) (\s :: CreateLoggerDefinitionResponse
s@CreateLoggerDefinitionResponse' {} Maybe Text
a -> CreateLoggerDefinitionResponse
s {$sel:id:CreateLoggerDefinitionResponse' :: Maybe Text
id = Maybe Text
a} :: CreateLoggerDefinitionResponse)

-- | The ID of the latest version associated with the definition.
createLoggerDefinitionResponse_latestVersion :: Lens.Lens' CreateLoggerDefinitionResponse (Prelude.Maybe Prelude.Text)
createLoggerDefinitionResponse_latestVersion :: (Maybe Text -> f (Maybe Text))
-> CreateLoggerDefinitionResponse
-> f CreateLoggerDefinitionResponse
createLoggerDefinitionResponse_latestVersion = (CreateLoggerDefinitionResponse -> Maybe Text)
-> (CreateLoggerDefinitionResponse
    -> Maybe Text -> CreateLoggerDefinitionResponse)
-> Lens
     CreateLoggerDefinitionResponse
     CreateLoggerDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoggerDefinitionResponse' {Maybe Text
latestVersion :: Maybe Text
$sel:latestVersion:CreateLoggerDefinitionResponse' :: CreateLoggerDefinitionResponse -> Maybe Text
latestVersion} -> Maybe Text
latestVersion) (\s :: CreateLoggerDefinitionResponse
s@CreateLoggerDefinitionResponse' {} Maybe Text
a -> CreateLoggerDefinitionResponse
s {$sel:latestVersion:CreateLoggerDefinitionResponse' :: Maybe Text
latestVersion = Maybe Text
a} :: CreateLoggerDefinitionResponse)

-- | The time, in milliseconds since the epoch, when the definition was last
-- updated.
createLoggerDefinitionResponse_lastUpdatedTimestamp :: Lens.Lens' CreateLoggerDefinitionResponse (Prelude.Maybe Prelude.Text)
createLoggerDefinitionResponse_lastUpdatedTimestamp :: (Maybe Text -> f (Maybe Text))
-> CreateLoggerDefinitionResponse
-> f CreateLoggerDefinitionResponse
createLoggerDefinitionResponse_lastUpdatedTimestamp = (CreateLoggerDefinitionResponse -> Maybe Text)
-> (CreateLoggerDefinitionResponse
    -> Maybe Text -> CreateLoggerDefinitionResponse)
-> Lens
     CreateLoggerDefinitionResponse
     CreateLoggerDefinitionResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoggerDefinitionResponse' {Maybe Text
lastUpdatedTimestamp :: Maybe Text
$sel:lastUpdatedTimestamp:CreateLoggerDefinitionResponse' :: CreateLoggerDefinitionResponse -> Maybe Text
lastUpdatedTimestamp} -> Maybe Text
lastUpdatedTimestamp) (\s :: CreateLoggerDefinitionResponse
s@CreateLoggerDefinitionResponse' {} Maybe Text
a -> CreateLoggerDefinitionResponse
s {$sel:lastUpdatedTimestamp:CreateLoggerDefinitionResponse' :: Maybe Text
lastUpdatedTimestamp = Maybe Text
a} :: CreateLoggerDefinitionResponse)

-- | The response's http status code.
createLoggerDefinitionResponse_httpStatus :: Lens.Lens' CreateLoggerDefinitionResponse Prelude.Int
createLoggerDefinitionResponse_httpStatus :: (Int -> f Int)
-> CreateLoggerDefinitionResponse
-> f CreateLoggerDefinitionResponse
createLoggerDefinitionResponse_httpStatus = (CreateLoggerDefinitionResponse -> Int)
-> (CreateLoggerDefinitionResponse
    -> Int -> CreateLoggerDefinitionResponse)
-> Lens
     CreateLoggerDefinitionResponse
     CreateLoggerDefinitionResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLoggerDefinitionResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateLoggerDefinitionResponse' :: CreateLoggerDefinitionResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateLoggerDefinitionResponse
s@CreateLoggerDefinitionResponse' {} Int
a -> CreateLoggerDefinitionResponse
s {$sel:httpStatus:CreateLoggerDefinitionResponse' :: Int
httpStatus = Int
a} :: CreateLoggerDefinitionResponse)

instance
  Prelude.NFData
    CreateLoggerDefinitionResponse