{-# 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.Proton.CreateServiceTemplate
-- 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)
--
-- Create a service template. The administrator creates a service template
-- to define standardized infrastructure and an optional CICD service
-- pipeline. Developers, in turn, select the service template from AWS
-- Proton. If the selected service template includes a service pipeline
-- definition, they provide a link to their source code repository. AWS
-- Proton then deploys and manages the infrastructure defined by the
-- selected service template. For more information, see
-- <https://docs.aws.amazon.com/proton/latest/adminguide/managing-svc-templates.html Service Templates>
-- in the /AWS Proton Administrator Guide/.
module Amazonka.Proton.CreateServiceTemplate
  ( -- * Creating a Request
    CreateServiceTemplate (..),
    newCreateServiceTemplate,

    -- * Request Lenses
    createServiceTemplate_displayName,
    createServiceTemplate_encryptionKey,
    createServiceTemplate_pipelineProvisioning,
    createServiceTemplate_description,
    createServiceTemplate_tags,
    createServiceTemplate_name,

    -- * Destructuring the Response
    CreateServiceTemplateResponse (..),
    newCreateServiceTemplateResponse,

    -- * Response Lenses
    createServiceTemplateResponse_httpStatus,
    createServiceTemplateResponse_serviceTemplate,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Proton.Types
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateServiceTemplate' smart constructor.
data CreateServiceTemplate = CreateServiceTemplate'
  { -- | The name of the service template as displayed in the developer
    -- interface.
    CreateServiceTemplate -> Maybe (Sensitive Text)
displayName :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | A customer provided encryption key that\'s used to encrypt data.
    CreateServiceTemplate -> Maybe Text
encryptionKey :: Prelude.Maybe Prelude.Text,
    -- | AWS Proton includes a service pipeline for your service by default. When
    -- included, this parameter indicates that an AWS Proton service pipeline
    -- /won\'t/ be included for your service. Once specified, this parameter
    -- /can\'t/ be changed. For more information, see
    -- <https://docs.aws.amazon.com/proton/latest/adminguide/ag-template-bundles.html Service template bundles>
    -- in the /AWS Proton Administrator Guide/.
    CreateServiceTemplate -> Maybe Provisioning
pipelineProvisioning :: Prelude.Maybe Provisioning,
    -- | A description of the service template.
    CreateServiceTemplate -> Maybe (Sensitive Text)
description :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | Create tags for your service template. For more information, see /AWS
    -- Proton resources and tagging/ in the
    -- <https://docs.aws.amazon.com/proton/latest/adminguide/resources.html AWS Proton Administrator Guide>
    -- or
    -- <https://docs.aws.amazon.com/proton/latest/userguide/resources.html AWS Proton User Guide>.
    CreateServiceTemplate -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name of the service template.
    CreateServiceTemplate -> Text
name :: Prelude.Text
  }
  deriving (CreateServiceTemplate -> CreateServiceTemplate -> Bool
(CreateServiceTemplate -> CreateServiceTemplate -> Bool)
-> (CreateServiceTemplate -> CreateServiceTemplate -> Bool)
-> Eq CreateServiceTemplate
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateServiceTemplate -> CreateServiceTemplate -> Bool
$c/= :: CreateServiceTemplate -> CreateServiceTemplate -> Bool
== :: CreateServiceTemplate -> CreateServiceTemplate -> Bool
$c== :: CreateServiceTemplate -> CreateServiceTemplate -> Bool
Prelude.Eq, Int -> CreateServiceTemplate -> ShowS
[CreateServiceTemplate] -> ShowS
CreateServiceTemplate -> String
(Int -> CreateServiceTemplate -> ShowS)
-> (CreateServiceTemplate -> String)
-> ([CreateServiceTemplate] -> ShowS)
-> Show CreateServiceTemplate
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateServiceTemplate] -> ShowS
$cshowList :: [CreateServiceTemplate] -> ShowS
show :: CreateServiceTemplate -> String
$cshow :: CreateServiceTemplate -> String
showsPrec :: Int -> CreateServiceTemplate -> ShowS
$cshowsPrec :: Int -> CreateServiceTemplate -> ShowS
Prelude.Show, (forall x. CreateServiceTemplate -> Rep CreateServiceTemplate x)
-> (forall x. Rep CreateServiceTemplate x -> CreateServiceTemplate)
-> Generic CreateServiceTemplate
forall x. Rep CreateServiceTemplate x -> CreateServiceTemplate
forall x. CreateServiceTemplate -> Rep CreateServiceTemplate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateServiceTemplate x -> CreateServiceTemplate
$cfrom :: forall x. CreateServiceTemplate -> Rep CreateServiceTemplate x
Prelude.Generic)

-- |
-- Create a value of 'CreateServiceTemplate' 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:
--
-- 'displayName', 'createServiceTemplate_displayName' - The name of the service template as displayed in the developer
-- interface.
--
-- 'encryptionKey', 'createServiceTemplate_encryptionKey' - A customer provided encryption key that\'s used to encrypt data.
--
-- 'pipelineProvisioning', 'createServiceTemplate_pipelineProvisioning' - AWS Proton includes a service pipeline for your service by default. When
-- included, this parameter indicates that an AWS Proton service pipeline
-- /won\'t/ be included for your service. Once specified, this parameter
-- /can\'t/ be changed. For more information, see
-- <https://docs.aws.amazon.com/proton/latest/adminguide/ag-template-bundles.html Service template bundles>
-- in the /AWS Proton Administrator Guide/.
--
-- 'description', 'createServiceTemplate_description' - A description of the service template.
--
-- 'tags', 'createServiceTemplate_tags' - Create tags for your service template. For more information, see /AWS
-- Proton resources and tagging/ in the
-- <https://docs.aws.amazon.com/proton/latest/adminguide/resources.html AWS Proton Administrator Guide>
-- or
-- <https://docs.aws.amazon.com/proton/latest/userguide/resources.html AWS Proton User Guide>.
--
-- 'name', 'createServiceTemplate_name' - The name of the service template.
newCreateServiceTemplate ::
  -- | 'name'
  Prelude.Text ->
  CreateServiceTemplate
newCreateServiceTemplate :: Text -> CreateServiceTemplate
newCreateServiceTemplate Text
pName_ =
  CreateServiceTemplate' :: Maybe (Sensitive Text)
-> Maybe Text
-> Maybe Provisioning
-> Maybe (Sensitive Text)
-> Maybe [Tag]
-> Text
-> CreateServiceTemplate
CreateServiceTemplate'
    { $sel:displayName:CreateServiceTemplate' :: Maybe (Sensitive Text)
displayName =
        Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:encryptionKey:CreateServiceTemplate' :: Maybe Text
encryptionKey = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:pipelineProvisioning:CreateServiceTemplate' :: Maybe Provisioning
pipelineProvisioning = Maybe Provisioning
forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateServiceTemplate' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateServiceTemplate' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateServiceTemplate' :: Text
name = Text
pName_
    }

-- | The name of the service template as displayed in the developer
-- interface.
createServiceTemplate_displayName :: Lens.Lens' CreateServiceTemplate (Prelude.Maybe Prelude.Text)
createServiceTemplate_displayName :: (Maybe Text -> f (Maybe Text))
-> CreateServiceTemplate -> f CreateServiceTemplate
createServiceTemplate_displayName = (CreateServiceTemplate -> Maybe (Sensitive Text))
-> (CreateServiceTemplate
    -> Maybe (Sensitive Text) -> CreateServiceTemplate)
-> Lens
     CreateServiceTemplate
     CreateServiceTemplate
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceTemplate' {Maybe (Sensitive Text)
displayName :: Maybe (Sensitive Text)
$sel:displayName:CreateServiceTemplate' :: CreateServiceTemplate -> Maybe (Sensitive Text)
displayName} -> Maybe (Sensitive Text)
displayName) (\s :: CreateServiceTemplate
s@CreateServiceTemplate' {} Maybe (Sensitive Text)
a -> CreateServiceTemplate
s {$sel:displayName:CreateServiceTemplate' :: Maybe (Sensitive Text)
displayName = Maybe (Sensitive Text)
a} :: CreateServiceTemplate) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> CreateServiceTemplate -> f CreateServiceTemplate)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateServiceTemplate
-> f CreateServiceTemplate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | A customer provided encryption key that\'s used to encrypt data.
createServiceTemplate_encryptionKey :: Lens.Lens' CreateServiceTemplate (Prelude.Maybe Prelude.Text)
createServiceTemplate_encryptionKey :: (Maybe Text -> f (Maybe Text))
-> CreateServiceTemplate -> f CreateServiceTemplate
createServiceTemplate_encryptionKey = (CreateServiceTemplate -> Maybe Text)
-> (CreateServiceTemplate -> Maybe Text -> CreateServiceTemplate)
-> Lens
     CreateServiceTemplate
     CreateServiceTemplate
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceTemplate' {Maybe Text
encryptionKey :: Maybe Text
$sel:encryptionKey:CreateServiceTemplate' :: CreateServiceTemplate -> Maybe Text
encryptionKey} -> Maybe Text
encryptionKey) (\s :: CreateServiceTemplate
s@CreateServiceTemplate' {} Maybe Text
a -> CreateServiceTemplate
s {$sel:encryptionKey:CreateServiceTemplate' :: Maybe Text
encryptionKey = Maybe Text
a} :: CreateServiceTemplate)

-- | AWS Proton includes a service pipeline for your service by default. When
-- included, this parameter indicates that an AWS Proton service pipeline
-- /won\'t/ be included for your service. Once specified, this parameter
-- /can\'t/ be changed. For more information, see
-- <https://docs.aws.amazon.com/proton/latest/adminguide/ag-template-bundles.html Service template bundles>
-- in the /AWS Proton Administrator Guide/.
createServiceTemplate_pipelineProvisioning :: Lens.Lens' CreateServiceTemplate (Prelude.Maybe Provisioning)
createServiceTemplate_pipelineProvisioning :: (Maybe Provisioning -> f (Maybe Provisioning))
-> CreateServiceTemplate -> f CreateServiceTemplate
createServiceTemplate_pipelineProvisioning = (CreateServiceTemplate -> Maybe Provisioning)
-> (CreateServiceTemplate
    -> Maybe Provisioning -> CreateServiceTemplate)
-> Lens
     CreateServiceTemplate
     CreateServiceTemplate
     (Maybe Provisioning)
     (Maybe Provisioning)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceTemplate' {Maybe Provisioning
pipelineProvisioning :: Maybe Provisioning
$sel:pipelineProvisioning:CreateServiceTemplate' :: CreateServiceTemplate -> Maybe Provisioning
pipelineProvisioning} -> Maybe Provisioning
pipelineProvisioning) (\s :: CreateServiceTemplate
s@CreateServiceTemplate' {} Maybe Provisioning
a -> CreateServiceTemplate
s {$sel:pipelineProvisioning:CreateServiceTemplate' :: Maybe Provisioning
pipelineProvisioning = Maybe Provisioning
a} :: CreateServiceTemplate)

-- | A description of the service template.
createServiceTemplate_description :: Lens.Lens' CreateServiceTemplate (Prelude.Maybe Prelude.Text)
createServiceTemplate_description :: (Maybe Text -> f (Maybe Text))
-> CreateServiceTemplate -> f CreateServiceTemplate
createServiceTemplate_description = (CreateServiceTemplate -> Maybe (Sensitive Text))
-> (CreateServiceTemplate
    -> Maybe (Sensitive Text) -> CreateServiceTemplate)
-> Lens
     CreateServiceTemplate
     CreateServiceTemplate
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceTemplate' {Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:description:CreateServiceTemplate' :: CreateServiceTemplate -> Maybe (Sensitive Text)
description} -> Maybe (Sensitive Text)
description) (\s :: CreateServiceTemplate
s@CreateServiceTemplate' {} Maybe (Sensitive Text)
a -> CreateServiceTemplate
s {$sel:description:CreateServiceTemplate' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
a} :: CreateServiceTemplate) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> CreateServiceTemplate -> f CreateServiceTemplate)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateServiceTemplate
-> f CreateServiceTemplate
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe Text)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | Create tags for your service template. For more information, see /AWS
-- Proton resources and tagging/ in the
-- <https://docs.aws.amazon.com/proton/latest/adminguide/resources.html AWS Proton Administrator Guide>
-- or
-- <https://docs.aws.amazon.com/proton/latest/userguide/resources.html AWS Proton User Guide>.
createServiceTemplate_tags :: Lens.Lens' CreateServiceTemplate (Prelude.Maybe [Tag])
createServiceTemplate_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateServiceTemplate -> f CreateServiceTemplate
createServiceTemplate_tags = (CreateServiceTemplate -> Maybe [Tag])
-> (CreateServiceTemplate -> Maybe [Tag] -> CreateServiceTemplate)
-> Lens
     CreateServiceTemplate
     CreateServiceTemplate
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceTemplate' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateServiceTemplate' :: CreateServiceTemplate -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateServiceTemplate
s@CreateServiceTemplate' {} Maybe [Tag]
a -> CreateServiceTemplate
s {$sel:tags:CreateServiceTemplate' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateServiceTemplate) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateServiceTemplate -> f CreateServiceTemplate)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateServiceTemplate
-> f CreateServiceTemplate
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 service template.
createServiceTemplate_name :: Lens.Lens' CreateServiceTemplate Prelude.Text
createServiceTemplate_name :: (Text -> f Text)
-> CreateServiceTemplate -> f CreateServiceTemplate
createServiceTemplate_name = (CreateServiceTemplate -> Text)
-> (CreateServiceTemplate -> Text -> CreateServiceTemplate)
-> Lens CreateServiceTemplate CreateServiceTemplate Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceTemplate' {Text
name :: Text
$sel:name:CreateServiceTemplate' :: CreateServiceTemplate -> Text
name} -> Text
name) (\s :: CreateServiceTemplate
s@CreateServiceTemplate' {} Text
a -> CreateServiceTemplate
s {$sel:name:CreateServiceTemplate' :: Text
name = Text
a} :: CreateServiceTemplate)

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

instance Prelude.Hashable CreateServiceTemplate

instance Prelude.NFData CreateServiceTemplate

instance Core.ToHeaders CreateServiceTemplate where
  toHeaders :: CreateServiceTemplate -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateServiceTemplate -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AwsProton20200720.CreateServiceTemplate" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateServiceTemplate where
  toJSON :: CreateServiceTemplate -> Value
toJSON CreateServiceTemplate' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Text)
Maybe Provisioning
Text
name :: Text
tags :: Maybe [Tag]
description :: Maybe (Sensitive Text)
pipelineProvisioning :: Maybe Provisioning
encryptionKey :: Maybe Text
displayName :: Maybe (Sensitive Text)
$sel:name:CreateServiceTemplate' :: CreateServiceTemplate -> Text
$sel:tags:CreateServiceTemplate' :: CreateServiceTemplate -> Maybe [Tag]
$sel:description:CreateServiceTemplate' :: CreateServiceTemplate -> Maybe (Sensitive Text)
$sel:pipelineProvisioning:CreateServiceTemplate' :: CreateServiceTemplate -> Maybe Provisioning
$sel:encryptionKey:CreateServiceTemplate' :: CreateServiceTemplate -> Maybe Text
$sel:displayName:CreateServiceTemplate' :: CreateServiceTemplate -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"displayName" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
displayName,
            (Text
"encryptionKey" 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
encryptionKey,
            (Text
"pipelineProvisioning" Text -> Provisioning -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Provisioning -> Pair) -> Maybe Provisioning -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Provisioning
pipelineProvisioning,
            (Text
"description" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive 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
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name)
          ]
      )

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

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

-- | /See:/ 'newCreateServiceTemplateResponse' smart constructor.
data CreateServiceTemplateResponse = CreateServiceTemplateResponse'
  { -- | The response's http status code.
    CreateServiceTemplateResponse -> Int
httpStatus :: Prelude.Int,
    -- | The service template detail data that\'s returned by AWS Proton.
    CreateServiceTemplateResponse -> ServiceTemplate
serviceTemplate :: ServiceTemplate
  }
  deriving (CreateServiceTemplateResponse
-> CreateServiceTemplateResponse -> Bool
(CreateServiceTemplateResponse
 -> CreateServiceTemplateResponse -> Bool)
-> (CreateServiceTemplateResponse
    -> CreateServiceTemplateResponse -> Bool)
-> Eq CreateServiceTemplateResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateServiceTemplateResponse
-> CreateServiceTemplateResponse -> Bool
$c/= :: CreateServiceTemplateResponse
-> CreateServiceTemplateResponse -> Bool
== :: CreateServiceTemplateResponse
-> CreateServiceTemplateResponse -> Bool
$c== :: CreateServiceTemplateResponse
-> CreateServiceTemplateResponse -> Bool
Prelude.Eq, Int -> CreateServiceTemplateResponse -> ShowS
[CreateServiceTemplateResponse] -> ShowS
CreateServiceTemplateResponse -> String
(Int -> CreateServiceTemplateResponse -> ShowS)
-> (CreateServiceTemplateResponse -> String)
-> ([CreateServiceTemplateResponse] -> ShowS)
-> Show CreateServiceTemplateResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateServiceTemplateResponse] -> ShowS
$cshowList :: [CreateServiceTemplateResponse] -> ShowS
show :: CreateServiceTemplateResponse -> String
$cshow :: CreateServiceTemplateResponse -> String
showsPrec :: Int -> CreateServiceTemplateResponse -> ShowS
$cshowsPrec :: Int -> CreateServiceTemplateResponse -> ShowS
Prelude.Show, (forall x.
 CreateServiceTemplateResponse
 -> Rep CreateServiceTemplateResponse x)
-> (forall x.
    Rep CreateServiceTemplateResponse x
    -> CreateServiceTemplateResponse)
-> Generic CreateServiceTemplateResponse
forall x.
Rep CreateServiceTemplateResponse x
-> CreateServiceTemplateResponse
forall x.
CreateServiceTemplateResponse
-> Rep CreateServiceTemplateResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateServiceTemplateResponse x
-> CreateServiceTemplateResponse
$cfrom :: forall x.
CreateServiceTemplateResponse
-> Rep CreateServiceTemplateResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateServiceTemplateResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'httpStatus', 'createServiceTemplateResponse_httpStatus' - The response's http status code.
--
-- 'serviceTemplate', 'createServiceTemplateResponse_serviceTemplate' - The service template detail data that\'s returned by AWS Proton.
newCreateServiceTemplateResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'serviceTemplate'
  ServiceTemplate ->
  CreateServiceTemplateResponse
newCreateServiceTemplateResponse :: Int -> ServiceTemplate -> CreateServiceTemplateResponse
newCreateServiceTemplateResponse
  Int
pHttpStatus_
  ServiceTemplate
pServiceTemplate_ =
    CreateServiceTemplateResponse' :: Int -> ServiceTemplate -> CreateServiceTemplateResponse
CreateServiceTemplateResponse'
      { $sel:httpStatus:CreateServiceTemplateResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:serviceTemplate:CreateServiceTemplateResponse' :: ServiceTemplate
serviceTemplate = ServiceTemplate
pServiceTemplate_
      }

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

-- | The service template detail data that\'s returned by AWS Proton.
createServiceTemplateResponse_serviceTemplate :: Lens.Lens' CreateServiceTemplateResponse ServiceTemplate
createServiceTemplateResponse_serviceTemplate :: (ServiceTemplate -> f ServiceTemplate)
-> CreateServiceTemplateResponse -> f CreateServiceTemplateResponse
createServiceTemplateResponse_serviceTemplate = (CreateServiceTemplateResponse -> ServiceTemplate)
-> (CreateServiceTemplateResponse
    -> ServiceTemplate -> CreateServiceTemplateResponse)
-> Lens
     CreateServiceTemplateResponse
     CreateServiceTemplateResponse
     ServiceTemplate
     ServiceTemplate
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceTemplateResponse' {ServiceTemplate
serviceTemplate :: ServiceTemplate
$sel:serviceTemplate:CreateServiceTemplateResponse' :: CreateServiceTemplateResponse -> ServiceTemplate
serviceTemplate} -> ServiceTemplate
serviceTemplate) (\s :: CreateServiceTemplateResponse
s@CreateServiceTemplateResponse' {} ServiceTemplate
a -> CreateServiceTemplateResponse
s {$sel:serviceTemplate:CreateServiceTemplateResponse' :: ServiceTemplate
serviceTemplate = ServiceTemplate
a} :: CreateServiceTemplateResponse)

instance Prelude.NFData CreateServiceTemplateResponse