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

    -- * Request Lenses
    createProvisioningTemplate_preProvisioningHook,
    createProvisioningTemplate_enabled,
    createProvisioningTemplate_description,
    createProvisioningTemplate_tags,
    createProvisioningTemplate_templateName,
    createProvisioningTemplate_templateBody,
    createProvisioningTemplate_provisioningRoleArn,

    -- * Destructuring the Response
    CreateProvisioningTemplateResponse (..),
    newCreateProvisioningTemplateResponse,

    -- * Response Lenses
    createProvisioningTemplateResponse_templateName,
    createProvisioningTemplateResponse_defaultVersionId,
    createProvisioningTemplateResponse_templateArn,
    createProvisioningTemplateResponse_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:/ 'newCreateProvisioningTemplate' smart constructor.
data CreateProvisioningTemplate = CreateProvisioningTemplate'
  { -- | Creates a pre-provisioning hook template.
    CreateProvisioningTemplate -> Maybe ProvisioningHook
preProvisioningHook :: Prelude.Maybe ProvisioningHook,
    -- | True to enable the fleet provisioning template, otherwise false.
    CreateProvisioningTemplate -> Maybe Bool
enabled :: Prelude.Maybe Prelude.Bool,
    -- | The description of the fleet provisioning template.
    CreateProvisioningTemplate -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Metadata which can be used to manage the fleet provisioning template.
    --
    -- For URI Request parameters use format: ...key1=value1&key2=value2...
    --
    -- For the CLI command-line parameter use format: &&tags
    -- \"key1=value1&key2=value2...\"
    --
    -- For the cli-input-json file use format: \"tags\":
    -- \"key1=value1&key2=value2...\"
    CreateProvisioningTemplate -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name of the fleet provisioning template.
    CreateProvisioningTemplate -> Text
templateName :: Prelude.Text,
    -- | The JSON formatted contents of the fleet provisioning template.
    CreateProvisioningTemplate -> Text
templateBody :: Prelude.Text,
    -- | The role ARN for the role associated with the fleet provisioning
    -- template. This IoT role grants permission to provision a device.
    CreateProvisioningTemplate -> Text
provisioningRoleArn :: Prelude.Text
  }
  deriving (CreateProvisioningTemplate -> CreateProvisioningTemplate -> Bool
(CreateProvisioningTemplate -> CreateProvisioningTemplate -> Bool)
-> (CreateProvisioningTemplate
    -> CreateProvisioningTemplate -> Bool)
-> Eq CreateProvisioningTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateProvisioningTemplate -> CreateProvisioningTemplate -> Bool
$c/= :: CreateProvisioningTemplate -> CreateProvisioningTemplate -> Bool
== :: CreateProvisioningTemplate -> CreateProvisioningTemplate -> Bool
$c== :: CreateProvisioningTemplate -> CreateProvisioningTemplate -> Bool
Prelude.Eq, ReadPrec [CreateProvisioningTemplate]
ReadPrec CreateProvisioningTemplate
Int -> ReadS CreateProvisioningTemplate
ReadS [CreateProvisioningTemplate]
(Int -> ReadS CreateProvisioningTemplate)
-> ReadS [CreateProvisioningTemplate]
-> ReadPrec CreateProvisioningTemplate
-> ReadPrec [CreateProvisioningTemplate]
-> Read CreateProvisioningTemplate
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateProvisioningTemplate]
$creadListPrec :: ReadPrec [CreateProvisioningTemplate]
readPrec :: ReadPrec CreateProvisioningTemplate
$creadPrec :: ReadPrec CreateProvisioningTemplate
readList :: ReadS [CreateProvisioningTemplate]
$creadList :: ReadS [CreateProvisioningTemplate]
readsPrec :: Int -> ReadS CreateProvisioningTemplate
$creadsPrec :: Int -> ReadS CreateProvisioningTemplate
Prelude.Read, Int -> CreateProvisioningTemplate -> ShowS
[CreateProvisioningTemplate] -> ShowS
CreateProvisioningTemplate -> String
(Int -> CreateProvisioningTemplate -> ShowS)
-> (CreateProvisioningTemplate -> String)
-> ([CreateProvisioningTemplate] -> ShowS)
-> Show CreateProvisioningTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateProvisioningTemplate] -> ShowS
$cshowList :: [CreateProvisioningTemplate] -> ShowS
show :: CreateProvisioningTemplate -> String
$cshow :: CreateProvisioningTemplate -> String
showsPrec :: Int -> CreateProvisioningTemplate -> ShowS
$cshowsPrec :: Int -> CreateProvisioningTemplate -> ShowS
Prelude.Show, (forall x.
 CreateProvisioningTemplate -> Rep CreateProvisioningTemplate x)
-> (forall x.
    Rep CreateProvisioningTemplate x -> CreateProvisioningTemplate)
-> Generic CreateProvisioningTemplate
forall x.
Rep CreateProvisioningTemplate x -> CreateProvisioningTemplate
forall x.
CreateProvisioningTemplate -> Rep CreateProvisioningTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateProvisioningTemplate x -> CreateProvisioningTemplate
$cfrom :: forall x.
CreateProvisioningTemplate -> Rep CreateProvisioningTemplate x
Prelude.Generic)

-- |
-- Create a value of 'CreateProvisioningTemplate' 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:
--
-- 'preProvisioningHook', 'createProvisioningTemplate_preProvisioningHook' - Creates a pre-provisioning hook template.
--
-- 'enabled', 'createProvisioningTemplate_enabled' - True to enable the fleet provisioning template, otherwise false.
--
-- 'description', 'createProvisioningTemplate_description' - The description of the fleet provisioning template.
--
-- 'tags', 'createProvisioningTemplate_tags' - Metadata which can be used to manage the fleet provisioning template.
--
-- For URI Request parameters use format: ...key1=value1&key2=value2...
--
-- For the CLI command-line parameter use format: &&tags
-- \"key1=value1&key2=value2...\"
--
-- For the cli-input-json file use format: \"tags\":
-- \"key1=value1&key2=value2...\"
--
-- 'templateName', 'createProvisioningTemplate_templateName' - The name of the fleet provisioning template.
--
-- 'templateBody', 'createProvisioningTemplate_templateBody' - The JSON formatted contents of the fleet provisioning template.
--
-- 'provisioningRoleArn', 'createProvisioningTemplate_provisioningRoleArn' - The role ARN for the role associated with the fleet provisioning
-- template. This IoT role grants permission to provision a device.
newCreateProvisioningTemplate ::
  -- | 'templateName'
  Prelude.Text ->
  -- | 'templateBody'
  Prelude.Text ->
  -- | 'provisioningRoleArn'
  Prelude.Text ->
  CreateProvisioningTemplate
newCreateProvisioningTemplate :: Text -> Text -> Text -> CreateProvisioningTemplate
newCreateProvisioningTemplate
  Text
pTemplateName_
  Text
pTemplateBody_
  Text
pProvisioningRoleArn_ =
    CreateProvisioningTemplate' :: Maybe ProvisioningHook
-> Maybe Bool
-> Maybe Text
-> Maybe [Tag]
-> Text
-> Text
-> Text
-> CreateProvisioningTemplate
CreateProvisioningTemplate'
      { $sel:preProvisioningHook:CreateProvisioningTemplate' :: Maybe ProvisioningHook
preProvisioningHook =
          Maybe ProvisioningHook
forall a. Maybe a
Prelude.Nothing,
        $sel:enabled:CreateProvisioningTemplate' :: Maybe Bool
enabled = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateProvisioningTemplate' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateProvisioningTemplate' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:templateName:CreateProvisioningTemplate' :: Text
templateName = Text
pTemplateName_,
        $sel:templateBody:CreateProvisioningTemplate' :: Text
templateBody = Text
pTemplateBody_,
        $sel:provisioningRoleArn:CreateProvisioningTemplate' :: Text
provisioningRoleArn = Text
pProvisioningRoleArn_
      }

-- | Creates a pre-provisioning hook template.
createProvisioningTemplate_preProvisioningHook :: Lens.Lens' CreateProvisioningTemplate (Prelude.Maybe ProvisioningHook)
createProvisioningTemplate_preProvisioningHook :: (Maybe ProvisioningHook -> f (Maybe ProvisioningHook))
-> CreateProvisioningTemplate -> f CreateProvisioningTemplate
createProvisioningTemplate_preProvisioningHook = (CreateProvisioningTemplate -> Maybe ProvisioningHook)
-> (CreateProvisioningTemplate
    -> Maybe ProvisioningHook -> CreateProvisioningTemplate)
-> Lens
     CreateProvisioningTemplate
     CreateProvisioningTemplate
     (Maybe ProvisioningHook)
     (Maybe ProvisioningHook)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProvisioningTemplate' {Maybe ProvisioningHook
preProvisioningHook :: Maybe ProvisioningHook
$sel:preProvisioningHook:CreateProvisioningTemplate' :: CreateProvisioningTemplate -> Maybe ProvisioningHook
preProvisioningHook} -> Maybe ProvisioningHook
preProvisioningHook) (\s :: CreateProvisioningTemplate
s@CreateProvisioningTemplate' {} Maybe ProvisioningHook
a -> CreateProvisioningTemplate
s {$sel:preProvisioningHook:CreateProvisioningTemplate' :: Maybe ProvisioningHook
preProvisioningHook = Maybe ProvisioningHook
a} :: CreateProvisioningTemplate)

-- | True to enable the fleet provisioning template, otherwise false.
createProvisioningTemplate_enabled :: Lens.Lens' CreateProvisioningTemplate (Prelude.Maybe Prelude.Bool)
createProvisioningTemplate_enabled :: (Maybe Bool -> f (Maybe Bool))
-> CreateProvisioningTemplate -> f CreateProvisioningTemplate
createProvisioningTemplate_enabled = (CreateProvisioningTemplate -> Maybe Bool)
-> (CreateProvisioningTemplate
    -> Maybe Bool -> CreateProvisioningTemplate)
-> Lens
     CreateProvisioningTemplate
     CreateProvisioningTemplate
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProvisioningTemplate' {Maybe Bool
enabled :: Maybe Bool
$sel:enabled:CreateProvisioningTemplate' :: CreateProvisioningTemplate -> Maybe Bool
enabled} -> Maybe Bool
enabled) (\s :: CreateProvisioningTemplate
s@CreateProvisioningTemplate' {} Maybe Bool
a -> CreateProvisioningTemplate
s {$sel:enabled:CreateProvisioningTemplate' :: Maybe Bool
enabled = Maybe Bool
a} :: CreateProvisioningTemplate)

-- | The description of the fleet provisioning template.
createProvisioningTemplate_description :: Lens.Lens' CreateProvisioningTemplate (Prelude.Maybe Prelude.Text)
createProvisioningTemplate_description :: (Maybe Text -> f (Maybe Text))
-> CreateProvisioningTemplate -> f CreateProvisioningTemplate
createProvisioningTemplate_description = (CreateProvisioningTemplate -> Maybe Text)
-> (CreateProvisioningTemplate
    -> Maybe Text -> CreateProvisioningTemplate)
-> Lens
     CreateProvisioningTemplate
     CreateProvisioningTemplate
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProvisioningTemplate' {Maybe Text
description :: Maybe Text
$sel:description:CreateProvisioningTemplate' :: CreateProvisioningTemplate -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateProvisioningTemplate
s@CreateProvisioningTemplate' {} Maybe Text
a -> CreateProvisioningTemplate
s {$sel:description:CreateProvisioningTemplate' :: Maybe Text
description = Maybe Text
a} :: CreateProvisioningTemplate)

-- | Metadata which can be used to manage the fleet provisioning template.
--
-- For URI Request parameters use format: ...key1=value1&key2=value2...
--
-- For the CLI command-line parameter use format: &&tags
-- \"key1=value1&key2=value2...\"
--
-- For the cli-input-json file use format: \"tags\":
-- \"key1=value1&key2=value2...\"
createProvisioningTemplate_tags :: Lens.Lens' CreateProvisioningTemplate (Prelude.Maybe [Tag])
createProvisioningTemplate_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateProvisioningTemplate -> f CreateProvisioningTemplate
createProvisioningTemplate_tags = (CreateProvisioningTemplate -> Maybe [Tag])
-> (CreateProvisioningTemplate
    -> Maybe [Tag] -> CreateProvisioningTemplate)
-> Lens
     CreateProvisioningTemplate
     CreateProvisioningTemplate
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProvisioningTemplate' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateProvisioningTemplate' :: CreateProvisioningTemplate -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateProvisioningTemplate
s@CreateProvisioningTemplate' {} Maybe [Tag]
a -> CreateProvisioningTemplate
s {$sel:tags:CreateProvisioningTemplate' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateProvisioningTemplate) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateProvisioningTemplate -> f CreateProvisioningTemplate)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateProvisioningTemplate
-> f CreateProvisioningTemplate
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 name of the fleet provisioning template.
createProvisioningTemplate_templateName :: Lens.Lens' CreateProvisioningTemplate Prelude.Text
createProvisioningTemplate_templateName :: (Text -> f Text)
-> CreateProvisioningTemplate -> f CreateProvisioningTemplate
createProvisioningTemplate_templateName = (CreateProvisioningTemplate -> Text)
-> (CreateProvisioningTemplate
    -> Text -> CreateProvisioningTemplate)
-> Lens
     CreateProvisioningTemplate CreateProvisioningTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProvisioningTemplate' {Text
templateName :: Text
$sel:templateName:CreateProvisioningTemplate' :: CreateProvisioningTemplate -> Text
templateName} -> Text
templateName) (\s :: CreateProvisioningTemplate
s@CreateProvisioningTemplate' {} Text
a -> CreateProvisioningTemplate
s {$sel:templateName:CreateProvisioningTemplate' :: Text
templateName = Text
a} :: CreateProvisioningTemplate)

-- | The JSON formatted contents of the fleet provisioning template.
createProvisioningTemplate_templateBody :: Lens.Lens' CreateProvisioningTemplate Prelude.Text
createProvisioningTemplate_templateBody :: (Text -> f Text)
-> CreateProvisioningTemplate -> f CreateProvisioningTemplate
createProvisioningTemplate_templateBody = (CreateProvisioningTemplate -> Text)
-> (CreateProvisioningTemplate
    -> Text -> CreateProvisioningTemplate)
-> Lens
     CreateProvisioningTemplate CreateProvisioningTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProvisioningTemplate' {Text
templateBody :: Text
$sel:templateBody:CreateProvisioningTemplate' :: CreateProvisioningTemplate -> Text
templateBody} -> Text
templateBody) (\s :: CreateProvisioningTemplate
s@CreateProvisioningTemplate' {} Text
a -> CreateProvisioningTemplate
s {$sel:templateBody:CreateProvisioningTemplate' :: Text
templateBody = Text
a} :: CreateProvisioningTemplate)

-- | The role ARN for the role associated with the fleet provisioning
-- template. This IoT role grants permission to provision a device.
createProvisioningTemplate_provisioningRoleArn :: Lens.Lens' CreateProvisioningTemplate Prelude.Text
createProvisioningTemplate_provisioningRoleArn :: (Text -> f Text)
-> CreateProvisioningTemplate -> f CreateProvisioningTemplate
createProvisioningTemplate_provisioningRoleArn = (CreateProvisioningTemplate -> Text)
-> (CreateProvisioningTemplate
    -> Text -> CreateProvisioningTemplate)
-> Lens
     CreateProvisioningTemplate CreateProvisioningTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProvisioningTemplate' {Text
provisioningRoleArn :: Text
$sel:provisioningRoleArn:CreateProvisioningTemplate' :: CreateProvisioningTemplate -> Text
provisioningRoleArn} -> Text
provisioningRoleArn) (\s :: CreateProvisioningTemplate
s@CreateProvisioningTemplate' {} Text
a -> CreateProvisioningTemplate
s {$sel:provisioningRoleArn:CreateProvisioningTemplate' :: Text
provisioningRoleArn = Text
a} :: CreateProvisioningTemplate)

instance Core.AWSRequest CreateProvisioningTemplate where
  type
    AWSResponse CreateProvisioningTemplate =
      CreateProvisioningTemplateResponse
  request :: CreateProvisioningTemplate -> Request CreateProvisioningTemplate
request = Service
-> CreateProvisioningTemplate -> Request CreateProvisioningTemplate
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateProvisioningTemplate
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateProvisioningTemplate)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateProvisioningTemplate))
-> Logger
-> Service
-> Proxy CreateProvisioningTemplate
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateProvisioningTemplate)))
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 Int
-> Maybe Text
-> Int
-> CreateProvisioningTemplateResponse
CreateProvisioningTemplateResponse'
            (Maybe Text
 -> Maybe Int
 -> Maybe Text
 -> Int
 -> CreateProvisioningTemplateResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Int
      -> Maybe Text -> Int -> CreateProvisioningTemplateResponse)
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
"templateName")
            Either
  String
  (Maybe Int
   -> Maybe Text -> Int -> CreateProvisioningTemplateResponse)
-> Either String (Maybe Int)
-> Either
     String (Maybe Text -> Int -> CreateProvisioningTemplateResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe Int)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"defaultVersionId")
            Either
  String (Maybe Text -> Int -> CreateProvisioningTemplateResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateProvisioningTemplateResponse)
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
"templateArn")
            Either String (Int -> CreateProvisioningTemplateResponse)
-> Either String Int
-> Either String CreateProvisioningTemplateResponse
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 CreateProvisioningTemplate

instance Prelude.NFData CreateProvisioningTemplate

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

instance Core.ToJSON CreateProvisioningTemplate where
  toJSON :: CreateProvisioningTemplate -> Value
toJSON CreateProvisioningTemplate' {Maybe Bool
Maybe [Tag]
Maybe Text
Maybe ProvisioningHook
Text
provisioningRoleArn :: Text
templateBody :: Text
templateName :: Text
tags :: Maybe [Tag]
description :: Maybe Text
enabled :: Maybe Bool
preProvisioningHook :: Maybe ProvisioningHook
$sel:provisioningRoleArn:CreateProvisioningTemplate' :: CreateProvisioningTemplate -> Text
$sel:templateBody:CreateProvisioningTemplate' :: CreateProvisioningTemplate -> Text
$sel:templateName:CreateProvisioningTemplate' :: CreateProvisioningTemplate -> Text
$sel:tags:CreateProvisioningTemplate' :: CreateProvisioningTemplate -> Maybe [Tag]
$sel:description:CreateProvisioningTemplate' :: CreateProvisioningTemplate -> Maybe Text
$sel:enabled:CreateProvisioningTemplate' :: CreateProvisioningTemplate -> Maybe Bool
$sel:preProvisioningHook:CreateProvisioningTemplate' :: CreateProvisioningTemplate -> Maybe ProvisioningHook
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"preProvisioningHook" Text -> ProvisioningHook -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ProvisioningHook -> Pair) -> Maybe ProvisioningHook -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ProvisioningHook
preProvisioningHook,
            (Text
"enabled" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
enabled,
            (Text
"description" 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
description,
            (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
"templateName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
templateName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"templateBody" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
templateBody),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"provisioningRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
provisioningRoleArn)
          ]
      )

instance Core.ToPath CreateProvisioningTemplate where
  toPath :: CreateProvisioningTemplate -> ByteString
toPath = ByteString -> CreateProvisioningTemplate -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/provisioning-templates"

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

-- | /See:/ 'newCreateProvisioningTemplateResponse' smart constructor.
data CreateProvisioningTemplateResponse = CreateProvisioningTemplateResponse'
  { -- | The name of the fleet provisioning template.
    CreateProvisioningTemplateResponse -> Maybe Text
templateName :: Prelude.Maybe Prelude.Text,
    -- | The default version of the fleet provisioning template.
    CreateProvisioningTemplateResponse -> Maybe Int
defaultVersionId :: Prelude.Maybe Prelude.Int,
    -- | The ARN that identifies the provisioning template.
    CreateProvisioningTemplateResponse -> Maybe Text
templateArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateProvisioningTemplateResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateProvisioningTemplateResponse
-> CreateProvisioningTemplateResponse -> Bool
(CreateProvisioningTemplateResponse
 -> CreateProvisioningTemplateResponse -> Bool)
-> (CreateProvisioningTemplateResponse
    -> CreateProvisioningTemplateResponse -> Bool)
-> Eq CreateProvisioningTemplateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateProvisioningTemplateResponse
-> CreateProvisioningTemplateResponse -> Bool
$c/= :: CreateProvisioningTemplateResponse
-> CreateProvisioningTemplateResponse -> Bool
== :: CreateProvisioningTemplateResponse
-> CreateProvisioningTemplateResponse -> Bool
$c== :: CreateProvisioningTemplateResponse
-> CreateProvisioningTemplateResponse -> Bool
Prelude.Eq, ReadPrec [CreateProvisioningTemplateResponse]
ReadPrec CreateProvisioningTemplateResponse
Int -> ReadS CreateProvisioningTemplateResponse
ReadS [CreateProvisioningTemplateResponse]
(Int -> ReadS CreateProvisioningTemplateResponse)
-> ReadS [CreateProvisioningTemplateResponse]
-> ReadPrec CreateProvisioningTemplateResponse
-> ReadPrec [CreateProvisioningTemplateResponse]
-> Read CreateProvisioningTemplateResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateProvisioningTemplateResponse]
$creadListPrec :: ReadPrec [CreateProvisioningTemplateResponse]
readPrec :: ReadPrec CreateProvisioningTemplateResponse
$creadPrec :: ReadPrec CreateProvisioningTemplateResponse
readList :: ReadS [CreateProvisioningTemplateResponse]
$creadList :: ReadS [CreateProvisioningTemplateResponse]
readsPrec :: Int -> ReadS CreateProvisioningTemplateResponse
$creadsPrec :: Int -> ReadS CreateProvisioningTemplateResponse
Prelude.Read, Int -> CreateProvisioningTemplateResponse -> ShowS
[CreateProvisioningTemplateResponse] -> ShowS
CreateProvisioningTemplateResponse -> String
(Int -> CreateProvisioningTemplateResponse -> ShowS)
-> (CreateProvisioningTemplateResponse -> String)
-> ([CreateProvisioningTemplateResponse] -> ShowS)
-> Show CreateProvisioningTemplateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateProvisioningTemplateResponse] -> ShowS
$cshowList :: [CreateProvisioningTemplateResponse] -> ShowS
show :: CreateProvisioningTemplateResponse -> String
$cshow :: CreateProvisioningTemplateResponse -> String
showsPrec :: Int -> CreateProvisioningTemplateResponse -> ShowS
$cshowsPrec :: Int -> CreateProvisioningTemplateResponse -> ShowS
Prelude.Show, (forall x.
 CreateProvisioningTemplateResponse
 -> Rep CreateProvisioningTemplateResponse x)
-> (forall x.
    Rep CreateProvisioningTemplateResponse x
    -> CreateProvisioningTemplateResponse)
-> Generic CreateProvisioningTemplateResponse
forall x.
Rep CreateProvisioningTemplateResponse x
-> CreateProvisioningTemplateResponse
forall x.
CreateProvisioningTemplateResponse
-> Rep CreateProvisioningTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateProvisioningTemplateResponse x
-> CreateProvisioningTemplateResponse
$cfrom :: forall x.
CreateProvisioningTemplateResponse
-> Rep CreateProvisioningTemplateResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateProvisioningTemplateResponse' 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:
--
-- 'templateName', 'createProvisioningTemplateResponse_templateName' - The name of the fleet provisioning template.
--
-- 'defaultVersionId', 'createProvisioningTemplateResponse_defaultVersionId' - The default version of the fleet provisioning template.
--
-- 'templateArn', 'createProvisioningTemplateResponse_templateArn' - The ARN that identifies the provisioning template.
--
-- 'httpStatus', 'createProvisioningTemplateResponse_httpStatus' - The response's http status code.
newCreateProvisioningTemplateResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateProvisioningTemplateResponse
newCreateProvisioningTemplateResponse :: Int -> CreateProvisioningTemplateResponse
newCreateProvisioningTemplateResponse Int
pHttpStatus_ =
  CreateProvisioningTemplateResponse' :: Maybe Text
-> Maybe Int
-> Maybe Text
-> Int
-> CreateProvisioningTemplateResponse
CreateProvisioningTemplateResponse'
    { $sel:templateName:CreateProvisioningTemplateResponse' :: Maybe Text
templateName =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:defaultVersionId:CreateProvisioningTemplateResponse' :: Maybe Int
defaultVersionId = Maybe Int
forall a. Maybe a
Prelude.Nothing,
      $sel:templateArn:CreateProvisioningTemplateResponse' :: Maybe Text
templateArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateProvisioningTemplateResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The name of the fleet provisioning template.
createProvisioningTemplateResponse_templateName :: Lens.Lens' CreateProvisioningTemplateResponse (Prelude.Maybe Prelude.Text)
createProvisioningTemplateResponse_templateName :: (Maybe Text -> f (Maybe Text))
-> CreateProvisioningTemplateResponse
-> f CreateProvisioningTemplateResponse
createProvisioningTemplateResponse_templateName = (CreateProvisioningTemplateResponse -> Maybe Text)
-> (CreateProvisioningTemplateResponse
    -> Maybe Text -> CreateProvisioningTemplateResponse)
-> Lens
     CreateProvisioningTemplateResponse
     CreateProvisioningTemplateResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProvisioningTemplateResponse' {Maybe Text
templateName :: Maybe Text
$sel:templateName:CreateProvisioningTemplateResponse' :: CreateProvisioningTemplateResponse -> Maybe Text
templateName} -> Maybe Text
templateName) (\s :: CreateProvisioningTemplateResponse
s@CreateProvisioningTemplateResponse' {} Maybe Text
a -> CreateProvisioningTemplateResponse
s {$sel:templateName:CreateProvisioningTemplateResponse' :: Maybe Text
templateName = Maybe Text
a} :: CreateProvisioningTemplateResponse)

-- | The default version of the fleet provisioning template.
createProvisioningTemplateResponse_defaultVersionId :: Lens.Lens' CreateProvisioningTemplateResponse (Prelude.Maybe Prelude.Int)
createProvisioningTemplateResponse_defaultVersionId :: (Maybe Int -> f (Maybe Int))
-> CreateProvisioningTemplateResponse
-> f CreateProvisioningTemplateResponse
createProvisioningTemplateResponse_defaultVersionId = (CreateProvisioningTemplateResponse -> Maybe Int)
-> (CreateProvisioningTemplateResponse
    -> Maybe Int -> CreateProvisioningTemplateResponse)
-> Lens
     CreateProvisioningTemplateResponse
     CreateProvisioningTemplateResponse
     (Maybe Int)
     (Maybe Int)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProvisioningTemplateResponse' {Maybe Int
defaultVersionId :: Maybe Int
$sel:defaultVersionId:CreateProvisioningTemplateResponse' :: CreateProvisioningTemplateResponse -> Maybe Int
defaultVersionId} -> Maybe Int
defaultVersionId) (\s :: CreateProvisioningTemplateResponse
s@CreateProvisioningTemplateResponse' {} Maybe Int
a -> CreateProvisioningTemplateResponse
s {$sel:defaultVersionId:CreateProvisioningTemplateResponse' :: Maybe Int
defaultVersionId = Maybe Int
a} :: CreateProvisioningTemplateResponse)

-- | The ARN that identifies the provisioning template.
createProvisioningTemplateResponse_templateArn :: Lens.Lens' CreateProvisioningTemplateResponse (Prelude.Maybe Prelude.Text)
createProvisioningTemplateResponse_templateArn :: (Maybe Text -> f (Maybe Text))
-> CreateProvisioningTemplateResponse
-> f CreateProvisioningTemplateResponse
createProvisioningTemplateResponse_templateArn = (CreateProvisioningTemplateResponse -> Maybe Text)
-> (CreateProvisioningTemplateResponse
    -> Maybe Text -> CreateProvisioningTemplateResponse)
-> Lens
     CreateProvisioningTemplateResponse
     CreateProvisioningTemplateResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateProvisioningTemplateResponse' {Maybe Text
templateArn :: Maybe Text
$sel:templateArn:CreateProvisioningTemplateResponse' :: CreateProvisioningTemplateResponse -> Maybe Text
templateArn} -> Maybe Text
templateArn) (\s :: CreateProvisioningTemplateResponse
s@CreateProvisioningTemplateResponse' {} Maybe Text
a -> CreateProvisioningTemplateResponse
s {$sel:templateArn:CreateProvisioningTemplateResponse' :: Maybe Text
templateArn = Maybe Text
a} :: CreateProvisioningTemplateResponse)

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

instance
  Prelude.NFData
    CreateProvisioningTemplateResponse