{-# 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.IotTwinMaker.CreateComponentType
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a component type.
module Amazonka.IotTwinMaker.CreateComponentType
  ( -- * Creating a Request
    CreateComponentType (..),
    newCreateComponentType,

    -- * Request Lenses
    createComponentType_componentTypeName,
    createComponentType_description,
    createComponentType_extendsFrom,
    createComponentType_functions,
    createComponentType_isSingleton,
    createComponentType_propertyDefinitions,
    createComponentType_propertyGroups,
    createComponentType_tags,
    createComponentType_workspaceId,
    createComponentType_componentTypeId,

    -- * Destructuring the Response
    CreateComponentTypeResponse (..),
    newCreateComponentTypeResponse,

    -- * Response Lenses
    createComponentTypeResponse_httpStatus,
    createComponentTypeResponse_arn,
    createComponentTypeResponse_creationDateTime,
    createComponentTypeResponse_state,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.IotTwinMaker.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateComponentType' smart constructor.
data CreateComponentType = CreateComponentType'
  { -- | A friendly name for the component type.
    CreateComponentType -> Maybe Text
componentTypeName :: Prelude.Maybe Prelude.Text,
    -- | The description of the component type.
    CreateComponentType -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Specifies the parent component type to extend.
    CreateComponentType -> Maybe [Text]
extendsFrom :: Prelude.Maybe [Prelude.Text],
    -- | An object that maps strings to the functions in the component type. Each
    -- string in the mapping must be unique to this object.
    CreateComponentType -> Maybe (HashMap Text FunctionRequest)
functions :: Prelude.Maybe (Prelude.HashMap Prelude.Text FunctionRequest),
    -- | A Boolean value that specifies whether an entity can have more than one
    -- component of this type.
    CreateComponentType -> Maybe Bool
isSingleton :: Prelude.Maybe Prelude.Bool,
    -- | An object that maps strings to the property definitions in the component
    -- type. Each string in the mapping must be unique to this object.
    CreateComponentType
-> Maybe (HashMap Text PropertyDefinitionRequest)
propertyDefinitions :: Prelude.Maybe (Prelude.HashMap Prelude.Text PropertyDefinitionRequest),
    CreateComponentType -> Maybe (HashMap Text PropertyGroupRequest)
propertyGroups :: Prelude.Maybe (Prelude.HashMap Prelude.Text PropertyGroupRequest),
    -- | Metadata that you can use to manage the component type.
    CreateComponentType -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The ID of the workspace that contains the component type.
    CreateComponentType -> Text
workspaceId :: Prelude.Text,
    -- | The ID of the component type.
    CreateComponentType -> Text
componentTypeId :: Prelude.Text
  }
  deriving (CreateComponentType -> CreateComponentType -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateComponentType -> CreateComponentType -> Bool
$c/= :: CreateComponentType -> CreateComponentType -> Bool
== :: CreateComponentType -> CreateComponentType -> Bool
$c== :: CreateComponentType -> CreateComponentType -> Bool
Prelude.Eq, ReadPrec [CreateComponentType]
ReadPrec CreateComponentType
Int -> ReadS CreateComponentType
ReadS [CreateComponentType]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateComponentType]
$creadListPrec :: ReadPrec [CreateComponentType]
readPrec :: ReadPrec CreateComponentType
$creadPrec :: ReadPrec CreateComponentType
readList :: ReadS [CreateComponentType]
$creadList :: ReadS [CreateComponentType]
readsPrec :: Int -> ReadS CreateComponentType
$creadsPrec :: Int -> ReadS CreateComponentType
Prelude.Read, Int -> CreateComponentType -> ShowS
[CreateComponentType] -> ShowS
CreateComponentType -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateComponentType] -> ShowS
$cshowList :: [CreateComponentType] -> ShowS
show :: CreateComponentType -> String
$cshow :: CreateComponentType -> String
showsPrec :: Int -> CreateComponentType -> ShowS
$cshowsPrec :: Int -> CreateComponentType -> ShowS
Prelude.Show, forall x. Rep CreateComponentType x -> CreateComponentType
forall x. CreateComponentType -> Rep CreateComponentType x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateComponentType x -> CreateComponentType
$cfrom :: forall x. CreateComponentType -> Rep CreateComponentType x
Prelude.Generic)

-- |
-- Create a value of 'CreateComponentType' 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:
--
-- 'componentTypeName', 'createComponentType_componentTypeName' - A friendly name for the component type.
--
-- 'description', 'createComponentType_description' - The description of the component type.
--
-- 'extendsFrom', 'createComponentType_extendsFrom' - Specifies the parent component type to extend.
--
-- 'functions', 'createComponentType_functions' - An object that maps strings to the functions in the component type. Each
-- string in the mapping must be unique to this object.
--
-- 'isSingleton', 'createComponentType_isSingleton' - A Boolean value that specifies whether an entity can have more than one
-- component of this type.
--
-- 'propertyDefinitions', 'createComponentType_propertyDefinitions' - An object that maps strings to the property definitions in the component
-- type. Each string in the mapping must be unique to this object.
--
-- 'propertyGroups', 'createComponentType_propertyGroups' -
--
-- 'tags', 'createComponentType_tags' - Metadata that you can use to manage the component type.
--
-- 'workspaceId', 'createComponentType_workspaceId' - The ID of the workspace that contains the component type.
--
-- 'componentTypeId', 'createComponentType_componentTypeId' - The ID of the component type.
newCreateComponentType ::
  -- | 'workspaceId'
  Prelude.Text ->
  -- | 'componentTypeId'
  Prelude.Text ->
  CreateComponentType
newCreateComponentType :: Text -> Text -> CreateComponentType
newCreateComponentType
  Text
pWorkspaceId_
  Text
pComponentTypeId_ =
    CreateComponentType'
      { $sel:componentTypeName:CreateComponentType' :: Maybe Text
componentTypeName =
          forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateComponentType' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
        $sel:extendsFrom:CreateComponentType' :: Maybe [Text]
extendsFrom = forall a. Maybe a
Prelude.Nothing,
        $sel:functions:CreateComponentType' :: Maybe (HashMap Text FunctionRequest)
functions = forall a. Maybe a
Prelude.Nothing,
        $sel:isSingleton:CreateComponentType' :: Maybe Bool
isSingleton = forall a. Maybe a
Prelude.Nothing,
        $sel:propertyDefinitions:CreateComponentType' :: Maybe (HashMap Text PropertyDefinitionRequest)
propertyDefinitions = forall a. Maybe a
Prelude.Nothing,
        $sel:propertyGroups:CreateComponentType' :: Maybe (HashMap Text PropertyGroupRequest)
propertyGroups = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateComponentType' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:workspaceId:CreateComponentType' :: Text
workspaceId = Text
pWorkspaceId_,
        $sel:componentTypeId:CreateComponentType' :: Text
componentTypeId = Text
pComponentTypeId_
      }

-- | A friendly name for the component type.
createComponentType_componentTypeName :: Lens.Lens' CreateComponentType (Prelude.Maybe Prelude.Text)
createComponentType_componentTypeName :: Lens' CreateComponentType (Maybe Text)
createComponentType_componentTypeName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponentType' {Maybe Text
componentTypeName :: Maybe Text
$sel:componentTypeName:CreateComponentType' :: CreateComponentType -> Maybe Text
componentTypeName} -> Maybe Text
componentTypeName) (\s :: CreateComponentType
s@CreateComponentType' {} Maybe Text
a -> CreateComponentType
s {$sel:componentTypeName:CreateComponentType' :: Maybe Text
componentTypeName = Maybe Text
a} :: CreateComponentType)

-- | The description of the component type.
createComponentType_description :: Lens.Lens' CreateComponentType (Prelude.Maybe Prelude.Text)
createComponentType_description :: Lens' CreateComponentType (Maybe Text)
createComponentType_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponentType' {Maybe Text
description :: Maybe Text
$sel:description:CreateComponentType' :: CreateComponentType -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateComponentType
s@CreateComponentType' {} Maybe Text
a -> CreateComponentType
s {$sel:description:CreateComponentType' :: Maybe Text
description = Maybe Text
a} :: CreateComponentType)

-- | Specifies the parent component type to extend.
createComponentType_extendsFrom :: Lens.Lens' CreateComponentType (Prelude.Maybe [Prelude.Text])
createComponentType_extendsFrom :: Lens' CreateComponentType (Maybe [Text])
createComponentType_extendsFrom = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponentType' {Maybe [Text]
extendsFrom :: Maybe [Text]
$sel:extendsFrom:CreateComponentType' :: CreateComponentType -> Maybe [Text]
extendsFrom} -> Maybe [Text]
extendsFrom) (\s :: CreateComponentType
s@CreateComponentType' {} Maybe [Text]
a -> CreateComponentType
s {$sel:extendsFrom:CreateComponentType' :: Maybe [Text]
extendsFrom = Maybe [Text]
a} :: CreateComponentType) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An object that maps strings to the functions in the component type. Each
-- string in the mapping must be unique to this object.
createComponentType_functions :: Lens.Lens' CreateComponentType (Prelude.Maybe (Prelude.HashMap Prelude.Text FunctionRequest))
createComponentType_functions :: Lens' CreateComponentType (Maybe (HashMap Text FunctionRequest))
createComponentType_functions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponentType' {Maybe (HashMap Text FunctionRequest)
functions :: Maybe (HashMap Text FunctionRequest)
$sel:functions:CreateComponentType' :: CreateComponentType -> Maybe (HashMap Text FunctionRequest)
functions} -> Maybe (HashMap Text FunctionRequest)
functions) (\s :: CreateComponentType
s@CreateComponentType' {} Maybe (HashMap Text FunctionRequest)
a -> CreateComponentType
s {$sel:functions:CreateComponentType' :: Maybe (HashMap Text FunctionRequest)
functions = Maybe (HashMap Text FunctionRequest)
a} :: CreateComponentType) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A Boolean value that specifies whether an entity can have more than one
-- component of this type.
createComponentType_isSingleton :: Lens.Lens' CreateComponentType (Prelude.Maybe Prelude.Bool)
createComponentType_isSingleton :: Lens' CreateComponentType (Maybe Bool)
createComponentType_isSingleton = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponentType' {Maybe Bool
isSingleton :: Maybe Bool
$sel:isSingleton:CreateComponentType' :: CreateComponentType -> Maybe Bool
isSingleton} -> Maybe Bool
isSingleton) (\s :: CreateComponentType
s@CreateComponentType' {} Maybe Bool
a -> CreateComponentType
s {$sel:isSingleton:CreateComponentType' :: Maybe Bool
isSingleton = Maybe Bool
a} :: CreateComponentType)

-- | An object that maps strings to the property definitions in the component
-- type. Each string in the mapping must be unique to this object.
createComponentType_propertyDefinitions :: Lens.Lens' CreateComponentType (Prelude.Maybe (Prelude.HashMap Prelude.Text PropertyDefinitionRequest))
createComponentType_propertyDefinitions :: Lens'
  CreateComponentType
  (Maybe (HashMap Text PropertyDefinitionRequest))
createComponentType_propertyDefinitions = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponentType' {Maybe (HashMap Text PropertyDefinitionRequest)
propertyDefinitions :: Maybe (HashMap Text PropertyDefinitionRequest)
$sel:propertyDefinitions:CreateComponentType' :: CreateComponentType
-> Maybe (HashMap Text PropertyDefinitionRequest)
propertyDefinitions} -> Maybe (HashMap Text PropertyDefinitionRequest)
propertyDefinitions) (\s :: CreateComponentType
s@CreateComponentType' {} Maybe (HashMap Text PropertyDefinitionRequest)
a -> CreateComponentType
s {$sel:propertyDefinitions:CreateComponentType' :: Maybe (HashMap Text PropertyDefinitionRequest)
propertyDefinitions = Maybe (HashMap Text PropertyDefinitionRequest)
a} :: CreateComponentType) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

createComponentType_propertyGroups :: Lens.Lens' CreateComponentType (Prelude.Maybe (Prelude.HashMap Prelude.Text PropertyGroupRequest))
createComponentType_propertyGroups :: Lens'
  CreateComponentType (Maybe (HashMap Text PropertyGroupRequest))
createComponentType_propertyGroups = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponentType' {Maybe (HashMap Text PropertyGroupRequest)
propertyGroups :: Maybe (HashMap Text PropertyGroupRequest)
$sel:propertyGroups:CreateComponentType' :: CreateComponentType -> Maybe (HashMap Text PropertyGroupRequest)
propertyGroups} -> Maybe (HashMap Text PropertyGroupRequest)
propertyGroups) (\s :: CreateComponentType
s@CreateComponentType' {} Maybe (HashMap Text PropertyGroupRequest)
a -> CreateComponentType
s {$sel:propertyGroups:CreateComponentType' :: Maybe (HashMap Text PropertyGroupRequest)
propertyGroups = Maybe (HashMap Text PropertyGroupRequest)
a} :: CreateComponentType) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Metadata that you can use to manage the component type.
createComponentType_tags :: Lens.Lens' CreateComponentType (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createComponentType_tags :: Lens' CreateComponentType (Maybe (HashMap Text Text))
createComponentType_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponentType' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateComponentType' :: CreateComponentType -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateComponentType
s@CreateComponentType' {} Maybe (HashMap Text Text)
a -> CreateComponentType
s {$sel:tags:CreateComponentType' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateComponentType) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The ID of the workspace that contains the component type.
createComponentType_workspaceId :: Lens.Lens' CreateComponentType Prelude.Text
createComponentType_workspaceId :: Lens' CreateComponentType Text
createComponentType_workspaceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponentType' {Text
workspaceId :: Text
$sel:workspaceId:CreateComponentType' :: CreateComponentType -> Text
workspaceId} -> Text
workspaceId) (\s :: CreateComponentType
s@CreateComponentType' {} Text
a -> CreateComponentType
s {$sel:workspaceId:CreateComponentType' :: Text
workspaceId = Text
a} :: CreateComponentType)

-- | The ID of the component type.
createComponentType_componentTypeId :: Lens.Lens' CreateComponentType Prelude.Text
createComponentType_componentTypeId :: Lens' CreateComponentType Text
createComponentType_componentTypeId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponentType' {Text
componentTypeId :: Text
$sel:componentTypeId:CreateComponentType' :: CreateComponentType -> Text
componentTypeId} -> Text
componentTypeId) (\s :: CreateComponentType
s@CreateComponentType' {} Text
a -> CreateComponentType
s {$sel:componentTypeId:CreateComponentType' :: Text
componentTypeId = Text
a} :: CreateComponentType)

instance Core.AWSRequest CreateComponentType where
  type
    AWSResponse CreateComponentType =
      CreateComponentTypeResponse
  request :: (Service -> Service)
-> CreateComponentType -> Request CreateComponentType
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateComponentType
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateComponentType)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Int -> Text -> POSIX -> State -> CreateComponentTypeResponse
CreateComponentTypeResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"arn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"creationDateTime")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"state")
      )

instance Prelude.Hashable CreateComponentType where
  hashWithSalt :: Int -> CreateComponentType -> Int
hashWithSalt Int
_salt CreateComponentType' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text PropertyGroupRequest)
Maybe (HashMap Text FunctionRequest)
Maybe (HashMap Text PropertyDefinitionRequest)
Text
componentTypeId :: Text
workspaceId :: Text
tags :: Maybe (HashMap Text Text)
propertyGroups :: Maybe (HashMap Text PropertyGroupRequest)
propertyDefinitions :: Maybe (HashMap Text PropertyDefinitionRequest)
isSingleton :: Maybe Bool
functions :: Maybe (HashMap Text FunctionRequest)
extendsFrom :: Maybe [Text]
description :: Maybe Text
componentTypeName :: Maybe Text
$sel:componentTypeId:CreateComponentType' :: CreateComponentType -> Text
$sel:workspaceId:CreateComponentType' :: CreateComponentType -> Text
$sel:tags:CreateComponentType' :: CreateComponentType -> Maybe (HashMap Text Text)
$sel:propertyGroups:CreateComponentType' :: CreateComponentType -> Maybe (HashMap Text PropertyGroupRequest)
$sel:propertyDefinitions:CreateComponentType' :: CreateComponentType
-> Maybe (HashMap Text PropertyDefinitionRequest)
$sel:isSingleton:CreateComponentType' :: CreateComponentType -> Maybe Bool
$sel:functions:CreateComponentType' :: CreateComponentType -> Maybe (HashMap Text FunctionRequest)
$sel:extendsFrom:CreateComponentType' :: CreateComponentType -> Maybe [Text]
$sel:description:CreateComponentType' :: CreateComponentType -> Maybe Text
$sel:componentTypeName:CreateComponentType' :: CreateComponentType -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
componentTypeName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
extendsFrom
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text FunctionRequest)
functions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
isSingleton
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text PropertyDefinitionRequest)
propertyDefinitions
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text PropertyGroupRequest)
propertyGroups
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
workspaceId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
componentTypeId

instance Prelude.NFData CreateComponentType where
  rnf :: CreateComponentType -> ()
rnf CreateComponentType' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text PropertyGroupRequest)
Maybe (HashMap Text FunctionRequest)
Maybe (HashMap Text PropertyDefinitionRequest)
Text
componentTypeId :: Text
workspaceId :: Text
tags :: Maybe (HashMap Text Text)
propertyGroups :: Maybe (HashMap Text PropertyGroupRequest)
propertyDefinitions :: Maybe (HashMap Text PropertyDefinitionRequest)
isSingleton :: Maybe Bool
functions :: Maybe (HashMap Text FunctionRequest)
extendsFrom :: Maybe [Text]
description :: Maybe Text
componentTypeName :: Maybe Text
$sel:componentTypeId:CreateComponentType' :: CreateComponentType -> Text
$sel:workspaceId:CreateComponentType' :: CreateComponentType -> Text
$sel:tags:CreateComponentType' :: CreateComponentType -> Maybe (HashMap Text Text)
$sel:propertyGroups:CreateComponentType' :: CreateComponentType -> Maybe (HashMap Text PropertyGroupRequest)
$sel:propertyDefinitions:CreateComponentType' :: CreateComponentType
-> Maybe (HashMap Text PropertyDefinitionRequest)
$sel:isSingleton:CreateComponentType' :: CreateComponentType -> Maybe Bool
$sel:functions:CreateComponentType' :: CreateComponentType -> Maybe (HashMap Text FunctionRequest)
$sel:extendsFrom:CreateComponentType' :: CreateComponentType -> Maybe [Text]
$sel:description:CreateComponentType' :: CreateComponentType -> Maybe Text
$sel:componentTypeName:CreateComponentType' :: CreateComponentType -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
componentTypeName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
extendsFrom
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text FunctionRequest)
functions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
isSingleton
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text PropertyDefinitionRequest)
propertyDefinitions
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text PropertyGroupRequest)
propertyGroups
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
workspaceId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
componentTypeId

instance Data.ToHeaders CreateComponentType where
  toHeaders :: CreateComponentType -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateComponentType where
  toJSON :: CreateComponentType -> Value
toJSON CreateComponentType' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text PropertyGroupRequest)
Maybe (HashMap Text FunctionRequest)
Maybe (HashMap Text PropertyDefinitionRequest)
Text
componentTypeId :: Text
workspaceId :: Text
tags :: Maybe (HashMap Text Text)
propertyGroups :: Maybe (HashMap Text PropertyGroupRequest)
propertyDefinitions :: Maybe (HashMap Text PropertyDefinitionRequest)
isSingleton :: Maybe Bool
functions :: Maybe (HashMap Text FunctionRequest)
extendsFrom :: Maybe [Text]
description :: Maybe Text
componentTypeName :: Maybe Text
$sel:componentTypeId:CreateComponentType' :: CreateComponentType -> Text
$sel:workspaceId:CreateComponentType' :: CreateComponentType -> Text
$sel:tags:CreateComponentType' :: CreateComponentType -> Maybe (HashMap Text Text)
$sel:propertyGroups:CreateComponentType' :: CreateComponentType -> Maybe (HashMap Text PropertyGroupRequest)
$sel:propertyDefinitions:CreateComponentType' :: CreateComponentType
-> Maybe (HashMap Text PropertyDefinitionRequest)
$sel:isSingleton:CreateComponentType' :: CreateComponentType -> Maybe Bool
$sel:functions:CreateComponentType' :: CreateComponentType -> Maybe (HashMap Text FunctionRequest)
$sel:extendsFrom:CreateComponentType' :: CreateComponentType -> Maybe [Text]
$sel:description:CreateComponentType' :: CreateComponentType -> Maybe Text
$sel:componentTypeName:CreateComponentType' :: CreateComponentType -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"componentTypeName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
componentTypeName,
            (Key
"description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Key
"extendsFrom" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
extendsFrom,
            (Key
"functions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text FunctionRequest)
functions,
            (Key
"isSingleton" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
isSingleton,
            (Key
"propertyDefinitions" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text PropertyDefinitionRequest)
propertyDefinitions,
            (Key
"propertyGroups" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text PropertyGroupRequest)
propertyGroups,
            (Key
"tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags
          ]
      )

instance Data.ToPath CreateComponentType where
  toPath :: CreateComponentType -> ByteString
toPath CreateComponentType' {Maybe Bool
Maybe [Text]
Maybe Text
Maybe (HashMap Text Text)
Maybe (HashMap Text PropertyGroupRequest)
Maybe (HashMap Text FunctionRequest)
Maybe (HashMap Text PropertyDefinitionRequest)
Text
componentTypeId :: Text
workspaceId :: Text
tags :: Maybe (HashMap Text Text)
propertyGroups :: Maybe (HashMap Text PropertyGroupRequest)
propertyDefinitions :: Maybe (HashMap Text PropertyDefinitionRequest)
isSingleton :: Maybe Bool
functions :: Maybe (HashMap Text FunctionRequest)
extendsFrom :: Maybe [Text]
description :: Maybe Text
componentTypeName :: Maybe Text
$sel:componentTypeId:CreateComponentType' :: CreateComponentType -> Text
$sel:workspaceId:CreateComponentType' :: CreateComponentType -> Text
$sel:tags:CreateComponentType' :: CreateComponentType -> Maybe (HashMap Text Text)
$sel:propertyGroups:CreateComponentType' :: CreateComponentType -> Maybe (HashMap Text PropertyGroupRequest)
$sel:propertyDefinitions:CreateComponentType' :: CreateComponentType
-> Maybe (HashMap Text PropertyDefinitionRequest)
$sel:isSingleton:CreateComponentType' :: CreateComponentType -> Maybe Bool
$sel:functions:CreateComponentType' :: CreateComponentType -> Maybe (HashMap Text FunctionRequest)
$sel:extendsFrom:CreateComponentType' :: CreateComponentType -> Maybe [Text]
$sel:description:CreateComponentType' :: CreateComponentType -> Maybe Text
$sel:componentTypeName:CreateComponentType' :: CreateComponentType -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/workspaces/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
workspaceId,
        ByteString
"/component-types/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
componentTypeId
      ]

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

-- | /See:/ 'newCreateComponentTypeResponse' smart constructor.
data CreateComponentTypeResponse = CreateComponentTypeResponse'
  { -- | The response's http status code.
    CreateComponentTypeResponse -> Int
httpStatus :: Prelude.Int,
    -- | The ARN of the component type.
    CreateComponentTypeResponse -> Text
arn :: Prelude.Text,
    -- | The date and time when the entity was created.
    CreateComponentTypeResponse -> POSIX
creationDateTime :: Data.POSIX,
    -- | The current state of the component type.
    CreateComponentTypeResponse -> State
state :: State
  }
  deriving (CreateComponentTypeResponse -> CreateComponentTypeResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateComponentTypeResponse -> CreateComponentTypeResponse -> Bool
$c/= :: CreateComponentTypeResponse -> CreateComponentTypeResponse -> Bool
== :: CreateComponentTypeResponse -> CreateComponentTypeResponse -> Bool
$c== :: CreateComponentTypeResponse -> CreateComponentTypeResponse -> Bool
Prelude.Eq, ReadPrec [CreateComponentTypeResponse]
ReadPrec CreateComponentTypeResponse
Int -> ReadS CreateComponentTypeResponse
ReadS [CreateComponentTypeResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateComponentTypeResponse]
$creadListPrec :: ReadPrec [CreateComponentTypeResponse]
readPrec :: ReadPrec CreateComponentTypeResponse
$creadPrec :: ReadPrec CreateComponentTypeResponse
readList :: ReadS [CreateComponentTypeResponse]
$creadList :: ReadS [CreateComponentTypeResponse]
readsPrec :: Int -> ReadS CreateComponentTypeResponse
$creadsPrec :: Int -> ReadS CreateComponentTypeResponse
Prelude.Read, Int -> CreateComponentTypeResponse -> ShowS
[CreateComponentTypeResponse] -> ShowS
CreateComponentTypeResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateComponentTypeResponse] -> ShowS
$cshowList :: [CreateComponentTypeResponse] -> ShowS
show :: CreateComponentTypeResponse -> String
$cshow :: CreateComponentTypeResponse -> String
showsPrec :: Int -> CreateComponentTypeResponse -> ShowS
$cshowsPrec :: Int -> CreateComponentTypeResponse -> ShowS
Prelude.Show, forall x.
Rep CreateComponentTypeResponse x -> CreateComponentTypeResponse
forall x.
CreateComponentTypeResponse -> Rep CreateComponentTypeResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateComponentTypeResponse x -> CreateComponentTypeResponse
$cfrom :: forall x.
CreateComponentTypeResponse -> Rep CreateComponentTypeResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateComponentTypeResponse' 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:
--
-- 'httpStatus', 'createComponentTypeResponse_httpStatus' - The response's http status code.
--
-- 'arn', 'createComponentTypeResponse_arn' - The ARN of the component type.
--
-- 'creationDateTime', 'createComponentTypeResponse_creationDateTime' - The date and time when the entity was created.
--
-- 'state', 'createComponentTypeResponse_state' - The current state of the component type.
newCreateComponentTypeResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'arn'
  Prelude.Text ->
  -- | 'creationDateTime'
  Prelude.UTCTime ->
  -- | 'state'
  State ->
  CreateComponentTypeResponse
newCreateComponentTypeResponse :: Int -> Text -> UTCTime -> State -> CreateComponentTypeResponse
newCreateComponentTypeResponse
  Int
pHttpStatus_
  Text
pArn_
  UTCTime
pCreationDateTime_
  State
pState_ =
    CreateComponentTypeResponse'
      { $sel:httpStatus:CreateComponentTypeResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:arn:CreateComponentTypeResponse' :: Text
arn = Text
pArn_,
        $sel:creationDateTime:CreateComponentTypeResponse' :: POSIX
creationDateTime =
          forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreationDateTime_,
        $sel:state:CreateComponentTypeResponse' :: State
state = State
pState_
      }

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

-- | The ARN of the component type.
createComponentTypeResponse_arn :: Lens.Lens' CreateComponentTypeResponse Prelude.Text
createComponentTypeResponse_arn :: Lens' CreateComponentTypeResponse Text
createComponentTypeResponse_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponentTypeResponse' {Text
arn :: Text
$sel:arn:CreateComponentTypeResponse' :: CreateComponentTypeResponse -> Text
arn} -> Text
arn) (\s :: CreateComponentTypeResponse
s@CreateComponentTypeResponse' {} Text
a -> CreateComponentTypeResponse
s {$sel:arn:CreateComponentTypeResponse' :: Text
arn = Text
a} :: CreateComponentTypeResponse)

-- | The date and time when the entity was created.
createComponentTypeResponse_creationDateTime :: Lens.Lens' CreateComponentTypeResponse Prelude.UTCTime
createComponentTypeResponse_creationDateTime :: Lens' CreateComponentTypeResponse UTCTime
createComponentTypeResponse_creationDateTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponentTypeResponse' {POSIX
creationDateTime :: POSIX
$sel:creationDateTime:CreateComponentTypeResponse' :: CreateComponentTypeResponse -> POSIX
creationDateTime} -> POSIX
creationDateTime) (\s :: CreateComponentTypeResponse
s@CreateComponentTypeResponse' {} POSIX
a -> CreateComponentTypeResponse
s {$sel:creationDateTime:CreateComponentTypeResponse' :: POSIX
creationDateTime = POSIX
a} :: CreateComponentTypeResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The current state of the component type.
createComponentTypeResponse_state :: Lens.Lens' CreateComponentTypeResponse State
createComponentTypeResponse_state :: Lens' CreateComponentTypeResponse State
createComponentTypeResponse_state = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateComponentTypeResponse' {State
state :: State
$sel:state:CreateComponentTypeResponse' :: CreateComponentTypeResponse -> State
state} -> State
state) (\s :: CreateComponentTypeResponse
s@CreateComponentTypeResponse' {} State
a -> CreateComponentTypeResponse
s {$sel:state:CreateComponentTypeResponse' :: State
state = State
a} :: CreateComponentTypeResponse)

instance Prelude.NFData CreateComponentTypeResponse where
  rnf :: CreateComponentTypeResponse -> ()
rnf CreateComponentTypeResponse' {Int
Text
POSIX
State
state :: State
creationDateTime :: POSIX
arn :: Text
httpStatus :: Int
$sel:state:CreateComponentTypeResponse' :: CreateComponentTypeResponse -> State
$sel:creationDateTime:CreateComponentTypeResponse' :: CreateComponentTypeResponse -> POSIX
$sel:arn:CreateComponentTypeResponse' :: CreateComponentTypeResponse -> Text
$sel:httpStatus:CreateComponentTypeResponse' :: CreateComponentTypeResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf POSIX
creationDateTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf State
state