{-# 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.Lightsail.CreateContainerService
-- 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 Amazon Lightsail container service.
--
-- A Lightsail container service is a compute resource to which you can
-- deploy containers. For more information, see
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-container-services Container services in Amazon Lightsail>
-- in the /Lightsail Dev Guide/.
module Amazonka.Lightsail.CreateContainerService
  ( -- * Creating a Request
    CreateContainerService (..),
    newCreateContainerService,

    -- * Request Lenses
    createContainerService_publicDomainNames,
    createContainerService_tags,
    createContainerService_deployment,
    createContainerService_serviceName,
    createContainerService_power,
    createContainerService_scale,

    -- * Destructuring the Response
    CreateContainerServiceResponse (..),
    newCreateContainerServiceResponse,

    -- * Response Lenses
    createContainerServiceResponse_containerService,
    createContainerServiceResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateContainerService' smart constructor.
data CreateContainerService = CreateContainerService'
  { -- | The public domain names to use with the container service, such as
    -- @example.com@ and @www.example.com@.
    --
    -- You can specify up to four public domain names for a container service.
    -- The domain names that you specify are used when you create a deployment
    -- with a container configured as the public endpoint of your container
    -- service.
    --
    -- If you don\'t specify public domain names, then you can use the default
    -- domain of the container service.
    --
    -- You must create and validate an SSL\/TLS certificate before you can use
    -- public domain names with your container service. Use the
    -- @CreateCertificate@ action to create a certificate for the public domain
    -- names you want to use with your container service.
    --
    -- You can specify public domain names using a string to array map as shown
    -- in the example later on this page.
    CreateContainerService -> Maybe (HashMap Text [Text])
publicDomainNames :: Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]),
    -- | The tag keys and optional values to add to the certificate during
    -- create.
    --
    -- Use the @TagResource@ action to tag a resource after it\'s created.
    --
    -- For more information about tags in Lightsail, see the
    -- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-tags Amazon Lightsail Developer Guide>.
    CreateContainerService -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | An object that describes a deployment for the container service.
    --
    -- A deployment specifies the containers that will be launched on the
    -- container service and their settings, such as the ports to open, the
    -- environment variables to apply, and the launch command to run. It also
    -- specifies the container that will serve as the public endpoint of the
    -- deployment and its settings, such as the HTTP or HTTPS port to use, and
    -- the health check configuration.
    CreateContainerService -> Maybe ContainerServiceDeploymentRequest
deployment :: Prelude.Maybe ContainerServiceDeploymentRequest,
    -- | The name for the container service.
    --
    -- The name that you specify for your container service will make up part
    -- of its default domain. The default domain of a container service is
    -- typically
    -- @https:\/\/\<ServiceName>.\<RandomGUID>.\<AWSRegion>.cs.amazonlightsail.com@.
    -- If the name of your container service is @container-service-1@, and
    -- it\'s located in the US East (Ohio) AWS region (@us-east-2@), then the
    -- domain for your container service will be like the following example:
    -- @https:\/\/container-service-1.ur4EXAMPLE2uq.us-east-2.cs.amazonlightsail.com@
    --
    -- The following are the requirements for container service names:
    --
    -- -   Must be unique within each AWS Region in your Lightsail account.
    --
    -- -   Must contain 1 to 63 characters.
    --
    -- -   Must contain only alphanumeric characters and hyphens.
    --
    -- -   A hyphen (-) can separate words but cannot be at the start or end of
    --     the name.
    CreateContainerService -> Text
serviceName :: Prelude.Text,
    -- | The power specification for the container service.
    --
    -- The power specifies the amount of memory, vCPUs, and base monthly cost
    -- of each node of the container service. The @power@ and @scale@ of a
    -- container service makes up its configured capacity. To determine the
    -- monthly price of your container service, multiply the base price of the
    -- @power@ with the @scale@ (the number of nodes) of the service.
    --
    -- Use the @GetContainerServicePowers@ action to get a list of power
    -- options that you can specify using this parameter, and their base
    -- monthly cost.
    CreateContainerService -> ContainerServicePowerName
power :: ContainerServicePowerName,
    -- | The scale specification for the container service.
    --
    -- The scale specifies the allocated compute nodes of the container
    -- service. The @power@ and @scale@ of a container service makes up its
    -- configured capacity. To determine the monthly price of your container
    -- service, multiply the base price of the @power@ with the @scale@ (the
    -- number of nodes) of the service.
    CreateContainerService -> Natural
scale :: Prelude.Natural
  }
  deriving (CreateContainerService -> CreateContainerService -> Bool
(CreateContainerService -> CreateContainerService -> Bool)
-> (CreateContainerService -> CreateContainerService -> Bool)
-> Eq CreateContainerService
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateContainerService -> CreateContainerService -> Bool
$c/= :: CreateContainerService -> CreateContainerService -> Bool
== :: CreateContainerService -> CreateContainerService -> Bool
$c== :: CreateContainerService -> CreateContainerService -> Bool
Prelude.Eq, ReadPrec [CreateContainerService]
ReadPrec CreateContainerService
Int -> ReadS CreateContainerService
ReadS [CreateContainerService]
(Int -> ReadS CreateContainerService)
-> ReadS [CreateContainerService]
-> ReadPrec CreateContainerService
-> ReadPrec [CreateContainerService]
-> Read CreateContainerService
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateContainerService]
$creadListPrec :: ReadPrec [CreateContainerService]
readPrec :: ReadPrec CreateContainerService
$creadPrec :: ReadPrec CreateContainerService
readList :: ReadS [CreateContainerService]
$creadList :: ReadS [CreateContainerService]
readsPrec :: Int -> ReadS CreateContainerService
$creadsPrec :: Int -> ReadS CreateContainerService
Prelude.Read, Int -> CreateContainerService -> ShowS
[CreateContainerService] -> ShowS
CreateContainerService -> String
(Int -> CreateContainerService -> ShowS)
-> (CreateContainerService -> String)
-> ([CreateContainerService] -> ShowS)
-> Show CreateContainerService
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateContainerService] -> ShowS
$cshowList :: [CreateContainerService] -> ShowS
show :: CreateContainerService -> String
$cshow :: CreateContainerService -> String
showsPrec :: Int -> CreateContainerService -> ShowS
$cshowsPrec :: Int -> CreateContainerService -> ShowS
Prelude.Show, (forall x. CreateContainerService -> Rep CreateContainerService x)
-> (forall x.
    Rep CreateContainerService x -> CreateContainerService)
-> Generic CreateContainerService
forall x. Rep CreateContainerService x -> CreateContainerService
forall x. CreateContainerService -> Rep CreateContainerService x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateContainerService x -> CreateContainerService
$cfrom :: forall x. CreateContainerService -> Rep CreateContainerService x
Prelude.Generic)

-- |
-- Create a value of 'CreateContainerService' 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:
--
-- 'publicDomainNames', 'createContainerService_publicDomainNames' - The public domain names to use with the container service, such as
-- @example.com@ and @www.example.com@.
--
-- You can specify up to four public domain names for a container service.
-- The domain names that you specify are used when you create a deployment
-- with a container configured as the public endpoint of your container
-- service.
--
-- If you don\'t specify public domain names, then you can use the default
-- domain of the container service.
--
-- You must create and validate an SSL\/TLS certificate before you can use
-- public domain names with your container service. Use the
-- @CreateCertificate@ action to create a certificate for the public domain
-- names you want to use with your container service.
--
-- You can specify public domain names using a string to array map as shown
-- in the example later on this page.
--
-- 'tags', 'createContainerService_tags' - The tag keys and optional values to add to the certificate during
-- create.
--
-- Use the @TagResource@ action to tag a resource after it\'s created.
--
-- For more information about tags in Lightsail, see the
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-tags Amazon Lightsail Developer Guide>.
--
-- 'deployment', 'createContainerService_deployment' - An object that describes a deployment for the container service.
--
-- A deployment specifies the containers that will be launched on the
-- container service and their settings, such as the ports to open, the
-- environment variables to apply, and the launch command to run. It also
-- specifies the container that will serve as the public endpoint of the
-- deployment and its settings, such as the HTTP or HTTPS port to use, and
-- the health check configuration.
--
-- 'serviceName', 'createContainerService_serviceName' - The name for the container service.
--
-- The name that you specify for your container service will make up part
-- of its default domain. The default domain of a container service is
-- typically
-- @https:\/\/\<ServiceName>.\<RandomGUID>.\<AWSRegion>.cs.amazonlightsail.com@.
-- If the name of your container service is @container-service-1@, and
-- it\'s located in the US East (Ohio) AWS region (@us-east-2@), then the
-- domain for your container service will be like the following example:
-- @https:\/\/container-service-1.ur4EXAMPLE2uq.us-east-2.cs.amazonlightsail.com@
--
-- The following are the requirements for container service names:
--
-- -   Must be unique within each AWS Region in your Lightsail account.
--
-- -   Must contain 1 to 63 characters.
--
-- -   Must contain only alphanumeric characters and hyphens.
--
-- -   A hyphen (-) can separate words but cannot be at the start or end of
--     the name.
--
-- 'power', 'createContainerService_power' - The power specification for the container service.
--
-- The power specifies the amount of memory, vCPUs, and base monthly cost
-- of each node of the container service. The @power@ and @scale@ of a
-- container service makes up its configured capacity. To determine the
-- monthly price of your container service, multiply the base price of the
-- @power@ with the @scale@ (the number of nodes) of the service.
--
-- Use the @GetContainerServicePowers@ action to get a list of power
-- options that you can specify using this parameter, and their base
-- monthly cost.
--
-- 'scale', 'createContainerService_scale' - The scale specification for the container service.
--
-- The scale specifies the allocated compute nodes of the container
-- service. The @power@ and @scale@ of a container service makes up its
-- configured capacity. To determine the monthly price of your container
-- service, multiply the base price of the @power@ with the @scale@ (the
-- number of nodes) of the service.
newCreateContainerService ::
  -- | 'serviceName'
  Prelude.Text ->
  -- | 'power'
  ContainerServicePowerName ->
  -- | 'scale'
  Prelude.Natural ->
  CreateContainerService
newCreateContainerService :: Text
-> ContainerServicePowerName -> Natural -> CreateContainerService
newCreateContainerService
  Text
pServiceName_
  ContainerServicePowerName
pPower_
  Natural
pScale_ =
    CreateContainerService' :: Maybe (HashMap Text [Text])
-> Maybe [Tag]
-> Maybe ContainerServiceDeploymentRequest
-> Text
-> ContainerServicePowerName
-> Natural
-> CreateContainerService
CreateContainerService'
      { $sel:publicDomainNames:CreateContainerService' :: Maybe (HashMap Text [Text])
publicDomainNames =
          Maybe (HashMap Text [Text])
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateContainerService' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:deployment:CreateContainerService' :: Maybe ContainerServiceDeploymentRequest
deployment = Maybe ContainerServiceDeploymentRequest
forall a. Maybe a
Prelude.Nothing,
        $sel:serviceName:CreateContainerService' :: Text
serviceName = Text
pServiceName_,
        $sel:power:CreateContainerService' :: ContainerServicePowerName
power = ContainerServicePowerName
pPower_,
        $sel:scale:CreateContainerService' :: Natural
scale = Natural
pScale_
      }

-- | The public domain names to use with the container service, such as
-- @example.com@ and @www.example.com@.
--
-- You can specify up to four public domain names for a container service.
-- The domain names that you specify are used when you create a deployment
-- with a container configured as the public endpoint of your container
-- service.
--
-- If you don\'t specify public domain names, then you can use the default
-- domain of the container service.
--
-- You must create and validate an SSL\/TLS certificate before you can use
-- public domain names with your container service. Use the
-- @CreateCertificate@ action to create a certificate for the public domain
-- names you want to use with your container service.
--
-- You can specify public domain names using a string to array map as shown
-- in the example later on this page.
createContainerService_publicDomainNames :: Lens.Lens' CreateContainerService (Prelude.Maybe (Prelude.HashMap Prelude.Text [Prelude.Text]))
createContainerService_publicDomainNames :: (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> CreateContainerService -> f CreateContainerService
createContainerService_publicDomainNames = (CreateContainerService -> Maybe (HashMap Text [Text]))
-> (CreateContainerService
    -> Maybe (HashMap Text [Text]) -> CreateContainerService)
-> Lens
     CreateContainerService
     CreateContainerService
     (Maybe (HashMap Text [Text]))
     (Maybe (HashMap Text [Text]))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContainerService' {Maybe (HashMap Text [Text])
publicDomainNames :: Maybe (HashMap Text [Text])
$sel:publicDomainNames:CreateContainerService' :: CreateContainerService -> Maybe (HashMap Text [Text])
publicDomainNames} -> Maybe (HashMap Text [Text])
publicDomainNames) (\s :: CreateContainerService
s@CreateContainerService' {} Maybe (HashMap Text [Text])
a -> CreateContainerService
s {$sel:publicDomainNames:CreateContainerService' :: Maybe (HashMap Text [Text])
publicDomainNames = Maybe (HashMap Text [Text])
a} :: CreateContainerService) ((Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
 -> CreateContainerService -> f CreateContainerService)
-> ((Maybe (HashMap Text [Text])
     -> f (Maybe (HashMap Text [Text])))
    -> Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> (Maybe (HashMap Text [Text]) -> f (Maybe (HashMap Text [Text])))
-> CreateContainerService
-> f CreateContainerService
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text [Text])
  (HashMap Text [Text])
  (HashMap Text [Text])
  (HashMap Text [Text])
-> Iso
     (Maybe (HashMap Text [Text]))
     (Maybe (HashMap Text [Text]))
     (Maybe (HashMap Text [Text]))
     (Maybe (HashMap Text [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
  (HashMap Text [Text])
  (HashMap Text [Text])
  (HashMap Text [Text])
  (HashMap Text [Text])
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The tag keys and optional values to add to the certificate during
-- create.
--
-- Use the @TagResource@ action to tag a resource after it\'s created.
--
-- For more information about tags in Lightsail, see the
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-tags Amazon Lightsail Developer Guide>.
createContainerService_tags :: Lens.Lens' CreateContainerService (Prelude.Maybe [Tag])
createContainerService_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateContainerService -> f CreateContainerService
createContainerService_tags = (CreateContainerService -> Maybe [Tag])
-> (CreateContainerService
    -> Maybe [Tag] -> CreateContainerService)
-> Lens
     CreateContainerService
     CreateContainerService
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContainerService' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateContainerService' :: CreateContainerService -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateContainerService
s@CreateContainerService' {} Maybe [Tag]
a -> CreateContainerService
s {$sel:tags:CreateContainerService' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateContainerService) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateContainerService -> f CreateContainerService)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateContainerService
-> f CreateContainerService
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 describes a deployment for the container service.
--
-- A deployment specifies the containers that will be launched on the
-- container service and their settings, such as the ports to open, the
-- environment variables to apply, and the launch command to run. It also
-- specifies the container that will serve as the public endpoint of the
-- deployment and its settings, such as the HTTP or HTTPS port to use, and
-- the health check configuration.
createContainerService_deployment :: Lens.Lens' CreateContainerService (Prelude.Maybe ContainerServiceDeploymentRequest)
createContainerService_deployment :: (Maybe ContainerServiceDeploymentRequest
 -> f (Maybe ContainerServiceDeploymentRequest))
-> CreateContainerService -> f CreateContainerService
createContainerService_deployment = (CreateContainerService -> Maybe ContainerServiceDeploymentRequest)
-> (CreateContainerService
    -> Maybe ContainerServiceDeploymentRequest
    -> CreateContainerService)
-> Lens
     CreateContainerService
     CreateContainerService
     (Maybe ContainerServiceDeploymentRequest)
     (Maybe ContainerServiceDeploymentRequest)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContainerService' {Maybe ContainerServiceDeploymentRequest
deployment :: Maybe ContainerServiceDeploymentRequest
$sel:deployment:CreateContainerService' :: CreateContainerService -> Maybe ContainerServiceDeploymentRequest
deployment} -> Maybe ContainerServiceDeploymentRequest
deployment) (\s :: CreateContainerService
s@CreateContainerService' {} Maybe ContainerServiceDeploymentRequest
a -> CreateContainerService
s {$sel:deployment:CreateContainerService' :: Maybe ContainerServiceDeploymentRequest
deployment = Maybe ContainerServiceDeploymentRequest
a} :: CreateContainerService)

-- | The name for the container service.
--
-- The name that you specify for your container service will make up part
-- of its default domain. The default domain of a container service is
-- typically
-- @https:\/\/\<ServiceName>.\<RandomGUID>.\<AWSRegion>.cs.amazonlightsail.com@.
-- If the name of your container service is @container-service-1@, and
-- it\'s located in the US East (Ohio) AWS region (@us-east-2@), then the
-- domain for your container service will be like the following example:
-- @https:\/\/container-service-1.ur4EXAMPLE2uq.us-east-2.cs.amazonlightsail.com@
--
-- The following are the requirements for container service names:
--
-- -   Must be unique within each AWS Region in your Lightsail account.
--
-- -   Must contain 1 to 63 characters.
--
-- -   Must contain only alphanumeric characters and hyphens.
--
-- -   A hyphen (-) can separate words but cannot be at the start or end of
--     the name.
createContainerService_serviceName :: Lens.Lens' CreateContainerService Prelude.Text
createContainerService_serviceName :: (Text -> f Text)
-> CreateContainerService -> f CreateContainerService
createContainerService_serviceName = (CreateContainerService -> Text)
-> (CreateContainerService -> Text -> CreateContainerService)
-> Lens CreateContainerService CreateContainerService Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContainerService' {Text
serviceName :: Text
$sel:serviceName:CreateContainerService' :: CreateContainerService -> Text
serviceName} -> Text
serviceName) (\s :: CreateContainerService
s@CreateContainerService' {} Text
a -> CreateContainerService
s {$sel:serviceName:CreateContainerService' :: Text
serviceName = Text
a} :: CreateContainerService)

-- | The power specification for the container service.
--
-- The power specifies the amount of memory, vCPUs, and base monthly cost
-- of each node of the container service. The @power@ and @scale@ of a
-- container service makes up its configured capacity. To determine the
-- monthly price of your container service, multiply the base price of the
-- @power@ with the @scale@ (the number of nodes) of the service.
--
-- Use the @GetContainerServicePowers@ action to get a list of power
-- options that you can specify using this parameter, and their base
-- monthly cost.
createContainerService_power :: Lens.Lens' CreateContainerService ContainerServicePowerName
createContainerService_power :: (ContainerServicePowerName -> f ContainerServicePowerName)
-> CreateContainerService -> f CreateContainerService
createContainerService_power = (CreateContainerService -> ContainerServicePowerName)
-> (CreateContainerService
    -> ContainerServicePowerName -> CreateContainerService)
-> Lens
     CreateContainerService
     CreateContainerService
     ContainerServicePowerName
     ContainerServicePowerName
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContainerService' {ContainerServicePowerName
power :: ContainerServicePowerName
$sel:power:CreateContainerService' :: CreateContainerService -> ContainerServicePowerName
power} -> ContainerServicePowerName
power) (\s :: CreateContainerService
s@CreateContainerService' {} ContainerServicePowerName
a -> CreateContainerService
s {$sel:power:CreateContainerService' :: ContainerServicePowerName
power = ContainerServicePowerName
a} :: CreateContainerService)

-- | The scale specification for the container service.
--
-- The scale specifies the allocated compute nodes of the container
-- service. The @power@ and @scale@ of a container service makes up its
-- configured capacity. To determine the monthly price of your container
-- service, multiply the base price of the @power@ with the @scale@ (the
-- number of nodes) of the service.
createContainerService_scale :: Lens.Lens' CreateContainerService Prelude.Natural
createContainerService_scale :: (Natural -> f Natural)
-> CreateContainerService -> f CreateContainerService
createContainerService_scale = (CreateContainerService -> Natural)
-> (CreateContainerService -> Natural -> CreateContainerService)
-> Lens
     CreateContainerService CreateContainerService Natural Natural
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContainerService' {Natural
scale :: Natural
$sel:scale:CreateContainerService' :: CreateContainerService -> Natural
scale} -> Natural
scale) (\s :: CreateContainerService
s@CreateContainerService' {} Natural
a -> CreateContainerService
s {$sel:scale:CreateContainerService' :: Natural
scale = Natural
a} :: CreateContainerService)

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

instance Prelude.Hashable CreateContainerService

instance Prelude.NFData CreateContainerService

instance Core.ToHeaders CreateContainerService where
  toHeaders :: CreateContainerService -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateContainerService -> 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
"Lightsail_20161128.CreateContainerService" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateContainerService where
  toJSON :: CreateContainerService -> Value
toJSON CreateContainerService' {Natural
Maybe [Tag]
Maybe (HashMap Text [Text])
Maybe ContainerServiceDeploymentRequest
Text
ContainerServicePowerName
scale :: Natural
power :: ContainerServicePowerName
serviceName :: Text
deployment :: Maybe ContainerServiceDeploymentRequest
tags :: Maybe [Tag]
publicDomainNames :: Maybe (HashMap Text [Text])
$sel:scale:CreateContainerService' :: CreateContainerService -> Natural
$sel:power:CreateContainerService' :: CreateContainerService -> ContainerServicePowerName
$sel:serviceName:CreateContainerService' :: CreateContainerService -> Text
$sel:deployment:CreateContainerService' :: CreateContainerService -> Maybe ContainerServiceDeploymentRequest
$sel:tags:CreateContainerService' :: CreateContainerService -> Maybe [Tag]
$sel:publicDomainNames:CreateContainerService' :: CreateContainerService -> Maybe (HashMap Text [Text])
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"publicDomainNames" Text -> HashMap Text [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HashMap Text [Text] -> Pair)
-> Maybe (HashMap Text [Text]) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text [Text])
publicDomainNames,
            (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
"deployment" Text -> ContainerServiceDeploymentRequest -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (ContainerServiceDeploymentRequest -> Pair)
-> Maybe ContainerServiceDeploymentRequest -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ContainerServiceDeploymentRequest
deployment,
            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
"power" Text -> ContainerServicePowerName -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= ContainerServicePowerName
power),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"scale" Text -> Natural -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Natural
scale)
          ]
      )

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

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

-- | /See:/ 'newCreateContainerServiceResponse' smart constructor.
data CreateContainerServiceResponse = CreateContainerServiceResponse'
  { -- | An object that describes a container service.
    CreateContainerServiceResponse -> Maybe ContainerService
containerService :: Prelude.Maybe ContainerService,
    -- | The response's http status code.
    CreateContainerServiceResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateContainerServiceResponse
-> CreateContainerServiceResponse -> Bool
(CreateContainerServiceResponse
 -> CreateContainerServiceResponse -> Bool)
-> (CreateContainerServiceResponse
    -> CreateContainerServiceResponse -> Bool)
-> Eq CreateContainerServiceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateContainerServiceResponse
-> CreateContainerServiceResponse -> Bool
$c/= :: CreateContainerServiceResponse
-> CreateContainerServiceResponse -> Bool
== :: CreateContainerServiceResponse
-> CreateContainerServiceResponse -> Bool
$c== :: CreateContainerServiceResponse
-> CreateContainerServiceResponse -> Bool
Prelude.Eq, ReadPrec [CreateContainerServiceResponse]
ReadPrec CreateContainerServiceResponse
Int -> ReadS CreateContainerServiceResponse
ReadS [CreateContainerServiceResponse]
(Int -> ReadS CreateContainerServiceResponse)
-> ReadS [CreateContainerServiceResponse]
-> ReadPrec CreateContainerServiceResponse
-> ReadPrec [CreateContainerServiceResponse]
-> Read CreateContainerServiceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateContainerServiceResponse]
$creadListPrec :: ReadPrec [CreateContainerServiceResponse]
readPrec :: ReadPrec CreateContainerServiceResponse
$creadPrec :: ReadPrec CreateContainerServiceResponse
readList :: ReadS [CreateContainerServiceResponse]
$creadList :: ReadS [CreateContainerServiceResponse]
readsPrec :: Int -> ReadS CreateContainerServiceResponse
$creadsPrec :: Int -> ReadS CreateContainerServiceResponse
Prelude.Read, Int -> CreateContainerServiceResponse -> ShowS
[CreateContainerServiceResponse] -> ShowS
CreateContainerServiceResponse -> String
(Int -> CreateContainerServiceResponse -> ShowS)
-> (CreateContainerServiceResponse -> String)
-> ([CreateContainerServiceResponse] -> ShowS)
-> Show CreateContainerServiceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateContainerServiceResponse] -> ShowS
$cshowList :: [CreateContainerServiceResponse] -> ShowS
show :: CreateContainerServiceResponse -> String
$cshow :: CreateContainerServiceResponse -> String
showsPrec :: Int -> CreateContainerServiceResponse -> ShowS
$cshowsPrec :: Int -> CreateContainerServiceResponse -> ShowS
Prelude.Show, (forall x.
 CreateContainerServiceResponse
 -> Rep CreateContainerServiceResponse x)
-> (forall x.
    Rep CreateContainerServiceResponse x
    -> CreateContainerServiceResponse)
-> Generic CreateContainerServiceResponse
forall x.
Rep CreateContainerServiceResponse x
-> CreateContainerServiceResponse
forall x.
CreateContainerServiceResponse
-> Rep CreateContainerServiceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateContainerServiceResponse x
-> CreateContainerServiceResponse
$cfrom :: forall x.
CreateContainerServiceResponse
-> Rep CreateContainerServiceResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateContainerServiceResponse' 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:
--
-- 'containerService', 'createContainerServiceResponse_containerService' - An object that describes a container service.
--
-- 'httpStatus', 'createContainerServiceResponse_httpStatus' - The response's http status code.
newCreateContainerServiceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateContainerServiceResponse
newCreateContainerServiceResponse :: Int -> CreateContainerServiceResponse
newCreateContainerServiceResponse Int
pHttpStatus_ =
  CreateContainerServiceResponse' :: Maybe ContainerService -> Int -> CreateContainerServiceResponse
CreateContainerServiceResponse'
    { $sel:containerService:CreateContainerServiceResponse' :: Maybe ContainerService
containerService =
        Maybe ContainerService
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateContainerServiceResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An object that describes a container service.
createContainerServiceResponse_containerService :: Lens.Lens' CreateContainerServiceResponse (Prelude.Maybe ContainerService)
createContainerServiceResponse_containerService :: (Maybe ContainerService -> f (Maybe ContainerService))
-> CreateContainerServiceResponse
-> f CreateContainerServiceResponse
createContainerServiceResponse_containerService = (CreateContainerServiceResponse -> Maybe ContainerService)
-> (CreateContainerServiceResponse
    -> Maybe ContainerService -> CreateContainerServiceResponse)
-> Lens
     CreateContainerServiceResponse
     CreateContainerServiceResponse
     (Maybe ContainerService)
     (Maybe ContainerService)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateContainerServiceResponse' {Maybe ContainerService
containerService :: Maybe ContainerService
$sel:containerService:CreateContainerServiceResponse' :: CreateContainerServiceResponse -> Maybe ContainerService
containerService} -> Maybe ContainerService
containerService) (\s :: CreateContainerServiceResponse
s@CreateContainerServiceResponse' {} Maybe ContainerService
a -> CreateContainerServiceResponse
s {$sel:containerService:CreateContainerServiceResponse' :: Maybe ContainerService
containerService = Maybe ContainerService
a} :: CreateContainerServiceResponse)

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

instance
  Prelude.NFData
    CreateContainerServiceResponse