{-# 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.AppRunner.CreateService
-- 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 an App Runner service. After the service is created, the action
-- also automatically starts a deployment.
--
-- This is an asynchronous operation. On a successful call, you can use the
-- returned @OperationId@ and the
-- <https://docs.aws.amazon.com/apprunner/latest/api/API_ListOperations.html ListOperations>
-- call to track the operation\'s progress.
module Amazonka.AppRunner.CreateService
  ( -- * Creating a Request
    CreateService (..),
    newCreateService,

    -- * Request Lenses
    createService_autoScalingConfigurationArn,
    createService_encryptionConfiguration,
    createService_healthCheckConfiguration,
    createService_tags,
    createService_instanceConfiguration,
    createService_serviceName,
    createService_sourceConfiguration,

    -- * Destructuring the Response
    CreateServiceResponse (..),
    newCreateServiceResponse,

    -- * Response Lenses
    createServiceResponse_httpStatus,
    createServiceResponse_service,
    createServiceResponse_operationId,
  )
where

import Amazonka.AppRunner.Types
import qualified Amazonka.Core as Core
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:/ 'newCreateService' smart constructor.
data CreateService = CreateService'
  { -- | The Amazon Resource Name (ARN) of an App Runner automatic scaling
    -- configuration resource that you want to associate with your service. If
    -- not provided, App Runner associates the latest revision of a default
    -- auto scaling configuration.
    CreateService -> Maybe Text
autoScalingConfigurationArn :: Prelude.Maybe Prelude.Text,
    -- | An optional custom encryption key that App Runner uses to encrypt the
    -- copy of your source repository that it maintains and your service logs.
    -- By default, App Runner uses an Amazon Web Services managed CMK.
    CreateService -> Maybe EncryptionConfiguration
encryptionConfiguration :: Prelude.Maybe EncryptionConfiguration,
    -- | The settings for the health check that App Runner performs to monitor
    -- the health of your service.
    CreateService -> Maybe HealthCheckConfiguration
healthCheckConfiguration :: Prelude.Maybe HealthCheckConfiguration,
    -- | An optional list of metadata items that you can associate with your
    -- service resource. A tag is a key-value pair.
    CreateService -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The runtime configuration of instances (scaling units) of the App Runner
    -- service.
    CreateService -> Maybe InstanceConfiguration
instanceConfiguration :: Prelude.Maybe InstanceConfiguration,
    -- | A name for the new service. It must be unique across all the running App
    -- Runner services in your Amazon Web Services account in the Amazon Web
    -- Services Region.
    CreateService -> Text
serviceName :: Prelude.Text,
    -- | The source to deploy to the App Runner service. It can be a code or an
    -- image repository.
    CreateService -> SourceConfiguration
sourceConfiguration :: SourceConfiguration
  }
  deriving (CreateService -> CreateService -> Bool
(CreateService -> CreateService -> Bool)
-> (CreateService -> CreateService -> Bool) -> Eq CreateService
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateService -> CreateService -> Bool
$c/= :: CreateService -> CreateService -> Bool
== :: CreateService -> CreateService -> Bool
$c== :: CreateService -> CreateService -> Bool
Prelude.Eq, Int -> CreateService -> ShowS
[CreateService] -> ShowS
CreateService -> String
(Int -> CreateService -> ShowS)
-> (CreateService -> String)
-> ([CreateService] -> ShowS)
-> Show CreateService
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateService] -> ShowS
$cshowList :: [CreateService] -> ShowS
show :: CreateService -> String
$cshow :: CreateService -> String
showsPrec :: Int -> CreateService -> ShowS
$cshowsPrec :: Int -> CreateService -> ShowS
Prelude.Show, (forall x. CreateService -> Rep CreateService x)
-> (forall x. Rep CreateService x -> CreateService)
-> Generic CreateService
forall x. Rep CreateService x -> CreateService
forall x. CreateService -> Rep CreateService x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateService x -> CreateService
$cfrom :: forall x. CreateService -> Rep CreateService x
Prelude.Generic)

-- |
-- Create a value of 'CreateService' 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:
--
-- 'autoScalingConfigurationArn', 'createService_autoScalingConfigurationArn' - The Amazon Resource Name (ARN) of an App Runner automatic scaling
-- configuration resource that you want to associate with your service. If
-- not provided, App Runner associates the latest revision of a default
-- auto scaling configuration.
--
-- 'encryptionConfiguration', 'createService_encryptionConfiguration' - An optional custom encryption key that App Runner uses to encrypt the
-- copy of your source repository that it maintains and your service logs.
-- By default, App Runner uses an Amazon Web Services managed CMK.
--
-- 'healthCheckConfiguration', 'createService_healthCheckConfiguration' - The settings for the health check that App Runner performs to monitor
-- the health of your service.
--
-- 'tags', 'createService_tags' - An optional list of metadata items that you can associate with your
-- service resource. A tag is a key-value pair.
--
-- 'instanceConfiguration', 'createService_instanceConfiguration' - The runtime configuration of instances (scaling units) of the App Runner
-- service.
--
-- 'serviceName', 'createService_serviceName' - A name for the new service. It must be unique across all the running App
-- Runner services in your Amazon Web Services account in the Amazon Web
-- Services Region.
--
-- 'sourceConfiguration', 'createService_sourceConfiguration' - The source to deploy to the App Runner service. It can be a code or an
-- image repository.
newCreateService ::
  -- | 'serviceName'
  Prelude.Text ->
  -- | 'sourceConfiguration'
  SourceConfiguration ->
  CreateService
newCreateService :: Text -> SourceConfiguration -> CreateService
newCreateService Text
pServiceName_ SourceConfiguration
pSourceConfiguration_ =
  CreateService' :: Maybe Text
-> Maybe EncryptionConfiguration
-> Maybe HealthCheckConfiguration
-> Maybe [Tag]
-> Maybe InstanceConfiguration
-> Text
-> SourceConfiguration
-> CreateService
CreateService'
    { $sel:autoScalingConfigurationArn:CreateService' :: Maybe Text
autoScalingConfigurationArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:encryptionConfiguration:CreateService' :: Maybe EncryptionConfiguration
encryptionConfiguration = Maybe EncryptionConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckConfiguration:CreateService' :: Maybe HealthCheckConfiguration
healthCheckConfiguration = Maybe HealthCheckConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateService' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceConfiguration:CreateService' :: Maybe InstanceConfiguration
instanceConfiguration = Maybe InstanceConfiguration
forall a. Maybe a
Prelude.Nothing,
      $sel:serviceName:CreateService' :: Text
serviceName = Text
pServiceName_,
      $sel:sourceConfiguration:CreateService' :: SourceConfiguration
sourceConfiguration = SourceConfiguration
pSourceConfiguration_
    }

-- | The Amazon Resource Name (ARN) of an App Runner automatic scaling
-- configuration resource that you want to associate with your service. If
-- not provided, App Runner associates the latest revision of a default
-- auto scaling configuration.
createService_autoScalingConfigurationArn :: Lens.Lens' CreateService (Prelude.Maybe Prelude.Text)
createService_autoScalingConfigurationArn :: (Maybe Text -> f (Maybe Text)) -> CreateService -> f CreateService
createService_autoScalingConfigurationArn = (CreateService -> Maybe Text)
-> (CreateService -> Maybe Text -> CreateService)
-> Lens CreateService CreateService (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateService' {Maybe Text
autoScalingConfigurationArn :: Maybe Text
$sel:autoScalingConfigurationArn:CreateService' :: CreateService -> Maybe Text
autoScalingConfigurationArn} -> Maybe Text
autoScalingConfigurationArn) (\s :: CreateService
s@CreateService' {} Maybe Text
a -> CreateService
s {$sel:autoScalingConfigurationArn:CreateService' :: Maybe Text
autoScalingConfigurationArn = Maybe Text
a} :: CreateService)

-- | An optional custom encryption key that App Runner uses to encrypt the
-- copy of your source repository that it maintains and your service logs.
-- By default, App Runner uses an Amazon Web Services managed CMK.
createService_encryptionConfiguration :: Lens.Lens' CreateService (Prelude.Maybe EncryptionConfiguration)
createService_encryptionConfiguration :: (Maybe EncryptionConfiguration
 -> f (Maybe EncryptionConfiguration))
-> CreateService -> f CreateService
createService_encryptionConfiguration = (CreateService -> Maybe EncryptionConfiguration)
-> (CreateService
    -> Maybe EncryptionConfiguration -> CreateService)
-> Lens
     CreateService
     CreateService
     (Maybe EncryptionConfiguration)
     (Maybe EncryptionConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateService' {Maybe EncryptionConfiguration
encryptionConfiguration :: Maybe EncryptionConfiguration
$sel:encryptionConfiguration:CreateService' :: CreateService -> Maybe EncryptionConfiguration
encryptionConfiguration} -> Maybe EncryptionConfiguration
encryptionConfiguration) (\s :: CreateService
s@CreateService' {} Maybe EncryptionConfiguration
a -> CreateService
s {$sel:encryptionConfiguration:CreateService' :: Maybe EncryptionConfiguration
encryptionConfiguration = Maybe EncryptionConfiguration
a} :: CreateService)

-- | The settings for the health check that App Runner performs to monitor
-- the health of your service.
createService_healthCheckConfiguration :: Lens.Lens' CreateService (Prelude.Maybe HealthCheckConfiguration)
createService_healthCheckConfiguration :: (Maybe HealthCheckConfiguration
 -> f (Maybe HealthCheckConfiguration))
-> CreateService -> f CreateService
createService_healthCheckConfiguration = (CreateService -> Maybe HealthCheckConfiguration)
-> (CreateService
    -> Maybe HealthCheckConfiguration -> CreateService)
-> Lens
     CreateService
     CreateService
     (Maybe HealthCheckConfiguration)
     (Maybe HealthCheckConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateService' {Maybe HealthCheckConfiguration
healthCheckConfiguration :: Maybe HealthCheckConfiguration
$sel:healthCheckConfiguration:CreateService' :: CreateService -> Maybe HealthCheckConfiguration
healthCheckConfiguration} -> Maybe HealthCheckConfiguration
healthCheckConfiguration) (\s :: CreateService
s@CreateService' {} Maybe HealthCheckConfiguration
a -> CreateService
s {$sel:healthCheckConfiguration:CreateService' :: Maybe HealthCheckConfiguration
healthCheckConfiguration = Maybe HealthCheckConfiguration
a} :: CreateService)

-- | An optional list of metadata items that you can associate with your
-- service resource. A tag is a key-value pair.
createService_tags :: Lens.Lens' CreateService (Prelude.Maybe [Tag])
createService_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateService -> f CreateService
createService_tags = (CreateService -> Maybe [Tag])
-> (CreateService -> Maybe [Tag] -> CreateService)
-> Lens CreateService CreateService (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateService' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateService' :: CreateService -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateService
s@CreateService' {} Maybe [Tag]
a -> CreateService
s {$sel:tags:CreateService' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateService) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateService -> f CreateService)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateService
-> f CreateService
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 runtime configuration of instances (scaling units) of the App Runner
-- service.
createService_instanceConfiguration :: Lens.Lens' CreateService (Prelude.Maybe InstanceConfiguration)
createService_instanceConfiguration :: (Maybe InstanceConfiguration -> f (Maybe InstanceConfiguration))
-> CreateService -> f CreateService
createService_instanceConfiguration = (CreateService -> Maybe InstanceConfiguration)
-> (CreateService -> Maybe InstanceConfiguration -> CreateService)
-> Lens
     CreateService
     CreateService
     (Maybe InstanceConfiguration)
     (Maybe InstanceConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateService' {Maybe InstanceConfiguration
instanceConfiguration :: Maybe InstanceConfiguration
$sel:instanceConfiguration:CreateService' :: CreateService -> Maybe InstanceConfiguration
instanceConfiguration} -> Maybe InstanceConfiguration
instanceConfiguration) (\s :: CreateService
s@CreateService' {} Maybe InstanceConfiguration
a -> CreateService
s {$sel:instanceConfiguration:CreateService' :: Maybe InstanceConfiguration
instanceConfiguration = Maybe InstanceConfiguration
a} :: CreateService)

-- | A name for the new service. It must be unique across all the running App
-- Runner services in your Amazon Web Services account in the Amazon Web
-- Services Region.
createService_serviceName :: Lens.Lens' CreateService Prelude.Text
createService_serviceName :: (Text -> f Text) -> CreateService -> f CreateService
createService_serviceName = (CreateService -> Text)
-> (CreateService -> Text -> CreateService)
-> Lens CreateService CreateService Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateService' {Text
serviceName :: Text
$sel:serviceName:CreateService' :: CreateService -> Text
serviceName} -> Text
serviceName) (\s :: CreateService
s@CreateService' {} Text
a -> CreateService
s {$sel:serviceName:CreateService' :: Text
serviceName = Text
a} :: CreateService)

-- | The source to deploy to the App Runner service. It can be a code or an
-- image repository.
createService_sourceConfiguration :: Lens.Lens' CreateService SourceConfiguration
createService_sourceConfiguration :: (SourceConfiguration -> f SourceConfiguration)
-> CreateService -> f CreateService
createService_sourceConfiguration = (CreateService -> SourceConfiguration)
-> (CreateService -> SourceConfiguration -> CreateService)
-> Lens
     CreateService CreateService SourceConfiguration SourceConfiguration
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateService' {SourceConfiguration
sourceConfiguration :: SourceConfiguration
$sel:sourceConfiguration:CreateService' :: CreateService -> SourceConfiguration
sourceConfiguration} -> SourceConfiguration
sourceConfiguration) (\s :: CreateService
s@CreateService' {} SourceConfiguration
a -> CreateService
s {$sel:sourceConfiguration:CreateService' :: SourceConfiguration
sourceConfiguration = SourceConfiguration
a} :: CreateService)

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

instance Prelude.Hashable CreateService

instance Prelude.NFData CreateService

instance Core.ToHeaders CreateService where
  toHeaders :: CreateService -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateService -> 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
"AppRunner.CreateService" :: 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 CreateService where
  toJSON :: CreateService -> Value
toJSON CreateService' {Maybe [Tag]
Maybe Text
Maybe EncryptionConfiguration
Maybe HealthCheckConfiguration
Maybe InstanceConfiguration
Text
SourceConfiguration
sourceConfiguration :: SourceConfiguration
serviceName :: Text
instanceConfiguration :: Maybe InstanceConfiguration
tags :: Maybe [Tag]
healthCheckConfiguration :: Maybe HealthCheckConfiguration
encryptionConfiguration :: Maybe EncryptionConfiguration
autoScalingConfigurationArn :: Maybe Text
$sel:sourceConfiguration:CreateService' :: CreateService -> SourceConfiguration
$sel:serviceName:CreateService' :: CreateService -> Text
$sel:instanceConfiguration:CreateService' :: CreateService -> Maybe InstanceConfiguration
$sel:tags:CreateService' :: CreateService -> Maybe [Tag]
$sel:healthCheckConfiguration:CreateService' :: CreateService -> Maybe HealthCheckConfiguration
$sel:encryptionConfiguration:CreateService' :: CreateService -> Maybe EncryptionConfiguration
$sel:autoScalingConfigurationArn:CreateService' :: CreateService -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"AutoScalingConfigurationArn" 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
autoScalingConfigurationArn,
            (Text
"EncryptionConfiguration" Text -> EncryptionConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (EncryptionConfiguration -> Pair)
-> Maybe EncryptionConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EncryptionConfiguration
encryptionConfiguration,
            (Text
"HealthCheckConfiguration" Text -> HealthCheckConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HealthCheckConfiguration -> Pair)
-> Maybe HealthCheckConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HealthCheckConfiguration
healthCheckConfiguration,
            (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,
            (Text
"InstanceConfiguration" Text -> InstanceConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (InstanceConfiguration -> Pair)
-> Maybe InstanceConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe InstanceConfiguration
instanceConfiguration,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ServiceName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serviceName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"SourceConfiguration" Text -> SourceConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SourceConfiguration
sourceConfiguration)
          ]
      )

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

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

-- | /See:/ 'newCreateServiceResponse' smart constructor.
data CreateServiceResponse = CreateServiceResponse'
  { -- | The response's http status code.
    CreateServiceResponse -> Int
httpStatus :: Prelude.Int,
    -- | A description of the App Runner service that\'s created by this request.
    CreateServiceResponse -> Service
service :: Service,
    -- | The unique ID of the asynchronous operation that this request started.
    -- You can use it combined with the
    -- <https://docs.aws.amazon.com/apprunner/latest/api/API_ListOperations.html ListOperations>
    -- call to track the operation\'s progress.
    CreateServiceResponse -> Text
operationId :: Prelude.Text
  }
  deriving (CreateServiceResponse -> CreateServiceResponse -> Bool
(CreateServiceResponse -> CreateServiceResponse -> Bool)
-> (CreateServiceResponse -> CreateServiceResponse -> Bool)
-> Eq CreateServiceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateServiceResponse -> CreateServiceResponse -> Bool
$c/= :: CreateServiceResponse -> CreateServiceResponse -> Bool
== :: CreateServiceResponse -> CreateServiceResponse -> Bool
$c== :: CreateServiceResponse -> CreateServiceResponse -> Bool
Prelude.Eq, Int -> CreateServiceResponse -> ShowS
[CreateServiceResponse] -> ShowS
CreateServiceResponse -> String
(Int -> CreateServiceResponse -> ShowS)
-> (CreateServiceResponse -> String)
-> ([CreateServiceResponse] -> ShowS)
-> Show CreateServiceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateServiceResponse] -> ShowS
$cshowList :: [CreateServiceResponse] -> ShowS
show :: CreateServiceResponse -> String
$cshow :: CreateServiceResponse -> String
showsPrec :: Int -> CreateServiceResponse -> ShowS
$cshowsPrec :: Int -> CreateServiceResponse -> ShowS
Prelude.Show, (forall x. CreateServiceResponse -> Rep CreateServiceResponse x)
-> (forall x. Rep CreateServiceResponse x -> CreateServiceResponse)
-> Generic CreateServiceResponse
forall x. Rep CreateServiceResponse x -> CreateServiceResponse
forall x. CreateServiceResponse -> Rep CreateServiceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateServiceResponse x -> CreateServiceResponse
$cfrom :: forall x. CreateServiceResponse -> Rep CreateServiceResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateServiceResponse' 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', 'createServiceResponse_httpStatus' - The response's http status code.
--
-- 'service', 'createServiceResponse_service' - A description of the App Runner service that\'s created by this request.
--
-- 'operationId', 'createServiceResponse_operationId' - The unique ID of the asynchronous operation that this request started.
-- You can use it combined with the
-- <https://docs.aws.amazon.com/apprunner/latest/api/API_ListOperations.html ListOperations>
-- call to track the operation\'s progress.
newCreateServiceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'service'
  Service ->
  -- | 'operationId'
  Prelude.Text ->
  CreateServiceResponse
newCreateServiceResponse :: Int -> Service -> Text -> CreateServiceResponse
newCreateServiceResponse
  Int
pHttpStatus_
  Service
pService_
  Text
pOperationId_ =
    CreateServiceResponse' :: Int -> Service -> Text -> CreateServiceResponse
CreateServiceResponse'
      { $sel:httpStatus:CreateServiceResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:service:CreateServiceResponse' :: Service
service = Service
pService_,
        $sel:operationId:CreateServiceResponse' :: Text
operationId = Text
pOperationId_
      }

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

-- | A description of the App Runner service that\'s created by this request.
createServiceResponse_service :: Lens.Lens' CreateServiceResponse Service
createServiceResponse_service :: (Service -> f Service)
-> CreateServiceResponse -> f CreateServiceResponse
createServiceResponse_service = (CreateServiceResponse -> Service)
-> (CreateServiceResponse -> Service -> CreateServiceResponse)
-> Lens CreateServiceResponse CreateServiceResponse Service Service
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceResponse' {Service
service :: Service
$sel:service:CreateServiceResponse' :: CreateServiceResponse -> Service
service} -> Service
service) (\s :: CreateServiceResponse
s@CreateServiceResponse' {} Service
a -> CreateServiceResponse
s {$sel:service:CreateServiceResponse' :: Service
service = Service
a} :: CreateServiceResponse)

-- | The unique ID of the asynchronous operation that this request started.
-- You can use it combined with the
-- <https://docs.aws.amazon.com/apprunner/latest/api/API_ListOperations.html ListOperations>
-- call to track the operation\'s progress.
createServiceResponse_operationId :: Lens.Lens' CreateServiceResponse Prelude.Text
createServiceResponse_operationId :: (Text -> f Text)
-> CreateServiceResponse -> f CreateServiceResponse
createServiceResponse_operationId = (CreateServiceResponse -> Text)
-> (CreateServiceResponse -> Text -> CreateServiceResponse)
-> Lens CreateServiceResponse CreateServiceResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateServiceResponse' {Text
operationId :: Text
$sel:operationId:CreateServiceResponse' :: CreateServiceResponse -> Text
operationId} -> Text
operationId) (\s :: CreateServiceResponse
s@CreateServiceResponse' {} Text
a -> CreateServiceResponse
s {$sel:operationId:CreateServiceResponse' :: Text
operationId = Text
a} :: CreateServiceResponse)

instance Prelude.NFData CreateServiceResponse