{-# 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.CreateServiceTemplateVersion
-- 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 new major or minor version of a service template. A major
-- version of a service template is a version that /isn\'t/ backwards
-- compatible. A minor version of a service template is a version that\'s
-- backwards compatible within its major version.
module Amazonka.Proton.CreateServiceTemplateVersion
  ( -- * Creating a Request
    CreateServiceTemplateVersion (..),
    newCreateServiceTemplateVersion,

    -- * Request Lenses
    createServiceTemplateVersion_clientToken,
    createServiceTemplateVersion_majorVersion,
    createServiceTemplateVersion_description,
    createServiceTemplateVersion_tags,
    createServiceTemplateVersion_compatibleEnvironmentTemplates,
    createServiceTemplateVersion_source,
    createServiceTemplateVersion_templateName,

    -- * Destructuring the Response
    CreateServiceTemplateVersionResponse (..),
    newCreateServiceTemplateVersionResponse,

    -- * Response Lenses
    createServiceTemplateVersionResponse_httpStatus,
    createServiceTemplateVersionResponse_serviceTemplateVersion,
  )
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:/ 'newCreateServiceTemplateVersion' smart constructor.
data CreateServiceTemplateVersion = CreateServiceTemplateVersion'
  { -- | When included, if two identicial requests are made with the same client
    -- token, AWS Proton returns the service template version that the first
    -- request created.
    CreateServiceTemplateVersion -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | To create a new minor version of the service template, include a
    -- @majorVersion@.
    --
    -- To create a new major and minor version of the service template,
    -- /exclude/ @majorVersion@.
    CreateServiceTemplateVersion -> Maybe Text
majorVersion :: Prelude.Maybe Prelude.Text,
    -- | A description of the new version of a service template.
    CreateServiceTemplateVersion -> Maybe (Sensitive Text)
description :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | Create tags for a new version of a service template.
    CreateServiceTemplateVersion -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | An array of compatible environment template objects for the new version
    -- of a service template.
    CreateServiceTemplateVersion
-> NonEmpty CompatibleEnvironmentTemplateInput
compatibleEnvironmentTemplates :: Prelude.NonEmpty CompatibleEnvironmentTemplateInput,
    -- | An object that includes the template bundle S3 bucket path and name for
    -- the new version of a service template.
    CreateServiceTemplateVersion -> TemplateVersionSourceInput
source :: TemplateVersionSourceInput,
    -- | The name of the service template.
    CreateServiceTemplateVersion -> Text
templateName :: Prelude.Text
  }
  deriving (CreateServiceTemplateVersion
-> CreateServiceTemplateVersion -> Bool
(CreateServiceTemplateVersion
 -> CreateServiceTemplateVersion -> Bool)
-> (CreateServiceTemplateVersion
    -> CreateServiceTemplateVersion -> Bool)
-> Eq CreateServiceTemplateVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateServiceTemplateVersion
-> CreateServiceTemplateVersion -> Bool
$c/= :: CreateServiceTemplateVersion
-> CreateServiceTemplateVersion -> Bool
== :: CreateServiceTemplateVersion
-> CreateServiceTemplateVersion -> Bool
$c== :: CreateServiceTemplateVersion
-> CreateServiceTemplateVersion -> Bool
Prelude.Eq, Int -> CreateServiceTemplateVersion -> ShowS
[CreateServiceTemplateVersion] -> ShowS
CreateServiceTemplateVersion -> String
(Int -> CreateServiceTemplateVersion -> ShowS)
-> (CreateServiceTemplateVersion -> String)
-> ([CreateServiceTemplateVersion] -> ShowS)
-> Show CreateServiceTemplateVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateServiceTemplateVersion] -> ShowS
$cshowList :: [CreateServiceTemplateVersion] -> ShowS
show :: CreateServiceTemplateVersion -> String
$cshow :: CreateServiceTemplateVersion -> String
showsPrec :: Int -> CreateServiceTemplateVersion -> ShowS
$cshowsPrec :: Int -> CreateServiceTemplateVersion -> ShowS
Prelude.Show, (forall x.
 CreateServiceTemplateVersion -> Rep CreateServiceTemplateVersion x)
-> (forall x.
    Rep CreateServiceTemplateVersion x -> CreateServiceTemplateVersion)
-> Generic CreateServiceTemplateVersion
forall x.
Rep CreateServiceTemplateVersion x -> CreateServiceTemplateVersion
forall x.
CreateServiceTemplateVersion -> Rep CreateServiceTemplateVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateServiceTemplateVersion x -> CreateServiceTemplateVersion
$cfrom :: forall x.
CreateServiceTemplateVersion -> Rep CreateServiceTemplateVersion x
Prelude.Generic)

-- |
-- Create a value of 'CreateServiceTemplateVersion' 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:
--
-- 'clientToken', 'createServiceTemplateVersion_clientToken' - When included, if two identicial requests are made with the same client
-- token, AWS Proton returns the service template version that the first
-- request created.
--
-- 'majorVersion', 'createServiceTemplateVersion_majorVersion' - To create a new minor version of the service template, include a
-- @majorVersion@.
--
-- To create a new major and minor version of the service template,
-- /exclude/ @majorVersion@.
--
-- 'description', 'createServiceTemplateVersion_description' - A description of the new version of a service template.
--
-- 'tags', 'createServiceTemplateVersion_tags' - Create tags for a new version of a service template.
--
-- 'compatibleEnvironmentTemplates', 'createServiceTemplateVersion_compatibleEnvironmentTemplates' - An array of compatible environment template objects for the new version
-- of a service template.
--
-- 'source', 'createServiceTemplateVersion_source' - An object that includes the template bundle S3 bucket path and name for
-- the new version of a service template.
--
-- 'templateName', 'createServiceTemplateVersion_templateName' - The name of the service template.
newCreateServiceTemplateVersion ::
  -- | 'compatibleEnvironmentTemplates'
  Prelude.NonEmpty CompatibleEnvironmentTemplateInput ->
  -- | 'source'
  TemplateVersionSourceInput ->
  -- | 'templateName'
  Prelude.Text ->
  CreateServiceTemplateVersion
newCreateServiceTemplateVersion :: NonEmpty CompatibleEnvironmentTemplateInput
-> TemplateVersionSourceInput
-> Text
-> CreateServiceTemplateVersion
newCreateServiceTemplateVersion
  NonEmpty CompatibleEnvironmentTemplateInput
pCompatibleEnvironmentTemplates_
  TemplateVersionSourceInput
pSource_
  Text
pTemplateName_ =
    CreateServiceTemplateVersion' :: Maybe Text
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe [Tag]
-> NonEmpty CompatibleEnvironmentTemplateInput
-> TemplateVersionSourceInput
-> Text
-> CreateServiceTemplateVersion
CreateServiceTemplateVersion'
      { $sel:clientToken:CreateServiceTemplateVersion' :: Maybe Text
clientToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:majorVersion:CreateServiceTemplateVersion' :: Maybe Text
majorVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateServiceTemplateVersion' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateServiceTemplateVersion' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:compatibleEnvironmentTemplates:CreateServiceTemplateVersion' :: NonEmpty CompatibleEnvironmentTemplateInput
compatibleEnvironmentTemplates =
          Tagged
  (NonEmpty CompatibleEnvironmentTemplateInput)
  (Identity (NonEmpty CompatibleEnvironmentTemplateInput))
-> Tagged
     (NonEmpty CompatibleEnvironmentTemplateInput)
     (Identity (NonEmpty CompatibleEnvironmentTemplateInput))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
            (Tagged
   (NonEmpty CompatibleEnvironmentTemplateInput)
   (Identity (NonEmpty CompatibleEnvironmentTemplateInput))
 -> Tagged
      (NonEmpty CompatibleEnvironmentTemplateInput)
      (Identity (NonEmpty CompatibleEnvironmentTemplateInput)))
-> NonEmpty CompatibleEnvironmentTemplateInput
-> NonEmpty CompatibleEnvironmentTemplateInput
forall t b. AReview t b -> b -> t
Lens.# NonEmpty CompatibleEnvironmentTemplateInput
pCompatibleEnvironmentTemplates_,
        $sel:source:CreateServiceTemplateVersion' :: TemplateVersionSourceInput
source = TemplateVersionSourceInput
pSource_,
        $sel:templateName:CreateServiceTemplateVersion' :: Text
templateName = Text
pTemplateName_
      }

-- | When included, if two identicial requests are made with the same client
-- token, AWS Proton returns the service template version that the first
-- request created.
createServiceTemplateVersion_clientToken :: Lens.Lens' CreateServiceTemplateVersion (Prelude.Maybe Prelude.Text)
createServiceTemplateVersion_clientToken :: (Maybe Text -> f (Maybe Text))
-> CreateServiceTemplateVersion -> f CreateServiceTemplateVersion
createServiceTemplateVersion_clientToken = (CreateServiceTemplateVersion -> Maybe Text)
-> (CreateServiceTemplateVersion
    -> Maybe Text -> CreateServiceTemplateVersion)
-> Lens
     CreateServiceTemplateVersion
     CreateServiceTemplateVersion
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceTemplateVersion' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateServiceTemplateVersion' :: CreateServiceTemplateVersion -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateServiceTemplateVersion
s@CreateServiceTemplateVersion' {} Maybe Text
a -> CreateServiceTemplateVersion
s {$sel:clientToken:CreateServiceTemplateVersion' :: Maybe Text
clientToken = Maybe Text
a} :: CreateServiceTemplateVersion)

-- | To create a new minor version of the service template, include a
-- @majorVersion@.
--
-- To create a new major and minor version of the service template,
-- /exclude/ @majorVersion@.
createServiceTemplateVersion_majorVersion :: Lens.Lens' CreateServiceTemplateVersion (Prelude.Maybe Prelude.Text)
createServiceTemplateVersion_majorVersion :: (Maybe Text -> f (Maybe Text))
-> CreateServiceTemplateVersion -> f CreateServiceTemplateVersion
createServiceTemplateVersion_majorVersion = (CreateServiceTemplateVersion -> Maybe Text)
-> (CreateServiceTemplateVersion
    -> Maybe Text -> CreateServiceTemplateVersion)
-> Lens
     CreateServiceTemplateVersion
     CreateServiceTemplateVersion
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceTemplateVersion' {Maybe Text
majorVersion :: Maybe Text
$sel:majorVersion:CreateServiceTemplateVersion' :: CreateServiceTemplateVersion -> Maybe Text
majorVersion} -> Maybe Text
majorVersion) (\s :: CreateServiceTemplateVersion
s@CreateServiceTemplateVersion' {} Maybe Text
a -> CreateServiceTemplateVersion
s {$sel:majorVersion:CreateServiceTemplateVersion' :: Maybe Text
majorVersion = Maybe Text
a} :: CreateServiceTemplateVersion)

-- | A description of the new version of a service template.
createServiceTemplateVersion_description :: Lens.Lens' CreateServiceTemplateVersion (Prelude.Maybe Prelude.Text)
createServiceTemplateVersion_description :: (Maybe Text -> f (Maybe Text))
-> CreateServiceTemplateVersion -> f CreateServiceTemplateVersion
createServiceTemplateVersion_description = (CreateServiceTemplateVersion -> Maybe (Sensitive Text))
-> (CreateServiceTemplateVersion
    -> Maybe (Sensitive Text) -> CreateServiceTemplateVersion)
-> Lens
     CreateServiceTemplateVersion
     CreateServiceTemplateVersion
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceTemplateVersion' {Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:description:CreateServiceTemplateVersion' :: CreateServiceTemplateVersion -> Maybe (Sensitive Text)
description} -> Maybe (Sensitive Text)
description) (\s :: CreateServiceTemplateVersion
s@CreateServiceTemplateVersion' {} Maybe (Sensitive Text)
a -> CreateServiceTemplateVersion
s {$sel:description:CreateServiceTemplateVersion' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
a} :: CreateServiceTemplateVersion) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> CreateServiceTemplateVersion -> f CreateServiceTemplateVersion)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateServiceTemplateVersion
-> f CreateServiceTemplateVersion
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 a new version of a service template.
createServiceTemplateVersion_tags :: Lens.Lens' CreateServiceTemplateVersion (Prelude.Maybe [Tag])
createServiceTemplateVersion_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateServiceTemplateVersion -> f CreateServiceTemplateVersion
createServiceTemplateVersion_tags = (CreateServiceTemplateVersion -> Maybe [Tag])
-> (CreateServiceTemplateVersion
    -> Maybe [Tag] -> CreateServiceTemplateVersion)
-> Lens
     CreateServiceTemplateVersion
     CreateServiceTemplateVersion
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceTemplateVersion' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateServiceTemplateVersion' :: CreateServiceTemplateVersion -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateServiceTemplateVersion
s@CreateServiceTemplateVersion' {} Maybe [Tag]
a -> CreateServiceTemplateVersion
s {$sel:tags:CreateServiceTemplateVersion' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateServiceTemplateVersion) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateServiceTemplateVersion -> f CreateServiceTemplateVersion)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateServiceTemplateVersion
-> f CreateServiceTemplateVersion
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

-- | An array of compatible environment template objects for the new version
-- of a service template.
createServiceTemplateVersion_compatibleEnvironmentTemplates :: Lens.Lens' CreateServiceTemplateVersion (Prelude.NonEmpty CompatibleEnvironmentTemplateInput)
createServiceTemplateVersion_compatibleEnvironmentTemplates :: (NonEmpty CompatibleEnvironmentTemplateInput
 -> f (NonEmpty CompatibleEnvironmentTemplateInput))
-> CreateServiceTemplateVersion -> f CreateServiceTemplateVersion
createServiceTemplateVersion_compatibleEnvironmentTemplates = (CreateServiceTemplateVersion
 -> NonEmpty CompatibleEnvironmentTemplateInput)
-> (CreateServiceTemplateVersion
    -> NonEmpty CompatibleEnvironmentTemplateInput
    -> CreateServiceTemplateVersion)
-> Lens
     CreateServiceTemplateVersion
     CreateServiceTemplateVersion
     (NonEmpty CompatibleEnvironmentTemplateInput)
     (NonEmpty CompatibleEnvironmentTemplateInput)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceTemplateVersion' {NonEmpty CompatibleEnvironmentTemplateInput
compatibleEnvironmentTemplates :: NonEmpty CompatibleEnvironmentTemplateInput
$sel:compatibleEnvironmentTemplates:CreateServiceTemplateVersion' :: CreateServiceTemplateVersion
-> NonEmpty CompatibleEnvironmentTemplateInput
compatibleEnvironmentTemplates} -> NonEmpty CompatibleEnvironmentTemplateInput
compatibleEnvironmentTemplates) (\s :: CreateServiceTemplateVersion
s@CreateServiceTemplateVersion' {} NonEmpty CompatibleEnvironmentTemplateInput
a -> CreateServiceTemplateVersion
s {$sel:compatibleEnvironmentTemplates:CreateServiceTemplateVersion' :: NonEmpty CompatibleEnvironmentTemplateInput
compatibleEnvironmentTemplates = NonEmpty CompatibleEnvironmentTemplateInput
a} :: CreateServiceTemplateVersion) ((NonEmpty CompatibleEnvironmentTemplateInput
  -> f (NonEmpty CompatibleEnvironmentTemplateInput))
 -> CreateServiceTemplateVersion -> f CreateServiceTemplateVersion)
-> ((NonEmpty CompatibleEnvironmentTemplateInput
     -> f (NonEmpty CompatibleEnvironmentTemplateInput))
    -> NonEmpty CompatibleEnvironmentTemplateInput
    -> f (NonEmpty CompatibleEnvironmentTemplateInput))
-> (NonEmpty CompatibleEnvironmentTemplateInput
    -> f (NonEmpty CompatibleEnvironmentTemplateInput))
-> CreateServiceTemplateVersion
-> f CreateServiceTemplateVersion
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty CompatibleEnvironmentTemplateInput
 -> f (NonEmpty CompatibleEnvironmentTemplateInput))
-> NonEmpty CompatibleEnvironmentTemplateInput
-> f (NonEmpty CompatibleEnvironmentTemplateInput)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An object that includes the template bundle S3 bucket path and name for
-- the new version of a service template.
createServiceTemplateVersion_source :: Lens.Lens' CreateServiceTemplateVersion TemplateVersionSourceInput
createServiceTemplateVersion_source :: (TemplateVersionSourceInput -> f TemplateVersionSourceInput)
-> CreateServiceTemplateVersion -> f CreateServiceTemplateVersion
createServiceTemplateVersion_source = (CreateServiceTemplateVersion -> TemplateVersionSourceInput)
-> (CreateServiceTemplateVersion
    -> TemplateVersionSourceInput -> CreateServiceTemplateVersion)
-> Lens
     CreateServiceTemplateVersion
     CreateServiceTemplateVersion
     TemplateVersionSourceInput
     TemplateVersionSourceInput
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceTemplateVersion' {TemplateVersionSourceInput
source :: TemplateVersionSourceInput
$sel:source:CreateServiceTemplateVersion' :: CreateServiceTemplateVersion -> TemplateVersionSourceInput
source} -> TemplateVersionSourceInput
source) (\s :: CreateServiceTemplateVersion
s@CreateServiceTemplateVersion' {} TemplateVersionSourceInput
a -> CreateServiceTemplateVersion
s {$sel:source:CreateServiceTemplateVersion' :: TemplateVersionSourceInput
source = TemplateVersionSourceInput
a} :: CreateServiceTemplateVersion)

-- | The name of the service template.
createServiceTemplateVersion_templateName :: Lens.Lens' CreateServiceTemplateVersion Prelude.Text
createServiceTemplateVersion_templateName :: (Text -> f Text)
-> CreateServiceTemplateVersion -> f CreateServiceTemplateVersion
createServiceTemplateVersion_templateName = (CreateServiceTemplateVersion -> Text)
-> (CreateServiceTemplateVersion
    -> Text -> CreateServiceTemplateVersion)
-> Lens
     CreateServiceTemplateVersion CreateServiceTemplateVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceTemplateVersion' {Text
templateName :: Text
$sel:templateName:CreateServiceTemplateVersion' :: CreateServiceTemplateVersion -> Text
templateName} -> Text
templateName) (\s :: CreateServiceTemplateVersion
s@CreateServiceTemplateVersion' {} Text
a -> CreateServiceTemplateVersion
s {$sel:templateName:CreateServiceTemplateVersion' :: Text
templateName = Text
a} :: CreateServiceTemplateVersion)

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

instance
  Prelude.Hashable
    CreateServiceTemplateVersion

instance Prelude.NFData CreateServiceTemplateVersion

instance Core.ToHeaders CreateServiceTemplateVersion where
  toHeaders :: CreateServiceTemplateVersion -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateServiceTemplateVersion -> 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.CreateServiceTemplateVersion" ::
                          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 CreateServiceTemplateVersion where
  toJSON :: CreateServiceTemplateVersion -> Value
toJSON CreateServiceTemplateVersion' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Text)
NonEmpty CompatibleEnvironmentTemplateInput
Text
TemplateVersionSourceInput
templateName :: Text
source :: TemplateVersionSourceInput
compatibleEnvironmentTemplates :: NonEmpty CompatibleEnvironmentTemplateInput
tags :: Maybe [Tag]
description :: Maybe (Sensitive Text)
majorVersion :: Maybe Text
clientToken :: Maybe Text
$sel:templateName:CreateServiceTemplateVersion' :: CreateServiceTemplateVersion -> Text
$sel:source:CreateServiceTemplateVersion' :: CreateServiceTemplateVersion -> TemplateVersionSourceInput
$sel:compatibleEnvironmentTemplates:CreateServiceTemplateVersion' :: CreateServiceTemplateVersion
-> NonEmpty CompatibleEnvironmentTemplateInput
$sel:tags:CreateServiceTemplateVersion' :: CreateServiceTemplateVersion -> Maybe [Tag]
$sel:description:CreateServiceTemplateVersion' :: CreateServiceTemplateVersion -> Maybe (Sensitive Text)
$sel:majorVersion:CreateServiceTemplateVersion' :: CreateServiceTemplateVersion -> Maybe Text
$sel:clientToken:CreateServiceTemplateVersion' :: CreateServiceTemplateVersion -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"clientToken" 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
clientToken,
            (Text
"majorVersion" 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
majorVersion,
            (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
"compatibleEnvironmentTemplates"
                  Text -> NonEmpty CompatibleEnvironmentTemplateInput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty CompatibleEnvironmentTemplateInput
compatibleEnvironmentTemplates
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"source" Text -> TemplateVersionSourceInput -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= TemplateVersionSourceInput
source),
            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)
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateServiceTemplateVersionResponse' 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', 'createServiceTemplateVersionResponse_httpStatus' - The response's http status code.
--
-- 'serviceTemplateVersion', 'createServiceTemplateVersionResponse_serviceTemplateVersion' - The service template version summary of detail data that\'s returned by
-- AWS Proton.
newCreateServiceTemplateVersionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'serviceTemplateVersion'
  ServiceTemplateVersion ->
  CreateServiceTemplateVersionResponse
newCreateServiceTemplateVersionResponse :: Int
-> ServiceTemplateVersion -> CreateServiceTemplateVersionResponse
newCreateServiceTemplateVersionResponse
  Int
pHttpStatus_
  ServiceTemplateVersion
pServiceTemplateVersion_ =
    CreateServiceTemplateVersionResponse' :: Int
-> ServiceTemplateVersion -> CreateServiceTemplateVersionResponse
CreateServiceTemplateVersionResponse'
      { $sel:httpStatus:CreateServiceTemplateVersionResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:serviceTemplateVersion:CreateServiceTemplateVersionResponse' :: ServiceTemplateVersion
serviceTemplateVersion =
          ServiceTemplateVersion
pServiceTemplateVersion_
      }

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

-- | The service template version summary of detail data that\'s returned by
-- AWS Proton.
createServiceTemplateVersionResponse_serviceTemplateVersion :: Lens.Lens' CreateServiceTemplateVersionResponse ServiceTemplateVersion
createServiceTemplateVersionResponse_serviceTemplateVersion :: (ServiceTemplateVersion -> f ServiceTemplateVersion)
-> CreateServiceTemplateVersionResponse
-> f CreateServiceTemplateVersionResponse
createServiceTemplateVersionResponse_serviceTemplateVersion = (CreateServiceTemplateVersionResponse -> ServiceTemplateVersion)
-> (CreateServiceTemplateVersionResponse
    -> ServiceTemplateVersion -> CreateServiceTemplateVersionResponse)
-> Lens
     CreateServiceTemplateVersionResponse
     CreateServiceTemplateVersionResponse
     ServiceTemplateVersion
     ServiceTemplateVersion
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceTemplateVersionResponse' {ServiceTemplateVersion
serviceTemplateVersion :: ServiceTemplateVersion
$sel:serviceTemplateVersion:CreateServiceTemplateVersionResponse' :: CreateServiceTemplateVersionResponse -> ServiceTemplateVersion
serviceTemplateVersion} -> ServiceTemplateVersion
serviceTemplateVersion) (\s :: CreateServiceTemplateVersionResponse
s@CreateServiceTemplateVersionResponse' {} ServiceTemplateVersion
a -> CreateServiceTemplateVersionResponse
s {$sel:serviceTemplateVersion:CreateServiceTemplateVersionResponse' :: ServiceTemplateVersion
serviceTemplateVersion = ServiceTemplateVersion
a} :: CreateServiceTemplateVersionResponse)

instance
  Prelude.NFData
    CreateServiceTemplateVersionResponse