{-# 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.CreateInstanceEventWindow
-- 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 an event window in which scheduled events for the associated
-- Amazon EC2 instances can run.
--
-- You can define either a set of time ranges or a cron expression when
-- creating the event window, but not both. All event window times are in
-- UTC.
--
-- You can create up to 200 event windows per Amazon Web Services Region.
--
-- When you create the event window, targets (instance IDs, Dedicated Host
-- IDs, or tags) are not yet associated with it. To ensure that the event
-- window can be used, you must associate one or more targets with it by
-- using the AssociateInstanceEventWindow API.
--
-- Event windows are applicable only for scheduled events that stop,
-- reboot, or terminate instances.
--
-- Event windows are /not/ applicable for:
--
-- -   Expedited scheduled events and network maintenance events.
--
-- -   Unscheduled maintenance such as AutoRecovery and unplanned reboots.
--
-- For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/event-windows.html Define event windows for scheduled events>
-- in the /Amazon EC2 User Guide/.
module Amazonka.EC2.CreateInstanceEventWindow
  ( -- * Creating a Request
    CreateInstanceEventWindow (..),
    newCreateInstanceEventWindow,

    -- * Request Lenses
    createInstanceEventWindow_cronExpression,
    createInstanceEventWindow_dryRun,
    createInstanceEventWindow_name,
    createInstanceEventWindow_tagSpecifications,
    createInstanceEventWindow_timeRanges,

    -- * Destructuring the Response
    CreateInstanceEventWindowResponse (..),
    newCreateInstanceEventWindowResponse,

    -- * Response Lenses
    createInstanceEventWindowResponse_instanceEventWindow,
    createInstanceEventWindowResponse_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:/ 'newCreateInstanceEventWindow' smart constructor.
data CreateInstanceEventWindow = CreateInstanceEventWindow'
  { -- | The cron expression for the event window, for example,
    -- @* 0-4,20-23 * * 1,5@. If you specify a cron expression, you can\'t
    -- specify a time range.
    --
    -- Constraints:
    --
    -- -   Only hour and day of the week values are supported.
    --
    -- -   For day of the week values, you can specify either integers @0@
    --     through @6@, or alternative single values @SUN@ through @SAT@.
    --
    -- -   The minute, month, and year must be specified by @*@.
    --
    -- -   The hour value must be one or a multiple range, for example, @0-4@
    --     or @0-4,20-23@.
    --
    -- -   Each hour range must be >= 2 hours, for example, @0-2@ or @20-23@.
    --
    -- -   The event window must be >= 4 hours. The combined total time ranges
    --     in the event window must be >= 4 hours.
    --
    -- For more information about cron expressions, see
    -- <https://en.wikipedia.org/wiki/Cron cron> on the /Wikipedia website/.
    CreateInstanceEventWindow -> Maybe Text
cronExpression :: 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@.
    CreateInstanceEventWindow -> Maybe Bool
dryRun :: Prelude.Maybe Prelude.Bool,
    -- | The name of the event window.
    CreateInstanceEventWindow -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The tags to apply to the event window.
    CreateInstanceEventWindow -> Maybe [TagSpecification]
tagSpecifications :: Prelude.Maybe [TagSpecification],
    -- | The time range for the event window. If you specify a time range, you
    -- can\'t specify a cron expression.
    CreateInstanceEventWindow
-> Maybe [InstanceEventWindowTimeRangeRequest]
timeRanges :: Prelude.Maybe [InstanceEventWindowTimeRangeRequest]
  }
  deriving (CreateInstanceEventWindow -> CreateInstanceEventWindow -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateInstanceEventWindow -> CreateInstanceEventWindow -> Bool
$c/= :: CreateInstanceEventWindow -> CreateInstanceEventWindow -> Bool
== :: CreateInstanceEventWindow -> CreateInstanceEventWindow -> Bool
$c== :: CreateInstanceEventWindow -> CreateInstanceEventWindow -> Bool
Prelude.Eq, ReadPrec [CreateInstanceEventWindow]
ReadPrec CreateInstanceEventWindow
Int -> ReadS CreateInstanceEventWindow
ReadS [CreateInstanceEventWindow]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateInstanceEventWindow]
$creadListPrec :: ReadPrec [CreateInstanceEventWindow]
readPrec :: ReadPrec CreateInstanceEventWindow
$creadPrec :: ReadPrec CreateInstanceEventWindow
readList :: ReadS [CreateInstanceEventWindow]
$creadList :: ReadS [CreateInstanceEventWindow]
readsPrec :: Int -> ReadS CreateInstanceEventWindow
$creadsPrec :: Int -> ReadS CreateInstanceEventWindow
Prelude.Read, Int -> CreateInstanceEventWindow -> ShowS
[CreateInstanceEventWindow] -> ShowS
CreateInstanceEventWindow -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateInstanceEventWindow] -> ShowS
$cshowList :: [CreateInstanceEventWindow] -> ShowS
show :: CreateInstanceEventWindow -> String
$cshow :: CreateInstanceEventWindow -> String
showsPrec :: Int -> CreateInstanceEventWindow -> ShowS
$cshowsPrec :: Int -> CreateInstanceEventWindow -> ShowS
Prelude.Show, forall x.
Rep CreateInstanceEventWindow x -> CreateInstanceEventWindow
forall x.
CreateInstanceEventWindow -> Rep CreateInstanceEventWindow x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateInstanceEventWindow x -> CreateInstanceEventWindow
$cfrom :: forall x.
CreateInstanceEventWindow -> Rep CreateInstanceEventWindow x
Prelude.Generic)

-- |
-- Create a value of 'CreateInstanceEventWindow' 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:
--
-- 'cronExpression', 'createInstanceEventWindow_cronExpression' - The cron expression for the event window, for example,
-- @* 0-4,20-23 * * 1,5@. If you specify a cron expression, you can\'t
-- specify a time range.
--
-- Constraints:
--
-- -   Only hour and day of the week values are supported.
--
-- -   For day of the week values, you can specify either integers @0@
--     through @6@, or alternative single values @SUN@ through @SAT@.
--
-- -   The minute, month, and year must be specified by @*@.
--
-- -   The hour value must be one or a multiple range, for example, @0-4@
--     or @0-4,20-23@.
--
-- -   Each hour range must be >= 2 hours, for example, @0-2@ or @20-23@.
--
-- -   The event window must be >= 4 hours. The combined total time ranges
--     in the event window must be >= 4 hours.
--
-- For more information about cron expressions, see
-- <https://en.wikipedia.org/wiki/Cron cron> on the /Wikipedia website/.
--
-- 'dryRun', 'createInstanceEventWindow_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@.
--
-- 'name', 'createInstanceEventWindow_name' - The name of the event window.
--
-- 'tagSpecifications', 'createInstanceEventWindow_tagSpecifications' - The tags to apply to the event window.
--
-- 'timeRanges', 'createInstanceEventWindow_timeRanges' - The time range for the event window. If you specify a time range, you
-- can\'t specify a cron expression.
newCreateInstanceEventWindow ::
  CreateInstanceEventWindow
newCreateInstanceEventWindow :: CreateInstanceEventWindow
newCreateInstanceEventWindow =
  CreateInstanceEventWindow'
    { $sel:cronExpression:CreateInstanceEventWindow' :: Maybe Text
cronExpression =
        forall a. Maybe a
Prelude.Nothing,
      $sel:dryRun:CreateInstanceEventWindow' :: Maybe Bool
dryRun = forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateInstanceEventWindow' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:tagSpecifications:CreateInstanceEventWindow' :: Maybe [TagSpecification]
tagSpecifications = forall a. Maybe a
Prelude.Nothing,
      $sel:timeRanges:CreateInstanceEventWindow' :: Maybe [InstanceEventWindowTimeRangeRequest]
timeRanges = forall a. Maybe a
Prelude.Nothing
    }

-- | The cron expression for the event window, for example,
-- @* 0-4,20-23 * * 1,5@. If you specify a cron expression, you can\'t
-- specify a time range.
--
-- Constraints:
--
-- -   Only hour and day of the week values are supported.
--
-- -   For day of the week values, you can specify either integers @0@
--     through @6@, or alternative single values @SUN@ through @SAT@.
--
-- -   The minute, month, and year must be specified by @*@.
--
-- -   The hour value must be one or a multiple range, for example, @0-4@
--     or @0-4,20-23@.
--
-- -   Each hour range must be >= 2 hours, for example, @0-2@ or @20-23@.
--
-- -   The event window must be >= 4 hours. The combined total time ranges
--     in the event window must be >= 4 hours.
--
-- For more information about cron expressions, see
-- <https://en.wikipedia.org/wiki/Cron cron> on the /Wikipedia website/.
createInstanceEventWindow_cronExpression :: Lens.Lens' CreateInstanceEventWindow (Prelude.Maybe Prelude.Text)
createInstanceEventWindow_cronExpression :: Lens' CreateInstanceEventWindow (Maybe Text)
createInstanceEventWindow_cronExpression = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstanceEventWindow' {Maybe Text
cronExpression :: Maybe Text
$sel:cronExpression:CreateInstanceEventWindow' :: CreateInstanceEventWindow -> Maybe Text
cronExpression} -> Maybe Text
cronExpression) (\s :: CreateInstanceEventWindow
s@CreateInstanceEventWindow' {} Maybe Text
a -> CreateInstanceEventWindow
s {$sel:cronExpression:CreateInstanceEventWindow' :: Maybe Text
cronExpression = Maybe Text
a} :: CreateInstanceEventWindow)

-- | 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@.
createInstanceEventWindow_dryRun :: Lens.Lens' CreateInstanceEventWindow (Prelude.Maybe Prelude.Bool)
createInstanceEventWindow_dryRun :: Lens' CreateInstanceEventWindow (Maybe Bool)
createInstanceEventWindow_dryRun = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstanceEventWindow' {Maybe Bool
dryRun :: Maybe Bool
$sel:dryRun:CreateInstanceEventWindow' :: CreateInstanceEventWindow -> Maybe Bool
dryRun} -> Maybe Bool
dryRun) (\s :: CreateInstanceEventWindow
s@CreateInstanceEventWindow' {} Maybe Bool
a -> CreateInstanceEventWindow
s {$sel:dryRun:CreateInstanceEventWindow' :: Maybe Bool
dryRun = Maybe Bool
a} :: CreateInstanceEventWindow)

-- | The name of the event window.
createInstanceEventWindow_name :: Lens.Lens' CreateInstanceEventWindow (Prelude.Maybe Prelude.Text)
createInstanceEventWindow_name :: Lens' CreateInstanceEventWindow (Maybe Text)
createInstanceEventWindow_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstanceEventWindow' {Maybe Text
name :: Maybe Text
$sel:name:CreateInstanceEventWindow' :: CreateInstanceEventWindow -> Maybe Text
name} -> Maybe Text
name) (\s :: CreateInstanceEventWindow
s@CreateInstanceEventWindow' {} Maybe Text
a -> CreateInstanceEventWindow
s {$sel:name:CreateInstanceEventWindow' :: Maybe Text
name = Maybe Text
a} :: CreateInstanceEventWindow)

-- | The tags to apply to the event window.
createInstanceEventWindow_tagSpecifications :: Lens.Lens' CreateInstanceEventWindow (Prelude.Maybe [TagSpecification])
createInstanceEventWindow_tagSpecifications :: Lens' CreateInstanceEventWindow (Maybe [TagSpecification])
createInstanceEventWindow_tagSpecifications = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstanceEventWindow' {Maybe [TagSpecification]
tagSpecifications :: Maybe [TagSpecification]
$sel:tagSpecifications:CreateInstanceEventWindow' :: CreateInstanceEventWindow -> Maybe [TagSpecification]
tagSpecifications} -> Maybe [TagSpecification]
tagSpecifications) (\s :: CreateInstanceEventWindow
s@CreateInstanceEventWindow' {} Maybe [TagSpecification]
a -> CreateInstanceEventWindow
s {$sel:tagSpecifications:CreateInstanceEventWindow' :: Maybe [TagSpecification]
tagSpecifications = Maybe [TagSpecification]
a} :: CreateInstanceEventWindow) 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 time range for the event window. If you specify a time range, you
-- can\'t specify a cron expression.
createInstanceEventWindow_timeRanges :: Lens.Lens' CreateInstanceEventWindow (Prelude.Maybe [InstanceEventWindowTimeRangeRequest])
createInstanceEventWindow_timeRanges :: Lens'
  CreateInstanceEventWindow
  (Maybe [InstanceEventWindowTimeRangeRequest])
createInstanceEventWindow_timeRanges = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstanceEventWindow' {Maybe [InstanceEventWindowTimeRangeRequest]
timeRanges :: Maybe [InstanceEventWindowTimeRangeRequest]
$sel:timeRanges:CreateInstanceEventWindow' :: CreateInstanceEventWindow
-> Maybe [InstanceEventWindowTimeRangeRequest]
timeRanges} -> Maybe [InstanceEventWindowTimeRangeRequest]
timeRanges) (\s :: CreateInstanceEventWindow
s@CreateInstanceEventWindow' {} Maybe [InstanceEventWindowTimeRangeRequest]
a -> CreateInstanceEventWindow
s {$sel:timeRanges:CreateInstanceEventWindow' :: Maybe [InstanceEventWindowTimeRangeRequest]
timeRanges = Maybe [InstanceEventWindowTimeRangeRequest]
a} :: CreateInstanceEventWindow) 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

instance Core.AWSRequest CreateInstanceEventWindow where
  type
    AWSResponse CreateInstanceEventWindow =
      CreateInstanceEventWindowResponse
  request :: (Service -> Service)
-> CreateInstanceEventWindow -> Request CreateInstanceEventWindow
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 CreateInstanceEventWindow
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateInstanceEventWindow)))
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 InstanceEventWindow
-> Int -> CreateInstanceEventWindowResponse
CreateInstanceEventWindowResponse'
            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
"instanceEventWindow")
            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 CreateInstanceEventWindow where
  hashWithSalt :: Int -> CreateInstanceEventWindow -> Int
hashWithSalt Int
_salt CreateInstanceEventWindow' {Maybe Bool
Maybe [TagSpecification]
Maybe [InstanceEventWindowTimeRangeRequest]
Maybe Text
timeRanges :: Maybe [InstanceEventWindowTimeRangeRequest]
tagSpecifications :: Maybe [TagSpecification]
name :: Maybe Text
dryRun :: Maybe Bool
cronExpression :: Maybe Text
$sel:timeRanges:CreateInstanceEventWindow' :: CreateInstanceEventWindow
-> Maybe [InstanceEventWindowTimeRangeRequest]
$sel:tagSpecifications:CreateInstanceEventWindow' :: CreateInstanceEventWindow -> Maybe [TagSpecification]
$sel:name:CreateInstanceEventWindow' :: CreateInstanceEventWindow -> Maybe Text
$sel:dryRun:CreateInstanceEventWindow' :: CreateInstanceEventWindow -> Maybe Bool
$sel:cronExpression:CreateInstanceEventWindow' :: CreateInstanceEventWindow -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
cronExpression
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Bool
dryRun
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [TagSpecification]
tagSpecifications
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [InstanceEventWindowTimeRangeRequest]
timeRanges

instance Prelude.NFData CreateInstanceEventWindow where
  rnf :: CreateInstanceEventWindow -> ()
rnf CreateInstanceEventWindow' {Maybe Bool
Maybe [TagSpecification]
Maybe [InstanceEventWindowTimeRangeRequest]
Maybe Text
timeRanges :: Maybe [InstanceEventWindowTimeRangeRequest]
tagSpecifications :: Maybe [TagSpecification]
name :: Maybe Text
dryRun :: Maybe Bool
cronExpression :: Maybe Text
$sel:timeRanges:CreateInstanceEventWindow' :: CreateInstanceEventWindow
-> Maybe [InstanceEventWindowTimeRangeRequest]
$sel:tagSpecifications:CreateInstanceEventWindow' :: CreateInstanceEventWindow -> Maybe [TagSpecification]
$sel:name:CreateInstanceEventWindow' :: CreateInstanceEventWindow -> Maybe Text
$sel:dryRun:CreateInstanceEventWindow' :: CreateInstanceEventWindow -> Maybe Bool
$sel:cronExpression:CreateInstanceEventWindow' :: CreateInstanceEventWindow -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
cronExpression
      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 Text
name
      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 [InstanceEventWindowTimeRangeRequest]
timeRanges

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

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

instance Data.ToQuery CreateInstanceEventWindow where
  toQuery :: CreateInstanceEventWindow -> QueryString
toQuery CreateInstanceEventWindow' {Maybe Bool
Maybe [TagSpecification]
Maybe [InstanceEventWindowTimeRangeRequest]
Maybe Text
timeRanges :: Maybe [InstanceEventWindowTimeRangeRequest]
tagSpecifications :: Maybe [TagSpecification]
name :: Maybe Text
dryRun :: Maybe Bool
cronExpression :: Maybe Text
$sel:timeRanges:CreateInstanceEventWindow' :: CreateInstanceEventWindow
-> Maybe [InstanceEventWindowTimeRangeRequest]
$sel:tagSpecifications:CreateInstanceEventWindow' :: CreateInstanceEventWindow -> Maybe [TagSpecification]
$sel:name:CreateInstanceEventWindow' :: CreateInstanceEventWindow -> Maybe Text
$sel:dryRun:CreateInstanceEventWindow' :: CreateInstanceEventWindow -> Maybe Bool
$sel:cronExpression:CreateInstanceEventWindow' :: CreateInstanceEventWindow -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"CreateInstanceEventWindow" :: Prelude.ByteString),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
        ByteString
"CronExpression" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
cronExpression,
        ByteString
"DryRun" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Bool
dryRun,
        ByteString
"Name" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
name,
        forall a. ToQuery a => a -> QueryString
Data.toQuery
          ( forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"TagSpecification"
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [TagSpecification]
tagSpecifications
          ),
        forall a. ToQuery a => a -> QueryString
Data.toQuery
          ( forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"TimeRange"
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [InstanceEventWindowTimeRangeRequest]
timeRanges
          )
      ]

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

-- |
-- Create a value of 'CreateInstanceEventWindowResponse' 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:
--
-- 'instanceEventWindow', 'createInstanceEventWindowResponse_instanceEventWindow' - Information about the event window.
--
-- 'httpStatus', 'createInstanceEventWindowResponse_httpStatus' - The response's http status code.
newCreateInstanceEventWindowResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateInstanceEventWindowResponse
newCreateInstanceEventWindowResponse :: Int -> CreateInstanceEventWindowResponse
newCreateInstanceEventWindowResponse Int
pHttpStatus_ =
  CreateInstanceEventWindowResponse'
    { $sel:instanceEventWindow:CreateInstanceEventWindowResponse' :: Maybe InstanceEventWindow
instanceEventWindow =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateInstanceEventWindowResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the event window.
createInstanceEventWindowResponse_instanceEventWindow :: Lens.Lens' CreateInstanceEventWindowResponse (Prelude.Maybe InstanceEventWindow)
createInstanceEventWindowResponse_instanceEventWindow :: Lens' CreateInstanceEventWindowResponse (Maybe InstanceEventWindow)
createInstanceEventWindowResponse_instanceEventWindow = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateInstanceEventWindowResponse' {Maybe InstanceEventWindow
instanceEventWindow :: Maybe InstanceEventWindow
$sel:instanceEventWindow:CreateInstanceEventWindowResponse' :: CreateInstanceEventWindowResponse -> Maybe InstanceEventWindow
instanceEventWindow} -> Maybe InstanceEventWindow
instanceEventWindow) (\s :: CreateInstanceEventWindowResponse
s@CreateInstanceEventWindowResponse' {} Maybe InstanceEventWindow
a -> CreateInstanceEventWindowResponse
s {$sel:instanceEventWindow:CreateInstanceEventWindowResponse' :: Maybe InstanceEventWindow
instanceEventWindow = Maybe InstanceEventWindow
a} :: CreateInstanceEventWindowResponse)

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

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