{-# 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.CreateInstances
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates one or more Amazon Lightsail instances.
--
-- The @create instances@ operation supports tag-based access control via
-- request tags. For more information, see the
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-controlling-access-using-tags Lightsail Developer Guide>.
module Amazonka.Lightsail.CreateInstances
  ( -- * Creating a Request
    CreateInstances (..),
    newCreateInstances,

    -- * Request Lenses
    createInstances_addOns,
    createInstances_customImageName,
    createInstances_ipAddressType,
    createInstances_keyPairName,
    createInstances_tags,
    createInstances_userData,
    createInstances_instanceNames,
    createInstances_availabilityZone,
    createInstances_blueprintId,
    createInstances_bundleId,

    -- * Destructuring the Response
    CreateInstancesResponse (..),
    newCreateInstancesResponse,

    -- * Response Lenses
    createInstancesResponse_operations,
    createInstancesResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateInstances' smart constructor.
data CreateInstances = CreateInstances'
  { -- | An array of objects representing the add-ons to enable for the new
    -- instance.
    CreateInstances -> Maybe [AddOnRequest]
addOns :: Prelude.Maybe [AddOnRequest],
    -- | (Deprecated) The name for your custom image.
    --
    -- In releases prior to June 12, 2017, this parameter was ignored by the
    -- API. It is now deprecated.
    CreateInstances -> Maybe Text
customImageName :: Prelude.Maybe Prelude.Text,
    -- | The IP address type for the instance.
    --
    -- The possible values are @ipv4@ for IPv4 only, and @dualstack@ for IPv4
    -- and IPv6.
    --
    -- The default value is @dualstack@.
    CreateInstances -> Maybe IpAddressType
ipAddressType :: Prelude.Maybe IpAddressType,
    -- | The name of your key pair.
    CreateInstances -> Maybe Text
keyPairName :: Prelude.Maybe Prelude.Text,
    -- | The tag keys and optional values to add to the resource during create.
    --
    -- Use the @TagResource@ action to tag a resource after it\'s created.
    CreateInstances -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | A launch script you can create that configures a server with additional
    -- user data. For example, you might want to run @apt-get -y update@.
    --
    -- Depending on the machine image you choose, the command to get software
    -- on your instance varies. Amazon Linux and CentOS use @yum@, Debian and
    -- Ubuntu use @apt-get@, and FreeBSD uses @pkg@. For a complete list, see
    -- the
    -- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/compare-options-choose-lightsail-instance-image Amazon Lightsail Developer Guide>.
    CreateInstances -> Maybe Text
userData :: Prelude.Maybe Prelude.Text,
    -- | The names to use for your new Lightsail instances. Separate multiple
    -- values using quotation marks and commas, for example:
    -- @[\"MyFirstInstance\",\"MySecondInstance\"]@
    CreateInstances -> [Text]
instanceNames :: [Prelude.Text],
    -- | The Availability Zone in which to create your instance. Use the
    -- following format: @us-east-2a@ (case sensitive). You can get a list of
    -- Availability Zones by using the
    -- <http://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetRegions.html get regions>
    -- operation. Be sure to add the @include Availability Zones@ parameter to
    -- your request.
    CreateInstances -> Text
availabilityZone :: Prelude.Text,
    -- | The ID for a virtual private server image (e.g., @app_wordpress_4_4@ or
    -- @app_lamp_7_0@). Use the @get blueprints@ operation to return a list of
    -- available images (or /blueprints/).
    --
    -- Use active blueprints when creating new instances. Inactive blueprints
    -- are listed to support customers with existing instances and are not
    -- necessarily available to create new instances. Blueprints are marked
    -- inactive when they become outdated due to operating system updates or
    -- new application releases.
    CreateInstances -> Text
blueprintId :: Prelude.Text,
    -- | The bundle of specification information for your virtual private server
    -- (or /instance/), including the pricing plan (e.g., @micro_1_0@).
    CreateInstances -> Text
bundleId :: Prelude.Text
  }
  deriving (CreateInstances -> CreateInstances -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateInstances -> CreateInstances -> Bool
$c/= :: CreateInstances -> CreateInstances -> Bool
== :: CreateInstances -> CreateInstances -> Bool
$c== :: CreateInstances -> CreateInstances -> Bool
Prelude.Eq, ReadPrec [CreateInstances]
ReadPrec CreateInstances
Int -> ReadS CreateInstances
ReadS [CreateInstances]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateInstances]
$creadListPrec :: ReadPrec [CreateInstances]
readPrec :: ReadPrec CreateInstances
$creadPrec :: ReadPrec CreateInstances
readList :: ReadS [CreateInstances]
$creadList :: ReadS [CreateInstances]
readsPrec :: Int -> ReadS CreateInstances
$creadsPrec :: Int -> ReadS CreateInstances
Prelude.Read, Int -> CreateInstances -> ShowS
[CreateInstances] -> ShowS
CreateInstances -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateInstances] -> ShowS
$cshowList :: [CreateInstances] -> ShowS
show :: CreateInstances -> String
$cshow :: CreateInstances -> String
showsPrec :: Int -> CreateInstances -> ShowS
$cshowsPrec :: Int -> CreateInstances -> ShowS
Prelude.Show, forall x. Rep CreateInstances x -> CreateInstances
forall x. CreateInstances -> Rep CreateInstances x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateInstances x -> CreateInstances
$cfrom :: forall x. CreateInstances -> Rep CreateInstances x
Prelude.Generic)

-- |
-- Create a value of 'CreateInstances' 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:
--
-- 'addOns', 'createInstances_addOns' - An array of objects representing the add-ons to enable for the new
-- instance.
--
-- 'customImageName', 'createInstances_customImageName' - (Deprecated) The name for your custom image.
--
-- In releases prior to June 12, 2017, this parameter was ignored by the
-- API. It is now deprecated.
--
-- 'ipAddressType', 'createInstances_ipAddressType' - The IP address type for the instance.
--
-- The possible values are @ipv4@ for IPv4 only, and @dualstack@ for IPv4
-- and IPv6.
--
-- The default value is @dualstack@.
--
-- 'keyPairName', 'createInstances_keyPairName' - The name of your key pair.
--
-- 'tags', 'createInstances_tags' - The tag keys and optional values to add to the resource during create.
--
-- Use the @TagResource@ action to tag a resource after it\'s created.
--
-- 'userData', 'createInstances_userData' - A launch script you can create that configures a server with additional
-- user data. For example, you might want to run @apt-get -y update@.
--
-- Depending on the machine image you choose, the command to get software
-- on your instance varies. Amazon Linux and CentOS use @yum@, Debian and
-- Ubuntu use @apt-get@, and FreeBSD uses @pkg@. For a complete list, see
-- the
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/compare-options-choose-lightsail-instance-image Amazon Lightsail Developer Guide>.
--
-- 'instanceNames', 'createInstances_instanceNames' - The names to use for your new Lightsail instances. Separate multiple
-- values using quotation marks and commas, for example:
-- @[\"MyFirstInstance\",\"MySecondInstance\"]@
--
-- 'availabilityZone', 'createInstances_availabilityZone' - The Availability Zone in which to create your instance. Use the
-- following format: @us-east-2a@ (case sensitive). You can get a list of
-- Availability Zones by using the
-- <http://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetRegions.html get regions>
-- operation. Be sure to add the @include Availability Zones@ parameter to
-- your request.
--
-- 'blueprintId', 'createInstances_blueprintId' - The ID for a virtual private server image (e.g., @app_wordpress_4_4@ or
-- @app_lamp_7_0@). Use the @get blueprints@ operation to return a list of
-- available images (or /blueprints/).
--
-- Use active blueprints when creating new instances. Inactive blueprints
-- are listed to support customers with existing instances and are not
-- necessarily available to create new instances. Blueprints are marked
-- inactive when they become outdated due to operating system updates or
-- new application releases.
--
-- 'bundleId', 'createInstances_bundleId' - The bundle of specification information for your virtual private server
-- (or /instance/), including the pricing plan (e.g., @micro_1_0@).
newCreateInstances ::
  -- | 'availabilityZone'
  Prelude.Text ->
  -- | 'blueprintId'
  Prelude.Text ->
  -- | 'bundleId'
  Prelude.Text ->
  CreateInstances
newCreateInstances :: Text -> Text -> Text -> CreateInstances
newCreateInstances
  Text
pAvailabilityZone_
  Text
pBlueprintId_
  Text
pBundleId_ =
    CreateInstances'
      { $sel:addOns:CreateInstances' :: Maybe [AddOnRequest]
addOns = forall a. Maybe a
Prelude.Nothing,
        $sel:customImageName:CreateInstances' :: Maybe Text
customImageName = forall a. Maybe a
Prelude.Nothing,
        $sel:ipAddressType:CreateInstances' :: Maybe IpAddressType
ipAddressType = forall a. Maybe a
Prelude.Nothing,
        $sel:keyPairName:CreateInstances' :: Maybe Text
keyPairName = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateInstances' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:userData:CreateInstances' :: Maybe Text
userData = forall a. Maybe a
Prelude.Nothing,
        $sel:instanceNames:CreateInstances' :: [Text]
instanceNames = forall a. Monoid a => a
Prelude.mempty,
        $sel:availabilityZone:CreateInstances' :: Text
availabilityZone = Text
pAvailabilityZone_,
        $sel:blueprintId:CreateInstances' :: Text
blueprintId = Text
pBlueprintId_,
        $sel:bundleId:CreateInstances' :: Text
bundleId = Text
pBundleId_
      }

-- | An array of objects representing the add-ons to enable for the new
-- instance.
createInstances_addOns :: Lens.Lens' CreateInstances (Prelude.Maybe [AddOnRequest])
createInstances_addOns :: Lens' CreateInstances (Maybe [AddOnRequest])
createInstances_addOns = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstances' {Maybe [AddOnRequest]
addOns :: Maybe [AddOnRequest]
$sel:addOns:CreateInstances' :: CreateInstances -> Maybe [AddOnRequest]
addOns} -> Maybe [AddOnRequest]
addOns) (\s :: CreateInstances
s@CreateInstances' {} Maybe [AddOnRequest]
a -> CreateInstances
s {$sel:addOns:CreateInstances' :: Maybe [AddOnRequest]
addOns = Maybe [AddOnRequest]
a} :: CreateInstances) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | (Deprecated) The name for your custom image.
--
-- In releases prior to June 12, 2017, this parameter was ignored by the
-- API. It is now deprecated.
createInstances_customImageName :: Lens.Lens' CreateInstances (Prelude.Maybe Prelude.Text)
createInstances_customImageName :: Lens' CreateInstances (Maybe Text)
createInstances_customImageName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstances' {Maybe Text
customImageName :: Maybe Text
$sel:customImageName:CreateInstances' :: CreateInstances -> Maybe Text
customImageName} -> Maybe Text
customImageName) (\s :: CreateInstances
s@CreateInstances' {} Maybe Text
a -> CreateInstances
s {$sel:customImageName:CreateInstances' :: Maybe Text
customImageName = Maybe Text
a} :: CreateInstances)

-- | The IP address type for the instance.
--
-- The possible values are @ipv4@ for IPv4 only, and @dualstack@ for IPv4
-- and IPv6.
--
-- The default value is @dualstack@.
createInstances_ipAddressType :: Lens.Lens' CreateInstances (Prelude.Maybe IpAddressType)
createInstances_ipAddressType :: Lens' CreateInstances (Maybe IpAddressType)
createInstances_ipAddressType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstances' {Maybe IpAddressType
ipAddressType :: Maybe IpAddressType
$sel:ipAddressType:CreateInstances' :: CreateInstances -> Maybe IpAddressType
ipAddressType} -> Maybe IpAddressType
ipAddressType) (\s :: CreateInstances
s@CreateInstances' {} Maybe IpAddressType
a -> CreateInstances
s {$sel:ipAddressType:CreateInstances' :: Maybe IpAddressType
ipAddressType = Maybe IpAddressType
a} :: CreateInstances)

-- | The name of your key pair.
createInstances_keyPairName :: Lens.Lens' CreateInstances (Prelude.Maybe Prelude.Text)
createInstances_keyPairName :: Lens' CreateInstances (Maybe Text)
createInstances_keyPairName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstances' {Maybe Text
keyPairName :: Maybe Text
$sel:keyPairName:CreateInstances' :: CreateInstances -> Maybe Text
keyPairName} -> Maybe Text
keyPairName) (\s :: CreateInstances
s@CreateInstances' {} Maybe Text
a -> CreateInstances
s {$sel:keyPairName:CreateInstances' :: Maybe Text
keyPairName = Maybe Text
a} :: CreateInstances)

-- | The tag keys and optional values to add to the resource during create.
--
-- Use the @TagResource@ action to tag a resource after it\'s created.
createInstances_tags :: Lens.Lens' CreateInstances (Prelude.Maybe [Tag])
createInstances_tags :: Lens' CreateInstances (Maybe [Tag])
createInstances_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstances' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateInstances' :: CreateInstances -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateInstances
s@CreateInstances' {} Maybe [Tag]
a -> CreateInstances
s {$sel:tags:CreateInstances' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateInstances) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A launch script you can create that configures a server with additional
-- user data. For example, you might want to run @apt-get -y update@.
--
-- Depending on the machine image you choose, the command to get software
-- on your instance varies. Amazon Linux and CentOS use @yum@, Debian and
-- Ubuntu use @apt-get@, and FreeBSD uses @pkg@. For a complete list, see
-- the
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/compare-options-choose-lightsail-instance-image Amazon Lightsail Developer Guide>.
createInstances_userData :: Lens.Lens' CreateInstances (Prelude.Maybe Prelude.Text)
createInstances_userData :: Lens' CreateInstances (Maybe Text)
createInstances_userData = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstances' {Maybe Text
userData :: Maybe Text
$sel:userData:CreateInstances' :: CreateInstances -> Maybe Text
userData} -> Maybe Text
userData) (\s :: CreateInstances
s@CreateInstances' {} Maybe Text
a -> CreateInstances
s {$sel:userData:CreateInstances' :: Maybe Text
userData = Maybe Text
a} :: CreateInstances)

-- | The names to use for your new Lightsail instances. Separate multiple
-- values using quotation marks and commas, for example:
-- @[\"MyFirstInstance\",\"MySecondInstance\"]@
createInstances_instanceNames :: Lens.Lens' CreateInstances [Prelude.Text]
createInstances_instanceNames :: Lens' CreateInstances [Text]
createInstances_instanceNames = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstances' {[Text]
instanceNames :: [Text]
$sel:instanceNames:CreateInstances' :: CreateInstances -> [Text]
instanceNames} -> [Text]
instanceNames) (\s :: CreateInstances
s@CreateInstances' {} [Text]
a -> CreateInstances
s {$sel:instanceNames:CreateInstances' :: [Text]
instanceNames = [Text]
a} :: CreateInstances) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Availability Zone in which to create your instance. Use the
-- following format: @us-east-2a@ (case sensitive). You can get a list of
-- Availability Zones by using the
-- <http://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetRegions.html get regions>
-- operation. Be sure to add the @include Availability Zones@ parameter to
-- your request.
createInstances_availabilityZone :: Lens.Lens' CreateInstances Prelude.Text
createInstances_availabilityZone :: Lens' CreateInstances Text
createInstances_availabilityZone = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstances' {Text
availabilityZone :: Text
$sel:availabilityZone:CreateInstances' :: CreateInstances -> Text
availabilityZone} -> Text
availabilityZone) (\s :: CreateInstances
s@CreateInstances' {} Text
a -> CreateInstances
s {$sel:availabilityZone:CreateInstances' :: Text
availabilityZone = Text
a} :: CreateInstances)

-- | The ID for a virtual private server image (e.g., @app_wordpress_4_4@ or
-- @app_lamp_7_0@). Use the @get blueprints@ operation to return a list of
-- available images (or /blueprints/).
--
-- Use active blueprints when creating new instances. Inactive blueprints
-- are listed to support customers with existing instances and are not
-- necessarily available to create new instances. Blueprints are marked
-- inactive when they become outdated due to operating system updates or
-- new application releases.
createInstances_blueprintId :: Lens.Lens' CreateInstances Prelude.Text
createInstances_blueprintId :: Lens' CreateInstances Text
createInstances_blueprintId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstances' {Text
blueprintId :: Text
$sel:blueprintId:CreateInstances' :: CreateInstances -> Text
blueprintId} -> Text
blueprintId) (\s :: CreateInstances
s@CreateInstances' {} Text
a -> CreateInstances
s {$sel:blueprintId:CreateInstances' :: Text
blueprintId = Text
a} :: CreateInstances)

-- | The bundle of specification information for your virtual private server
-- (or /instance/), including the pricing plan (e.g., @micro_1_0@).
createInstances_bundleId :: Lens.Lens' CreateInstances Prelude.Text
createInstances_bundleId :: Lens' CreateInstances Text
createInstances_bundleId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstances' {Text
bundleId :: Text
$sel:bundleId:CreateInstances' :: CreateInstances -> Text
bundleId} -> Text
bundleId) (\s :: CreateInstances
s@CreateInstances' {} Text
a -> CreateInstances
s {$sel:bundleId:CreateInstances' :: Text
bundleId = Text
a} :: CreateInstances)

instance Core.AWSRequest CreateInstances where
  type
    AWSResponse CreateInstances =
      CreateInstancesResponse
  request :: (Service -> Service) -> CreateInstances -> Request CreateInstances
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateInstances
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateInstances)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe [Operation] -> Int -> CreateInstancesResponse
CreateInstancesResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"operations" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateInstances where
  hashWithSalt :: Int -> CreateInstances -> Int
hashWithSalt Int
_salt CreateInstances' {[Text]
Maybe [AddOnRequest]
Maybe [Tag]
Maybe Text
Maybe IpAddressType
Text
bundleId :: Text
blueprintId :: Text
availabilityZone :: Text
instanceNames :: [Text]
userData :: Maybe Text
tags :: Maybe [Tag]
keyPairName :: Maybe Text
ipAddressType :: Maybe IpAddressType
customImageName :: Maybe Text
addOns :: Maybe [AddOnRequest]
$sel:bundleId:CreateInstances' :: CreateInstances -> Text
$sel:blueprintId:CreateInstances' :: CreateInstances -> Text
$sel:availabilityZone:CreateInstances' :: CreateInstances -> Text
$sel:instanceNames:CreateInstances' :: CreateInstances -> [Text]
$sel:userData:CreateInstances' :: CreateInstances -> Maybe Text
$sel:tags:CreateInstances' :: CreateInstances -> Maybe [Tag]
$sel:keyPairName:CreateInstances' :: CreateInstances -> Maybe Text
$sel:ipAddressType:CreateInstances' :: CreateInstances -> Maybe IpAddressType
$sel:customImageName:CreateInstances' :: CreateInstances -> Maybe Text
$sel:addOns:CreateInstances' :: CreateInstances -> Maybe [AddOnRequest]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [AddOnRequest]
addOns
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
customImageName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe IpAddressType
ipAddressType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
keyPairName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
userData
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [Text]
instanceNames
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
availabilityZone
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
blueprintId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
bundleId

instance Prelude.NFData CreateInstances where
  rnf :: CreateInstances -> ()
rnf CreateInstances' {[Text]
Maybe [AddOnRequest]
Maybe [Tag]
Maybe Text
Maybe IpAddressType
Text
bundleId :: Text
blueprintId :: Text
availabilityZone :: Text
instanceNames :: [Text]
userData :: Maybe Text
tags :: Maybe [Tag]
keyPairName :: Maybe Text
ipAddressType :: Maybe IpAddressType
customImageName :: Maybe Text
addOns :: Maybe [AddOnRequest]
$sel:bundleId:CreateInstances' :: CreateInstances -> Text
$sel:blueprintId:CreateInstances' :: CreateInstances -> Text
$sel:availabilityZone:CreateInstances' :: CreateInstances -> Text
$sel:instanceNames:CreateInstances' :: CreateInstances -> [Text]
$sel:userData:CreateInstances' :: CreateInstances -> Maybe Text
$sel:tags:CreateInstances' :: CreateInstances -> Maybe [Tag]
$sel:keyPairName:CreateInstances' :: CreateInstances -> Maybe Text
$sel:ipAddressType:CreateInstances' :: CreateInstances -> Maybe IpAddressType
$sel:customImageName:CreateInstances' :: CreateInstances -> Maybe Text
$sel:addOns:CreateInstances' :: CreateInstances -> Maybe [AddOnRequest]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [AddOnRequest]
addOns
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
customImageName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe IpAddressType
ipAddressType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
keyPairName
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Tag]
tags
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
userData
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [Text]
instanceNames
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
availabilityZone
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
blueprintId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
bundleId

instance Data.ToHeaders CreateInstances where
  toHeaders :: CreateInstances -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"Lightsail_20161128.CreateInstances" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON CreateInstances where
  toJSON :: CreateInstances -> Value
toJSON CreateInstances' {[Text]
Maybe [AddOnRequest]
Maybe [Tag]
Maybe Text
Maybe IpAddressType
Text
bundleId :: Text
blueprintId :: Text
availabilityZone :: Text
instanceNames :: [Text]
userData :: Maybe Text
tags :: Maybe [Tag]
keyPairName :: Maybe Text
ipAddressType :: Maybe IpAddressType
customImageName :: Maybe Text
addOns :: Maybe [AddOnRequest]
$sel:bundleId:CreateInstances' :: CreateInstances -> Text
$sel:blueprintId:CreateInstances' :: CreateInstances -> Text
$sel:availabilityZone:CreateInstances' :: CreateInstances -> Text
$sel:instanceNames:CreateInstances' :: CreateInstances -> [Text]
$sel:userData:CreateInstances' :: CreateInstances -> Maybe Text
$sel:tags:CreateInstances' :: CreateInstances -> Maybe [Tag]
$sel:keyPairName:CreateInstances' :: CreateInstances -> Maybe Text
$sel:ipAddressType:CreateInstances' :: CreateInstances -> Maybe IpAddressType
$sel:customImageName:CreateInstances' :: CreateInstances -> Maybe Text
$sel:addOns:CreateInstances' :: CreateInstances -> Maybe [AddOnRequest]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"addOns" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AddOnRequest]
addOns,
            (Key
"customImageName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
customImageName,
            (Key
"ipAddressType" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe IpAddressType
ipAddressType,
            (Key
"keyPairName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
keyPairName,
            (Key
"tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            (Key
"userData" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
userData,
            forall a. a -> Maybe a
Prelude.Just (Key
"instanceNames" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= [Text]
instanceNames),
            forall a. a -> Maybe a
Prelude.Just
              (Key
"availabilityZone" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
availabilityZone),
            forall a. a -> Maybe a
Prelude.Just (Key
"blueprintId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
blueprintId),
            forall a. a -> Maybe a
Prelude.Just (Key
"bundleId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
bundleId)
          ]
      )

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

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

-- | /See:/ 'newCreateInstancesResponse' smart constructor.
data CreateInstancesResponse = CreateInstancesResponse'
  { -- | An array of objects that describe the result of the action, such as the
    -- status of the request, the timestamp of the request, and the resources
    -- affected by the request.
    CreateInstancesResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
    -- | The response's http status code.
    CreateInstancesResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateInstancesResponse -> CreateInstancesResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateInstancesResponse -> CreateInstancesResponse -> Bool
$c/= :: CreateInstancesResponse -> CreateInstancesResponse -> Bool
== :: CreateInstancesResponse -> CreateInstancesResponse -> Bool
$c== :: CreateInstancesResponse -> CreateInstancesResponse -> Bool
Prelude.Eq, ReadPrec [CreateInstancesResponse]
ReadPrec CreateInstancesResponse
Int -> ReadS CreateInstancesResponse
ReadS [CreateInstancesResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateInstancesResponse]
$creadListPrec :: ReadPrec [CreateInstancesResponse]
readPrec :: ReadPrec CreateInstancesResponse
$creadPrec :: ReadPrec CreateInstancesResponse
readList :: ReadS [CreateInstancesResponse]
$creadList :: ReadS [CreateInstancesResponse]
readsPrec :: Int -> ReadS CreateInstancesResponse
$creadsPrec :: Int -> ReadS CreateInstancesResponse
Prelude.Read, Int -> CreateInstancesResponse -> ShowS
[CreateInstancesResponse] -> ShowS
CreateInstancesResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateInstancesResponse] -> ShowS
$cshowList :: [CreateInstancesResponse] -> ShowS
show :: CreateInstancesResponse -> String
$cshow :: CreateInstancesResponse -> String
showsPrec :: Int -> CreateInstancesResponse -> ShowS
$cshowsPrec :: Int -> CreateInstancesResponse -> ShowS
Prelude.Show, forall x. Rep CreateInstancesResponse x -> CreateInstancesResponse
forall x. CreateInstancesResponse -> Rep CreateInstancesResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateInstancesResponse x -> CreateInstancesResponse
$cfrom :: forall x. CreateInstancesResponse -> Rep CreateInstancesResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateInstancesResponse' 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:
--
-- 'operations', 'createInstancesResponse_operations' - An array of objects that describe the result of the action, such as the
-- status of the request, the timestamp of the request, and the resources
-- affected by the request.
--
-- 'httpStatus', 'createInstancesResponse_httpStatus' - The response's http status code.
newCreateInstancesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateInstancesResponse
newCreateInstancesResponse :: Int -> CreateInstancesResponse
newCreateInstancesResponse Int
pHttpStatus_ =
  CreateInstancesResponse'
    { $sel:operations:CreateInstancesResponse' :: Maybe [Operation]
operations =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateInstancesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | An array of objects that describe the result of the action, such as the
-- status of the request, the timestamp of the request, and the resources
-- affected by the request.
createInstancesResponse_operations :: Lens.Lens' CreateInstancesResponse (Prelude.Maybe [Operation])
createInstancesResponse_operations :: Lens' CreateInstancesResponse (Maybe [Operation])
createInstancesResponse_operations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstancesResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:CreateInstancesResponse' :: CreateInstancesResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: CreateInstancesResponse
s@CreateInstancesResponse' {} Maybe [Operation]
a -> CreateInstancesResponse
s {$sel:operations:CreateInstancesResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: CreateInstancesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData CreateInstancesResponse where
  rnf :: CreateInstancesResponse -> ()
rnf CreateInstancesResponse' {Int
Maybe [Operation]
httpStatus :: Int
operations :: Maybe [Operation]
$sel:httpStatus:CreateInstancesResponse' :: CreateInstancesResponse -> Int
$sel:operations:CreateInstancesResponse' :: CreateInstancesResponse -> Maybe [Operation]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [Operation]
operations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus