{-# 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.CreateCoreDefinition
-- 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 core definition. You may provide the initial version of the
-- core definition now or use \'\'CreateCoreDefinitionVersion\'\' at a
-- later time. Greengrass groups must each contain exactly one Greengrass
-- core.
module Amazonka.Greengrass.CreateCoreDefinition
  ( -- * Creating a Request
    CreateCoreDefinition (..),
    newCreateCoreDefinition,

    -- * Request Lenses
    createCoreDefinition_amznClientToken,
    createCoreDefinition_initialVersion,
    createCoreDefinition_name,
    createCoreDefinition_tags,

    -- * Destructuring the Response
    CreateCoreDefinitionResponse (..),
    newCreateCoreDefinitionResponse,

    -- * Response Lenses
    createCoreDefinitionResponse_latestVersionArn,
    createCoreDefinitionResponse_arn,
    createCoreDefinitionResponse_name,
    createCoreDefinitionResponse_creationTimestamp,
    createCoreDefinitionResponse_id,
    createCoreDefinitionResponse_latestVersion,
    createCoreDefinitionResponse_lastUpdatedTimestamp,
    createCoreDefinitionResponse_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

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

-- |
-- Create a value of 'CreateCoreDefinition' 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', 'createCoreDefinition_amznClientToken' - A client token used to correlate requests and responses.
--
-- 'initialVersion', 'createCoreDefinition_initialVersion' - Information about the initial version of the core definition.
--
-- 'name', 'createCoreDefinition_name' - The name of the core definition.
--
-- 'tags', 'createCoreDefinition_tags' - Tag(s) to add to the new resource.
newCreateCoreDefinition ::
  CreateCoreDefinition
newCreateCoreDefinition :: CreateCoreDefinition
newCreateCoreDefinition =
  CreateCoreDefinition' :: Maybe Text
-> Maybe CoreDefinitionVersion
-> Maybe Text
-> Maybe (HashMap Text Text)
-> CreateCoreDefinition
CreateCoreDefinition'
    { $sel:amznClientToken:CreateCoreDefinition' :: Maybe Text
amznClientToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:initialVersion:CreateCoreDefinition' :: Maybe CoreDefinitionVersion
initialVersion = Maybe CoreDefinitionVersion
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateCoreDefinition' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateCoreDefinition' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

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

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

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

-- | Tag(s) to add to the new resource.
createCoreDefinition_tags :: Lens.Lens' CreateCoreDefinition (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createCoreDefinition_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateCoreDefinition -> f CreateCoreDefinition
createCoreDefinition_tags = (CreateCoreDefinition -> Maybe (HashMap Text Text))
-> (CreateCoreDefinition
    -> Maybe (HashMap Text Text) -> CreateCoreDefinition)
-> Lens
     CreateCoreDefinition
     CreateCoreDefinition
     (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 (\CreateCoreDefinition' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateCoreDefinition' :: CreateCoreDefinition -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateCoreDefinition
s@CreateCoreDefinition' {} Maybe (HashMap Text Text)
a -> CreateCoreDefinition
s {$sel:tags:CreateCoreDefinition' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateCoreDefinition) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateCoreDefinition -> f CreateCoreDefinition)
-> ((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)))
-> CreateCoreDefinition
-> f CreateCoreDefinition
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 CreateCoreDefinition where
  type
    AWSResponse CreateCoreDefinition =
      CreateCoreDefinitionResponse
  request :: CreateCoreDefinition -> Request CreateCoreDefinition
request = Service -> CreateCoreDefinition -> Request CreateCoreDefinition
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateCoreDefinition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateCoreDefinition)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateCoreDefinition))
-> Logger
-> Service
-> Proxy CreateCoreDefinition
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateCoreDefinition)))
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
-> CreateCoreDefinitionResponse
CreateCoreDefinitionResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> CreateCoreDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateCoreDefinitionResponse)
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
   -> CreateCoreDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateCoreDefinitionResponse)
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
   -> CreateCoreDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateCoreDefinitionResponse)
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
   -> CreateCoreDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Maybe Text -> Int -> CreateCoreDefinitionResponse)
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 -> CreateCoreDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text -> Maybe Text -> Int -> CreateCoreDefinitionResponse)
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 -> CreateCoreDefinitionResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> CreateCoreDefinitionResponse)
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 -> CreateCoreDefinitionResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateCoreDefinitionResponse)
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 -> CreateCoreDefinitionResponse)
-> Either String Int -> Either String CreateCoreDefinitionResponse
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 CreateCoreDefinition

instance Prelude.NFData CreateCoreDefinition

instance Core.ToHeaders CreateCoreDefinition where
  toHeaders :: CreateCoreDefinition -> ResponseHeaders
toHeaders CreateCoreDefinition' {Maybe Text
Maybe (HashMap Text Text)
Maybe CoreDefinitionVersion
tags :: Maybe (HashMap Text Text)
name :: Maybe Text
initialVersion :: Maybe CoreDefinitionVersion
amznClientToken :: Maybe Text
$sel:tags:CreateCoreDefinition' :: CreateCoreDefinition -> Maybe (HashMap Text Text)
$sel:name:CreateCoreDefinition' :: CreateCoreDefinition -> Maybe Text
$sel:initialVersion:CreateCoreDefinition' :: CreateCoreDefinition -> Maybe CoreDefinitionVersion
$sel:amznClientToken:CreateCoreDefinition' :: CreateCoreDefinition -> 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 CreateCoreDefinition where
  toJSON :: CreateCoreDefinition -> Value
toJSON CreateCoreDefinition' {Maybe Text
Maybe (HashMap Text Text)
Maybe CoreDefinitionVersion
tags :: Maybe (HashMap Text Text)
name :: Maybe Text
initialVersion :: Maybe CoreDefinitionVersion
amznClientToken :: Maybe Text
$sel:tags:CreateCoreDefinition' :: CreateCoreDefinition -> Maybe (HashMap Text Text)
$sel:name:CreateCoreDefinition' :: CreateCoreDefinition -> Maybe Text
$sel:initialVersion:CreateCoreDefinition' :: CreateCoreDefinition -> Maybe CoreDefinitionVersion
$sel:amznClientToken:CreateCoreDefinition' :: CreateCoreDefinition -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"InitialVersion" Text -> CoreDefinitionVersion -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CoreDefinitionVersion -> Pair)
-> Maybe CoreDefinitionVersion -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CoreDefinitionVersion
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 CreateCoreDefinition where
  toPath :: CreateCoreDefinition -> ByteString
toPath = ByteString -> CreateCoreDefinition -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/greengrass/definition/cores"

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

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

-- |
-- Create a value of 'CreateCoreDefinitionResponse' 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', 'createCoreDefinitionResponse_latestVersionArn' - The ARN of the latest version associated with the definition.
--
-- 'arn', 'createCoreDefinitionResponse_arn' - The ARN of the definition.
--
-- 'name', 'createCoreDefinitionResponse_name' - The name of the definition.
--
-- 'creationTimestamp', 'createCoreDefinitionResponse_creationTimestamp' - The time, in milliseconds since the epoch, when the definition was
-- created.
--
-- 'id', 'createCoreDefinitionResponse_id' - The ID of the definition.
--
-- 'latestVersion', 'createCoreDefinitionResponse_latestVersion' - The ID of the latest version associated with the definition.
--
-- 'lastUpdatedTimestamp', 'createCoreDefinitionResponse_lastUpdatedTimestamp' - The time, in milliseconds since the epoch, when the definition was last
-- updated.
--
-- 'httpStatus', 'createCoreDefinitionResponse_httpStatus' - The response's http status code.
newCreateCoreDefinitionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateCoreDefinitionResponse
newCreateCoreDefinitionResponse :: Int -> CreateCoreDefinitionResponse
newCreateCoreDefinitionResponse Int
pHttpStatus_ =
  CreateCoreDefinitionResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateCoreDefinitionResponse
CreateCoreDefinitionResponse'
    { $sel:latestVersionArn:CreateCoreDefinitionResponse' :: Maybe Text
latestVersionArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:CreateCoreDefinitionResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateCoreDefinitionResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimestamp:CreateCoreDefinitionResponse' :: Maybe Text
creationTimestamp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:CreateCoreDefinitionResponse' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:latestVersion:CreateCoreDefinitionResponse' :: Maybe Text
latestVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimestamp:CreateCoreDefinitionResponse' :: Maybe Text
lastUpdatedTimestamp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateCoreDefinitionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

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

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

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

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

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

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

instance Prelude.NFData CreateCoreDefinitionResponse