{-# 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.CreateInstancesFromSnapshot
-- 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 one or more new instances from a manual or automatic snapshot of
-- an instance.
--
-- The @create instances from snapshot@ operation supports tag-based access
-- control via request tags and resource tags applied to the resource
-- identified by @instance snapshot name@. For more information, see the
-- <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-controlling-access-using-tags Amazon Lightsail Developer Guide>.
module Amazonka.Lightsail.CreateInstancesFromSnapshot
  ( -- * Creating a Request
    CreateInstancesFromSnapshot (..),
    newCreateInstancesFromSnapshot,

    -- * Request Lenses
    createInstancesFromSnapshot_useLatestRestorableAutoSnapshot,
    createInstancesFromSnapshot_instanceSnapshotName,
    createInstancesFromSnapshot_addOns,
    createInstancesFromSnapshot_userData,
    createInstancesFromSnapshot_restoreDate,
    createInstancesFromSnapshot_ipAddressType,
    createInstancesFromSnapshot_keyPairName,
    createInstancesFromSnapshot_sourceInstanceName,
    createInstancesFromSnapshot_attachedDiskMapping,
    createInstancesFromSnapshot_tags,
    createInstancesFromSnapshot_instanceNames,
    createInstancesFromSnapshot_availabilityZone,
    createInstancesFromSnapshot_bundleId,

    -- * Destructuring the Response
    CreateInstancesFromSnapshotResponse (..),
    newCreateInstancesFromSnapshotResponse,

    -- * Response Lenses
    createInstancesFromSnapshotResponse_operations,
    createInstancesFromSnapshotResponse_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:/ 'newCreateInstancesFromSnapshot' smart constructor.
data CreateInstancesFromSnapshot = CreateInstancesFromSnapshot'
  { -- | A Boolean value to indicate whether to use the latest available
    -- automatic snapshot.
    --
    -- Constraints:
    --
    -- -   This parameter cannot be defined together with the @restore date@
    --     parameter. The @use latest restorable auto snapshot@ and
    --     @restore date@ parameters are mutually exclusive.
    --
    -- -   Define this parameter only when creating a new instance from an
    --     automatic snapshot. For more information, see the
    --     <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-configuring-automatic-snapshots Amazon Lightsail Developer Guide>.
    CreateInstancesFromSnapshot -> Maybe Bool
useLatestRestorableAutoSnapshot :: Prelude.Maybe Prelude.Bool,
    -- | The name of the instance snapshot on which you are basing your new
    -- instances. Use the get instance snapshots operation to return
    -- information about your existing snapshots.
    --
    -- Constraint:
    --
    -- -   This parameter cannot be defined together with the
    --     @source instance name@ parameter. The @instance snapshot name@ and
    --     @source instance name@ parameters are mutually exclusive.
    CreateInstancesFromSnapshot -> Maybe Text
instanceSnapshotName :: Prelude.Maybe Prelude.Text,
    -- | An array of objects representing the add-ons to enable for the new
    -- instance.
    CreateInstancesFromSnapshot -> Maybe [AddOnRequest]
addOns :: Prelude.Maybe [AddOnRequest],
    -- | You can create a launch script that configures a server with additional
    -- user data. For example, @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>.
    CreateInstancesFromSnapshot -> Maybe Text
userData :: Prelude.Maybe Prelude.Text,
    -- | The date of the automatic snapshot to use for the new instance. Use the
    -- @get auto snapshots@ operation to identify the dates of the available
    -- automatic snapshots.
    --
    -- Constraints:
    --
    -- -   Must be specified in @YYYY-MM-DD@ format.
    --
    -- -   This parameter cannot be defined together with the
    --     @use latest restorable auto snapshot@ parameter. The @restore date@
    --     and @use latest restorable auto snapshot@ parameters are mutually
    --     exclusive.
    --
    -- -   Define this parameter only when creating a new instance from an
    --     automatic snapshot. For more information, see the
    --     <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-configuring-automatic-snapshots Amazon Lightsail Developer Guide>.
    CreateInstancesFromSnapshot -> Maybe Text
restoreDate :: 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@.
    CreateInstancesFromSnapshot -> Maybe IpAddressType
ipAddressType :: Prelude.Maybe IpAddressType,
    -- | The name for your key pair.
    CreateInstancesFromSnapshot -> Maybe Text
keyPairName :: Prelude.Maybe Prelude.Text,
    -- | The name of the source instance from which the source automatic snapshot
    -- was created.
    --
    -- Constraints:
    --
    -- -   This parameter cannot be defined together with the
    --     @instance snapshot name@ parameter. The @source instance name@ and
    --     @instance snapshot name@ parameters are mutually exclusive.
    --
    -- -   Define this parameter only when creating a new instance from an
    --     automatic snapshot. For more information, see the
    --     <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-configuring-automatic-snapshots Amazon Lightsail Developer Guide>.
    CreateInstancesFromSnapshot -> Maybe Text
sourceInstanceName :: Prelude.Maybe Prelude.Text,
    -- | An object containing information about one or more disk mappings.
    CreateInstancesFromSnapshot -> Maybe (HashMap Text [DiskMap])
attachedDiskMapping :: Prelude.Maybe (Prelude.HashMap Prelude.Text [DiskMap]),
    -- | 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.
    CreateInstancesFromSnapshot -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The names for your new instances.
    CreateInstancesFromSnapshot -> [Text]
instanceNames :: [Prelude.Text],
    -- | The Availability Zone where you want to create your instances. Use the
    -- following formatting: @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.
    CreateInstancesFromSnapshot -> Text
availabilityZone :: Prelude.Text,
    -- | The bundle of specification information for your virtual private server
    -- (or /instance/), including the pricing plan (e.g., @micro_1_0@).
    CreateInstancesFromSnapshot -> Text
bundleId :: Prelude.Text
  }
  deriving (CreateInstancesFromSnapshot -> CreateInstancesFromSnapshot -> Bool
(CreateInstancesFromSnapshot
 -> CreateInstancesFromSnapshot -> Bool)
-> (CreateInstancesFromSnapshot
    -> CreateInstancesFromSnapshot -> Bool)
-> Eq CreateInstancesFromSnapshot
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateInstancesFromSnapshot -> CreateInstancesFromSnapshot -> Bool
$c/= :: CreateInstancesFromSnapshot -> CreateInstancesFromSnapshot -> Bool
== :: CreateInstancesFromSnapshot -> CreateInstancesFromSnapshot -> Bool
$c== :: CreateInstancesFromSnapshot -> CreateInstancesFromSnapshot -> Bool
Prelude.Eq, ReadPrec [CreateInstancesFromSnapshot]
ReadPrec CreateInstancesFromSnapshot
Int -> ReadS CreateInstancesFromSnapshot
ReadS [CreateInstancesFromSnapshot]
(Int -> ReadS CreateInstancesFromSnapshot)
-> ReadS [CreateInstancesFromSnapshot]
-> ReadPrec CreateInstancesFromSnapshot
-> ReadPrec [CreateInstancesFromSnapshot]
-> Read CreateInstancesFromSnapshot
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateInstancesFromSnapshot]
$creadListPrec :: ReadPrec [CreateInstancesFromSnapshot]
readPrec :: ReadPrec CreateInstancesFromSnapshot
$creadPrec :: ReadPrec CreateInstancesFromSnapshot
readList :: ReadS [CreateInstancesFromSnapshot]
$creadList :: ReadS [CreateInstancesFromSnapshot]
readsPrec :: Int -> ReadS CreateInstancesFromSnapshot
$creadsPrec :: Int -> ReadS CreateInstancesFromSnapshot
Prelude.Read, Int -> CreateInstancesFromSnapshot -> ShowS
[CreateInstancesFromSnapshot] -> ShowS
CreateInstancesFromSnapshot -> String
(Int -> CreateInstancesFromSnapshot -> ShowS)
-> (CreateInstancesFromSnapshot -> String)
-> ([CreateInstancesFromSnapshot] -> ShowS)
-> Show CreateInstancesFromSnapshot
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateInstancesFromSnapshot] -> ShowS
$cshowList :: [CreateInstancesFromSnapshot] -> ShowS
show :: CreateInstancesFromSnapshot -> String
$cshow :: CreateInstancesFromSnapshot -> String
showsPrec :: Int -> CreateInstancesFromSnapshot -> ShowS
$cshowsPrec :: Int -> CreateInstancesFromSnapshot -> ShowS
Prelude.Show, (forall x.
 CreateInstancesFromSnapshot -> Rep CreateInstancesFromSnapshot x)
-> (forall x.
    Rep CreateInstancesFromSnapshot x -> CreateInstancesFromSnapshot)
-> Generic CreateInstancesFromSnapshot
forall x.
Rep CreateInstancesFromSnapshot x -> CreateInstancesFromSnapshot
forall x.
CreateInstancesFromSnapshot -> Rep CreateInstancesFromSnapshot x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateInstancesFromSnapshot x -> CreateInstancesFromSnapshot
$cfrom :: forall x.
CreateInstancesFromSnapshot -> Rep CreateInstancesFromSnapshot x
Prelude.Generic)

-- |
-- Create a value of 'CreateInstancesFromSnapshot' 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:
--
-- 'useLatestRestorableAutoSnapshot', 'createInstancesFromSnapshot_useLatestRestorableAutoSnapshot' - A Boolean value to indicate whether to use the latest available
-- automatic snapshot.
--
-- Constraints:
--
-- -   This parameter cannot be defined together with the @restore date@
--     parameter. The @use latest restorable auto snapshot@ and
--     @restore date@ parameters are mutually exclusive.
--
-- -   Define this parameter only when creating a new instance from an
--     automatic snapshot. For more information, see the
--     <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-configuring-automatic-snapshots Amazon Lightsail Developer Guide>.
--
-- 'instanceSnapshotName', 'createInstancesFromSnapshot_instanceSnapshotName' - The name of the instance snapshot on which you are basing your new
-- instances. Use the get instance snapshots operation to return
-- information about your existing snapshots.
--
-- Constraint:
--
-- -   This parameter cannot be defined together with the
--     @source instance name@ parameter. The @instance snapshot name@ and
--     @source instance name@ parameters are mutually exclusive.
--
-- 'addOns', 'createInstancesFromSnapshot_addOns' - An array of objects representing the add-ons to enable for the new
-- instance.
--
-- 'userData', 'createInstancesFromSnapshot_userData' - You can create a launch script that configures a server with additional
-- user data. For example, @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>.
--
-- 'restoreDate', 'createInstancesFromSnapshot_restoreDate' - The date of the automatic snapshot to use for the new instance. Use the
-- @get auto snapshots@ operation to identify the dates of the available
-- automatic snapshots.
--
-- Constraints:
--
-- -   Must be specified in @YYYY-MM-DD@ format.
--
-- -   This parameter cannot be defined together with the
--     @use latest restorable auto snapshot@ parameter. The @restore date@
--     and @use latest restorable auto snapshot@ parameters are mutually
--     exclusive.
--
-- -   Define this parameter only when creating a new instance from an
--     automatic snapshot. For more information, see the
--     <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-configuring-automatic-snapshots Amazon Lightsail Developer Guide>.
--
-- 'ipAddressType', 'createInstancesFromSnapshot_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', 'createInstancesFromSnapshot_keyPairName' - The name for your key pair.
--
-- 'sourceInstanceName', 'createInstancesFromSnapshot_sourceInstanceName' - The name of the source instance from which the source automatic snapshot
-- was created.
--
-- Constraints:
--
-- -   This parameter cannot be defined together with the
--     @instance snapshot name@ parameter. The @source instance name@ and
--     @instance snapshot name@ parameters are mutually exclusive.
--
-- -   Define this parameter only when creating a new instance from an
--     automatic snapshot. For more information, see the
--     <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-configuring-automatic-snapshots Amazon Lightsail Developer Guide>.
--
-- 'attachedDiskMapping', 'createInstancesFromSnapshot_attachedDiskMapping' - An object containing information about one or more disk mappings.
--
-- 'tags', 'createInstancesFromSnapshot_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.
--
-- 'instanceNames', 'createInstancesFromSnapshot_instanceNames' - The names for your new instances.
--
-- 'availabilityZone', 'createInstancesFromSnapshot_availabilityZone' - The Availability Zone where you want to create your instances. Use the
-- following formatting: @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.
--
-- 'bundleId', 'createInstancesFromSnapshot_bundleId' - The bundle of specification information for your virtual private server
-- (or /instance/), including the pricing plan (e.g., @micro_1_0@).
newCreateInstancesFromSnapshot ::
  -- | 'availabilityZone'
  Prelude.Text ->
  -- | 'bundleId'
  Prelude.Text ->
  CreateInstancesFromSnapshot
newCreateInstancesFromSnapshot :: Text -> Text -> CreateInstancesFromSnapshot
newCreateInstancesFromSnapshot
  Text
pAvailabilityZone_
  Text
pBundleId_ =
    CreateInstancesFromSnapshot' :: Maybe Bool
-> Maybe Text
-> Maybe [AddOnRequest]
-> Maybe Text
-> Maybe Text
-> Maybe IpAddressType
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text [DiskMap])
-> Maybe [Tag]
-> [Text]
-> Text
-> Text
-> CreateInstancesFromSnapshot
CreateInstancesFromSnapshot'
      { $sel:useLatestRestorableAutoSnapshot:CreateInstancesFromSnapshot' :: Maybe Bool
useLatestRestorableAutoSnapshot =
          Maybe Bool
forall a. Maybe a
Prelude.Nothing,
        $sel:instanceSnapshotName:CreateInstancesFromSnapshot' :: Maybe Text
instanceSnapshotName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:addOns:CreateInstancesFromSnapshot' :: Maybe [AddOnRequest]
addOns = Maybe [AddOnRequest]
forall a. Maybe a
Prelude.Nothing,
        $sel:userData:CreateInstancesFromSnapshot' :: Maybe Text
userData = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:restoreDate:CreateInstancesFromSnapshot' :: Maybe Text
restoreDate = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:ipAddressType:CreateInstancesFromSnapshot' :: Maybe IpAddressType
ipAddressType = Maybe IpAddressType
forall a. Maybe a
Prelude.Nothing,
        $sel:keyPairName:CreateInstancesFromSnapshot' :: Maybe Text
keyPairName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:sourceInstanceName:CreateInstancesFromSnapshot' :: Maybe Text
sourceInstanceName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:attachedDiskMapping:CreateInstancesFromSnapshot' :: Maybe (HashMap Text [DiskMap])
attachedDiskMapping = Maybe (HashMap Text [DiskMap])
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateInstancesFromSnapshot' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:instanceNames:CreateInstancesFromSnapshot' :: [Text]
instanceNames = [Text]
forall a. Monoid a => a
Prelude.mempty,
        $sel:availabilityZone:CreateInstancesFromSnapshot' :: Text
availabilityZone = Text
pAvailabilityZone_,
        $sel:bundleId:CreateInstancesFromSnapshot' :: Text
bundleId = Text
pBundleId_
      }

-- | A Boolean value to indicate whether to use the latest available
-- automatic snapshot.
--
-- Constraints:
--
-- -   This parameter cannot be defined together with the @restore date@
--     parameter. The @use latest restorable auto snapshot@ and
--     @restore date@ parameters are mutually exclusive.
--
-- -   Define this parameter only when creating a new instance from an
--     automatic snapshot. For more information, see the
--     <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-configuring-automatic-snapshots Amazon Lightsail Developer Guide>.
createInstancesFromSnapshot_useLatestRestorableAutoSnapshot :: Lens.Lens' CreateInstancesFromSnapshot (Prelude.Maybe Prelude.Bool)
createInstancesFromSnapshot_useLatestRestorableAutoSnapshot :: (Maybe Bool -> f (Maybe Bool))
-> CreateInstancesFromSnapshot -> f CreateInstancesFromSnapshot
createInstancesFromSnapshot_useLatestRestorableAutoSnapshot = (CreateInstancesFromSnapshot -> Maybe Bool)
-> (CreateInstancesFromSnapshot
    -> Maybe Bool -> CreateInstancesFromSnapshot)
-> Lens
     CreateInstancesFromSnapshot
     CreateInstancesFromSnapshot
     (Maybe Bool)
     (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstancesFromSnapshot' {Maybe Bool
useLatestRestorableAutoSnapshot :: Maybe Bool
$sel:useLatestRestorableAutoSnapshot:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Bool
useLatestRestorableAutoSnapshot} -> Maybe Bool
useLatestRestorableAutoSnapshot) (\s :: CreateInstancesFromSnapshot
s@CreateInstancesFromSnapshot' {} Maybe Bool
a -> CreateInstancesFromSnapshot
s {$sel:useLatestRestorableAutoSnapshot:CreateInstancesFromSnapshot' :: Maybe Bool
useLatestRestorableAutoSnapshot = Maybe Bool
a} :: CreateInstancesFromSnapshot)

-- | The name of the instance snapshot on which you are basing your new
-- instances. Use the get instance snapshots operation to return
-- information about your existing snapshots.
--
-- Constraint:
--
-- -   This parameter cannot be defined together with the
--     @source instance name@ parameter. The @instance snapshot name@ and
--     @source instance name@ parameters are mutually exclusive.
createInstancesFromSnapshot_instanceSnapshotName :: Lens.Lens' CreateInstancesFromSnapshot (Prelude.Maybe Prelude.Text)
createInstancesFromSnapshot_instanceSnapshotName :: (Maybe Text -> f (Maybe Text))
-> CreateInstancesFromSnapshot -> f CreateInstancesFromSnapshot
createInstancesFromSnapshot_instanceSnapshotName = (CreateInstancesFromSnapshot -> Maybe Text)
-> (CreateInstancesFromSnapshot
    -> Maybe Text -> CreateInstancesFromSnapshot)
-> Lens
     CreateInstancesFromSnapshot
     CreateInstancesFromSnapshot
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstancesFromSnapshot' {Maybe Text
instanceSnapshotName :: Maybe Text
$sel:instanceSnapshotName:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
instanceSnapshotName} -> Maybe Text
instanceSnapshotName) (\s :: CreateInstancesFromSnapshot
s@CreateInstancesFromSnapshot' {} Maybe Text
a -> CreateInstancesFromSnapshot
s {$sel:instanceSnapshotName:CreateInstancesFromSnapshot' :: Maybe Text
instanceSnapshotName = Maybe Text
a} :: CreateInstancesFromSnapshot)

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

-- | You can create a launch script that configures a server with additional
-- user data. For example, @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>.
createInstancesFromSnapshot_userData :: Lens.Lens' CreateInstancesFromSnapshot (Prelude.Maybe Prelude.Text)
createInstancesFromSnapshot_userData :: (Maybe Text -> f (Maybe Text))
-> CreateInstancesFromSnapshot -> f CreateInstancesFromSnapshot
createInstancesFromSnapshot_userData = (CreateInstancesFromSnapshot -> Maybe Text)
-> (CreateInstancesFromSnapshot
    -> Maybe Text -> CreateInstancesFromSnapshot)
-> Lens
     CreateInstancesFromSnapshot
     CreateInstancesFromSnapshot
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstancesFromSnapshot' {Maybe Text
userData :: Maybe Text
$sel:userData:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
userData} -> Maybe Text
userData) (\s :: CreateInstancesFromSnapshot
s@CreateInstancesFromSnapshot' {} Maybe Text
a -> CreateInstancesFromSnapshot
s {$sel:userData:CreateInstancesFromSnapshot' :: Maybe Text
userData = Maybe Text
a} :: CreateInstancesFromSnapshot)

-- | The date of the automatic snapshot to use for the new instance. Use the
-- @get auto snapshots@ operation to identify the dates of the available
-- automatic snapshots.
--
-- Constraints:
--
-- -   Must be specified in @YYYY-MM-DD@ format.
--
-- -   This parameter cannot be defined together with the
--     @use latest restorable auto snapshot@ parameter. The @restore date@
--     and @use latest restorable auto snapshot@ parameters are mutually
--     exclusive.
--
-- -   Define this parameter only when creating a new instance from an
--     automatic snapshot. For more information, see the
--     <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-configuring-automatic-snapshots Amazon Lightsail Developer Guide>.
createInstancesFromSnapshot_restoreDate :: Lens.Lens' CreateInstancesFromSnapshot (Prelude.Maybe Prelude.Text)
createInstancesFromSnapshot_restoreDate :: (Maybe Text -> f (Maybe Text))
-> CreateInstancesFromSnapshot -> f CreateInstancesFromSnapshot
createInstancesFromSnapshot_restoreDate = (CreateInstancesFromSnapshot -> Maybe Text)
-> (CreateInstancesFromSnapshot
    -> Maybe Text -> CreateInstancesFromSnapshot)
-> Lens
     CreateInstancesFromSnapshot
     CreateInstancesFromSnapshot
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstancesFromSnapshot' {Maybe Text
restoreDate :: Maybe Text
$sel:restoreDate:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
restoreDate} -> Maybe Text
restoreDate) (\s :: CreateInstancesFromSnapshot
s@CreateInstancesFromSnapshot' {} Maybe Text
a -> CreateInstancesFromSnapshot
s {$sel:restoreDate:CreateInstancesFromSnapshot' :: Maybe Text
restoreDate = Maybe Text
a} :: CreateInstancesFromSnapshot)

-- | 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@.
createInstancesFromSnapshot_ipAddressType :: Lens.Lens' CreateInstancesFromSnapshot (Prelude.Maybe IpAddressType)
createInstancesFromSnapshot_ipAddressType :: (Maybe IpAddressType -> f (Maybe IpAddressType))
-> CreateInstancesFromSnapshot -> f CreateInstancesFromSnapshot
createInstancesFromSnapshot_ipAddressType = (CreateInstancesFromSnapshot -> Maybe IpAddressType)
-> (CreateInstancesFromSnapshot
    -> Maybe IpAddressType -> CreateInstancesFromSnapshot)
-> Lens
     CreateInstancesFromSnapshot
     CreateInstancesFromSnapshot
     (Maybe IpAddressType)
     (Maybe IpAddressType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstancesFromSnapshot' {Maybe IpAddressType
ipAddressType :: Maybe IpAddressType
$sel:ipAddressType:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe IpAddressType
ipAddressType} -> Maybe IpAddressType
ipAddressType) (\s :: CreateInstancesFromSnapshot
s@CreateInstancesFromSnapshot' {} Maybe IpAddressType
a -> CreateInstancesFromSnapshot
s {$sel:ipAddressType:CreateInstancesFromSnapshot' :: Maybe IpAddressType
ipAddressType = Maybe IpAddressType
a} :: CreateInstancesFromSnapshot)

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

-- | The name of the source instance from which the source automatic snapshot
-- was created.
--
-- Constraints:
--
-- -   This parameter cannot be defined together with the
--     @instance snapshot name@ parameter. The @source instance name@ and
--     @instance snapshot name@ parameters are mutually exclusive.
--
-- -   Define this parameter only when creating a new instance from an
--     automatic snapshot. For more information, see the
--     <https://lightsail.aws.amazon.com/ls/docs/en_us/articles/amazon-lightsail-configuring-automatic-snapshots Amazon Lightsail Developer Guide>.
createInstancesFromSnapshot_sourceInstanceName :: Lens.Lens' CreateInstancesFromSnapshot (Prelude.Maybe Prelude.Text)
createInstancesFromSnapshot_sourceInstanceName :: (Maybe Text -> f (Maybe Text))
-> CreateInstancesFromSnapshot -> f CreateInstancesFromSnapshot
createInstancesFromSnapshot_sourceInstanceName = (CreateInstancesFromSnapshot -> Maybe Text)
-> (CreateInstancesFromSnapshot
    -> Maybe Text -> CreateInstancesFromSnapshot)
-> Lens
     CreateInstancesFromSnapshot
     CreateInstancesFromSnapshot
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstancesFromSnapshot' {Maybe Text
sourceInstanceName :: Maybe Text
$sel:sourceInstanceName:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
sourceInstanceName} -> Maybe Text
sourceInstanceName) (\s :: CreateInstancesFromSnapshot
s@CreateInstancesFromSnapshot' {} Maybe Text
a -> CreateInstancesFromSnapshot
s {$sel:sourceInstanceName:CreateInstancesFromSnapshot' :: Maybe Text
sourceInstanceName = Maybe Text
a} :: CreateInstancesFromSnapshot)

-- | An object containing information about one or more disk mappings.
createInstancesFromSnapshot_attachedDiskMapping :: Lens.Lens' CreateInstancesFromSnapshot (Prelude.Maybe (Prelude.HashMap Prelude.Text [DiskMap]))
createInstancesFromSnapshot_attachedDiskMapping :: (Maybe (HashMap Text [DiskMap])
 -> f (Maybe (HashMap Text [DiskMap])))
-> CreateInstancesFromSnapshot -> f CreateInstancesFromSnapshot
createInstancesFromSnapshot_attachedDiskMapping = (CreateInstancesFromSnapshot -> Maybe (HashMap Text [DiskMap]))
-> (CreateInstancesFromSnapshot
    -> Maybe (HashMap Text [DiskMap]) -> CreateInstancesFromSnapshot)
-> Lens
     CreateInstancesFromSnapshot
     CreateInstancesFromSnapshot
     (Maybe (HashMap Text [DiskMap]))
     (Maybe (HashMap Text [DiskMap]))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstancesFromSnapshot' {Maybe (HashMap Text [DiskMap])
attachedDiskMapping :: Maybe (HashMap Text [DiskMap])
$sel:attachedDiskMapping:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe (HashMap Text [DiskMap])
attachedDiskMapping} -> Maybe (HashMap Text [DiskMap])
attachedDiskMapping) (\s :: CreateInstancesFromSnapshot
s@CreateInstancesFromSnapshot' {} Maybe (HashMap Text [DiskMap])
a -> CreateInstancesFromSnapshot
s {$sel:attachedDiskMapping:CreateInstancesFromSnapshot' :: Maybe (HashMap Text [DiskMap])
attachedDiskMapping = Maybe (HashMap Text [DiskMap])
a} :: CreateInstancesFromSnapshot) ((Maybe (HashMap Text [DiskMap])
  -> f (Maybe (HashMap Text [DiskMap])))
 -> CreateInstancesFromSnapshot -> f CreateInstancesFromSnapshot)
-> ((Maybe (HashMap Text [DiskMap])
     -> f (Maybe (HashMap Text [DiskMap])))
    -> Maybe (HashMap Text [DiskMap])
    -> f (Maybe (HashMap Text [DiskMap])))
-> (Maybe (HashMap Text [DiskMap])
    -> f (Maybe (HashMap Text [DiskMap])))
-> CreateInstancesFromSnapshot
-> f CreateInstancesFromSnapshot
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text [DiskMap])
  (HashMap Text [DiskMap])
  (HashMap Text [DiskMap])
  (HashMap Text [DiskMap])
-> Iso
     (Maybe (HashMap Text [DiskMap]))
     (Maybe (HashMap Text [DiskMap]))
     (Maybe (HashMap Text [DiskMap]))
     (Maybe (HashMap Text [DiskMap]))
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 [DiskMap])
  (HashMap Text [DiskMap])
  (HashMap Text [DiskMap])
  (HashMap Text [DiskMap])
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 resource during create.
--
-- Use the @TagResource@ action to tag a resource after it\'s created.
createInstancesFromSnapshot_tags :: Lens.Lens' CreateInstancesFromSnapshot (Prelude.Maybe [Tag])
createInstancesFromSnapshot_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateInstancesFromSnapshot -> f CreateInstancesFromSnapshot
createInstancesFromSnapshot_tags = (CreateInstancesFromSnapshot -> Maybe [Tag])
-> (CreateInstancesFromSnapshot
    -> Maybe [Tag] -> CreateInstancesFromSnapshot)
-> Lens
     CreateInstancesFromSnapshot
     CreateInstancesFromSnapshot
     (Maybe [Tag])
     (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstancesFromSnapshot' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateInstancesFromSnapshot
s@CreateInstancesFromSnapshot' {} Maybe [Tag]
a -> CreateInstancesFromSnapshot
s {$sel:tags:CreateInstancesFromSnapshot' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateInstancesFromSnapshot) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateInstancesFromSnapshot -> f CreateInstancesFromSnapshot)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateInstancesFromSnapshot
-> f CreateInstancesFromSnapshot
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 names for your new instances.
createInstancesFromSnapshot_instanceNames :: Lens.Lens' CreateInstancesFromSnapshot [Prelude.Text]
createInstancesFromSnapshot_instanceNames :: ([Text] -> f [Text])
-> CreateInstancesFromSnapshot -> f CreateInstancesFromSnapshot
createInstancesFromSnapshot_instanceNames = (CreateInstancesFromSnapshot -> [Text])
-> (CreateInstancesFromSnapshot
    -> [Text] -> CreateInstancesFromSnapshot)
-> Lens
     CreateInstancesFromSnapshot
     CreateInstancesFromSnapshot
     [Text]
     [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstancesFromSnapshot' {[Text]
instanceNames :: [Text]
$sel:instanceNames:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> [Text]
instanceNames} -> [Text]
instanceNames) (\s :: CreateInstancesFromSnapshot
s@CreateInstancesFromSnapshot' {} [Text]
a -> CreateInstancesFromSnapshot
s {$sel:instanceNames:CreateInstancesFromSnapshot' :: [Text]
instanceNames = [Text]
a} :: CreateInstancesFromSnapshot) (([Text] -> f [Text])
 -> CreateInstancesFromSnapshot -> f CreateInstancesFromSnapshot)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> CreateInstancesFromSnapshot
-> f CreateInstancesFromSnapshot
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Availability Zone where you want to create your instances. Use the
-- following formatting: @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.
createInstancesFromSnapshot_availabilityZone :: Lens.Lens' CreateInstancesFromSnapshot Prelude.Text
createInstancesFromSnapshot_availabilityZone :: (Text -> f Text)
-> CreateInstancesFromSnapshot -> f CreateInstancesFromSnapshot
createInstancesFromSnapshot_availabilityZone = (CreateInstancesFromSnapshot -> Text)
-> (CreateInstancesFromSnapshot
    -> Text -> CreateInstancesFromSnapshot)
-> Lens
     CreateInstancesFromSnapshot CreateInstancesFromSnapshot Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstancesFromSnapshot' {Text
availabilityZone :: Text
$sel:availabilityZone:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Text
availabilityZone} -> Text
availabilityZone) (\s :: CreateInstancesFromSnapshot
s@CreateInstancesFromSnapshot' {} Text
a -> CreateInstancesFromSnapshot
s {$sel:availabilityZone:CreateInstancesFromSnapshot' :: Text
availabilityZone = Text
a} :: CreateInstancesFromSnapshot)

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

instance Core.AWSRequest CreateInstancesFromSnapshot where
  type
    AWSResponse CreateInstancesFromSnapshot =
      CreateInstancesFromSnapshotResponse
  request :: CreateInstancesFromSnapshot -> Request CreateInstancesFromSnapshot
request = Service
-> CreateInstancesFromSnapshot
-> Request CreateInstancesFromSnapshot
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateInstancesFromSnapshot
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateInstancesFromSnapshot)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateInstancesFromSnapshot))
-> Logger
-> Service
-> Proxy CreateInstancesFromSnapshot
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateInstancesFromSnapshot)))
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 [Operation] -> Int -> CreateInstancesFromSnapshotResponse
CreateInstancesFromSnapshotResponse'
            (Maybe [Operation] -> Int -> CreateInstancesFromSnapshotResponse)
-> Either String (Maybe [Operation])
-> Either String (Int -> CreateInstancesFromSnapshotResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe (Maybe [Operation]))
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"operations" Either String (Maybe (Maybe [Operation]))
-> Maybe [Operation] -> Either String (Maybe [Operation])
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ Maybe [Operation]
forall a. Monoid a => a
Prelude.mempty)
            Either String (Int -> CreateInstancesFromSnapshotResponse)
-> Either String Int
-> Either String CreateInstancesFromSnapshotResponse
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 CreateInstancesFromSnapshot

instance Prelude.NFData CreateInstancesFromSnapshot

instance Core.ToHeaders CreateInstancesFromSnapshot where
  toHeaders :: CreateInstancesFromSnapshot -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateInstancesFromSnapshot -> 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.CreateInstancesFromSnapshot" ::
                          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 CreateInstancesFromSnapshot where
  toJSON :: CreateInstancesFromSnapshot -> Value
toJSON CreateInstancesFromSnapshot' {[Text]
Maybe Bool
Maybe [AddOnRequest]
Maybe [Tag]
Maybe Text
Maybe (HashMap Text [DiskMap])
Maybe IpAddressType
Text
bundleId :: Text
availabilityZone :: Text
instanceNames :: [Text]
tags :: Maybe [Tag]
attachedDiskMapping :: Maybe (HashMap Text [DiskMap])
sourceInstanceName :: Maybe Text
keyPairName :: Maybe Text
ipAddressType :: Maybe IpAddressType
restoreDate :: Maybe Text
userData :: Maybe Text
addOns :: Maybe [AddOnRequest]
instanceSnapshotName :: Maybe Text
useLatestRestorableAutoSnapshot :: Maybe Bool
$sel:bundleId:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Text
$sel:availabilityZone:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Text
$sel:instanceNames:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> [Text]
$sel:tags:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe [Tag]
$sel:attachedDiskMapping:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe (HashMap Text [DiskMap])
$sel:sourceInstanceName:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:keyPairName:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:ipAddressType:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe IpAddressType
$sel:restoreDate:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:userData:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:addOns:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe [AddOnRequest]
$sel:instanceSnapshotName:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:useLatestRestorableAutoSnapshot:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Bool
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"useLatestRestorableAutoSnapshot" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
useLatestRestorableAutoSnapshot,
            (Text
"instanceSnapshotName" 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
instanceSnapshotName,
            (Text
"addOns" Text -> [AddOnRequest] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([AddOnRequest] -> Pair) -> Maybe [AddOnRequest] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [AddOnRequest]
addOns,
            (Text
"userData" 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
userData,
            (Text
"restoreDate" 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
restoreDate,
            (Text
"ipAddressType" Text -> IpAddressType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (IpAddressType -> Pair) -> Maybe IpAddressType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe IpAddressType
ipAddressType,
            (Text
"keyPairName" 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
keyPairName,
            (Text
"sourceInstanceName" 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
sourceInstanceName,
            (Text
"attachedDiskMapping" Text -> HashMap Text [DiskMap] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (HashMap Text [DiskMap] -> Pair)
-> Maybe (HashMap Text [DiskMap]) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text [DiskMap])
attachedDiskMapping,
            (Text
"tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"instanceNames" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
instanceNames),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"availabilityZone" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
availabilityZone),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"bundleId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
bundleId)
          ]
      )

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

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

-- | /See:/ 'newCreateInstancesFromSnapshotResponse' smart constructor.
data CreateInstancesFromSnapshotResponse = CreateInstancesFromSnapshotResponse'
  { -- | 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.
    CreateInstancesFromSnapshotResponse -> Maybe [Operation]
operations :: Prelude.Maybe [Operation],
    -- | The response's http status code.
    CreateInstancesFromSnapshotResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateInstancesFromSnapshotResponse
-> CreateInstancesFromSnapshotResponse -> Bool
(CreateInstancesFromSnapshotResponse
 -> CreateInstancesFromSnapshotResponse -> Bool)
-> (CreateInstancesFromSnapshotResponse
    -> CreateInstancesFromSnapshotResponse -> Bool)
-> Eq CreateInstancesFromSnapshotResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateInstancesFromSnapshotResponse
-> CreateInstancesFromSnapshotResponse -> Bool
$c/= :: CreateInstancesFromSnapshotResponse
-> CreateInstancesFromSnapshotResponse -> Bool
== :: CreateInstancesFromSnapshotResponse
-> CreateInstancesFromSnapshotResponse -> Bool
$c== :: CreateInstancesFromSnapshotResponse
-> CreateInstancesFromSnapshotResponse -> Bool
Prelude.Eq, ReadPrec [CreateInstancesFromSnapshotResponse]
ReadPrec CreateInstancesFromSnapshotResponse
Int -> ReadS CreateInstancesFromSnapshotResponse
ReadS [CreateInstancesFromSnapshotResponse]
(Int -> ReadS CreateInstancesFromSnapshotResponse)
-> ReadS [CreateInstancesFromSnapshotResponse]
-> ReadPrec CreateInstancesFromSnapshotResponse
-> ReadPrec [CreateInstancesFromSnapshotResponse]
-> Read CreateInstancesFromSnapshotResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateInstancesFromSnapshotResponse]
$creadListPrec :: ReadPrec [CreateInstancesFromSnapshotResponse]
readPrec :: ReadPrec CreateInstancesFromSnapshotResponse
$creadPrec :: ReadPrec CreateInstancesFromSnapshotResponse
readList :: ReadS [CreateInstancesFromSnapshotResponse]
$creadList :: ReadS [CreateInstancesFromSnapshotResponse]
readsPrec :: Int -> ReadS CreateInstancesFromSnapshotResponse
$creadsPrec :: Int -> ReadS CreateInstancesFromSnapshotResponse
Prelude.Read, Int -> CreateInstancesFromSnapshotResponse -> ShowS
[CreateInstancesFromSnapshotResponse] -> ShowS
CreateInstancesFromSnapshotResponse -> String
(Int -> CreateInstancesFromSnapshotResponse -> ShowS)
-> (CreateInstancesFromSnapshotResponse -> String)
-> ([CreateInstancesFromSnapshotResponse] -> ShowS)
-> Show CreateInstancesFromSnapshotResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateInstancesFromSnapshotResponse] -> ShowS
$cshowList :: [CreateInstancesFromSnapshotResponse] -> ShowS
show :: CreateInstancesFromSnapshotResponse -> String
$cshow :: CreateInstancesFromSnapshotResponse -> String
showsPrec :: Int -> CreateInstancesFromSnapshotResponse -> ShowS
$cshowsPrec :: Int -> CreateInstancesFromSnapshotResponse -> ShowS
Prelude.Show, (forall x.
 CreateInstancesFromSnapshotResponse
 -> Rep CreateInstancesFromSnapshotResponse x)
-> (forall x.
    Rep CreateInstancesFromSnapshotResponse x
    -> CreateInstancesFromSnapshotResponse)
-> Generic CreateInstancesFromSnapshotResponse
forall x.
Rep CreateInstancesFromSnapshotResponse x
-> CreateInstancesFromSnapshotResponse
forall x.
CreateInstancesFromSnapshotResponse
-> Rep CreateInstancesFromSnapshotResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateInstancesFromSnapshotResponse x
-> CreateInstancesFromSnapshotResponse
$cfrom :: forall x.
CreateInstancesFromSnapshotResponse
-> Rep CreateInstancesFromSnapshotResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateInstancesFromSnapshotResponse' 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', 'createInstancesFromSnapshotResponse_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', 'createInstancesFromSnapshotResponse_httpStatus' - The response's http status code.
newCreateInstancesFromSnapshotResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateInstancesFromSnapshotResponse
newCreateInstancesFromSnapshotResponse :: Int -> CreateInstancesFromSnapshotResponse
newCreateInstancesFromSnapshotResponse Int
pHttpStatus_ =
  CreateInstancesFromSnapshotResponse' :: Maybe [Operation] -> Int -> CreateInstancesFromSnapshotResponse
CreateInstancesFromSnapshotResponse'
    { $sel:operations:CreateInstancesFromSnapshotResponse' :: Maybe [Operation]
operations =
        Maybe [Operation]
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateInstancesFromSnapshotResponse' :: 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.
createInstancesFromSnapshotResponse_operations :: Lens.Lens' CreateInstancesFromSnapshotResponse (Prelude.Maybe [Operation])
createInstancesFromSnapshotResponse_operations :: (Maybe [Operation] -> f (Maybe [Operation]))
-> CreateInstancesFromSnapshotResponse
-> f CreateInstancesFromSnapshotResponse
createInstancesFromSnapshotResponse_operations = (CreateInstancesFromSnapshotResponse -> Maybe [Operation])
-> (CreateInstancesFromSnapshotResponse
    -> Maybe [Operation] -> CreateInstancesFromSnapshotResponse)
-> Lens
     CreateInstancesFromSnapshotResponse
     CreateInstancesFromSnapshotResponse
     (Maybe [Operation])
     (Maybe [Operation])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstancesFromSnapshotResponse' {Maybe [Operation]
operations :: Maybe [Operation]
$sel:operations:CreateInstancesFromSnapshotResponse' :: CreateInstancesFromSnapshotResponse -> Maybe [Operation]
operations} -> Maybe [Operation]
operations) (\s :: CreateInstancesFromSnapshotResponse
s@CreateInstancesFromSnapshotResponse' {} Maybe [Operation]
a -> CreateInstancesFromSnapshotResponse
s {$sel:operations:CreateInstancesFromSnapshotResponse' :: Maybe [Operation]
operations = Maybe [Operation]
a} :: CreateInstancesFromSnapshotResponse) ((Maybe [Operation] -> f (Maybe [Operation]))
 -> CreateInstancesFromSnapshotResponse
 -> f CreateInstancesFromSnapshotResponse)
-> ((Maybe [Operation] -> f (Maybe [Operation]))
    -> Maybe [Operation] -> f (Maybe [Operation]))
-> (Maybe [Operation] -> f (Maybe [Operation]))
-> CreateInstancesFromSnapshotResponse
-> f CreateInstancesFromSnapshotResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Operation] [Operation] [Operation] [Operation]
-> Iso
     (Maybe [Operation])
     (Maybe [Operation])
     (Maybe [Operation])
     (Maybe [Operation])
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 [Operation] [Operation] [Operation] [Operation]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    CreateInstancesFromSnapshotResponse