{-# 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.IoT.CreateThing
-- 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 thing record in the registry. If this call is made multiple
-- times using the same thing name and configuration, the call will
-- succeed. If this call is made with the same thing name but different
-- configuration a @ResourceAlreadyExistsException@ is thrown.
--
-- This is a control plane operation. See
-- <https://docs.aws.amazon.com/iot/latest/developerguide/iot-authorization.html Authorization>
-- for information about authorizing control plane actions.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions CreateThing>
-- action.
module Amazonka.IoT.CreateThing
  ( -- * Creating a Request
    CreateThing (..),
    newCreateThing,

    -- * Request Lenses
    createThing_thingTypeName,
    createThing_attributePayload,
    createThing_billingGroupName,
    createThing_thingName,

    -- * Destructuring the Response
    CreateThingResponse (..),
    newCreateThingResponse,

    -- * Response Lenses
    createThingResponse_thingArn,
    createThingResponse_thingName,
    createThingResponse_thingId,
    createThingResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.IoT.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

-- | The input for the CreateThing operation.
--
-- /See:/ 'newCreateThing' smart constructor.
data CreateThing = CreateThing'
  { -- | The name of the thing type associated with the new thing.
    CreateThing -> Maybe Text
thingTypeName :: Prelude.Maybe Prelude.Text,
    -- | The attribute payload, which consists of up to three name\/value pairs
    -- in a JSON document. For example:
    --
    -- @{\\\"attributes\\\":{\\\"string1\\\":\\\"string2\\\"}}@
    CreateThing -> Maybe AttributePayload
attributePayload :: Prelude.Maybe AttributePayload,
    -- | The name of the billing group the thing will be added to.
    CreateThing -> Maybe Text
billingGroupName :: Prelude.Maybe Prelude.Text,
    -- | The name of the thing to create.
    --
    -- You can\'t change a thing\'s name after you create it. To change a
    -- thing\'s name, you must create a new thing, give it the new name, and
    -- then delete the old thing.
    CreateThing -> Text
thingName :: Prelude.Text
  }
  deriving (CreateThing -> CreateThing -> Bool
(CreateThing -> CreateThing -> Bool)
-> (CreateThing -> CreateThing -> Bool) -> Eq CreateThing
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateThing -> CreateThing -> Bool
$c/= :: CreateThing -> CreateThing -> Bool
== :: CreateThing -> CreateThing -> Bool
$c== :: CreateThing -> CreateThing -> Bool
Prelude.Eq, ReadPrec [CreateThing]
ReadPrec CreateThing
Int -> ReadS CreateThing
ReadS [CreateThing]
(Int -> ReadS CreateThing)
-> ReadS [CreateThing]
-> ReadPrec CreateThing
-> ReadPrec [CreateThing]
-> Read CreateThing
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateThing]
$creadListPrec :: ReadPrec [CreateThing]
readPrec :: ReadPrec CreateThing
$creadPrec :: ReadPrec CreateThing
readList :: ReadS [CreateThing]
$creadList :: ReadS [CreateThing]
readsPrec :: Int -> ReadS CreateThing
$creadsPrec :: Int -> ReadS CreateThing
Prelude.Read, Int -> CreateThing -> ShowS
[CreateThing] -> ShowS
CreateThing -> String
(Int -> CreateThing -> ShowS)
-> (CreateThing -> String)
-> ([CreateThing] -> ShowS)
-> Show CreateThing
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateThing] -> ShowS
$cshowList :: [CreateThing] -> ShowS
show :: CreateThing -> String
$cshow :: CreateThing -> String
showsPrec :: Int -> CreateThing -> ShowS
$cshowsPrec :: Int -> CreateThing -> ShowS
Prelude.Show, (forall x. CreateThing -> Rep CreateThing x)
-> (forall x. Rep CreateThing x -> CreateThing)
-> Generic CreateThing
forall x. Rep CreateThing x -> CreateThing
forall x. CreateThing -> Rep CreateThing x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateThing x -> CreateThing
$cfrom :: forall x. CreateThing -> Rep CreateThing x
Prelude.Generic)

-- |
-- Create a value of 'CreateThing' 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:
--
-- 'thingTypeName', 'createThing_thingTypeName' - The name of the thing type associated with the new thing.
--
-- 'attributePayload', 'createThing_attributePayload' - The attribute payload, which consists of up to three name\/value pairs
-- in a JSON document. For example:
--
-- @{\\\"attributes\\\":{\\\"string1\\\":\\\"string2\\\"}}@
--
-- 'billingGroupName', 'createThing_billingGroupName' - The name of the billing group the thing will be added to.
--
-- 'thingName', 'createThing_thingName' - The name of the thing to create.
--
-- You can\'t change a thing\'s name after you create it. To change a
-- thing\'s name, you must create a new thing, give it the new name, and
-- then delete the old thing.
newCreateThing ::
  -- | 'thingName'
  Prelude.Text ->
  CreateThing
newCreateThing :: Text -> CreateThing
newCreateThing Text
pThingName_ =
  CreateThing' :: Maybe Text
-> Maybe AttributePayload -> Maybe Text -> Text -> CreateThing
CreateThing'
    { $sel:thingTypeName:CreateThing' :: Maybe Text
thingTypeName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:attributePayload:CreateThing' :: Maybe AttributePayload
attributePayload = Maybe AttributePayload
forall a. Maybe a
Prelude.Nothing,
      $sel:billingGroupName:CreateThing' :: Maybe Text
billingGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:thingName:CreateThing' :: Text
thingName = Text
pThingName_
    }

-- | The name of the thing type associated with the new thing.
createThing_thingTypeName :: Lens.Lens' CreateThing (Prelude.Maybe Prelude.Text)
createThing_thingTypeName :: (Maybe Text -> f (Maybe Text)) -> CreateThing -> f CreateThing
createThing_thingTypeName = (CreateThing -> Maybe Text)
-> (CreateThing -> Maybe Text -> CreateThing)
-> Lens CreateThing CreateThing (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateThing' {Maybe Text
thingTypeName :: Maybe Text
$sel:thingTypeName:CreateThing' :: CreateThing -> Maybe Text
thingTypeName} -> Maybe Text
thingTypeName) (\s :: CreateThing
s@CreateThing' {} Maybe Text
a -> CreateThing
s {$sel:thingTypeName:CreateThing' :: Maybe Text
thingTypeName = Maybe Text
a} :: CreateThing)

-- | The attribute payload, which consists of up to three name\/value pairs
-- in a JSON document. For example:
--
-- @{\\\"attributes\\\":{\\\"string1\\\":\\\"string2\\\"}}@
createThing_attributePayload :: Lens.Lens' CreateThing (Prelude.Maybe AttributePayload)
createThing_attributePayload :: (Maybe AttributePayload -> f (Maybe AttributePayload))
-> CreateThing -> f CreateThing
createThing_attributePayload = (CreateThing -> Maybe AttributePayload)
-> (CreateThing -> Maybe AttributePayload -> CreateThing)
-> Lens
     CreateThing
     CreateThing
     (Maybe AttributePayload)
     (Maybe AttributePayload)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateThing' {Maybe AttributePayload
attributePayload :: Maybe AttributePayload
$sel:attributePayload:CreateThing' :: CreateThing -> Maybe AttributePayload
attributePayload} -> Maybe AttributePayload
attributePayload) (\s :: CreateThing
s@CreateThing' {} Maybe AttributePayload
a -> CreateThing
s {$sel:attributePayload:CreateThing' :: Maybe AttributePayload
attributePayload = Maybe AttributePayload
a} :: CreateThing)

-- | The name of the billing group the thing will be added to.
createThing_billingGroupName :: Lens.Lens' CreateThing (Prelude.Maybe Prelude.Text)
createThing_billingGroupName :: (Maybe Text -> f (Maybe Text)) -> CreateThing -> f CreateThing
createThing_billingGroupName = (CreateThing -> Maybe Text)
-> (CreateThing -> Maybe Text -> CreateThing)
-> Lens CreateThing CreateThing (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateThing' {Maybe Text
billingGroupName :: Maybe Text
$sel:billingGroupName:CreateThing' :: CreateThing -> Maybe Text
billingGroupName} -> Maybe Text
billingGroupName) (\s :: CreateThing
s@CreateThing' {} Maybe Text
a -> CreateThing
s {$sel:billingGroupName:CreateThing' :: Maybe Text
billingGroupName = Maybe Text
a} :: CreateThing)

-- | The name of the thing to create.
--
-- You can\'t change a thing\'s name after you create it. To change a
-- thing\'s name, you must create a new thing, give it the new name, and
-- then delete the old thing.
createThing_thingName :: Lens.Lens' CreateThing Prelude.Text
createThing_thingName :: (Text -> f Text) -> CreateThing -> f CreateThing
createThing_thingName = (CreateThing -> Text)
-> (CreateThing -> Text -> CreateThing)
-> Lens CreateThing CreateThing Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateThing' {Text
thingName :: Text
$sel:thingName:CreateThing' :: CreateThing -> Text
thingName} -> Text
thingName) (\s :: CreateThing
s@CreateThing' {} Text
a -> CreateThing
s {$sel:thingName:CreateThing' :: Text
thingName = Text
a} :: CreateThing)

instance Core.AWSRequest CreateThing where
  type AWSResponse CreateThing = CreateThingResponse
  request :: CreateThing -> Request CreateThing
request = Service -> CreateThing -> Request CreateThing
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateThing
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateThing)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateThing))
-> Logger
-> Service
-> Proxy CreateThing
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateThing)))
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 -> Int -> CreateThingResponse
CreateThingResponse'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Int -> CreateThingResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Text -> Int -> CreateThingResponse)
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
"thingArn")
            Either
  String (Maybe Text -> Maybe Text -> Int -> CreateThingResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> CreateThingResponse)
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
"thingName")
            Either String (Maybe Text -> Int -> CreateThingResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateThingResponse)
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
"thingId")
            Either String (Int -> CreateThingResponse)
-> Either String Int -> Either String CreateThingResponse
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 CreateThing

instance Prelude.NFData CreateThing

instance Core.ToHeaders CreateThing where
  toHeaders :: CreateThing -> ResponseHeaders
toHeaders = ResponseHeaders -> CreateThing -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToJSON CreateThing where
  toJSON :: CreateThing -> Value
toJSON CreateThing' {Maybe Text
Maybe AttributePayload
Text
thingName :: Text
billingGroupName :: Maybe Text
attributePayload :: Maybe AttributePayload
thingTypeName :: Maybe Text
$sel:thingName:CreateThing' :: CreateThing -> Text
$sel:billingGroupName:CreateThing' :: CreateThing -> Maybe Text
$sel:attributePayload:CreateThing' :: CreateThing -> Maybe AttributePayload
$sel:thingTypeName:CreateThing' :: CreateThing -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"thingTypeName" 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
thingTypeName,
            (Text
"attributePayload" Text -> AttributePayload -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (AttributePayload -> Pair) -> Maybe AttributePayload -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe AttributePayload
attributePayload,
            (Text
"billingGroupName" 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
billingGroupName
          ]
      )

instance Core.ToPath CreateThing where
  toPath :: CreateThing -> ByteString
toPath CreateThing' {Maybe Text
Maybe AttributePayload
Text
thingName :: Text
billingGroupName :: Maybe Text
attributePayload :: Maybe AttributePayload
thingTypeName :: Maybe Text
$sel:thingName:CreateThing' :: CreateThing -> Text
$sel:billingGroupName:CreateThing' :: CreateThing -> Maybe Text
$sel:attributePayload:CreateThing' :: CreateThing -> Maybe AttributePayload
$sel:thingTypeName:CreateThing' :: CreateThing -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/things/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
thingName]

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

-- | The output of the CreateThing operation.
--
-- /See:/ 'newCreateThingResponse' smart constructor.
data CreateThingResponse = CreateThingResponse'
  { -- | The ARN of the new thing.
    CreateThingResponse -> Maybe Text
thingArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the new thing.
    CreateThingResponse -> Maybe Text
thingName :: Prelude.Maybe Prelude.Text,
    -- | The thing ID.
    CreateThingResponse -> Maybe Text
thingId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateThingResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateThingResponse -> CreateThingResponse -> Bool
(CreateThingResponse -> CreateThingResponse -> Bool)
-> (CreateThingResponse -> CreateThingResponse -> Bool)
-> Eq CreateThingResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateThingResponse -> CreateThingResponse -> Bool
$c/= :: CreateThingResponse -> CreateThingResponse -> Bool
== :: CreateThingResponse -> CreateThingResponse -> Bool
$c== :: CreateThingResponse -> CreateThingResponse -> Bool
Prelude.Eq, ReadPrec [CreateThingResponse]
ReadPrec CreateThingResponse
Int -> ReadS CreateThingResponse
ReadS [CreateThingResponse]
(Int -> ReadS CreateThingResponse)
-> ReadS [CreateThingResponse]
-> ReadPrec CreateThingResponse
-> ReadPrec [CreateThingResponse]
-> Read CreateThingResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateThingResponse]
$creadListPrec :: ReadPrec [CreateThingResponse]
readPrec :: ReadPrec CreateThingResponse
$creadPrec :: ReadPrec CreateThingResponse
readList :: ReadS [CreateThingResponse]
$creadList :: ReadS [CreateThingResponse]
readsPrec :: Int -> ReadS CreateThingResponse
$creadsPrec :: Int -> ReadS CreateThingResponse
Prelude.Read, Int -> CreateThingResponse -> ShowS
[CreateThingResponse] -> ShowS
CreateThingResponse -> String
(Int -> CreateThingResponse -> ShowS)
-> (CreateThingResponse -> String)
-> ([CreateThingResponse] -> ShowS)
-> Show CreateThingResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateThingResponse] -> ShowS
$cshowList :: [CreateThingResponse] -> ShowS
show :: CreateThingResponse -> String
$cshow :: CreateThingResponse -> String
showsPrec :: Int -> CreateThingResponse -> ShowS
$cshowsPrec :: Int -> CreateThingResponse -> ShowS
Prelude.Show, (forall x. CreateThingResponse -> Rep CreateThingResponse x)
-> (forall x. Rep CreateThingResponse x -> CreateThingResponse)
-> Generic CreateThingResponse
forall x. Rep CreateThingResponse x -> CreateThingResponse
forall x. CreateThingResponse -> Rep CreateThingResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateThingResponse x -> CreateThingResponse
$cfrom :: forall x. CreateThingResponse -> Rep CreateThingResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateThingResponse' 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:
--
-- 'thingArn', 'createThingResponse_thingArn' - The ARN of the new thing.
--
-- 'thingName', 'createThingResponse_thingName' - The name of the new thing.
--
-- 'thingId', 'createThingResponse_thingId' - The thing ID.
--
-- 'httpStatus', 'createThingResponse_httpStatus' - The response's http status code.
newCreateThingResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateThingResponse
newCreateThingResponse :: Int -> CreateThingResponse
newCreateThingResponse Int
pHttpStatus_ =
  CreateThingResponse' :: Maybe Text
-> Maybe Text -> Maybe Text -> Int -> CreateThingResponse
CreateThingResponse'
    { $sel:thingArn:CreateThingResponse' :: Maybe Text
thingArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:thingName:CreateThingResponse' :: Maybe Text
thingName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:thingId:CreateThingResponse' :: Maybe Text
thingId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateThingResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the new thing.
createThingResponse_thingArn :: Lens.Lens' CreateThingResponse (Prelude.Maybe Prelude.Text)
createThingResponse_thingArn :: (Maybe Text -> f (Maybe Text))
-> CreateThingResponse -> f CreateThingResponse
createThingResponse_thingArn = (CreateThingResponse -> Maybe Text)
-> (CreateThingResponse -> Maybe Text -> CreateThingResponse)
-> Lens
     CreateThingResponse CreateThingResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateThingResponse' {Maybe Text
thingArn :: Maybe Text
$sel:thingArn:CreateThingResponse' :: CreateThingResponse -> Maybe Text
thingArn} -> Maybe Text
thingArn) (\s :: CreateThingResponse
s@CreateThingResponse' {} Maybe Text
a -> CreateThingResponse
s {$sel:thingArn:CreateThingResponse' :: Maybe Text
thingArn = Maybe Text
a} :: CreateThingResponse)

-- | The name of the new thing.
createThingResponse_thingName :: Lens.Lens' CreateThingResponse (Prelude.Maybe Prelude.Text)
createThingResponse_thingName :: (Maybe Text -> f (Maybe Text))
-> CreateThingResponse -> f CreateThingResponse
createThingResponse_thingName = (CreateThingResponse -> Maybe Text)
-> (CreateThingResponse -> Maybe Text -> CreateThingResponse)
-> Lens
     CreateThingResponse CreateThingResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateThingResponse' {Maybe Text
thingName :: Maybe Text
$sel:thingName:CreateThingResponse' :: CreateThingResponse -> Maybe Text
thingName} -> Maybe Text
thingName) (\s :: CreateThingResponse
s@CreateThingResponse' {} Maybe Text
a -> CreateThingResponse
s {$sel:thingName:CreateThingResponse' :: Maybe Text
thingName = Maybe Text
a} :: CreateThingResponse)

-- | The thing ID.
createThingResponse_thingId :: Lens.Lens' CreateThingResponse (Prelude.Maybe Prelude.Text)
createThingResponse_thingId :: (Maybe Text -> f (Maybe Text))
-> CreateThingResponse -> f CreateThingResponse
createThingResponse_thingId = (CreateThingResponse -> Maybe Text)
-> (CreateThingResponse -> Maybe Text -> CreateThingResponse)
-> Lens
     CreateThingResponse CreateThingResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateThingResponse' {Maybe Text
thingId :: Maybe Text
$sel:thingId:CreateThingResponse' :: CreateThingResponse -> Maybe Text
thingId} -> Maybe Text
thingId) (\s :: CreateThingResponse
s@CreateThingResponse' {} Maybe Text
a -> CreateThingResponse
s {$sel:thingId:CreateThingResponse' :: Maybe Text
thingId = Maybe Text
a} :: CreateThingResponse)

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

instance Prelude.NFData CreateThingResponse