{-# 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-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 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_addOns,
    createInstancesFromSnapshot_attachedDiskMapping,
    createInstancesFromSnapshot_instanceSnapshotName,
    createInstancesFromSnapshot_ipAddressType,
    createInstancesFromSnapshot_keyPairName,
    createInstancesFromSnapshot_restoreDate,
    createInstancesFromSnapshot_sourceInstanceName,
    createInstancesFromSnapshot_tags,
    createInstancesFromSnapshot_useLatestRestorableAutoSnapshot,
    createInstancesFromSnapshot_userData,
    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.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:/ 'newCreateInstancesFromSnapshot' smart constructor.
data CreateInstancesFromSnapshot = CreateInstancesFromSnapshot'
  { -- | An array of objects representing the add-ons to enable for the new
    -- instance.
    CreateInstancesFromSnapshot -> Maybe [AddOnRequest]
addOns :: Prelude.Maybe [AddOnRequest],
    -- | An object containing information about one or more disk mappings.
    CreateInstancesFromSnapshot -> Maybe (HashMap Text [DiskMap])
attachedDiskMapping :: Prelude.Maybe (Prelude.HashMap Prelude.Text [DiskMap]),
    -- | 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,
    -- | 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 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 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,
    -- | 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],
    -- | 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,
    -- | 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 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
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]
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
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.
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:
--
-- 'addOns', 'createInstancesFromSnapshot_addOns' - An array of objects representing the add-ons to enable for the new
-- instance.
--
-- 'attachedDiskMapping', 'createInstancesFromSnapshot_attachedDiskMapping' - An object containing information about one or more disk mappings.
--
-- '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.
--
-- '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.
--
-- '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>.
--
-- '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>.
--
-- '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.
--
-- '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>.
--
-- '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>.
--
-- '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'
      { $sel:addOns:CreateInstancesFromSnapshot' :: Maybe [AddOnRequest]
addOns =
          forall a. Maybe a
Prelude.Nothing,
        $sel:attachedDiskMapping:CreateInstancesFromSnapshot' :: Maybe (HashMap Text [DiskMap])
attachedDiskMapping = forall a. Maybe a
Prelude.Nothing,
        $sel:instanceSnapshotName:CreateInstancesFromSnapshot' :: Maybe Text
instanceSnapshotName = forall a. Maybe a
Prelude.Nothing,
        $sel:ipAddressType:CreateInstancesFromSnapshot' :: Maybe IpAddressType
ipAddressType = forall a. Maybe a
Prelude.Nothing,
        $sel:keyPairName:CreateInstancesFromSnapshot' :: Maybe Text
keyPairName = forall a. Maybe a
Prelude.Nothing,
        $sel:restoreDate:CreateInstancesFromSnapshot' :: Maybe Text
restoreDate = forall a. Maybe a
Prelude.Nothing,
        $sel:sourceInstanceName:CreateInstancesFromSnapshot' :: Maybe Text
sourceInstanceName = forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateInstancesFromSnapshot' :: Maybe [Tag]
tags = forall a. Maybe a
Prelude.Nothing,
        $sel:useLatestRestorableAutoSnapshot:CreateInstancesFromSnapshot' :: Maybe Bool
useLatestRestorableAutoSnapshot =
          forall a. Maybe a
Prelude.Nothing,
        $sel:userData:CreateInstancesFromSnapshot' :: Maybe Text
userData = forall a. Maybe a
Prelude.Nothing,
        $sel:instanceNames:CreateInstancesFromSnapshot' :: [Text]
instanceNames = forall a. Monoid a => a
Prelude.mempty,
        $sel:availabilityZone:CreateInstancesFromSnapshot' :: Text
availabilityZone = Text
pAvailabilityZone_,
        $sel:bundleId:CreateInstancesFromSnapshot' :: Text
bundleId = Text
pBundleId_
      }

-- | An array of objects representing the add-ons to enable for the new
-- instance.
createInstancesFromSnapshot_addOns :: Lens.Lens' CreateInstancesFromSnapshot (Prelude.Maybe [AddOnRequest])
createInstancesFromSnapshot_addOns :: Lens' CreateInstancesFromSnapshot (Maybe [AddOnRequest])
createInstancesFromSnapshot_addOns = 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) 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

-- | An object containing information about one or more disk mappings.
createInstancesFromSnapshot_attachedDiskMapping :: Lens.Lens' CreateInstancesFromSnapshot (Prelude.Maybe (Prelude.HashMap Prelude.Text [DiskMap]))
createInstancesFromSnapshot_attachedDiskMapping :: Lens' CreateInstancesFromSnapshot (Maybe (HashMap Text [DiskMap]))
createInstancesFromSnapshot_attachedDiskMapping = 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) 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 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 :: Lens' CreateInstancesFromSnapshot (Maybe Text)
createInstancesFromSnapshot_instanceSnapshotName = 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)

-- | 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 :: Lens' CreateInstancesFromSnapshot (Maybe IpAddressType)
createInstancesFromSnapshot_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 :: Lens' CreateInstancesFromSnapshot (Maybe Text)
createInstancesFromSnapshot_keyPairName = 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 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 :: Lens' CreateInstancesFromSnapshot (Maybe Text)
createInstancesFromSnapshot_restoreDate = 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 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 :: Lens' CreateInstancesFromSnapshot (Maybe Text)
createInstancesFromSnapshot_sourceInstanceName = 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)

-- | 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 :: Lens' CreateInstancesFromSnapshot (Maybe [Tag])
createInstancesFromSnapshot_tags = 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) 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 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 :: Lens' CreateInstancesFromSnapshot (Maybe Bool)
createInstancesFromSnapshot_useLatestRestorableAutoSnapshot = 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)

-- | 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 :: Lens' CreateInstancesFromSnapshot (Maybe Text)
createInstancesFromSnapshot_userData = 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 names for your new instances.
createInstancesFromSnapshot_instanceNames :: Lens.Lens' CreateInstancesFromSnapshot [Prelude.Text]
createInstancesFromSnapshot_instanceNames :: Lens' CreateInstancesFromSnapshot [Text]
createInstancesFromSnapshot_instanceNames = 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) 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 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 :: Lens' CreateInstancesFromSnapshot Text
createInstancesFromSnapshot_availabilityZone = 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 :: Lens' CreateInstancesFromSnapshot Text
createInstancesFromSnapshot_bundleId = 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 :: (Service -> Service)
-> CreateInstancesFromSnapshot
-> Request CreateInstancesFromSnapshot
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 CreateInstancesFromSnapshot
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateInstancesFromSnapshot)))
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 -> CreateInstancesFromSnapshotResponse
CreateInstancesFromSnapshotResponse'
            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 CreateInstancesFromSnapshot where
  hashWithSalt :: Int -> CreateInstancesFromSnapshot -> Int
hashWithSalt Int
_salt CreateInstancesFromSnapshot' {[Text]
Maybe Bool
Maybe [AddOnRequest]
Maybe [Tag]
Maybe Text
Maybe (HashMap Text [DiskMap])
Maybe IpAddressType
Text
bundleId :: Text
availabilityZone :: Text
instanceNames :: [Text]
userData :: Maybe Text
useLatestRestorableAutoSnapshot :: Maybe Bool
tags :: Maybe [Tag]
sourceInstanceName :: Maybe Text
restoreDate :: Maybe Text
keyPairName :: Maybe Text
ipAddressType :: Maybe IpAddressType
instanceSnapshotName :: Maybe Text
attachedDiskMapping :: Maybe (HashMap Text [DiskMap])
addOns :: Maybe [AddOnRequest]
$sel:bundleId:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Text
$sel:availabilityZone:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Text
$sel:instanceNames:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> [Text]
$sel:userData:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:useLatestRestorableAutoSnapshot:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Bool
$sel:tags:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe [Tag]
$sel:sourceInstanceName:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:restoreDate:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:keyPairName:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:ipAddressType:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe IpAddressType
$sel:instanceSnapshotName:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:attachedDiskMapping:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe (HashMap Text [DiskMap])
$sel:addOns:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> 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 (HashMap Text [DiskMap])
attachedDiskMapping
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
instanceSnapshotName
      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 Text
restoreDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sourceInstanceName
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Tag]
tags
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
useLatestRestorableAutoSnapshot
      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
bundleId

instance Prelude.NFData CreateInstancesFromSnapshot where
  rnf :: CreateInstancesFromSnapshot -> ()
rnf CreateInstancesFromSnapshot' {[Text]
Maybe Bool
Maybe [AddOnRequest]
Maybe [Tag]
Maybe Text
Maybe (HashMap Text [DiskMap])
Maybe IpAddressType
Text
bundleId :: Text
availabilityZone :: Text
instanceNames :: [Text]
userData :: Maybe Text
useLatestRestorableAutoSnapshot :: Maybe Bool
tags :: Maybe [Tag]
sourceInstanceName :: Maybe Text
restoreDate :: Maybe Text
keyPairName :: Maybe Text
ipAddressType :: Maybe IpAddressType
instanceSnapshotName :: Maybe Text
attachedDiskMapping :: Maybe (HashMap Text [DiskMap])
addOns :: Maybe [AddOnRequest]
$sel:bundleId:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Text
$sel:availabilityZone:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Text
$sel:instanceNames:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> [Text]
$sel:userData:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:useLatestRestorableAutoSnapshot:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Bool
$sel:tags:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe [Tag]
$sel:sourceInstanceName:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:restoreDate:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:keyPairName:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:ipAddressType:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe IpAddressType
$sel:instanceSnapshotName:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:attachedDiskMapping:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe (HashMap Text [DiskMap])
$sel:addOns:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> 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 (HashMap Text [DiskMap])
attachedDiskMapping
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
instanceSnapshotName
      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 Text
restoreDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sourceInstanceName
      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 Bool
useLatestRestorableAutoSnapshot
      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
bundleId

instance Data.ToHeaders CreateInstancesFromSnapshot where
  toHeaders :: CreateInstancesFromSnapshot -> 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.CreateInstancesFromSnapshot" ::
                          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 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]
userData :: Maybe Text
useLatestRestorableAutoSnapshot :: Maybe Bool
tags :: Maybe [Tag]
sourceInstanceName :: Maybe Text
restoreDate :: Maybe Text
keyPairName :: Maybe Text
ipAddressType :: Maybe IpAddressType
instanceSnapshotName :: Maybe Text
attachedDiskMapping :: Maybe (HashMap Text [DiskMap])
addOns :: Maybe [AddOnRequest]
$sel:bundleId:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Text
$sel:availabilityZone:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Text
$sel:instanceNames:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> [Text]
$sel:userData:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:useLatestRestorableAutoSnapshot:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Bool
$sel:tags:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe [Tag]
$sel:sourceInstanceName:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:restoreDate:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:keyPairName:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:ipAddressType:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe IpAddressType
$sel:instanceSnapshotName:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe Text
$sel:attachedDiskMapping:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> Maybe (HashMap Text [DiskMap])
$sel:addOns:CreateInstancesFromSnapshot' :: CreateInstancesFromSnapshot -> 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
"attachedDiskMapping" 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 (HashMap Text [DiskMap])
attachedDiskMapping,
            (Key
"instanceSnapshotName" 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
instanceSnapshotName,
            (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
"restoreDate" 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
restoreDate,
            (Key
"sourceInstanceName" 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
sourceInstanceName,
            (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
"useLatestRestorableAutoSnapshot" 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 Bool
useLatestRestorableAutoSnapshot,
            (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
"bundleId" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
bundleId)
          ]
      )

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

instance Data.ToQuery CreateInstancesFromSnapshot where
  toQuery :: CreateInstancesFromSnapshot -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const 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
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]
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
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.
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'
    { $sel:operations:CreateInstancesFromSnapshotResponse' :: Maybe [Operation]
operations =
        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 :: Lens' CreateInstancesFromSnapshotResponse (Maybe [Operation])
createInstancesFromSnapshotResponse_operations = 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) 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.
createInstancesFromSnapshotResponse_httpStatus :: Lens.Lens' CreateInstancesFromSnapshotResponse Prelude.Int
createInstancesFromSnapshotResponse_httpStatus :: Lens' CreateInstancesFromSnapshotResponse Int
createInstancesFromSnapshotResponse_httpStatus = 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
  where
  rnf :: CreateInstancesFromSnapshotResponse -> ()
rnf CreateInstancesFromSnapshotResponse' {Int
Maybe [Operation]
httpStatus :: Int
operations :: Maybe [Operation]
$sel:httpStatus:CreateInstancesFromSnapshotResponse' :: CreateInstancesFromSnapshotResponse -> Int
$sel:operations:CreateInstancesFromSnapshotResponse' :: CreateInstancesFromSnapshotResponse -> 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