{-# 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.CreateResourceDefinition
-- 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 resource definition which contains a list of resources to be
-- used in a group. You can create an initial version of the definition by
-- providing a list of resources now, or use
-- \'\'CreateResourceDefinitionVersion\'\' later.
module Amazonka.Greengrass.CreateResourceDefinition
  ( -- * Creating a Request
    CreateResourceDefinition (..),
    newCreateResourceDefinition,

    -- * Request Lenses
    createResourceDefinition_amznClientToken,
    createResourceDefinition_initialVersion,
    createResourceDefinition_name,
    createResourceDefinition_tags,

    -- * Destructuring the Response
    CreateResourceDefinitionResponse (..),
    newCreateResourceDefinitionResponse,

    -- * Response Lenses
    createResourceDefinitionResponse_latestVersionArn,
    createResourceDefinitionResponse_arn,
    createResourceDefinitionResponse_name,
    createResourceDefinitionResponse_creationTimestamp,
    createResourceDefinitionResponse_id,
    createResourceDefinitionResponse_latestVersion,
    createResourceDefinitionResponse_lastUpdatedTimestamp,
    createResourceDefinitionResponse_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:/ 'newCreateResourceDefinition' smart constructor.
data CreateResourceDefinition = CreateResourceDefinition'
  { -- | A client token used to correlate requests and responses.
    CreateResourceDefinition -> Maybe Text
amznClientToken :: Prelude.Maybe Prelude.Text,
    -- | Information about the initial version of the resource definition.
    CreateResourceDefinition -> Maybe ResourceDefinitionVersion
initialVersion :: Prelude.Maybe ResourceDefinitionVersion,
    -- | The name of the resource definition.
    CreateResourceDefinition -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | Tag(s) to add to the new resource.
    CreateResourceDefinition -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text)
  }
  deriving (CreateResourceDefinition -> CreateResourceDefinition -> Bool
(CreateResourceDefinition -> CreateResourceDefinition -> Bool)
-> (CreateResourceDefinition -> CreateResourceDefinition -> Bool)
-> Eq CreateResourceDefinition
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateResourceDefinition -> CreateResourceDefinition -> Bool
$c/= :: CreateResourceDefinition -> CreateResourceDefinition -> Bool
== :: CreateResourceDefinition -> CreateResourceDefinition -> Bool
$c== :: CreateResourceDefinition -> CreateResourceDefinition -> Bool
Prelude.Eq, ReadPrec [CreateResourceDefinition]
ReadPrec CreateResourceDefinition
Int -> ReadS CreateResourceDefinition
ReadS [CreateResourceDefinition]
(Int -> ReadS CreateResourceDefinition)
-> ReadS [CreateResourceDefinition]
-> ReadPrec CreateResourceDefinition
-> ReadPrec [CreateResourceDefinition]
-> Read CreateResourceDefinition
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateResourceDefinition]
$creadListPrec :: ReadPrec [CreateResourceDefinition]
readPrec :: ReadPrec CreateResourceDefinition
$creadPrec :: ReadPrec CreateResourceDefinition
readList :: ReadS [CreateResourceDefinition]
$creadList :: ReadS [CreateResourceDefinition]
readsPrec :: Int -> ReadS CreateResourceDefinition
$creadsPrec :: Int -> ReadS CreateResourceDefinition
Prelude.Read, Int -> CreateResourceDefinition -> ShowS
[CreateResourceDefinition] -> ShowS
CreateResourceDefinition -> String
(Int -> CreateResourceDefinition -> ShowS)
-> (CreateResourceDefinition -> String)
-> ([CreateResourceDefinition] -> ShowS)
-> Show CreateResourceDefinition
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateResourceDefinition] -> ShowS
$cshowList :: [CreateResourceDefinition] -> ShowS
show :: CreateResourceDefinition -> String
$cshow :: CreateResourceDefinition -> String
showsPrec :: Int -> CreateResourceDefinition -> ShowS
$cshowsPrec :: Int -> CreateResourceDefinition -> ShowS
Prelude.Show, (forall x.
 CreateResourceDefinition -> Rep CreateResourceDefinition x)
-> (forall x.
    Rep CreateResourceDefinition x -> CreateResourceDefinition)
-> Generic CreateResourceDefinition
forall x.
Rep CreateResourceDefinition x -> CreateResourceDefinition
forall x.
CreateResourceDefinition -> Rep CreateResourceDefinition x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateResourceDefinition x -> CreateResourceDefinition
$cfrom :: forall x.
CreateResourceDefinition -> Rep CreateResourceDefinition x
Prelude.Generic)

-- |
-- Create a value of 'CreateResourceDefinition' 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', 'createResourceDefinition_amznClientToken' - A client token used to correlate requests and responses.
--
-- 'initialVersion', 'createResourceDefinition_initialVersion' - Information about the initial version of the resource definition.
--
-- 'name', 'createResourceDefinition_name' - The name of the resource definition.
--
-- 'tags', 'createResourceDefinition_tags' - Tag(s) to add to the new resource.
newCreateResourceDefinition ::
  CreateResourceDefinition
newCreateResourceDefinition :: CreateResourceDefinition
newCreateResourceDefinition =
  CreateResourceDefinition' :: Maybe Text
-> Maybe ResourceDefinitionVersion
-> Maybe Text
-> Maybe (HashMap Text Text)
-> CreateResourceDefinition
CreateResourceDefinition'
    { $sel:amznClientToken:CreateResourceDefinition' :: Maybe Text
amznClientToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:initialVersion:CreateResourceDefinition' :: Maybe ResourceDefinitionVersion
initialVersion = Maybe ResourceDefinitionVersion
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateResourceDefinition' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateResourceDefinition' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing
    }

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

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

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

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

instance Prelude.NFData CreateResourceDefinition

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

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

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

-- |
-- Create a value of 'CreateResourceDefinitionResponse' 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', 'createResourceDefinitionResponse_latestVersionArn' - The ARN of the latest version associated with the definition.
--
-- 'arn', 'createResourceDefinitionResponse_arn' - The ARN of the definition.
--
-- 'name', 'createResourceDefinitionResponse_name' - The name of the definition.
--
-- 'creationTimestamp', 'createResourceDefinitionResponse_creationTimestamp' - The time, in milliseconds since the epoch, when the definition was
-- created.
--
-- 'id', 'createResourceDefinitionResponse_id' - The ID of the definition.
--
-- 'latestVersion', 'createResourceDefinitionResponse_latestVersion' - The ID of the latest version associated with the definition.
--
-- 'lastUpdatedTimestamp', 'createResourceDefinitionResponse_lastUpdatedTimestamp' - The time, in milliseconds since the epoch, when the definition was last
-- updated.
--
-- 'httpStatus', 'createResourceDefinitionResponse_httpStatus' - The response's http status code.
newCreateResourceDefinitionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateResourceDefinitionResponse
newCreateResourceDefinitionResponse :: Int -> CreateResourceDefinitionResponse
newCreateResourceDefinitionResponse Int
pHttpStatus_ =
  CreateResourceDefinitionResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateResourceDefinitionResponse
CreateResourceDefinitionResponse'
    { $sel:latestVersionArn:CreateResourceDefinitionResponse' :: Maybe Text
latestVersionArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:CreateResourceDefinitionResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateResourceDefinitionResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:creationTimestamp:CreateResourceDefinitionResponse' :: Maybe Text
creationTimestamp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:CreateResourceDefinitionResponse' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:latestVersion:CreateResourceDefinitionResponse' :: Maybe Text
latestVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:lastUpdatedTimestamp:CreateResourceDefinitionResponse' :: Maybe Text
lastUpdatedTimestamp = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateResourceDefinitionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

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

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

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

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

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

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

instance
  Prelude.NFData
    CreateResourceDefinitionResponse