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

    -- * Request Lenses
    createEnvironmentTemplateVersion_clientToken,
    createEnvironmentTemplateVersion_majorVersion,
    createEnvironmentTemplateVersion_description,
    createEnvironmentTemplateVersion_tags,
    createEnvironmentTemplateVersion_source,
    createEnvironmentTemplateVersion_templateName,

    -- * Destructuring the Response
    CreateEnvironmentTemplateVersionResponse (..),
    newCreateEnvironmentTemplateVersionResponse,

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

-- |
-- Create a value of 'CreateEnvironmentTemplateVersion' 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', 'createEnvironmentTemplateVersion_clientToken' - When included, if two identicial requests are made with the same client
-- token, AWS Proton returns the environment template version that the
-- first request created.
--
-- 'majorVersion', 'createEnvironmentTemplateVersion_majorVersion' - To create a new minor version of the environment template, include a
-- @majorVersion@.
--
-- To create a new major and minor version of the environment template,
-- /exclude/ @majorVersion@.
--
-- 'description', 'createEnvironmentTemplateVersion_description' - A description of the new version of an environment template.
--
-- 'tags', 'createEnvironmentTemplateVersion_tags' - Create tags for a new version of an environment template.
--
-- 'source', 'createEnvironmentTemplateVersion_source' - An object that includes the template bundle S3 bucket path and name for
-- the new version of an template.
--
-- 'templateName', 'createEnvironmentTemplateVersion_templateName' - The name of the environment template.
newCreateEnvironmentTemplateVersion ::
  -- | 'source'
  TemplateVersionSourceInput ->
  -- | 'templateName'
  Prelude.Text ->
  CreateEnvironmentTemplateVersion
newCreateEnvironmentTemplateVersion :: TemplateVersionSourceInput
-> Text -> CreateEnvironmentTemplateVersion
newCreateEnvironmentTemplateVersion
  TemplateVersionSourceInput
pSource_
  Text
pTemplateName_ =
    CreateEnvironmentTemplateVersion' :: Maybe Text
-> Maybe Text
-> Maybe (Sensitive Text)
-> Maybe [Tag]
-> TemplateVersionSourceInput
-> Text
-> CreateEnvironmentTemplateVersion
CreateEnvironmentTemplateVersion'
      { $sel:clientToken:CreateEnvironmentTemplateVersion' :: Maybe Text
clientToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:majorVersion:CreateEnvironmentTemplateVersion' :: Maybe Text
majorVersion = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateEnvironmentTemplateVersion' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateEnvironmentTemplateVersion' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:source:CreateEnvironmentTemplateVersion' :: TemplateVersionSourceInput
source = TemplateVersionSourceInput
pSource_,
        $sel:templateName:CreateEnvironmentTemplateVersion' :: Text
templateName = Text
pTemplateName_
      }

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

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

-- | A description of the new version of an environment template.
createEnvironmentTemplateVersion_description :: Lens.Lens' CreateEnvironmentTemplateVersion (Prelude.Maybe Prelude.Text)
createEnvironmentTemplateVersion_description :: (Maybe Text -> f (Maybe Text))
-> CreateEnvironmentTemplateVersion
-> f CreateEnvironmentTemplateVersion
createEnvironmentTemplateVersion_description = (CreateEnvironmentTemplateVersion -> Maybe (Sensitive Text))
-> (CreateEnvironmentTemplateVersion
    -> Maybe (Sensitive Text) -> CreateEnvironmentTemplateVersion)
-> Lens
     CreateEnvironmentTemplateVersion
     CreateEnvironmentTemplateVersion
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentTemplateVersion' {Maybe (Sensitive Text)
description :: Maybe (Sensitive Text)
$sel:description:CreateEnvironmentTemplateVersion' :: CreateEnvironmentTemplateVersion -> Maybe (Sensitive Text)
description} -> Maybe (Sensitive Text)
description) (\s :: CreateEnvironmentTemplateVersion
s@CreateEnvironmentTemplateVersion' {} Maybe (Sensitive Text)
a -> CreateEnvironmentTemplateVersion
s {$sel:description:CreateEnvironmentTemplateVersion' :: Maybe (Sensitive Text)
description = Maybe (Sensitive Text)
a} :: CreateEnvironmentTemplateVersion) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> CreateEnvironmentTemplateVersion
 -> f CreateEnvironmentTemplateVersion)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateEnvironmentTemplateVersion
-> f CreateEnvironmentTemplateVersion
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 an environment template.
createEnvironmentTemplateVersion_tags :: Lens.Lens' CreateEnvironmentTemplateVersion (Prelude.Maybe [Tag])
createEnvironmentTemplateVersion_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateEnvironmentTemplateVersion
-> f CreateEnvironmentTemplateVersion
createEnvironmentTemplateVersion_tags = (CreateEnvironmentTemplateVersion -> Maybe [Tag])
-> (CreateEnvironmentTemplateVersion
    -> Maybe [Tag] -> CreateEnvironmentTemplateVersion)
-> Lens
     CreateEnvironmentTemplateVersion
     CreateEnvironmentTemplateVersion
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentTemplateVersion' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateEnvironmentTemplateVersion' :: CreateEnvironmentTemplateVersion -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateEnvironmentTemplateVersion
s@CreateEnvironmentTemplateVersion' {} Maybe [Tag]
a -> CreateEnvironmentTemplateVersion
s {$sel:tags:CreateEnvironmentTemplateVersion' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateEnvironmentTemplateVersion) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateEnvironmentTemplateVersion
 -> f CreateEnvironmentTemplateVersion)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateEnvironmentTemplateVersion
-> f CreateEnvironmentTemplateVersion
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 object that includes the template bundle S3 bucket path and name for
-- the new version of an template.
createEnvironmentTemplateVersion_source :: Lens.Lens' CreateEnvironmentTemplateVersion TemplateVersionSourceInput
createEnvironmentTemplateVersion_source :: (TemplateVersionSourceInput -> f TemplateVersionSourceInput)
-> CreateEnvironmentTemplateVersion
-> f CreateEnvironmentTemplateVersion
createEnvironmentTemplateVersion_source = (CreateEnvironmentTemplateVersion -> TemplateVersionSourceInput)
-> (CreateEnvironmentTemplateVersion
    -> TemplateVersionSourceInput -> CreateEnvironmentTemplateVersion)
-> Lens
     CreateEnvironmentTemplateVersion
     CreateEnvironmentTemplateVersion
     TemplateVersionSourceInput
     TemplateVersionSourceInput
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentTemplateVersion' {TemplateVersionSourceInput
source :: TemplateVersionSourceInput
$sel:source:CreateEnvironmentTemplateVersion' :: CreateEnvironmentTemplateVersion -> TemplateVersionSourceInput
source} -> TemplateVersionSourceInput
source) (\s :: CreateEnvironmentTemplateVersion
s@CreateEnvironmentTemplateVersion' {} TemplateVersionSourceInput
a -> CreateEnvironmentTemplateVersion
s {$sel:source:CreateEnvironmentTemplateVersion' :: TemplateVersionSourceInput
source = TemplateVersionSourceInput
a} :: CreateEnvironmentTemplateVersion)

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

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

instance
  Prelude.Hashable
    CreateEnvironmentTemplateVersion

instance
  Prelude.NFData
    CreateEnvironmentTemplateVersion

instance
  Core.ToHeaders
    CreateEnvironmentTemplateVersion
  where
  toHeaders :: CreateEnvironmentTemplateVersion -> ResponseHeaders
toHeaders =
    ResponseHeaders
-> CreateEnvironmentTemplateVersion -> 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.CreateEnvironmentTemplateVersion" ::
                          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 CreateEnvironmentTemplateVersion where
  toJSON :: CreateEnvironmentTemplateVersion -> Value
toJSON CreateEnvironmentTemplateVersion' {Maybe [Tag]
Maybe Text
Maybe (Sensitive Text)
Text
TemplateVersionSourceInput
templateName :: Text
source :: TemplateVersionSourceInput
tags :: Maybe [Tag]
description :: Maybe (Sensitive Text)
majorVersion :: Maybe Text
clientToken :: Maybe Text
$sel:templateName:CreateEnvironmentTemplateVersion' :: CreateEnvironmentTemplateVersion -> Text
$sel:source:CreateEnvironmentTemplateVersion' :: CreateEnvironmentTemplateVersion -> TemplateVersionSourceInput
$sel:tags:CreateEnvironmentTemplateVersion' :: CreateEnvironmentTemplateVersion -> Maybe [Tag]
$sel:description:CreateEnvironmentTemplateVersion' :: CreateEnvironmentTemplateVersion -> Maybe (Sensitive Text)
$sel:majorVersion:CreateEnvironmentTemplateVersion' :: CreateEnvironmentTemplateVersion -> Maybe Text
$sel:clientToken:CreateEnvironmentTemplateVersion' :: CreateEnvironmentTemplateVersion -> 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
"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 CreateEnvironmentTemplateVersion where
  toPath :: CreateEnvironmentTemplateVersion -> ByteString
toPath = ByteString -> CreateEnvironmentTemplateVersion -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

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

-- |
-- Create a value of 'CreateEnvironmentTemplateVersionResponse' 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', 'createEnvironmentTemplateVersionResponse_httpStatus' - The response's http status code.
--
-- 'environmentTemplateVersion', 'createEnvironmentTemplateVersionResponse_environmentTemplateVersion' - The environment template detail data that\'s returned by AWS Proton.
newCreateEnvironmentTemplateVersionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'environmentTemplateVersion'
  EnvironmentTemplateVersion ->
  CreateEnvironmentTemplateVersionResponse
newCreateEnvironmentTemplateVersionResponse :: Int
-> EnvironmentTemplateVersion
-> CreateEnvironmentTemplateVersionResponse
newCreateEnvironmentTemplateVersionResponse
  Int
pHttpStatus_
  EnvironmentTemplateVersion
pEnvironmentTemplateVersion_ =
    CreateEnvironmentTemplateVersionResponse' :: Int
-> EnvironmentTemplateVersion
-> CreateEnvironmentTemplateVersionResponse
CreateEnvironmentTemplateVersionResponse'
      { $sel:httpStatus:CreateEnvironmentTemplateVersionResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:environmentTemplateVersion:CreateEnvironmentTemplateVersionResponse' :: EnvironmentTemplateVersion
environmentTemplateVersion =
          EnvironmentTemplateVersion
pEnvironmentTemplateVersion_
      }

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

-- | The environment template detail data that\'s returned by AWS Proton.
createEnvironmentTemplateVersionResponse_environmentTemplateVersion :: Lens.Lens' CreateEnvironmentTemplateVersionResponse EnvironmentTemplateVersion
createEnvironmentTemplateVersionResponse_environmentTemplateVersion :: (EnvironmentTemplateVersion -> f EnvironmentTemplateVersion)
-> CreateEnvironmentTemplateVersionResponse
-> f CreateEnvironmentTemplateVersionResponse
createEnvironmentTemplateVersionResponse_environmentTemplateVersion = (CreateEnvironmentTemplateVersionResponse
 -> EnvironmentTemplateVersion)
-> (CreateEnvironmentTemplateVersionResponse
    -> EnvironmentTemplateVersion
    -> CreateEnvironmentTemplateVersionResponse)
-> Lens
     CreateEnvironmentTemplateVersionResponse
     CreateEnvironmentTemplateVersionResponse
     EnvironmentTemplateVersion
     EnvironmentTemplateVersion
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateEnvironmentTemplateVersionResponse' {EnvironmentTemplateVersion
environmentTemplateVersion :: EnvironmentTemplateVersion
$sel:environmentTemplateVersion:CreateEnvironmentTemplateVersionResponse' :: CreateEnvironmentTemplateVersionResponse
-> EnvironmentTemplateVersion
environmentTemplateVersion} -> EnvironmentTemplateVersion
environmentTemplateVersion) (\s :: CreateEnvironmentTemplateVersionResponse
s@CreateEnvironmentTemplateVersionResponse' {} EnvironmentTemplateVersion
a -> CreateEnvironmentTemplateVersionResponse
s {$sel:environmentTemplateVersion:CreateEnvironmentTemplateVersionResponse' :: EnvironmentTemplateVersion
environmentTemplateVersion = EnvironmentTemplateVersion
a} :: CreateEnvironmentTemplateVersionResponse)

instance
  Prelude.NFData
    CreateEnvironmentTemplateVersionResponse