{-# 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.ElasticBeanstalk.CreateApplicationVersion
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates an application version for the specified application. You can
-- create an application version from a source bundle in Amazon S3, a
-- commit in AWS CodeCommit, or the output of an AWS CodeBuild build as
-- follows:
--
-- Specify a commit in an AWS CodeCommit repository with
-- @SourceBuildInformation@.
--
-- Specify a build in an AWS CodeBuild with @SourceBuildInformation@ and
-- @BuildConfiguration@.
--
-- Specify a source bundle in S3 with @SourceBundle@
--
-- Omit both @SourceBuildInformation@ and @SourceBundle@ to use the default
-- sample application.
--
-- After you create an application version with a specified Amazon S3
-- bucket and key location, you can\'t change that Amazon S3 location. If
-- you change the Amazon S3 location, you receive an exception when you
-- attempt to launch an environment from the application version.
module Amazonka.ElasticBeanstalk.CreateApplicationVersion
  ( -- * Creating a Request
    CreateApplicationVersion (..),
    newCreateApplicationVersion,

    -- * Request Lenses
    createApplicationVersion_process,
    createApplicationVersion_sourceBundle,
    createApplicationVersion_autoCreateApplication,
    createApplicationVersion_sourceBuildInformation,
    createApplicationVersion_description,
    createApplicationVersion_buildConfiguration,
    createApplicationVersion_tags,
    createApplicationVersion_applicationName,
    createApplicationVersion_versionLabel,

    -- * Destructuring the Response
    ApplicationVersionDescriptionMessage (..),
    newApplicationVersionDescriptionMessage,

    -- * Response Lenses
    applicationVersionDescriptionMessage_applicationVersion,
  )
where

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

-- |
--
-- /See:/ 'newCreateApplicationVersion' smart constructor.
data CreateApplicationVersion = CreateApplicationVersion'
  { -- | Pre-processes and validates the environment manifest (@env.yaml@) and
    -- configuration files (@*.config@ files in the @.ebextensions@ folder) in
    -- the source bundle. Validating configuration files can identify issues
    -- prior to deploying the application version to an environment.
    --
    -- You must turn processing on for application versions that you create
    -- using AWS CodeBuild or AWS CodeCommit. For application versions built
    -- from a source bundle in Amazon S3, processing is optional.
    --
    -- The @Process@ option validates Elastic Beanstalk configuration files. It
    -- doesn\'t validate your application\'s configuration files, like proxy
    -- server or Docker configuration.
    CreateApplicationVersion -> Maybe Bool
process :: Prelude.Maybe Prelude.Bool,
    -- | The Amazon S3 bucket and key that identify the location of the source
    -- bundle for this version.
    --
    -- The Amazon S3 bucket must be in the same region as the environment.
    --
    -- Specify a source bundle in S3 or a commit in an AWS CodeCommit
    -- repository (with @SourceBuildInformation@), but not both. If neither
    -- @SourceBundle@ nor @SourceBuildInformation@ are provided, Elastic
    -- Beanstalk uses a sample application.
    CreateApplicationVersion -> Maybe S3Location
sourceBundle :: Prelude.Maybe S3Location,
    -- | Set to @true@ to create an application with the specified name if it
    -- doesn\'t already exist.
    CreateApplicationVersion -> Maybe Bool
autoCreateApplication :: Prelude.Maybe Prelude.Bool,
    -- | Specify a commit in an AWS CodeCommit Git repository to use as the
    -- source code for the application version.
    CreateApplicationVersion -> Maybe SourceBuildInformation
sourceBuildInformation :: Prelude.Maybe SourceBuildInformation,
    -- | A description of this application version.
    CreateApplicationVersion -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Settings for an AWS CodeBuild build.
    CreateApplicationVersion -> Maybe BuildConfiguration
buildConfiguration :: Prelude.Maybe BuildConfiguration,
    -- | Specifies the tags applied to the application version.
    --
    -- Elastic Beanstalk applies these tags only to the application version.
    -- Environments that use the application version don\'t inherit the tags.
    CreateApplicationVersion -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The name of the application. If no application is found with this name,
    -- and @AutoCreateApplication@ is @false@, returns an
    -- @InvalidParameterValue@ error.
    CreateApplicationVersion -> Text
applicationName :: Prelude.Text,
    -- | A label identifying this version.
    --
    -- Constraint: Must be unique per application. If an application version
    -- already exists with this label for the specified application, AWS
    -- Elastic Beanstalk returns an @InvalidParameterValue@ error.
    CreateApplicationVersion -> Text
versionLabel :: Prelude.Text
  }
  deriving (CreateApplicationVersion -> CreateApplicationVersion -> Bool
(CreateApplicationVersion -> CreateApplicationVersion -> Bool)
-> (CreateApplicationVersion -> CreateApplicationVersion -> Bool)
-> Eq CreateApplicationVersion
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateApplicationVersion -> CreateApplicationVersion -> Bool
$c/= :: CreateApplicationVersion -> CreateApplicationVersion -> Bool
== :: CreateApplicationVersion -> CreateApplicationVersion -> Bool
$c== :: CreateApplicationVersion -> CreateApplicationVersion -> Bool
Prelude.Eq, ReadPrec [CreateApplicationVersion]
ReadPrec CreateApplicationVersion
Int -> ReadS CreateApplicationVersion
ReadS [CreateApplicationVersion]
(Int -> ReadS CreateApplicationVersion)
-> ReadS [CreateApplicationVersion]
-> ReadPrec CreateApplicationVersion
-> ReadPrec [CreateApplicationVersion]
-> Read CreateApplicationVersion
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateApplicationVersion]
$creadListPrec :: ReadPrec [CreateApplicationVersion]
readPrec :: ReadPrec CreateApplicationVersion
$creadPrec :: ReadPrec CreateApplicationVersion
readList :: ReadS [CreateApplicationVersion]
$creadList :: ReadS [CreateApplicationVersion]
readsPrec :: Int -> ReadS CreateApplicationVersion
$creadsPrec :: Int -> ReadS CreateApplicationVersion
Prelude.Read, Int -> CreateApplicationVersion -> ShowS
[CreateApplicationVersion] -> ShowS
CreateApplicationVersion -> String
(Int -> CreateApplicationVersion -> ShowS)
-> (CreateApplicationVersion -> String)
-> ([CreateApplicationVersion] -> ShowS)
-> Show CreateApplicationVersion
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateApplicationVersion] -> ShowS
$cshowList :: [CreateApplicationVersion] -> ShowS
show :: CreateApplicationVersion -> String
$cshow :: CreateApplicationVersion -> String
showsPrec :: Int -> CreateApplicationVersion -> ShowS
$cshowsPrec :: Int -> CreateApplicationVersion -> ShowS
Prelude.Show, (forall x.
 CreateApplicationVersion -> Rep CreateApplicationVersion x)
-> (forall x.
    Rep CreateApplicationVersion x -> CreateApplicationVersion)
-> Generic CreateApplicationVersion
forall x.
Rep CreateApplicationVersion x -> CreateApplicationVersion
forall x.
CreateApplicationVersion -> Rep CreateApplicationVersion x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateApplicationVersion x -> CreateApplicationVersion
$cfrom :: forall x.
CreateApplicationVersion -> Rep CreateApplicationVersion x
Prelude.Generic)

-- |
-- Create a value of 'CreateApplicationVersion' 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:
--
-- 'process', 'createApplicationVersion_process' - Pre-processes and validates the environment manifest (@env.yaml@) and
-- configuration files (@*.config@ files in the @.ebextensions@ folder) in
-- the source bundle. Validating configuration files can identify issues
-- prior to deploying the application version to an environment.
--
-- You must turn processing on for application versions that you create
-- using AWS CodeBuild or AWS CodeCommit. For application versions built
-- from a source bundle in Amazon S3, processing is optional.
--
-- The @Process@ option validates Elastic Beanstalk configuration files. It
-- doesn\'t validate your application\'s configuration files, like proxy
-- server or Docker configuration.
--
-- 'sourceBundle', 'createApplicationVersion_sourceBundle' - The Amazon S3 bucket and key that identify the location of the source
-- bundle for this version.
--
-- The Amazon S3 bucket must be in the same region as the environment.
--
-- Specify a source bundle in S3 or a commit in an AWS CodeCommit
-- repository (with @SourceBuildInformation@), but not both. If neither
-- @SourceBundle@ nor @SourceBuildInformation@ are provided, Elastic
-- Beanstalk uses a sample application.
--
-- 'autoCreateApplication', 'createApplicationVersion_autoCreateApplication' - Set to @true@ to create an application with the specified name if it
-- doesn\'t already exist.
--
-- 'sourceBuildInformation', 'createApplicationVersion_sourceBuildInformation' - Specify a commit in an AWS CodeCommit Git repository to use as the
-- source code for the application version.
--
-- 'description', 'createApplicationVersion_description' - A description of this application version.
--
-- 'buildConfiguration', 'createApplicationVersion_buildConfiguration' - Settings for an AWS CodeBuild build.
--
-- 'tags', 'createApplicationVersion_tags' - Specifies the tags applied to the application version.
--
-- Elastic Beanstalk applies these tags only to the application version.
-- Environments that use the application version don\'t inherit the tags.
--
-- 'applicationName', 'createApplicationVersion_applicationName' - The name of the application. If no application is found with this name,
-- and @AutoCreateApplication@ is @false@, returns an
-- @InvalidParameterValue@ error.
--
-- 'versionLabel', 'createApplicationVersion_versionLabel' - A label identifying this version.
--
-- Constraint: Must be unique per application. If an application version
-- already exists with this label for the specified application, AWS
-- Elastic Beanstalk returns an @InvalidParameterValue@ error.
newCreateApplicationVersion ::
  -- | 'applicationName'
  Prelude.Text ->
  -- | 'versionLabel'
  Prelude.Text ->
  CreateApplicationVersion
newCreateApplicationVersion :: Text -> Text -> CreateApplicationVersion
newCreateApplicationVersion
  Text
pApplicationName_
  Text
pVersionLabel_ =
    CreateApplicationVersion' :: Maybe Bool
-> Maybe S3Location
-> Maybe Bool
-> Maybe SourceBuildInformation
-> Maybe Text
-> Maybe BuildConfiguration
-> Maybe [Tag]
-> Text
-> Text
-> CreateApplicationVersion
CreateApplicationVersion'
      { $sel:process:CreateApplicationVersion' :: Maybe Bool
process =
          Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:sourceBundle:CreateApplicationVersion' :: Maybe S3Location
sourceBundle = Maybe S3Location
forall a. Maybe a
Prelude.Nothing,
        $sel:autoCreateApplication:CreateApplicationVersion' :: Maybe Bool
autoCreateApplication = Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:sourceBuildInformation:CreateApplicationVersion' :: Maybe SourceBuildInformation
sourceBuildInformation = Maybe SourceBuildInformation
forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateApplicationVersion' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:buildConfiguration:CreateApplicationVersion' :: Maybe BuildConfiguration
buildConfiguration = Maybe BuildConfiguration
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateApplicationVersion' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:applicationName:CreateApplicationVersion' :: Text
applicationName = Text
pApplicationName_,
        $sel:versionLabel:CreateApplicationVersion' :: Text
versionLabel = Text
pVersionLabel_
      }

-- | Pre-processes and validates the environment manifest (@env.yaml@) and
-- configuration files (@*.config@ files in the @.ebextensions@ folder) in
-- the source bundle. Validating configuration files can identify issues
-- prior to deploying the application version to an environment.
--
-- You must turn processing on for application versions that you create
-- using AWS CodeBuild or AWS CodeCommit. For application versions built
-- from a source bundle in Amazon S3, processing is optional.
--
-- The @Process@ option validates Elastic Beanstalk configuration files. It
-- doesn\'t validate your application\'s configuration files, like proxy
-- server or Docker configuration.
createApplicationVersion_process :: Lens.Lens' CreateApplicationVersion (Prelude.Maybe Prelude.Bool)
createApplicationVersion_process :: (Maybe Bool -> f (Maybe Bool))
-> CreateApplicationVersion -> f CreateApplicationVersion
createApplicationVersion_process = (CreateApplicationVersion -> Maybe Bool)
-> (CreateApplicationVersion
    -> Maybe Bool -> CreateApplicationVersion)
-> Lens
     CreateApplicationVersion
     CreateApplicationVersion
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationVersion' {Maybe Bool
process :: Maybe Bool
$sel:process:CreateApplicationVersion' :: CreateApplicationVersion -> Maybe Bool
process} -> Maybe Bool
process) (\s :: CreateApplicationVersion
s@CreateApplicationVersion' {} Maybe Bool
a -> CreateApplicationVersion
s {$sel:process:CreateApplicationVersion' :: Maybe Bool
process = Maybe Bool
a} :: CreateApplicationVersion)

-- | The Amazon S3 bucket and key that identify the location of the source
-- bundle for this version.
--
-- The Amazon S3 bucket must be in the same region as the environment.
--
-- Specify a source bundle in S3 or a commit in an AWS CodeCommit
-- repository (with @SourceBuildInformation@), but not both. If neither
-- @SourceBundle@ nor @SourceBuildInformation@ are provided, Elastic
-- Beanstalk uses a sample application.
createApplicationVersion_sourceBundle :: Lens.Lens' CreateApplicationVersion (Prelude.Maybe S3Location)
createApplicationVersion_sourceBundle :: (Maybe S3Location -> f (Maybe S3Location))
-> CreateApplicationVersion -> f CreateApplicationVersion
createApplicationVersion_sourceBundle = (CreateApplicationVersion -> Maybe S3Location)
-> (CreateApplicationVersion
    -> Maybe S3Location -> CreateApplicationVersion)
-> Lens
     CreateApplicationVersion
     CreateApplicationVersion
     (Maybe S3Location)
     (Maybe S3Location)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationVersion' {Maybe S3Location
sourceBundle :: Maybe S3Location
$sel:sourceBundle:CreateApplicationVersion' :: CreateApplicationVersion -> Maybe S3Location
sourceBundle} -> Maybe S3Location
sourceBundle) (\s :: CreateApplicationVersion
s@CreateApplicationVersion' {} Maybe S3Location
a -> CreateApplicationVersion
s {$sel:sourceBundle:CreateApplicationVersion' :: Maybe S3Location
sourceBundle = Maybe S3Location
a} :: CreateApplicationVersion)

-- | Set to @true@ to create an application with the specified name if it
-- doesn\'t already exist.
createApplicationVersion_autoCreateApplication :: Lens.Lens' CreateApplicationVersion (Prelude.Maybe Prelude.Bool)
createApplicationVersion_autoCreateApplication :: (Maybe Bool -> f (Maybe Bool))
-> CreateApplicationVersion -> f CreateApplicationVersion
createApplicationVersion_autoCreateApplication = (CreateApplicationVersion -> Maybe Bool)
-> (CreateApplicationVersion
    -> Maybe Bool -> CreateApplicationVersion)
-> Lens
     CreateApplicationVersion
     CreateApplicationVersion
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationVersion' {Maybe Bool
autoCreateApplication :: Maybe Bool
$sel:autoCreateApplication:CreateApplicationVersion' :: CreateApplicationVersion -> Maybe Bool
autoCreateApplication} -> Maybe Bool
autoCreateApplication) (\s :: CreateApplicationVersion
s@CreateApplicationVersion' {} Maybe Bool
a -> CreateApplicationVersion
s {$sel:autoCreateApplication:CreateApplicationVersion' :: Maybe Bool
autoCreateApplication = Maybe Bool
a} :: CreateApplicationVersion)

-- | Specify a commit in an AWS CodeCommit Git repository to use as the
-- source code for the application version.
createApplicationVersion_sourceBuildInformation :: Lens.Lens' CreateApplicationVersion (Prelude.Maybe SourceBuildInformation)
createApplicationVersion_sourceBuildInformation :: (Maybe SourceBuildInformation -> f (Maybe SourceBuildInformation))
-> CreateApplicationVersion -> f CreateApplicationVersion
createApplicationVersion_sourceBuildInformation = (CreateApplicationVersion -> Maybe SourceBuildInformation)
-> (CreateApplicationVersion
    -> Maybe SourceBuildInformation -> CreateApplicationVersion)
-> Lens
     CreateApplicationVersion
     CreateApplicationVersion
     (Maybe SourceBuildInformation)
     (Maybe SourceBuildInformation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationVersion' {Maybe SourceBuildInformation
sourceBuildInformation :: Maybe SourceBuildInformation
$sel:sourceBuildInformation:CreateApplicationVersion' :: CreateApplicationVersion -> Maybe SourceBuildInformation
sourceBuildInformation} -> Maybe SourceBuildInformation
sourceBuildInformation) (\s :: CreateApplicationVersion
s@CreateApplicationVersion' {} Maybe SourceBuildInformation
a -> CreateApplicationVersion
s {$sel:sourceBuildInformation:CreateApplicationVersion' :: Maybe SourceBuildInformation
sourceBuildInformation = Maybe SourceBuildInformation
a} :: CreateApplicationVersion)

-- | A description of this application version.
createApplicationVersion_description :: Lens.Lens' CreateApplicationVersion (Prelude.Maybe Prelude.Text)
createApplicationVersion_description :: (Maybe Text -> f (Maybe Text))
-> CreateApplicationVersion -> f CreateApplicationVersion
createApplicationVersion_description = (CreateApplicationVersion -> Maybe Text)
-> (CreateApplicationVersion
    -> Maybe Text -> CreateApplicationVersion)
-> Lens
     CreateApplicationVersion
     CreateApplicationVersion
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationVersion' {Maybe Text
description :: Maybe Text
$sel:description:CreateApplicationVersion' :: CreateApplicationVersion -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateApplicationVersion
s@CreateApplicationVersion' {} Maybe Text
a -> CreateApplicationVersion
s {$sel:description:CreateApplicationVersion' :: Maybe Text
description = Maybe Text
a} :: CreateApplicationVersion)

-- | Settings for an AWS CodeBuild build.
createApplicationVersion_buildConfiguration :: Lens.Lens' CreateApplicationVersion (Prelude.Maybe BuildConfiguration)
createApplicationVersion_buildConfiguration :: (Maybe BuildConfiguration -> f (Maybe BuildConfiguration))
-> CreateApplicationVersion -> f CreateApplicationVersion
createApplicationVersion_buildConfiguration = (CreateApplicationVersion -> Maybe BuildConfiguration)
-> (CreateApplicationVersion
    -> Maybe BuildConfiguration -> CreateApplicationVersion)
-> Lens
     CreateApplicationVersion
     CreateApplicationVersion
     (Maybe BuildConfiguration)
     (Maybe BuildConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationVersion' {Maybe BuildConfiguration
buildConfiguration :: Maybe BuildConfiguration
$sel:buildConfiguration:CreateApplicationVersion' :: CreateApplicationVersion -> Maybe BuildConfiguration
buildConfiguration} -> Maybe BuildConfiguration
buildConfiguration) (\s :: CreateApplicationVersion
s@CreateApplicationVersion' {} Maybe BuildConfiguration
a -> CreateApplicationVersion
s {$sel:buildConfiguration:CreateApplicationVersion' :: Maybe BuildConfiguration
buildConfiguration = Maybe BuildConfiguration
a} :: CreateApplicationVersion)

-- | Specifies the tags applied to the application version.
--
-- Elastic Beanstalk applies these tags only to the application version.
-- Environments that use the application version don\'t inherit the tags.
createApplicationVersion_tags :: Lens.Lens' CreateApplicationVersion (Prelude.Maybe [Tag])
createApplicationVersion_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateApplicationVersion -> f CreateApplicationVersion
createApplicationVersion_tags = (CreateApplicationVersion -> Maybe [Tag])
-> (CreateApplicationVersion
    -> Maybe [Tag] -> CreateApplicationVersion)
-> Lens
     CreateApplicationVersion
     CreateApplicationVersion
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationVersion' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateApplicationVersion' :: CreateApplicationVersion -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateApplicationVersion
s@CreateApplicationVersion' {} Maybe [Tag]
a -> CreateApplicationVersion
s {$sel:tags:CreateApplicationVersion' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateApplicationVersion) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateApplicationVersion -> f CreateApplicationVersion)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateApplicationVersion
-> f CreateApplicationVersion
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 application. If no application is found with this name,
-- and @AutoCreateApplication@ is @false@, returns an
-- @InvalidParameterValue@ error.
createApplicationVersion_applicationName :: Lens.Lens' CreateApplicationVersion Prelude.Text
createApplicationVersion_applicationName :: (Text -> f Text)
-> CreateApplicationVersion -> f CreateApplicationVersion
createApplicationVersion_applicationName = (CreateApplicationVersion -> Text)
-> (CreateApplicationVersion -> Text -> CreateApplicationVersion)
-> Lens CreateApplicationVersion CreateApplicationVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationVersion' {Text
applicationName :: Text
$sel:applicationName:CreateApplicationVersion' :: CreateApplicationVersion -> Text
applicationName} -> Text
applicationName) (\s :: CreateApplicationVersion
s@CreateApplicationVersion' {} Text
a -> CreateApplicationVersion
s {$sel:applicationName:CreateApplicationVersion' :: Text
applicationName = Text
a} :: CreateApplicationVersion)

-- | A label identifying this version.
--
-- Constraint: Must be unique per application. If an application version
-- already exists with this label for the specified application, AWS
-- Elastic Beanstalk returns an @InvalidParameterValue@ error.
createApplicationVersion_versionLabel :: Lens.Lens' CreateApplicationVersion Prelude.Text
createApplicationVersion_versionLabel :: (Text -> f Text)
-> CreateApplicationVersion -> f CreateApplicationVersion
createApplicationVersion_versionLabel = (CreateApplicationVersion -> Text)
-> (CreateApplicationVersion -> Text -> CreateApplicationVersion)
-> Lens CreateApplicationVersion CreateApplicationVersion Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateApplicationVersion' {Text
versionLabel :: Text
$sel:versionLabel:CreateApplicationVersion' :: CreateApplicationVersion -> Text
versionLabel} -> Text
versionLabel) (\s :: CreateApplicationVersion
s@CreateApplicationVersion' {} Text
a -> CreateApplicationVersion
s {$sel:versionLabel:CreateApplicationVersion' :: Text
versionLabel = Text
a} :: CreateApplicationVersion)

instance Core.AWSRequest CreateApplicationVersion where
  type
    AWSResponse CreateApplicationVersion =
      ApplicationVersionDescriptionMessage
  request :: CreateApplicationVersion -> Request CreateApplicationVersion
request = Service
-> CreateApplicationVersion -> Request CreateApplicationVersion
forall a. ToRequest a => Service -> a -> Request a
Request.postQuery Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateApplicationVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateApplicationVersion)))
response =
    Text
-> (Int
    -> ResponseHeaders
    -> [Node]
    -> Either String (AWSResponse CreateApplicationVersion))
-> Logger
-> Service
-> Proxy CreateApplicationVersion
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateApplicationVersion)))
forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"CreateApplicationVersionResult"
      (\Int
s ResponseHeaders
h [Node]
x -> [Node] -> Either String ApplicationVersionDescriptionMessage
forall a. FromXML a => [Node] -> Either String a
Core.parseXML [Node]
x)

instance Prelude.Hashable CreateApplicationVersion

instance Prelude.NFData CreateApplicationVersion

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

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

instance Core.ToQuery CreateApplicationVersion where
  toQuery :: CreateApplicationVersion -> QueryString
toQuery CreateApplicationVersion' {Maybe Bool
Maybe [Tag]
Maybe Text
Maybe BuildConfiguration
Maybe S3Location
Maybe SourceBuildInformation
Text
versionLabel :: Text
applicationName :: Text
tags :: Maybe [Tag]
buildConfiguration :: Maybe BuildConfiguration
description :: Maybe Text
sourceBuildInformation :: Maybe SourceBuildInformation
autoCreateApplication :: Maybe Bool
sourceBundle :: Maybe S3Location
process :: Maybe Bool
$sel:versionLabel:CreateApplicationVersion' :: CreateApplicationVersion -> Text
$sel:applicationName:CreateApplicationVersion' :: CreateApplicationVersion -> Text
$sel:tags:CreateApplicationVersion' :: CreateApplicationVersion -> Maybe [Tag]
$sel:buildConfiguration:CreateApplicationVersion' :: CreateApplicationVersion -> Maybe BuildConfiguration
$sel:description:CreateApplicationVersion' :: CreateApplicationVersion -> Maybe Text
$sel:sourceBuildInformation:CreateApplicationVersion' :: CreateApplicationVersion -> Maybe SourceBuildInformation
$sel:autoCreateApplication:CreateApplicationVersion' :: CreateApplicationVersion -> Maybe Bool
$sel:sourceBundle:CreateApplicationVersion' :: CreateApplicationVersion -> Maybe S3Location
$sel:process:CreateApplicationVersion' :: CreateApplicationVersion -> Maybe Bool
..} =
    [QueryString] -> QueryString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"CreateApplicationVersion" :: Prelude.ByteString),
        ByteString
"Version"
          ByteString -> ByteString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: (ByteString
"2010-12-01" :: Prelude.ByteString),
        ByteString
"Process" ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
process,
        ByteString
"SourceBundle" ByteString -> Maybe S3Location -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe S3Location
sourceBundle,
        ByteString
"AutoCreateApplication"
          ByteString -> Maybe Bool -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Bool
autoCreateApplication,
        ByteString
"SourceBuildInformation"
          ByteString -> Maybe SourceBuildInformation -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe SourceBuildInformation
sourceBuildInformation,
        ByteString
"Description" ByteString -> Maybe Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe Text
description,
        ByteString
"BuildConfiguration" ByteString -> Maybe BuildConfiguration -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe BuildConfiguration
buildConfiguration,
        ByteString
"Tags"
          ByteString -> QueryString -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Maybe QueryString -> QueryString
forall a. ToQuery a => a -> QueryString
Core.toQuery
            (ByteString -> [Tag] -> QueryString
forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Core.toQueryList ByteString
"member" ([Tag] -> QueryString) -> Maybe [Tag] -> Maybe QueryString
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags),
        ByteString
"ApplicationName" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
applicationName,
        ByteString
"VersionLabel" ByteString -> Text -> QueryString
forall a. ToQuery a => ByteString -> a -> QueryString
Core.=: Text
versionLabel
      ]