{-# 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.EC2.CreateCapacityReservation
-- 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 a new Capacity Reservation with the specified attributes.
--
-- Capacity Reservations enable you to reserve capacity for your Amazon EC2
-- instances in a specific Availability Zone for any duration. This gives
-- you the flexibility to selectively add capacity reservations and still
-- get the Regional RI discounts for that usage. By creating Capacity
-- Reservations, you ensure that you always have access to Amazon EC2
-- capacity when you need it, for as long as you need it. For more
-- information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-capacity-reservations.html Capacity Reservations>
-- in the /Amazon EC2 User Guide/.
--
-- Your request to create a Capacity Reservation could fail if Amazon EC2
-- does not have sufficient capacity to fulfill the request. If your
-- request fails due to Amazon EC2 capacity constraints, either try again
-- at a later time, try in a different Availability Zone, or request a
-- smaller capacity reservation. If your application is flexible across
-- instance types and sizes, try to create a Capacity Reservation with
-- different instance attributes.
--
-- Your request could also fail if the requested quantity exceeds your
-- On-Demand Instance limit for the selected instance type. If your request
-- fails due to limit constraints, increase your On-Demand Instance limit
-- for the required instance type and try again. For more information about
-- increasing your instance limits, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ec2-resource-limits.html Amazon EC2 Service Quotas>
-- in the /Amazon EC2 User Guide/.
module Amazonka.EC2.CreateCapacityReservation
  ( -- * Creating a Request
    CreateCapacityReservation (..),
    newCreateCapacityReservation,

    -- * Request Lenses
    createCapacityReservation_availabilityZone,
    createCapacityReservation_availabilityZoneId,
    createCapacityReservation_clientToken,
    createCapacityReservation_dryRun,
    createCapacityReservation_ebsOptimized,
    createCapacityReservation_endDate,
    createCapacityReservation_endDateType,
    createCapacityReservation_ephemeralStorage,
    createCapacityReservation_instanceMatchCriteria,
    createCapacityReservation_outpostArn,
    createCapacityReservation_placementGroupArn,
    createCapacityReservation_tagSpecifications,
    createCapacityReservation_tenancy,
    createCapacityReservation_instanceType,
    createCapacityReservation_instancePlatform,
    createCapacityReservation_instanceCount,

    -- * Destructuring the Response
    CreateCapacityReservationResponse (..),
    newCreateCapacityReservationResponse,

    -- * Response Lenses
    createCapacityReservationResponse_capacityReservation,
    createCapacityReservationResponse_httpStatus,
  )
where

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

-- | /See:/ 'newCreateCapacityReservation' smart constructor.
data CreateCapacityReservation = CreateCapacityReservation'
  { -- | The Availability Zone in which to create the Capacity Reservation.
    CreateCapacityReservation -> Maybe Text
availabilityZone :: Prelude.Maybe Prelude.Text,
    -- | The ID of the Availability Zone in which to create the Capacity
    -- Reservation.
    CreateCapacityReservation -> Maybe Text
availabilityZoneId :: Prelude.Maybe Prelude.Text,
    -- | Unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request. For more information, see
    -- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html Ensure Idempotency>.
    CreateCapacityReservation -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | Checks whether you have the required permissions for the action, without
    -- actually making the request, and provides an error response. If you have
    -- the required permissions, the error response is @DryRunOperation@.
    -- Otherwise, it is @UnauthorizedOperation@.
    CreateCapacityReservation -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | Indicates whether the Capacity Reservation supports EBS-optimized
    -- instances. This optimization provides dedicated throughput to Amazon EBS
    -- and an optimized configuration stack to provide optimal I\/O
    -- performance. This optimization isn\'t available with all instance types.
    -- Additional usage charges apply when using an EBS- optimized instance.
    CreateCapacityReservation -> Maybe Bool
ebsOptimized :: Prelude.Maybe Prelude.Bool,
    -- | The date and time at which the Capacity Reservation expires. When a
    -- Capacity Reservation expires, the reserved capacity is released and you
    -- can no longer launch instances into it. The Capacity Reservation\'s
    -- state changes to @expired@ when it reaches its end date and time.
    --
    -- You must provide an @EndDate@ value if @EndDateType@ is @limited@. Omit
    -- @EndDate@ if @EndDateType@ is @unlimited@.
    --
    -- If the @EndDateType@ is @limited@, the Capacity Reservation is cancelled
    -- within an hour from the specified time. For example, if you specify
    -- 5\/31\/2019, 13:30:55, the Capacity Reservation is guaranteed to end
    -- between 13:30:55 and 14:30:55 on 5\/31\/2019.
    CreateCapacityReservation -> Maybe ISO8601
endDate :: Prelude.Maybe Data.ISO8601,
    -- | Indicates the way in which the Capacity Reservation ends. A Capacity
    -- Reservation can have one of the following end types:
    --
    -- -   @unlimited@ - The Capacity Reservation remains active until you
    --     explicitly cancel it. Do not provide an @EndDate@ if the
    --     @EndDateType@ is @unlimited@.
    --
    -- -   @limited@ - The Capacity Reservation expires automatically at a
    --     specified date and time. You must provide an @EndDate@ value if the
    --     @EndDateType@ value is @limited@.
    CreateCapacityReservation -> Maybe EndDateType
endDateType :: Prelude.Maybe EndDateType,
    -- | /Deprecated./
    CreateCapacityReservation -> Maybe Bool
ephemeralStorage :: Prelude.Maybe Prelude.Bool,
    -- | Indicates the type of instance launches that the Capacity Reservation
    -- accepts. The options include:
    --
    -- -   @open@ - The Capacity Reservation automatically matches all
    --     instances that have matching attributes (instance type, platform,
    --     and Availability Zone). Instances that have matching attributes run
    --     in the Capacity Reservation automatically without specifying any
    --     additional parameters.
    --
    -- -   @targeted@ - The Capacity Reservation only accepts instances that
    --     have matching attributes (instance type, platform, and Availability
    --     Zone), and explicitly target the Capacity Reservation. This ensures
    --     that only permitted instances can use the reserved capacity.
    --
    -- Default: @open@
    CreateCapacityReservation -> Maybe InstanceMatchCriteria
instanceMatchCriteria :: Prelude.Maybe InstanceMatchCriteria,
    -- | The Amazon Resource Name (ARN) of the Outpost on which to create the
    -- Capacity Reservation.
    CreateCapacityReservation -> Maybe Text
outpostArn :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the cluster placement group in which
    -- to create the Capacity Reservation. For more information, see
    -- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/cr-cpg.html Capacity Reservations for cluster placement groups>
    -- in the /Amazon EC2 User Guide/.
    CreateCapacityReservation -> Maybe Text
placementGroupArn :: Prelude.Maybe Prelude.Text,
    -- | The tags to apply to the Capacity Reservation during launch.
    CreateCapacityReservation -> Maybe [TagSpecification]
tagSpecifications :: Prelude.Maybe [TagSpecification],
    -- | Indicates the tenancy of the Capacity Reservation. A Capacity
    -- Reservation can have one of the following tenancy settings:
    --
    -- -   @default@ - The Capacity Reservation is created on hardware that is
    --     shared with other Amazon Web Services accounts.
    --
    -- -   @dedicated@ - The Capacity Reservation is created on single-tenant
    --     hardware that is dedicated to a single Amazon Web Services account.
    CreateCapacityReservation -> Maybe CapacityReservationTenancy
tenancy :: Prelude.Maybe CapacityReservationTenancy,
    -- | The instance type for which to reserve capacity. For more information,
    -- see
    -- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html Instance types>
    -- in the /Amazon EC2 User Guide/.
    CreateCapacityReservation -> Text
instanceType :: Prelude.Text,
    -- | The type of operating system for which to reserve capacity.
    CreateCapacityReservation -> CapacityReservationInstancePlatform
instancePlatform :: CapacityReservationInstancePlatform,
    -- | The number of instances for which to reserve capacity.
    --
    -- Valid range: 1 - 1000
    CreateCapacityReservation -> Int
instanceCount :: Prelude.Int
  }
  deriving (CreateCapacityReservation -> CreateCapacityReservation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCapacityReservation -> CreateCapacityReservation -> Bool
$c/= :: CreateCapacityReservation -> CreateCapacityReservation -> Bool
== :: CreateCapacityReservation -> CreateCapacityReservation -> Bool
$c== :: CreateCapacityReservation -> CreateCapacityReservation -> Bool
Prelude.Eq, ReadPrec [CreateCapacityReservation]
ReadPrec CreateCapacityReservation
Int -> ReadS CreateCapacityReservation
ReadS [CreateCapacityReservation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCapacityReservation]
$creadListPrec :: ReadPrec [CreateCapacityReservation]
readPrec :: ReadPrec CreateCapacityReservation
$creadPrec :: ReadPrec CreateCapacityReservation
readList :: ReadS [CreateCapacityReservation]
$creadList :: ReadS [CreateCapacityReservation]
readsPrec :: Int -> ReadS CreateCapacityReservation
$creadsPrec :: Int -> ReadS CreateCapacityReservation
Prelude.Read, Int -> CreateCapacityReservation -> ShowS
[CreateCapacityReservation] -> ShowS
CreateCapacityReservation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCapacityReservation] -> ShowS
$cshowList :: [CreateCapacityReservation] -> ShowS
show :: CreateCapacityReservation -> String
$cshow :: CreateCapacityReservation -> String
showsPrec :: Int -> CreateCapacityReservation -> ShowS
$cshowsPrec :: Int -> CreateCapacityReservation -> ShowS
Prelude.Show, forall x.
Rep CreateCapacityReservation x -> CreateCapacityReservation
forall x.
CreateCapacityReservation -> Rep CreateCapacityReservation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCapacityReservation x -> CreateCapacityReservation
$cfrom :: forall x.
CreateCapacityReservation -> Rep CreateCapacityReservation x
Prelude.Generic)

-- |
-- Create a value of 'CreateCapacityReservation' 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:
--
-- 'availabilityZone', 'createCapacityReservation_availabilityZone' - The Availability Zone in which to create the Capacity Reservation.
--
-- 'availabilityZoneId', 'createCapacityReservation_availabilityZoneId' - The ID of the Availability Zone in which to create the Capacity
-- Reservation.
--
-- 'clientToken', 'createCapacityReservation_clientToken' - Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request. For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html Ensure Idempotency>.
--
-- 'dryRun', 'createCapacityReservation_dryRun' - Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
--
-- 'ebsOptimized', 'createCapacityReservation_ebsOptimized' - Indicates whether the Capacity Reservation supports EBS-optimized
-- instances. This optimization provides dedicated throughput to Amazon EBS
-- and an optimized configuration stack to provide optimal I\/O
-- performance. This optimization isn\'t available with all instance types.
-- Additional usage charges apply when using an EBS- optimized instance.
--
-- 'endDate', 'createCapacityReservation_endDate' - The date and time at which the Capacity Reservation expires. When a
-- Capacity Reservation expires, the reserved capacity is released and you
-- can no longer launch instances into it. The Capacity Reservation\'s
-- state changes to @expired@ when it reaches its end date and time.
--
-- You must provide an @EndDate@ value if @EndDateType@ is @limited@. Omit
-- @EndDate@ if @EndDateType@ is @unlimited@.
--
-- If the @EndDateType@ is @limited@, the Capacity Reservation is cancelled
-- within an hour from the specified time. For example, if you specify
-- 5\/31\/2019, 13:30:55, the Capacity Reservation is guaranteed to end
-- between 13:30:55 and 14:30:55 on 5\/31\/2019.
--
-- 'endDateType', 'createCapacityReservation_endDateType' - Indicates the way in which the Capacity Reservation ends. A Capacity
-- Reservation can have one of the following end types:
--
-- -   @unlimited@ - The Capacity Reservation remains active until you
--     explicitly cancel it. Do not provide an @EndDate@ if the
--     @EndDateType@ is @unlimited@.
--
-- -   @limited@ - The Capacity Reservation expires automatically at a
--     specified date and time. You must provide an @EndDate@ value if the
--     @EndDateType@ value is @limited@.
--
-- 'ephemeralStorage', 'createCapacityReservation_ephemeralStorage' - /Deprecated./
--
-- 'instanceMatchCriteria', 'createCapacityReservation_instanceMatchCriteria' - Indicates the type of instance launches that the Capacity Reservation
-- accepts. The options include:
--
-- -   @open@ - The Capacity Reservation automatically matches all
--     instances that have matching attributes (instance type, platform,
--     and Availability Zone). Instances that have matching attributes run
--     in the Capacity Reservation automatically without specifying any
--     additional parameters.
--
-- -   @targeted@ - The Capacity Reservation only accepts instances that
--     have matching attributes (instance type, platform, and Availability
--     Zone), and explicitly target the Capacity Reservation. This ensures
--     that only permitted instances can use the reserved capacity.
--
-- Default: @open@
--
-- 'outpostArn', 'createCapacityReservation_outpostArn' - The Amazon Resource Name (ARN) of the Outpost on which to create the
-- Capacity Reservation.
--
-- 'placementGroupArn', 'createCapacityReservation_placementGroupArn' - The Amazon Resource Name (ARN) of the cluster placement group in which
-- to create the Capacity Reservation. For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/cr-cpg.html Capacity Reservations for cluster placement groups>
-- in the /Amazon EC2 User Guide/.
--
-- 'tagSpecifications', 'createCapacityReservation_tagSpecifications' - The tags to apply to the Capacity Reservation during launch.
--
-- 'tenancy', 'createCapacityReservation_tenancy' - Indicates the tenancy of the Capacity Reservation. A Capacity
-- Reservation can have one of the following tenancy settings:
--
-- -   @default@ - The Capacity Reservation is created on hardware that is
--     shared with other Amazon Web Services accounts.
--
-- -   @dedicated@ - The Capacity Reservation is created on single-tenant
--     hardware that is dedicated to a single Amazon Web Services account.
--
-- 'instanceType', 'createCapacityReservation_instanceType' - The instance type for which to reserve capacity. For more information,
-- see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html Instance types>
-- in the /Amazon EC2 User Guide/.
--
-- 'instancePlatform', 'createCapacityReservation_instancePlatform' - The type of operating system for which to reserve capacity.
--
-- 'instanceCount', 'createCapacityReservation_instanceCount' - The number of instances for which to reserve capacity.
--
-- Valid range: 1 - 1000
newCreateCapacityReservation ::
  -- | 'instanceType'
  Prelude.Text ->
  -- | 'instancePlatform'
  CapacityReservationInstancePlatform ->
  -- | 'instanceCount'
  Prelude.Int ->
  CreateCapacityReservation
newCreateCapacityReservation :: Text
-> CapacityReservationInstancePlatform
-> Int
-> CreateCapacityReservation
newCreateCapacityReservation
  Text
pInstanceType_
  CapacityReservationInstancePlatform
pInstancePlatform_
  Int
pInstanceCount_ =
    CreateCapacityReservation'
      { $sel:availabilityZone:CreateCapacityReservation' :: Maybe Text
availabilityZone =
          forall a. Maybe a
Prelude.Nothing,
        $sel:availabilityZoneId:CreateCapacityReservation' :: Maybe Text
availabilityZoneId = forall a. Maybe a
Prelude.Nothing,
        $sel:clientToken:CreateCapacityReservation' :: Maybe Text
clientToken = forall a. Maybe a
Prelude.Nothing,
        $sel:dryRun:CreateCapacityReservation' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
        $sel:ebsOptimized:CreateCapacityReservation' :: Maybe Bool
ebsOptimized = forall a. Maybe a
Prelude.Nothing,
        $sel:endDate:CreateCapacityReservation' :: Maybe ISO8601
endDate = forall a. Maybe a
Prelude.Nothing,
        $sel:endDateType:CreateCapacityReservation' :: Maybe EndDateType
endDateType = forall a. Maybe a
Prelude.Nothing,
        $sel:ephemeralStorage:CreateCapacityReservation' :: Maybe Bool
ephemeralStorage = forall a. Maybe a
Prelude.Nothing,
        $sel:instanceMatchCriteria:CreateCapacityReservation' :: Maybe InstanceMatchCriteria
instanceMatchCriteria = forall a. Maybe a
Prelude.Nothing,
        $sel:outpostArn:CreateCapacityReservation' :: Maybe Text
outpostArn = forall a. Maybe a
Prelude.Nothing,
        $sel:placementGroupArn:CreateCapacityReservation' :: Maybe Text
placementGroupArn = forall a. Maybe a
Prelude.Nothing,
        $sel:tagSpecifications:CreateCapacityReservation' :: Maybe [TagSpecification]
tagSpecifications = forall a. Maybe a
Prelude.Nothing,
        $sel:tenancy:CreateCapacityReservation' :: Maybe CapacityReservationTenancy
tenancy = forall a. Maybe a
Prelude.Nothing,
        $sel:instanceType:CreateCapacityReservation' :: Text
instanceType = Text
pInstanceType_,
        $sel:instancePlatform:CreateCapacityReservation' :: CapacityReservationInstancePlatform
instancePlatform = CapacityReservationInstancePlatform
pInstancePlatform_,
        $sel:instanceCount:CreateCapacityReservation' :: Int
instanceCount = Int
pInstanceCount_
      }

-- | The Availability Zone in which to create the Capacity Reservation.
createCapacityReservation_availabilityZone :: Lens.Lens' CreateCapacityReservation (Prelude.Maybe Prelude.Text)
createCapacityReservation_availabilityZone :: Lens' CreateCapacityReservation (Maybe Text)
createCapacityReservation_availabilityZone = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityReservation' {Maybe Text
availabilityZone :: Maybe Text
$sel:availabilityZone:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
availabilityZone} -> Maybe Text
availabilityZone) (\s :: CreateCapacityReservation
s@CreateCapacityReservation' {} Maybe Text
a -> CreateCapacityReservation
s {$sel:availabilityZone:CreateCapacityReservation' :: Maybe Text
availabilityZone = Maybe Text
a} :: CreateCapacityReservation)

-- | The ID of the Availability Zone in which to create the Capacity
-- Reservation.
createCapacityReservation_availabilityZoneId :: Lens.Lens' CreateCapacityReservation (Prelude.Maybe Prelude.Text)
createCapacityReservation_availabilityZoneId :: Lens' CreateCapacityReservation (Maybe Text)
createCapacityReservation_availabilityZoneId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityReservation' {Maybe Text
availabilityZoneId :: Maybe Text
$sel:availabilityZoneId:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
availabilityZoneId} -> Maybe Text
availabilityZoneId) (\s :: CreateCapacityReservation
s@CreateCapacityReservation' {} Maybe Text
a -> CreateCapacityReservation
s {$sel:availabilityZoneId:CreateCapacityReservation' :: Maybe Text
availabilityZoneId = Maybe Text
a} :: CreateCapacityReservation)

-- | Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request. For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/APIReference/Run_Instance_Idempotency.html Ensure Idempotency>.
createCapacityReservation_clientToken :: Lens.Lens' CreateCapacityReservation (Prelude.Maybe Prelude.Text)
createCapacityReservation_clientToken :: Lens' CreateCapacityReservation (Maybe Text)
createCapacityReservation_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityReservation' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateCapacityReservation
s@CreateCapacityReservation' {} Maybe Text
a -> CreateCapacityReservation
s {$sel:clientToken:CreateCapacityReservation' :: Maybe Text
clientToken = Maybe Text
a} :: CreateCapacityReservation)

-- | Checks whether you have the required permissions for the action, without
-- actually making the request, and provides an error response. If you have
-- the required permissions, the error response is @DryRunOperation@.
-- Otherwise, it is @UnauthorizedOperation@.
createCapacityReservation_dryRun :: Lens.Lens' CreateCapacityReservation (Prelude.Maybe Prelude.Bool)
createCapacityReservation_dryRun :: Lens' CreateCapacityReservation (Maybe Bool)
createCapacityReservation_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityReservation' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: CreateCapacityReservation
s@CreateCapacityReservation' {} Maybe Bool
a -> CreateCapacityReservation
s {$sel:dryRun:CreateCapacityReservation' :: Maybe Bool
dryRun = Maybe Bool
a} :: CreateCapacityReservation)

-- | Indicates whether the Capacity Reservation supports EBS-optimized
-- instances. This optimization provides dedicated throughput to Amazon EBS
-- and an optimized configuration stack to provide optimal I\/O
-- performance. This optimization isn\'t available with all instance types.
-- Additional usage charges apply when using an EBS- optimized instance.
createCapacityReservation_ebsOptimized :: Lens.Lens' CreateCapacityReservation (Prelude.Maybe Prelude.Bool)
createCapacityReservation_ebsOptimized :: Lens' CreateCapacityReservation (Maybe Bool)
createCapacityReservation_ebsOptimized = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityReservation' {Maybe Bool
ebsOptimized :: Maybe Bool
$sel:ebsOptimized:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Bool
ebsOptimized} -> Maybe Bool
ebsOptimized) (\s :: CreateCapacityReservation
s@CreateCapacityReservation' {} Maybe Bool
a -> CreateCapacityReservation
s {$sel:ebsOptimized:CreateCapacityReservation' :: Maybe Bool
ebsOptimized = Maybe Bool
a} :: CreateCapacityReservation)

-- | The date and time at which the Capacity Reservation expires. When a
-- Capacity Reservation expires, the reserved capacity is released and you
-- can no longer launch instances into it. The Capacity Reservation\'s
-- state changes to @expired@ when it reaches its end date and time.
--
-- You must provide an @EndDate@ value if @EndDateType@ is @limited@. Omit
-- @EndDate@ if @EndDateType@ is @unlimited@.
--
-- If the @EndDateType@ is @limited@, the Capacity Reservation is cancelled
-- within an hour from the specified time. For example, if you specify
-- 5\/31\/2019, 13:30:55, the Capacity Reservation is guaranteed to end
-- between 13:30:55 and 14:30:55 on 5\/31\/2019.
createCapacityReservation_endDate :: Lens.Lens' CreateCapacityReservation (Prelude.Maybe Prelude.UTCTime)
createCapacityReservation_endDate :: Lens' CreateCapacityReservation (Maybe UTCTime)
createCapacityReservation_endDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityReservation' {Maybe ISO8601
endDate :: Maybe ISO8601
$sel:endDate:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe ISO8601
endDate} -> Maybe ISO8601
endDate) (\s :: CreateCapacityReservation
s@CreateCapacityReservation' {} Maybe ISO8601
a -> CreateCapacityReservation
s {$sel:endDate:CreateCapacityReservation' :: Maybe ISO8601
endDate = Maybe ISO8601
a} :: CreateCapacityReservation) 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 (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | Indicates the way in which the Capacity Reservation ends. A Capacity
-- Reservation can have one of the following end types:
--
-- -   @unlimited@ - The Capacity Reservation remains active until you
--     explicitly cancel it. Do not provide an @EndDate@ if the
--     @EndDateType@ is @unlimited@.
--
-- -   @limited@ - The Capacity Reservation expires automatically at a
--     specified date and time. You must provide an @EndDate@ value if the
--     @EndDateType@ value is @limited@.
createCapacityReservation_endDateType :: Lens.Lens' CreateCapacityReservation (Prelude.Maybe EndDateType)
createCapacityReservation_endDateType :: Lens' CreateCapacityReservation (Maybe EndDateType)
createCapacityReservation_endDateType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityReservation' {Maybe EndDateType
endDateType :: Maybe EndDateType
$sel:endDateType:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe EndDateType
endDateType} -> Maybe EndDateType
endDateType) (\s :: CreateCapacityReservation
s@CreateCapacityReservation' {} Maybe EndDateType
a -> CreateCapacityReservation
s {$sel:endDateType:CreateCapacityReservation' :: Maybe EndDateType
endDateType = Maybe EndDateType
a} :: CreateCapacityReservation)

-- | /Deprecated./
createCapacityReservation_ephemeralStorage :: Lens.Lens' CreateCapacityReservation (Prelude.Maybe Prelude.Bool)
createCapacityReservation_ephemeralStorage :: Lens' CreateCapacityReservation (Maybe Bool)
createCapacityReservation_ephemeralStorage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityReservation' {Maybe Bool
ephemeralStorage :: Maybe Bool
$sel:ephemeralStorage:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Bool
ephemeralStorage} -> Maybe Bool
ephemeralStorage) (\s :: CreateCapacityReservation
s@CreateCapacityReservation' {} Maybe Bool
a -> CreateCapacityReservation
s {$sel:ephemeralStorage:CreateCapacityReservation' :: Maybe Bool
ephemeralStorage = Maybe Bool
a} :: CreateCapacityReservation)

-- | Indicates the type of instance launches that the Capacity Reservation
-- accepts. The options include:
--
-- -   @open@ - The Capacity Reservation automatically matches all
--     instances that have matching attributes (instance type, platform,
--     and Availability Zone). Instances that have matching attributes run
--     in the Capacity Reservation automatically without specifying any
--     additional parameters.
--
-- -   @targeted@ - The Capacity Reservation only accepts instances that
--     have matching attributes (instance type, platform, and Availability
--     Zone), and explicitly target the Capacity Reservation. This ensures
--     that only permitted instances can use the reserved capacity.
--
-- Default: @open@
createCapacityReservation_instanceMatchCriteria :: Lens.Lens' CreateCapacityReservation (Prelude.Maybe InstanceMatchCriteria)
createCapacityReservation_instanceMatchCriteria :: Lens' CreateCapacityReservation (Maybe InstanceMatchCriteria)
createCapacityReservation_instanceMatchCriteria = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityReservation' {Maybe InstanceMatchCriteria
instanceMatchCriteria :: Maybe InstanceMatchCriteria
$sel:instanceMatchCriteria:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe InstanceMatchCriteria
instanceMatchCriteria} -> Maybe InstanceMatchCriteria
instanceMatchCriteria) (\s :: CreateCapacityReservation
s@CreateCapacityReservation' {} Maybe InstanceMatchCriteria
a -> CreateCapacityReservation
s {$sel:instanceMatchCriteria:CreateCapacityReservation' :: Maybe InstanceMatchCriteria
instanceMatchCriteria = Maybe InstanceMatchCriteria
a} :: CreateCapacityReservation)

-- | The Amazon Resource Name (ARN) of the Outpost on which to create the
-- Capacity Reservation.
createCapacityReservation_outpostArn :: Lens.Lens' CreateCapacityReservation (Prelude.Maybe Prelude.Text)
createCapacityReservation_outpostArn :: Lens' CreateCapacityReservation (Maybe Text)
createCapacityReservation_outpostArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityReservation' {Maybe Text
outpostArn :: Maybe Text
$sel:outpostArn:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
outpostArn} -> Maybe Text
outpostArn) (\s :: CreateCapacityReservation
s@CreateCapacityReservation' {} Maybe Text
a -> CreateCapacityReservation
s {$sel:outpostArn:CreateCapacityReservation' :: Maybe Text
outpostArn = Maybe Text
a} :: CreateCapacityReservation)

-- | The Amazon Resource Name (ARN) of the cluster placement group in which
-- to create the Capacity Reservation. For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/cr-cpg.html Capacity Reservations for cluster placement groups>
-- in the /Amazon EC2 User Guide/.
createCapacityReservation_placementGroupArn :: Lens.Lens' CreateCapacityReservation (Prelude.Maybe Prelude.Text)
createCapacityReservation_placementGroupArn :: Lens' CreateCapacityReservation (Maybe Text)
createCapacityReservation_placementGroupArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityReservation' {Maybe Text
placementGroupArn :: Maybe Text
$sel:placementGroupArn:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
placementGroupArn} -> Maybe Text
placementGroupArn) (\s :: CreateCapacityReservation
s@CreateCapacityReservation' {} Maybe Text
a -> CreateCapacityReservation
s {$sel:placementGroupArn:CreateCapacityReservation' :: Maybe Text
placementGroupArn = Maybe Text
a} :: CreateCapacityReservation)

-- | The tags to apply to the Capacity Reservation during launch.
createCapacityReservation_tagSpecifications :: Lens.Lens' CreateCapacityReservation (Prelude.Maybe [TagSpecification])
createCapacityReservation_tagSpecifications :: Lens' CreateCapacityReservation (Maybe [TagSpecification])
createCapacityReservation_tagSpecifications = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityReservation' {Maybe [TagSpecification]
tagSpecifications :: Maybe [TagSpecification]
$sel:tagSpecifications:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe [TagSpecification]
tagSpecifications} -> Maybe [TagSpecification]
tagSpecifications) (\s :: CreateCapacityReservation
s@CreateCapacityReservation' {} Maybe [TagSpecification]
a -> CreateCapacityReservation
s {$sel:tagSpecifications:CreateCapacityReservation' :: Maybe [TagSpecification]
tagSpecifications = Maybe [TagSpecification]
a} :: CreateCapacityReservation) 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

-- | Indicates the tenancy of the Capacity Reservation. A Capacity
-- Reservation can have one of the following tenancy settings:
--
-- -   @default@ - The Capacity Reservation is created on hardware that is
--     shared with other Amazon Web Services accounts.
--
-- -   @dedicated@ - The Capacity Reservation is created on single-tenant
--     hardware that is dedicated to a single Amazon Web Services account.
createCapacityReservation_tenancy :: Lens.Lens' CreateCapacityReservation (Prelude.Maybe CapacityReservationTenancy)
createCapacityReservation_tenancy :: Lens' CreateCapacityReservation (Maybe CapacityReservationTenancy)
createCapacityReservation_tenancy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityReservation' {Maybe CapacityReservationTenancy
tenancy :: Maybe CapacityReservationTenancy
$sel:tenancy:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe CapacityReservationTenancy
tenancy} -> Maybe CapacityReservationTenancy
tenancy) (\s :: CreateCapacityReservation
s@CreateCapacityReservation' {} Maybe CapacityReservationTenancy
a -> CreateCapacityReservation
s {$sel:tenancy:CreateCapacityReservation' :: Maybe CapacityReservationTenancy
tenancy = Maybe CapacityReservationTenancy
a} :: CreateCapacityReservation)

-- | The instance type for which to reserve capacity. For more information,
-- see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html Instance types>
-- in the /Amazon EC2 User Guide/.
createCapacityReservation_instanceType :: Lens.Lens' CreateCapacityReservation Prelude.Text
createCapacityReservation_instanceType :: Lens' CreateCapacityReservation Text
createCapacityReservation_instanceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityReservation' {Text
instanceType :: Text
$sel:instanceType:CreateCapacityReservation' :: CreateCapacityReservation -> Text
instanceType} -> Text
instanceType) (\s :: CreateCapacityReservation
s@CreateCapacityReservation' {} Text
a -> CreateCapacityReservation
s {$sel:instanceType:CreateCapacityReservation' :: Text
instanceType = Text
a} :: CreateCapacityReservation)

-- | The type of operating system for which to reserve capacity.
createCapacityReservation_instancePlatform :: Lens.Lens' CreateCapacityReservation CapacityReservationInstancePlatform
createCapacityReservation_instancePlatform :: Lens' CreateCapacityReservation CapacityReservationInstancePlatform
createCapacityReservation_instancePlatform = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityReservation' {CapacityReservationInstancePlatform
instancePlatform :: CapacityReservationInstancePlatform
$sel:instancePlatform:CreateCapacityReservation' :: CreateCapacityReservation -> CapacityReservationInstancePlatform
instancePlatform} -> CapacityReservationInstancePlatform
instancePlatform) (\s :: CreateCapacityReservation
s@CreateCapacityReservation' {} CapacityReservationInstancePlatform
a -> CreateCapacityReservation
s {$sel:instancePlatform:CreateCapacityReservation' :: CapacityReservationInstancePlatform
instancePlatform = CapacityReservationInstancePlatform
a} :: CreateCapacityReservation)

-- | The number of instances for which to reserve capacity.
--
-- Valid range: 1 - 1000
createCapacityReservation_instanceCount :: Lens.Lens' CreateCapacityReservation Prelude.Int
createCapacityReservation_instanceCount :: Lens' CreateCapacityReservation Int
createCapacityReservation_instanceCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityReservation' {Int
instanceCount :: Int
$sel:instanceCount:CreateCapacityReservation' :: CreateCapacityReservation -> Int
instanceCount} -> Int
instanceCount) (\s :: CreateCapacityReservation
s@CreateCapacityReservation' {} Int
a -> CreateCapacityReservation
s {$sel:instanceCount:CreateCapacityReservation' :: Int
instanceCount = Int
a} :: CreateCapacityReservation)

instance Core.AWSRequest CreateCapacityReservation where
  type
    AWSResponse CreateCapacityReservation =
      CreateCapacityReservationResponse
  request :: (Service -> Service)
-> CreateCapacityReservation -> Request CreateCapacityReservation
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy CreateCapacityReservation
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateCapacityReservation)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe CapacityReservation
-> Int -> CreateCapacityReservationResponse
CreateCapacityReservationResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"capacityReservation")
            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 CreateCapacityReservation where
  hashWithSalt :: Int -> CreateCapacityReservation -> Int
hashWithSalt Int
_salt CreateCapacityReservation' {Int
Maybe Bool
Maybe [TagSpecification]
Maybe Text
Maybe ISO8601
Maybe CapacityReservationTenancy
Maybe EndDateType
Maybe InstanceMatchCriteria
Text
CapacityReservationInstancePlatform
instanceCount :: Int
instancePlatform :: CapacityReservationInstancePlatform
instanceType :: Text
tenancy :: Maybe CapacityReservationTenancy
tagSpecifications :: Maybe [TagSpecification]
placementGroupArn :: Maybe Text
outpostArn :: Maybe Text
instanceMatchCriteria :: Maybe InstanceMatchCriteria
ephemeralStorage :: Maybe Bool
endDateType :: Maybe EndDateType
endDate :: Maybe ISO8601
ebsOptimized :: Maybe Bool
dryRun :: Maybe Bool
clientToken :: Maybe Text
availabilityZoneId :: Maybe Text
availabilityZone :: Maybe Text
$sel:instanceCount:CreateCapacityReservation' :: CreateCapacityReservation -> Int
$sel:instancePlatform:CreateCapacityReservation' :: CreateCapacityReservation -> CapacityReservationInstancePlatform
$sel:instanceType:CreateCapacityReservation' :: CreateCapacityReservation -> Text
$sel:tenancy:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe CapacityReservationTenancy
$sel:tagSpecifications:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe [TagSpecification]
$sel:placementGroupArn:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
$sel:outpostArn:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
$sel:instanceMatchCriteria:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe InstanceMatchCriteria
$sel:ephemeralStorage:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Bool
$sel:endDateType:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe EndDateType
$sel:endDate:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe ISO8601
$sel:ebsOptimized:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Bool
$sel:dryRun:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Bool
$sel:clientToken:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
$sel:availabilityZoneId:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
$sel:availabilityZone:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
availabilityZone
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
availabilityZoneId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
ebsOptimized
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
endDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe EndDateType
endDateType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
ephemeralStorage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe InstanceMatchCriteria
instanceMatchCriteria
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
outpostArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
placementGroupArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [TagSpecification]
tagSpecifications
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe CapacityReservationTenancy
tenancy
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
instanceType
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` CapacityReservationInstancePlatform
instancePlatform
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Int
instanceCount

instance Prelude.NFData CreateCapacityReservation where
  rnf :: CreateCapacityReservation -> ()
rnf CreateCapacityReservation' {Int
Maybe Bool
Maybe [TagSpecification]
Maybe Text
Maybe ISO8601
Maybe CapacityReservationTenancy
Maybe EndDateType
Maybe InstanceMatchCriteria
Text
CapacityReservationInstancePlatform
instanceCount :: Int
instancePlatform :: CapacityReservationInstancePlatform
instanceType :: Text
tenancy :: Maybe CapacityReservationTenancy
tagSpecifications :: Maybe [TagSpecification]
placementGroupArn :: Maybe Text
outpostArn :: Maybe Text
instanceMatchCriteria :: Maybe InstanceMatchCriteria
ephemeralStorage :: Maybe Bool
endDateType :: Maybe EndDateType
endDate :: Maybe ISO8601
ebsOptimized :: Maybe Bool
dryRun :: Maybe Bool
clientToken :: Maybe Text
availabilityZoneId :: Maybe Text
availabilityZone :: Maybe Text
$sel:instanceCount:CreateCapacityReservation' :: CreateCapacityReservation -> Int
$sel:instancePlatform:CreateCapacityReservation' :: CreateCapacityReservation -> CapacityReservationInstancePlatform
$sel:instanceType:CreateCapacityReservation' :: CreateCapacityReservation -> Text
$sel:tenancy:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe CapacityReservationTenancy
$sel:tagSpecifications:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe [TagSpecification]
$sel:placementGroupArn:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
$sel:outpostArn:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
$sel:instanceMatchCriteria:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe InstanceMatchCriteria
$sel:ephemeralStorage:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Bool
$sel:endDateType:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe EndDateType
$sel:endDate:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe ISO8601
$sel:ebsOptimized:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Bool
$sel:dryRun:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Bool
$sel:clientToken:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
$sel:availabilityZoneId:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
$sel:availabilityZone:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
availabilityZone
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
availabilityZoneId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
clientToken
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
dryRun
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
ebsOptimized
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
endDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe EndDateType
endDateType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
ephemeralStorage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe InstanceMatchCriteria
instanceMatchCriteria
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
outpostArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
placementGroupArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [TagSpecification]
tagSpecifications
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe CapacityReservationTenancy
tenancy
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
instanceType
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf CapacityReservationInstancePlatform
instancePlatform
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
instanceCount

instance Data.ToHeaders CreateCapacityReservation where
  toHeaders :: CreateCapacityReservation -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty

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

instance Data.ToQuery CreateCapacityReservation where
  toQuery :: CreateCapacityReservation -> QueryString
toQuery CreateCapacityReservation' {Int
Maybe Bool
Maybe [TagSpecification]
Maybe Text
Maybe ISO8601
Maybe CapacityReservationTenancy
Maybe EndDateType
Maybe InstanceMatchCriteria
Text
CapacityReservationInstancePlatform
instanceCount :: Int
instancePlatform :: CapacityReservationInstancePlatform
instanceType :: Text
tenancy :: Maybe CapacityReservationTenancy
tagSpecifications :: Maybe [TagSpecification]
placementGroupArn :: Maybe Text
outpostArn :: Maybe Text
instanceMatchCriteria :: Maybe InstanceMatchCriteria
ephemeralStorage :: Maybe Bool
endDateType :: Maybe EndDateType
endDate :: Maybe ISO8601
ebsOptimized :: Maybe Bool
dryRun :: Maybe Bool
clientToken :: Maybe Text
availabilityZoneId :: Maybe Text
availabilityZone :: Maybe Text
$sel:instanceCount:CreateCapacityReservation' :: CreateCapacityReservation -> Int
$sel:instancePlatform:CreateCapacityReservation' :: CreateCapacityReservation -> CapacityReservationInstancePlatform
$sel:instanceType:CreateCapacityReservation' :: CreateCapacityReservation -> Text
$sel:tenancy:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe CapacityReservationTenancy
$sel:tagSpecifications:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe [TagSpecification]
$sel:placementGroupArn:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
$sel:outpostArn:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
$sel:instanceMatchCriteria:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe InstanceMatchCriteria
$sel:ephemeralStorage:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Bool
$sel:endDateType:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe EndDateType
$sel:endDate:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe ISO8601
$sel:ebsOptimized:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Bool
$sel:dryRun:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Bool
$sel:clientToken:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
$sel:availabilityZoneId:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
$sel:availabilityZone:CreateCapacityReservation' :: CreateCapacityReservation -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"CreateCapacityReservation" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
        ByteString
"AvailabilityZone" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
availabilityZone,
        ByteString
"AvailabilityZoneId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
availabilityZoneId,
        ByteString
"ClientToken" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
clientToken,
        ByteString
"DryRun" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
dryRun,
        ByteString
"EbsOptimized" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
ebsOptimized,
        ByteString
"EndDate" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe ISO8601
endDate,
        ByteString
"EndDateType" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe EndDateType
endDateType,
        ByteString
"EphemeralStorage" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
ephemeralStorage,
        ByteString
"InstanceMatchCriteria"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe InstanceMatchCriteria
instanceMatchCriteria,
        ByteString
"OutpostArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
outpostArn,
        ByteString
"PlacementGroupArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
placementGroupArn,
        forall a. ToQuery a => a -> QueryString
Data.toQuery
          ( forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"TagSpecifications"
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [TagSpecification]
tagSpecifications
          ),
        ByteString
"Tenancy" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe CapacityReservationTenancy
tenancy,
        ByteString
"InstanceType" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
instanceType,
        ByteString
"InstancePlatform" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: CapacityReservationInstancePlatform
instancePlatform,
        ByteString
"InstanceCount" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Int
instanceCount
      ]

-- | /See:/ 'newCreateCapacityReservationResponse' smart constructor.
data CreateCapacityReservationResponse = CreateCapacityReservationResponse'
  { -- | Information about the Capacity Reservation.
    CreateCapacityReservationResponse -> Maybe CapacityReservation
capacityReservation :: Prelude.Maybe CapacityReservation,
    -- | The response's http status code.
    CreateCapacityReservationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateCapacityReservationResponse
-> CreateCapacityReservationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateCapacityReservationResponse
-> CreateCapacityReservationResponse -> Bool
$c/= :: CreateCapacityReservationResponse
-> CreateCapacityReservationResponse -> Bool
== :: CreateCapacityReservationResponse
-> CreateCapacityReservationResponse -> Bool
$c== :: CreateCapacityReservationResponse
-> CreateCapacityReservationResponse -> Bool
Prelude.Eq, ReadPrec [CreateCapacityReservationResponse]
ReadPrec CreateCapacityReservationResponse
Int -> ReadS CreateCapacityReservationResponse
ReadS [CreateCapacityReservationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateCapacityReservationResponse]
$creadListPrec :: ReadPrec [CreateCapacityReservationResponse]
readPrec :: ReadPrec CreateCapacityReservationResponse
$creadPrec :: ReadPrec CreateCapacityReservationResponse
readList :: ReadS [CreateCapacityReservationResponse]
$creadList :: ReadS [CreateCapacityReservationResponse]
readsPrec :: Int -> ReadS CreateCapacityReservationResponse
$creadsPrec :: Int -> ReadS CreateCapacityReservationResponse
Prelude.Read, Int -> CreateCapacityReservationResponse -> ShowS
[CreateCapacityReservationResponse] -> ShowS
CreateCapacityReservationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateCapacityReservationResponse] -> ShowS
$cshowList :: [CreateCapacityReservationResponse] -> ShowS
show :: CreateCapacityReservationResponse -> String
$cshow :: CreateCapacityReservationResponse -> String
showsPrec :: Int -> CreateCapacityReservationResponse -> ShowS
$cshowsPrec :: Int -> CreateCapacityReservationResponse -> ShowS
Prelude.Show, forall x.
Rep CreateCapacityReservationResponse x
-> CreateCapacityReservationResponse
forall x.
CreateCapacityReservationResponse
-> Rep CreateCapacityReservationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateCapacityReservationResponse x
-> CreateCapacityReservationResponse
$cfrom :: forall x.
CreateCapacityReservationResponse
-> Rep CreateCapacityReservationResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateCapacityReservationResponse' 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:
--
-- 'capacityReservation', 'createCapacityReservationResponse_capacityReservation' - Information about the Capacity Reservation.
--
-- 'httpStatus', 'createCapacityReservationResponse_httpStatus' - The response's http status code.
newCreateCapacityReservationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateCapacityReservationResponse
newCreateCapacityReservationResponse :: Int -> CreateCapacityReservationResponse
newCreateCapacityReservationResponse Int
pHttpStatus_ =
  CreateCapacityReservationResponse'
    { $sel:capacityReservation:CreateCapacityReservationResponse' :: Maybe CapacityReservation
capacityReservation =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateCapacityReservationResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the Capacity Reservation.
createCapacityReservationResponse_capacityReservation :: Lens.Lens' CreateCapacityReservationResponse (Prelude.Maybe CapacityReservation)
createCapacityReservationResponse_capacityReservation :: Lens' CreateCapacityReservationResponse (Maybe CapacityReservation)
createCapacityReservationResponse_capacityReservation = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateCapacityReservationResponse' {Maybe CapacityReservation
capacityReservation :: Maybe CapacityReservation
$sel:capacityReservation:CreateCapacityReservationResponse' :: CreateCapacityReservationResponse -> Maybe CapacityReservation
capacityReservation} -> Maybe CapacityReservation
capacityReservation) (\s :: CreateCapacityReservationResponse
s@CreateCapacityReservationResponse' {} Maybe CapacityReservation
a -> CreateCapacityReservationResponse
s {$sel:capacityReservation:CreateCapacityReservationResponse' :: Maybe CapacityReservation
capacityReservation = Maybe CapacityReservation
a} :: CreateCapacityReservationResponse)

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

instance
  Prelude.NFData
    CreateCapacityReservationResponse
  where
  rnf :: CreateCapacityReservationResponse -> ()
rnf CreateCapacityReservationResponse' {Int
Maybe CapacityReservation
httpStatus :: Int
capacityReservation :: Maybe CapacityReservation
$sel:httpStatus:CreateCapacityReservationResponse' :: CreateCapacityReservationResponse -> Int
$sel:capacityReservation:CreateCapacityReservationResponse' :: CreateCapacityReservationResponse -> Maybe CapacityReservation
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe CapacityReservation
capacityReservation
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus