{-# 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.CreateDynamicThingGroup
-- 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 dynamic thing group.
--
-- Requires permission to access the
-- <https://docs.aws.amazon.com/service-authorization/latest/reference/list_awsiot.html#awsiot-actions-as-permissions CreateDynamicThingGroup>
-- action.
module Amazonka.IoT.CreateDynamicThingGroup
  ( -- * Creating a Request
    CreateDynamicThingGroup (..),
    newCreateDynamicThingGroup,

    -- * Request Lenses
    createDynamicThingGroup_queryVersion,
    createDynamicThingGroup_thingGroupProperties,
    createDynamicThingGroup_indexName,
    createDynamicThingGroup_tags,
    createDynamicThingGroup_thingGroupName,
    createDynamicThingGroup_queryString,

    -- * Destructuring the Response
    CreateDynamicThingGroupResponse (..),
    newCreateDynamicThingGroupResponse,

    -- * Response Lenses
    createDynamicThingGroupResponse_queryVersion,
    createDynamicThingGroupResponse_thingGroupArn,
    createDynamicThingGroupResponse_thingGroupId,
    createDynamicThingGroupResponse_thingGroupName,
    createDynamicThingGroupResponse_queryString,
    createDynamicThingGroupResponse_indexName,
    createDynamicThingGroupResponse_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

-- | /See:/ 'newCreateDynamicThingGroup' smart constructor.
data CreateDynamicThingGroup = CreateDynamicThingGroup'
  { -- | The dynamic thing group query version.
    --
    -- Currently one query version is supported: \"2017-09-30\". If not
    -- specified, the query version defaults to this value.
    CreateDynamicThingGroup -> Maybe Text
queryVersion :: Prelude.Maybe Prelude.Text,
    -- | The dynamic thing group properties.
    CreateDynamicThingGroup -> Maybe ThingGroupProperties
thingGroupProperties :: Prelude.Maybe ThingGroupProperties,
    -- | The dynamic thing group index name.
    --
    -- Currently one index is supported: @AWS_Things@.
    CreateDynamicThingGroup -> Maybe Text
indexName :: Prelude.Maybe Prelude.Text,
    -- | Metadata which can be used to manage the dynamic thing group.
    CreateDynamicThingGroup -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The dynamic thing group name to create.
    CreateDynamicThingGroup -> Text
thingGroupName :: Prelude.Text,
    -- | The dynamic thing group search query string.
    --
    -- See
    -- <https://docs.aws.amazon.com/iot/latest/developerguide/query-syntax.html Query Syntax>
    -- for information about query string syntax.
    CreateDynamicThingGroup -> Text
queryString :: Prelude.Text
  }
  deriving (CreateDynamicThingGroup -> CreateDynamicThingGroup -> Bool
(CreateDynamicThingGroup -> CreateDynamicThingGroup -> Bool)
-> (CreateDynamicThingGroup -> CreateDynamicThingGroup -> Bool)
-> Eq CreateDynamicThingGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDynamicThingGroup -> CreateDynamicThingGroup -> Bool
$c/= :: CreateDynamicThingGroup -> CreateDynamicThingGroup -> Bool
== :: CreateDynamicThingGroup -> CreateDynamicThingGroup -> Bool
$c== :: CreateDynamicThingGroup -> CreateDynamicThingGroup -> Bool
Prelude.Eq, ReadPrec [CreateDynamicThingGroup]
ReadPrec CreateDynamicThingGroup
Int -> ReadS CreateDynamicThingGroup
ReadS [CreateDynamicThingGroup]
(Int -> ReadS CreateDynamicThingGroup)
-> ReadS [CreateDynamicThingGroup]
-> ReadPrec CreateDynamicThingGroup
-> ReadPrec [CreateDynamicThingGroup]
-> Read CreateDynamicThingGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDynamicThingGroup]
$creadListPrec :: ReadPrec [CreateDynamicThingGroup]
readPrec :: ReadPrec CreateDynamicThingGroup
$creadPrec :: ReadPrec CreateDynamicThingGroup
readList :: ReadS [CreateDynamicThingGroup]
$creadList :: ReadS [CreateDynamicThingGroup]
readsPrec :: Int -> ReadS CreateDynamicThingGroup
$creadsPrec :: Int -> ReadS CreateDynamicThingGroup
Prelude.Read, Int -> CreateDynamicThingGroup -> ShowS
[CreateDynamicThingGroup] -> ShowS
CreateDynamicThingGroup -> String
(Int -> CreateDynamicThingGroup -> ShowS)
-> (CreateDynamicThingGroup -> String)
-> ([CreateDynamicThingGroup] -> ShowS)
-> Show CreateDynamicThingGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDynamicThingGroup] -> ShowS
$cshowList :: [CreateDynamicThingGroup] -> ShowS
show :: CreateDynamicThingGroup -> String
$cshow :: CreateDynamicThingGroup -> String
showsPrec :: Int -> CreateDynamicThingGroup -> ShowS
$cshowsPrec :: Int -> CreateDynamicThingGroup -> ShowS
Prelude.Show, (forall x.
 CreateDynamicThingGroup -> Rep CreateDynamicThingGroup x)
-> (forall x.
    Rep CreateDynamicThingGroup x -> CreateDynamicThingGroup)
-> Generic CreateDynamicThingGroup
forall x. Rep CreateDynamicThingGroup x -> CreateDynamicThingGroup
forall x. CreateDynamicThingGroup -> Rep CreateDynamicThingGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateDynamicThingGroup x -> CreateDynamicThingGroup
$cfrom :: forall x. CreateDynamicThingGroup -> Rep CreateDynamicThingGroup x
Prelude.Generic)

-- |
-- Create a value of 'CreateDynamicThingGroup' 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:
--
-- 'queryVersion', 'createDynamicThingGroup_queryVersion' - The dynamic thing group query version.
--
-- Currently one query version is supported: \"2017-09-30\". If not
-- specified, the query version defaults to this value.
--
-- 'thingGroupProperties', 'createDynamicThingGroup_thingGroupProperties' - The dynamic thing group properties.
--
-- 'indexName', 'createDynamicThingGroup_indexName' - The dynamic thing group index name.
--
-- Currently one index is supported: @AWS_Things@.
--
-- 'tags', 'createDynamicThingGroup_tags' - Metadata which can be used to manage the dynamic thing group.
--
-- 'thingGroupName', 'createDynamicThingGroup_thingGroupName' - The dynamic thing group name to create.
--
-- 'queryString', 'createDynamicThingGroup_queryString' - The dynamic thing group search query string.
--
-- See
-- <https://docs.aws.amazon.com/iot/latest/developerguide/query-syntax.html Query Syntax>
-- for information about query string syntax.
newCreateDynamicThingGroup ::
  -- | 'thingGroupName'
  Prelude.Text ->
  -- | 'queryString'
  Prelude.Text ->
  CreateDynamicThingGroup
newCreateDynamicThingGroup :: Text -> Text -> CreateDynamicThingGroup
newCreateDynamicThingGroup
  Text
pThingGroupName_
  Text
pQueryString_ =
    CreateDynamicThingGroup' :: Maybe Text
-> Maybe ThingGroupProperties
-> Maybe Text
-> Maybe [Tag]
-> Text
-> Text
-> CreateDynamicThingGroup
CreateDynamicThingGroup'
      { $sel:queryVersion:CreateDynamicThingGroup' :: Maybe Text
queryVersion =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:thingGroupProperties:CreateDynamicThingGroup' :: Maybe ThingGroupProperties
thingGroupProperties = Maybe ThingGroupProperties
forall a. Maybe a
Prelude.Nothing,
        $sel:indexName:CreateDynamicThingGroup' :: Maybe Text
indexName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateDynamicThingGroup' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:thingGroupName:CreateDynamicThingGroup' :: Text
thingGroupName = Text
pThingGroupName_,
        $sel:queryString:CreateDynamicThingGroup' :: Text
queryString = Text
pQueryString_
      }

-- | The dynamic thing group query version.
--
-- Currently one query version is supported: \"2017-09-30\". If not
-- specified, the query version defaults to this value.
createDynamicThingGroup_queryVersion :: Lens.Lens' CreateDynamicThingGroup (Prelude.Maybe Prelude.Text)
createDynamicThingGroup_queryVersion :: (Maybe Text -> f (Maybe Text))
-> CreateDynamicThingGroup -> f CreateDynamicThingGroup
createDynamicThingGroup_queryVersion = (CreateDynamicThingGroup -> Maybe Text)
-> (CreateDynamicThingGroup
    -> Maybe Text -> CreateDynamicThingGroup)
-> Lens
     CreateDynamicThingGroup
     CreateDynamicThingGroup
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDynamicThingGroup' {Maybe Text
queryVersion :: Maybe Text
$sel:queryVersion:CreateDynamicThingGroup' :: CreateDynamicThingGroup -> Maybe Text
queryVersion} -> Maybe Text
queryVersion) (\s :: CreateDynamicThingGroup
s@CreateDynamicThingGroup' {} Maybe Text
a -> CreateDynamicThingGroup
s {$sel:queryVersion:CreateDynamicThingGroup' :: Maybe Text
queryVersion = Maybe Text
a} :: CreateDynamicThingGroup)

-- | The dynamic thing group properties.
createDynamicThingGroup_thingGroupProperties :: Lens.Lens' CreateDynamicThingGroup (Prelude.Maybe ThingGroupProperties)
createDynamicThingGroup_thingGroupProperties :: (Maybe ThingGroupProperties -> f (Maybe ThingGroupProperties))
-> CreateDynamicThingGroup -> f CreateDynamicThingGroup
createDynamicThingGroup_thingGroupProperties = (CreateDynamicThingGroup -> Maybe ThingGroupProperties)
-> (CreateDynamicThingGroup
    -> Maybe ThingGroupProperties -> CreateDynamicThingGroup)
-> Lens
     CreateDynamicThingGroup
     CreateDynamicThingGroup
     (Maybe ThingGroupProperties)
     (Maybe ThingGroupProperties)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDynamicThingGroup' {Maybe ThingGroupProperties
thingGroupProperties :: Maybe ThingGroupProperties
$sel:thingGroupProperties:CreateDynamicThingGroup' :: CreateDynamicThingGroup -> Maybe ThingGroupProperties
thingGroupProperties} -> Maybe ThingGroupProperties
thingGroupProperties) (\s :: CreateDynamicThingGroup
s@CreateDynamicThingGroup' {} Maybe ThingGroupProperties
a -> CreateDynamicThingGroup
s {$sel:thingGroupProperties:CreateDynamicThingGroup' :: Maybe ThingGroupProperties
thingGroupProperties = Maybe ThingGroupProperties
a} :: CreateDynamicThingGroup)

-- | The dynamic thing group index name.
--
-- Currently one index is supported: @AWS_Things@.
createDynamicThingGroup_indexName :: Lens.Lens' CreateDynamicThingGroup (Prelude.Maybe Prelude.Text)
createDynamicThingGroup_indexName :: (Maybe Text -> f (Maybe Text))
-> CreateDynamicThingGroup -> f CreateDynamicThingGroup
createDynamicThingGroup_indexName = (CreateDynamicThingGroup -> Maybe Text)
-> (CreateDynamicThingGroup
    -> Maybe Text -> CreateDynamicThingGroup)
-> Lens
     CreateDynamicThingGroup
     CreateDynamicThingGroup
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDynamicThingGroup' {Maybe Text
indexName :: Maybe Text
$sel:indexName:CreateDynamicThingGroup' :: CreateDynamicThingGroup -> Maybe Text
indexName} -> Maybe Text
indexName) (\s :: CreateDynamicThingGroup
s@CreateDynamicThingGroup' {} Maybe Text
a -> CreateDynamicThingGroup
s {$sel:indexName:CreateDynamicThingGroup' :: Maybe Text
indexName = Maybe Text
a} :: CreateDynamicThingGroup)

-- | Metadata which can be used to manage the dynamic thing group.
createDynamicThingGroup_tags :: Lens.Lens' CreateDynamicThingGroup (Prelude.Maybe [Tag])
createDynamicThingGroup_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDynamicThingGroup -> f CreateDynamicThingGroup
createDynamicThingGroup_tags = (CreateDynamicThingGroup -> Maybe [Tag])
-> (CreateDynamicThingGroup
    -> Maybe [Tag] -> CreateDynamicThingGroup)
-> Lens
     CreateDynamicThingGroup
     CreateDynamicThingGroup
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDynamicThingGroup' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateDynamicThingGroup' :: CreateDynamicThingGroup -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateDynamicThingGroup
s@CreateDynamicThingGroup' {} Maybe [Tag]
a -> CreateDynamicThingGroup
s {$sel:tags:CreateDynamicThingGroup' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateDynamicThingGroup) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateDynamicThingGroup -> f CreateDynamicThingGroup)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateDynamicThingGroup
-> f CreateDynamicThingGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The dynamic thing group name to create.
createDynamicThingGroup_thingGroupName :: Lens.Lens' CreateDynamicThingGroup Prelude.Text
createDynamicThingGroup_thingGroupName :: (Text -> f Text)
-> CreateDynamicThingGroup -> f CreateDynamicThingGroup
createDynamicThingGroup_thingGroupName = (CreateDynamicThingGroup -> Text)
-> (CreateDynamicThingGroup -> Text -> CreateDynamicThingGroup)
-> Lens CreateDynamicThingGroup CreateDynamicThingGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDynamicThingGroup' {Text
thingGroupName :: Text
$sel:thingGroupName:CreateDynamicThingGroup' :: CreateDynamicThingGroup -> Text
thingGroupName} -> Text
thingGroupName) (\s :: CreateDynamicThingGroup
s@CreateDynamicThingGroup' {} Text
a -> CreateDynamicThingGroup
s {$sel:thingGroupName:CreateDynamicThingGroup' :: Text
thingGroupName = Text
a} :: CreateDynamicThingGroup)

-- | The dynamic thing group search query string.
--
-- See
-- <https://docs.aws.amazon.com/iot/latest/developerguide/query-syntax.html Query Syntax>
-- for information about query string syntax.
createDynamicThingGroup_queryString :: Lens.Lens' CreateDynamicThingGroup Prelude.Text
createDynamicThingGroup_queryString :: (Text -> f Text)
-> CreateDynamicThingGroup -> f CreateDynamicThingGroup
createDynamicThingGroup_queryString = (CreateDynamicThingGroup -> Text)
-> (CreateDynamicThingGroup -> Text -> CreateDynamicThingGroup)
-> Lens CreateDynamicThingGroup CreateDynamicThingGroup Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDynamicThingGroup' {Text
queryString :: Text
$sel:queryString:CreateDynamicThingGroup' :: CreateDynamicThingGroup -> Text
queryString} -> Text
queryString) (\s :: CreateDynamicThingGroup
s@CreateDynamicThingGroup' {} Text
a -> CreateDynamicThingGroup
s {$sel:queryString:CreateDynamicThingGroup' :: Text
queryString = Text
a} :: CreateDynamicThingGroup)

instance Core.AWSRequest CreateDynamicThingGroup where
  type
    AWSResponse CreateDynamicThingGroup =
      CreateDynamicThingGroupResponse
  request :: CreateDynamicThingGroup -> Request CreateDynamicThingGroup
request = Service
-> CreateDynamicThingGroup -> Request CreateDynamicThingGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateDynamicThingGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateDynamicThingGroup)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateDynamicThingGroup))
-> Logger
-> Service
-> Proxy CreateDynamicThingGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateDynamicThingGroup)))
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
-> Int
-> CreateDynamicThingGroupResponse
CreateDynamicThingGroupResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> CreateDynamicThingGroupResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateDynamicThingGroupResponse)
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
"queryVersion")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateDynamicThingGroupResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateDynamicThingGroupResponse)
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
"thingGroupArn")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateDynamicThingGroupResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateDynamicThingGroupResponse)
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
"thingGroupId")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateDynamicThingGroupResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text -> Int -> CreateDynamicThingGroupResponse)
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
"thingGroupName")
            Either
  String
  (Maybe Text
   -> Maybe Text -> Int -> CreateDynamicThingGroupResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> CreateDynamicThingGroupResponse)
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
"queryString")
            Either
  String (Maybe Text -> Int -> CreateDynamicThingGroupResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateDynamicThingGroupResponse)
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
"indexName")
            Either String (Int -> CreateDynamicThingGroupResponse)
-> Either String Int
-> Either String CreateDynamicThingGroupResponse
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 CreateDynamicThingGroup

instance Prelude.NFData CreateDynamicThingGroup

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

instance Core.ToJSON CreateDynamicThingGroup where
  toJSON :: CreateDynamicThingGroup -> Value
toJSON CreateDynamicThingGroup' {Maybe [Tag]
Maybe Text
Maybe ThingGroupProperties
Text
queryString :: Text
thingGroupName :: Text
tags :: Maybe [Tag]
indexName :: Maybe Text
thingGroupProperties :: Maybe ThingGroupProperties
queryVersion :: Maybe Text
$sel:queryString:CreateDynamicThingGroup' :: CreateDynamicThingGroup -> Text
$sel:thingGroupName:CreateDynamicThingGroup' :: CreateDynamicThingGroup -> Text
$sel:tags:CreateDynamicThingGroup' :: CreateDynamicThingGroup -> Maybe [Tag]
$sel:indexName:CreateDynamicThingGroup' :: CreateDynamicThingGroup -> Maybe Text
$sel:thingGroupProperties:CreateDynamicThingGroup' :: CreateDynamicThingGroup -> Maybe ThingGroupProperties
$sel:queryVersion:CreateDynamicThingGroup' :: CreateDynamicThingGroup -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"queryVersion" 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
queryVersion,
            (Text
"thingGroupProperties" Text -> ThingGroupProperties -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ThingGroupProperties -> Pair)
-> Maybe ThingGroupProperties -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ThingGroupProperties
thingGroupProperties,
            (Text
"indexName" 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
indexName,
            (Text
"tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"queryString" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
queryString)
          ]
      )

instance Core.ToPath CreateDynamicThingGroup where
  toPath :: CreateDynamicThingGroup -> ByteString
toPath CreateDynamicThingGroup' {Maybe [Tag]
Maybe Text
Maybe ThingGroupProperties
Text
queryString :: Text
thingGroupName :: Text
tags :: Maybe [Tag]
indexName :: Maybe Text
thingGroupProperties :: Maybe ThingGroupProperties
queryVersion :: Maybe Text
$sel:queryString:CreateDynamicThingGroup' :: CreateDynamicThingGroup -> Text
$sel:thingGroupName:CreateDynamicThingGroup' :: CreateDynamicThingGroup -> Text
$sel:tags:CreateDynamicThingGroup' :: CreateDynamicThingGroup -> Maybe [Tag]
$sel:indexName:CreateDynamicThingGroup' :: CreateDynamicThingGroup -> Maybe Text
$sel:thingGroupProperties:CreateDynamicThingGroup' :: CreateDynamicThingGroup -> Maybe ThingGroupProperties
$sel:queryVersion:CreateDynamicThingGroup' :: CreateDynamicThingGroup -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ByteString
"/dynamic-thing-groups/", Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
thingGroupName]

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

-- | /See:/ 'newCreateDynamicThingGroupResponse' smart constructor.
data CreateDynamicThingGroupResponse = CreateDynamicThingGroupResponse'
  { -- | The dynamic thing group query version.
    CreateDynamicThingGroupResponse -> Maybe Text
queryVersion :: Prelude.Maybe Prelude.Text,
    -- | The dynamic thing group ARN.
    CreateDynamicThingGroupResponse -> Maybe Text
thingGroupArn :: Prelude.Maybe Prelude.Text,
    -- | The dynamic thing group ID.
    CreateDynamicThingGroupResponse -> Maybe Text
thingGroupId :: Prelude.Maybe Prelude.Text,
    -- | The dynamic thing group name.
    CreateDynamicThingGroupResponse -> Maybe Text
thingGroupName :: Prelude.Maybe Prelude.Text,
    -- | The dynamic thing group search query string.
    CreateDynamicThingGroupResponse -> Maybe Text
queryString :: Prelude.Maybe Prelude.Text,
    -- | The dynamic thing group index name.
    CreateDynamicThingGroupResponse -> Maybe Text
indexName :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateDynamicThingGroupResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateDynamicThingGroupResponse
-> CreateDynamicThingGroupResponse -> Bool
(CreateDynamicThingGroupResponse
 -> CreateDynamicThingGroupResponse -> Bool)
-> (CreateDynamicThingGroupResponse
    -> CreateDynamicThingGroupResponse -> Bool)
-> Eq CreateDynamicThingGroupResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateDynamicThingGroupResponse
-> CreateDynamicThingGroupResponse -> Bool
$c/= :: CreateDynamicThingGroupResponse
-> CreateDynamicThingGroupResponse -> Bool
== :: CreateDynamicThingGroupResponse
-> CreateDynamicThingGroupResponse -> Bool
$c== :: CreateDynamicThingGroupResponse
-> CreateDynamicThingGroupResponse -> Bool
Prelude.Eq, ReadPrec [CreateDynamicThingGroupResponse]
ReadPrec CreateDynamicThingGroupResponse
Int -> ReadS CreateDynamicThingGroupResponse
ReadS [CreateDynamicThingGroupResponse]
(Int -> ReadS CreateDynamicThingGroupResponse)
-> ReadS [CreateDynamicThingGroupResponse]
-> ReadPrec CreateDynamicThingGroupResponse
-> ReadPrec [CreateDynamicThingGroupResponse]
-> Read CreateDynamicThingGroupResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateDynamicThingGroupResponse]
$creadListPrec :: ReadPrec [CreateDynamicThingGroupResponse]
readPrec :: ReadPrec CreateDynamicThingGroupResponse
$creadPrec :: ReadPrec CreateDynamicThingGroupResponse
readList :: ReadS [CreateDynamicThingGroupResponse]
$creadList :: ReadS [CreateDynamicThingGroupResponse]
readsPrec :: Int -> ReadS CreateDynamicThingGroupResponse
$creadsPrec :: Int -> ReadS CreateDynamicThingGroupResponse
Prelude.Read, Int -> CreateDynamicThingGroupResponse -> ShowS
[CreateDynamicThingGroupResponse] -> ShowS
CreateDynamicThingGroupResponse -> String
(Int -> CreateDynamicThingGroupResponse -> ShowS)
-> (CreateDynamicThingGroupResponse -> String)
-> ([CreateDynamicThingGroupResponse] -> ShowS)
-> Show CreateDynamicThingGroupResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateDynamicThingGroupResponse] -> ShowS
$cshowList :: [CreateDynamicThingGroupResponse] -> ShowS
show :: CreateDynamicThingGroupResponse -> String
$cshow :: CreateDynamicThingGroupResponse -> String
showsPrec :: Int -> CreateDynamicThingGroupResponse -> ShowS
$cshowsPrec :: Int -> CreateDynamicThingGroupResponse -> ShowS
Prelude.Show, (forall x.
 CreateDynamicThingGroupResponse
 -> Rep CreateDynamicThingGroupResponse x)
-> (forall x.
    Rep CreateDynamicThingGroupResponse x
    -> CreateDynamicThingGroupResponse)
-> Generic CreateDynamicThingGroupResponse
forall x.
Rep CreateDynamicThingGroupResponse x
-> CreateDynamicThingGroupResponse
forall x.
CreateDynamicThingGroupResponse
-> Rep CreateDynamicThingGroupResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateDynamicThingGroupResponse x
-> CreateDynamicThingGroupResponse
$cfrom :: forall x.
CreateDynamicThingGroupResponse
-> Rep CreateDynamicThingGroupResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateDynamicThingGroupResponse' 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:
--
-- 'queryVersion', 'createDynamicThingGroupResponse_queryVersion' - The dynamic thing group query version.
--
-- 'thingGroupArn', 'createDynamicThingGroupResponse_thingGroupArn' - The dynamic thing group ARN.
--
-- 'thingGroupId', 'createDynamicThingGroupResponse_thingGroupId' - The dynamic thing group ID.
--
-- 'thingGroupName', 'createDynamicThingGroupResponse_thingGroupName' - The dynamic thing group name.
--
-- 'queryString', 'createDynamicThingGroupResponse_queryString' - The dynamic thing group search query string.
--
-- 'indexName', 'createDynamicThingGroupResponse_indexName' - The dynamic thing group index name.
--
-- 'httpStatus', 'createDynamicThingGroupResponse_httpStatus' - The response's http status code.
newCreateDynamicThingGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateDynamicThingGroupResponse
newCreateDynamicThingGroupResponse :: Int -> CreateDynamicThingGroupResponse
newCreateDynamicThingGroupResponse Int
pHttpStatus_ =
  CreateDynamicThingGroupResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateDynamicThingGroupResponse
CreateDynamicThingGroupResponse'
    { $sel:queryVersion:CreateDynamicThingGroupResponse' :: Maybe Text
queryVersion =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:thingGroupArn:CreateDynamicThingGroupResponse' :: Maybe Text
thingGroupArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:thingGroupId:CreateDynamicThingGroupResponse' :: Maybe Text
thingGroupId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:thingGroupName:CreateDynamicThingGroupResponse' :: Maybe Text
thingGroupName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:queryString:CreateDynamicThingGroupResponse' :: Maybe Text
queryString = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:indexName:CreateDynamicThingGroupResponse' :: Maybe Text
indexName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateDynamicThingGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The dynamic thing group query version.
createDynamicThingGroupResponse_queryVersion :: Lens.Lens' CreateDynamicThingGroupResponse (Prelude.Maybe Prelude.Text)
createDynamicThingGroupResponse_queryVersion :: (Maybe Text -> f (Maybe Text))
-> CreateDynamicThingGroupResponse
-> f CreateDynamicThingGroupResponse
createDynamicThingGroupResponse_queryVersion = (CreateDynamicThingGroupResponse -> Maybe Text)
-> (CreateDynamicThingGroupResponse
    -> Maybe Text -> CreateDynamicThingGroupResponse)
-> Lens
     CreateDynamicThingGroupResponse
     CreateDynamicThingGroupResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDynamicThingGroupResponse' {Maybe Text
queryVersion :: Maybe Text
$sel:queryVersion:CreateDynamicThingGroupResponse' :: CreateDynamicThingGroupResponse -> Maybe Text
queryVersion} -> Maybe Text
queryVersion) (\s :: CreateDynamicThingGroupResponse
s@CreateDynamicThingGroupResponse' {} Maybe Text
a -> CreateDynamicThingGroupResponse
s {$sel:queryVersion:CreateDynamicThingGroupResponse' :: Maybe Text
queryVersion = Maybe Text
a} :: CreateDynamicThingGroupResponse)

-- | The dynamic thing group ARN.
createDynamicThingGroupResponse_thingGroupArn :: Lens.Lens' CreateDynamicThingGroupResponse (Prelude.Maybe Prelude.Text)
createDynamicThingGroupResponse_thingGroupArn :: (Maybe Text -> f (Maybe Text))
-> CreateDynamicThingGroupResponse
-> f CreateDynamicThingGroupResponse
createDynamicThingGroupResponse_thingGroupArn = (CreateDynamicThingGroupResponse -> Maybe Text)
-> (CreateDynamicThingGroupResponse
    -> Maybe Text -> CreateDynamicThingGroupResponse)
-> Lens
     CreateDynamicThingGroupResponse
     CreateDynamicThingGroupResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDynamicThingGroupResponse' {Maybe Text
thingGroupArn :: Maybe Text
$sel:thingGroupArn:CreateDynamicThingGroupResponse' :: CreateDynamicThingGroupResponse -> Maybe Text
thingGroupArn} -> Maybe Text
thingGroupArn) (\s :: CreateDynamicThingGroupResponse
s@CreateDynamicThingGroupResponse' {} Maybe Text
a -> CreateDynamicThingGroupResponse
s {$sel:thingGroupArn:CreateDynamicThingGroupResponse' :: Maybe Text
thingGroupArn = Maybe Text
a} :: CreateDynamicThingGroupResponse)

-- | The dynamic thing group ID.
createDynamicThingGroupResponse_thingGroupId :: Lens.Lens' CreateDynamicThingGroupResponse (Prelude.Maybe Prelude.Text)
createDynamicThingGroupResponse_thingGroupId :: (Maybe Text -> f (Maybe Text))
-> CreateDynamicThingGroupResponse
-> f CreateDynamicThingGroupResponse
createDynamicThingGroupResponse_thingGroupId = (CreateDynamicThingGroupResponse -> Maybe Text)
-> (CreateDynamicThingGroupResponse
    -> Maybe Text -> CreateDynamicThingGroupResponse)
-> Lens
     CreateDynamicThingGroupResponse
     CreateDynamicThingGroupResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDynamicThingGroupResponse' {Maybe Text
thingGroupId :: Maybe Text
$sel:thingGroupId:CreateDynamicThingGroupResponse' :: CreateDynamicThingGroupResponse -> Maybe Text
thingGroupId} -> Maybe Text
thingGroupId) (\s :: CreateDynamicThingGroupResponse
s@CreateDynamicThingGroupResponse' {} Maybe Text
a -> CreateDynamicThingGroupResponse
s {$sel:thingGroupId:CreateDynamicThingGroupResponse' :: Maybe Text
thingGroupId = Maybe Text
a} :: CreateDynamicThingGroupResponse)

-- | The dynamic thing group name.
createDynamicThingGroupResponse_thingGroupName :: Lens.Lens' CreateDynamicThingGroupResponse (Prelude.Maybe Prelude.Text)
createDynamicThingGroupResponse_thingGroupName :: (Maybe Text -> f (Maybe Text))
-> CreateDynamicThingGroupResponse
-> f CreateDynamicThingGroupResponse
createDynamicThingGroupResponse_thingGroupName = (CreateDynamicThingGroupResponse -> Maybe Text)
-> (CreateDynamicThingGroupResponse
    -> Maybe Text -> CreateDynamicThingGroupResponse)
-> Lens
     CreateDynamicThingGroupResponse
     CreateDynamicThingGroupResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDynamicThingGroupResponse' {Maybe Text
thingGroupName :: Maybe Text
$sel:thingGroupName:CreateDynamicThingGroupResponse' :: CreateDynamicThingGroupResponse -> Maybe Text
thingGroupName} -> Maybe Text
thingGroupName) (\s :: CreateDynamicThingGroupResponse
s@CreateDynamicThingGroupResponse' {} Maybe Text
a -> CreateDynamicThingGroupResponse
s {$sel:thingGroupName:CreateDynamicThingGroupResponse' :: Maybe Text
thingGroupName = Maybe Text
a} :: CreateDynamicThingGroupResponse)

-- | The dynamic thing group search query string.
createDynamicThingGroupResponse_queryString :: Lens.Lens' CreateDynamicThingGroupResponse (Prelude.Maybe Prelude.Text)
createDynamicThingGroupResponse_queryString :: (Maybe Text -> f (Maybe Text))
-> CreateDynamicThingGroupResponse
-> f CreateDynamicThingGroupResponse
createDynamicThingGroupResponse_queryString = (CreateDynamicThingGroupResponse -> Maybe Text)
-> (CreateDynamicThingGroupResponse
    -> Maybe Text -> CreateDynamicThingGroupResponse)
-> Lens
     CreateDynamicThingGroupResponse
     CreateDynamicThingGroupResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDynamicThingGroupResponse' {Maybe Text
queryString :: Maybe Text
$sel:queryString:CreateDynamicThingGroupResponse' :: CreateDynamicThingGroupResponse -> Maybe Text
queryString} -> Maybe Text
queryString) (\s :: CreateDynamicThingGroupResponse
s@CreateDynamicThingGroupResponse' {} Maybe Text
a -> CreateDynamicThingGroupResponse
s {$sel:queryString:CreateDynamicThingGroupResponse' :: Maybe Text
queryString = Maybe Text
a} :: CreateDynamicThingGroupResponse)

-- | The dynamic thing group index name.
createDynamicThingGroupResponse_indexName :: Lens.Lens' CreateDynamicThingGroupResponse (Prelude.Maybe Prelude.Text)
createDynamicThingGroupResponse_indexName :: (Maybe Text -> f (Maybe Text))
-> CreateDynamicThingGroupResponse
-> f CreateDynamicThingGroupResponse
createDynamicThingGroupResponse_indexName = (CreateDynamicThingGroupResponse -> Maybe Text)
-> (CreateDynamicThingGroupResponse
    -> Maybe Text -> CreateDynamicThingGroupResponse)
-> Lens
     CreateDynamicThingGroupResponse
     CreateDynamicThingGroupResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateDynamicThingGroupResponse' {Maybe Text
indexName :: Maybe Text
$sel:indexName:CreateDynamicThingGroupResponse' :: CreateDynamicThingGroupResponse -> Maybe Text
indexName} -> Maybe Text
indexName) (\s :: CreateDynamicThingGroupResponse
s@CreateDynamicThingGroupResponse' {} Maybe Text
a -> CreateDynamicThingGroupResponse
s {$sel:indexName:CreateDynamicThingGroupResponse' :: Maybe Text
indexName = Maybe Text
a} :: CreateDynamicThingGroupResponse)

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

instance
  Prelude.NFData
    CreateDynamicThingGroupResponse