{-# 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.MediaLive.StartInputDeviceMaintenanceWindow
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Start a maintenance window for the specified input device. Starting a
-- maintenance window will give the device up to two hours to install
-- software. If the device was streaming prior to the maintenance, it will
-- resume streaming when the software is fully installed. Devices
-- automatically install updates while they are powered on and their
-- MediaLive channels are stopped. A maintenance window allows you to
-- update a device without having to stop MediaLive channels that use the
-- device. The device must remain powered on and connected to the internet
-- for the duration of the maintenance.
module Amazonka.MediaLive.StartInputDeviceMaintenanceWindow
  ( -- * Creating a Request
    StartInputDeviceMaintenanceWindow (..),
    newStartInputDeviceMaintenanceWindow,

    -- * Request Lenses
    startInputDeviceMaintenanceWindow_inputDeviceId,

    -- * Destructuring the Response
    StartInputDeviceMaintenanceWindowResponse (..),
    newStartInputDeviceMaintenanceWindowResponse,

    -- * Response Lenses
    startInputDeviceMaintenanceWindowResponse_httpStatus,
  )
where

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

-- | Placeholder documentation for StartInputDeviceMaintenanceWindowRequest
--
-- /See:/ 'newStartInputDeviceMaintenanceWindow' smart constructor.
data StartInputDeviceMaintenanceWindow = StartInputDeviceMaintenanceWindow'
  { -- | The unique ID of the input device to start a maintenance window for. For
    -- example, hd-123456789abcdef.
    StartInputDeviceMaintenanceWindow -> Text
inputDeviceId :: Prelude.Text
  }
  deriving (StartInputDeviceMaintenanceWindow
-> StartInputDeviceMaintenanceWindow -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: StartInputDeviceMaintenanceWindow
-> StartInputDeviceMaintenanceWindow -> Bool
$c/= :: StartInputDeviceMaintenanceWindow
-> StartInputDeviceMaintenanceWindow -> Bool
== :: StartInputDeviceMaintenanceWindow
-> StartInputDeviceMaintenanceWindow -> Bool
$c== :: StartInputDeviceMaintenanceWindow
-> StartInputDeviceMaintenanceWindow -> Bool
Prelude.Eq, ReadPrec [StartInputDeviceMaintenanceWindow]
ReadPrec StartInputDeviceMaintenanceWindow
Int -> ReadS StartInputDeviceMaintenanceWindow
ReadS [StartInputDeviceMaintenanceWindow]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [StartInputDeviceMaintenanceWindow]
$creadListPrec :: ReadPrec [StartInputDeviceMaintenanceWindow]
readPrec :: ReadPrec StartInputDeviceMaintenanceWindow
$creadPrec :: ReadPrec StartInputDeviceMaintenanceWindow
readList :: ReadS [StartInputDeviceMaintenanceWindow]
$creadList :: ReadS [StartInputDeviceMaintenanceWindow]
readsPrec :: Int -> ReadS StartInputDeviceMaintenanceWindow
$creadsPrec :: Int -> ReadS StartInputDeviceMaintenanceWindow
Prelude.Read, Int -> StartInputDeviceMaintenanceWindow -> ShowS
[StartInputDeviceMaintenanceWindow] -> ShowS
StartInputDeviceMaintenanceWindow -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [StartInputDeviceMaintenanceWindow] -> ShowS
$cshowList :: [StartInputDeviceMaintenanceWindow] -> ShowS
show :: StartInputDeviceMaintenanceWindow -> String
$cshow :: StartInputDeviceMaintenanceWindow -> String
showsPrec :: Int -> StartInputDeviceMaintenanceWindow -> ShowS
$cshowsPrec :: Int -> StartInputDeviceMaintenanceWindow -> ShowS
Prelude.Show, forall x.
Rep StartInputDeviceMaintenanceWindow x
-> StartInputDeviceMaintenanceWindow
forall x.
StartInputDeviceMaintenanceWindow
-> Rep StartInputDeviceMaintenanceWindow x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep StartInputDeviceMaintenanceWindow x
-> StartInputDeviceMaintenanceWindow
$cfrom :: forall x.
StartInputDeviceMaintenanceWindow
-> Rep StartInputDeviceMaintenanceWindow x
Prelude.Generic)

-- |
-- Create a value of 'StartInputDeviceMaintenanceWindow' 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:
--
-- 'inputDeviceId', 'startInputDeviceMaintenanceWindow_inputDeviceId' - The unique ID of the input device to start a maintenance window for. For
-- example, hd-123456789abcdef.
newStartInputDeviceMaintenanceWindow ::
  -- | 'inputDeviceId'
  Prelude.Text ->
  StartInputDeviceMaintenanceWindow
newStartInputDeviceMaintenanceWindow :: Text -> StartInputDeviceMaintenanceWindow
newStartInputDeviceMaintenanceWindow Text
pInputDeviceId_ =
  StartInputDeviceMaintenanceWindow'
    { $sel:inputDeviceId:StartInputDeviceMaintenanceWindow' :: Text
inputDeviceId =
        Text
pInputDeviceId_
    }

-- | The unique ID of the input device to start a maintenance window for. For
-- example, hd-123456789abcdef.
startInputDeviceMaintenanceWindow_inputDeviceId :: Lens.Lens' StartInputDeviceMaintenanceWindow Prelude.Text
startInputDeviceMaintenanceWindow_inputDeviceId :: Lens' StartInputDeviceMaintenanceWindow Text
startInputDeviceMaintenanceWindow_inputDeviceId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\StartInputDeviceMaintenanceWindow' {Text
inputDeviceId :: Text
$sel:inputDeviceId:StartInputDeviceMaintenanceWindow' :: StartInputDeviceMaintenanceWindow -> Text
inputDeviceId} -> Text
inputDeviceId) (\s :: StartInputDeviceMaintenanceWindow
s@StartInputDeviceMaintenanceWindow' {} Text
a -> StartInputDeviceMaintenanceWindow
s {$sel:inputDeviceId:StartInputDeviceMaintenanceWindow' :: Text
inputDeviceId = Text
a} :: StartInputDeviceMaintenanceWindow)

instance
  Core.AWSRequest
    StartInputDeviceMaintenanceWindow
  where
  type
    AWSResponse StartInputDeviceMaintenanceWindow =
      StartInputDeviceMaintenanceWindowResponse
  request :: (Service -> Service)
-> StartInputDeviceMaintenanceWindow
-> Request StartInputDeviceMaintenanceWindow
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 StartInputDeviceMaintenanceWindow
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse StartInputDeviceMaintenanceWindow)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> StartInputDeviceMaintenanceWindowResponse
StartInputDeviceMaintenanceWindowResponse'
            forall (f :: * -> *) a b. Functor 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
    StartInputDeviceMaintenanceWindow
  where
  hashWithSalt :: Int -> StartInputDeviceMaintenanceWindow -> Int
hashWithSalt
    Int
_salt
    StartInputDeviceMaintenanceWindow' {Text
inputDeviceId :: Text
$sel:inputDeviceId:StartInputDeviceMaintenanceWindow' :: StartInputDeviceMaintenanceWindow -> Text
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
inputDeviceId

instance
  Prelude.NFData
    StartInputDeviceMaintenanceWindow
  where
  rnf :: StartInputDeviceMaintenanceWindow -> ()
rnf StartInputDeviceMaintenanceWindow' {Text
inputDeviceId :: Text
$sel:inputDeviceId:StartInputDeviceMaintenanceWindow' :: StartInputDeviceMaintenanceWindow -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
inputDeviceId

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

instance
  Data.ToJSON
    StartInputDeviceMaintenanceWindow
  where
  toJSON :: StartInputDeviceMaintenanceWindow -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)

instance
  Data.ToPath
    StartInputDeviceMaintenanceWindow
  where
  toPath :: StartInputDeviceMaintenanceWindow -> ByteString
toPath StartInputDeviceMaintenanceWindow' {Text
inputDeviceId :: Text
$sel:inputDeviceId:StartInputDeviceMaintenanceWindow' :: StartInputDeviceMaintenanceWindow -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/prod/inputDevices/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
inputDeviceId,
        ByteString
"/startInputDeviceMaintenanceWindow"
      ]

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

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

-- |
-- Create a value of 'StartInputDeviceMaintenanceWindowResponse' 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:
--
-- 'httpStatus', 'startInputDeviceMaintenanceWindowResponse_httpStatus' - The response's http status code.
newStartInputDeviceMaintenanceWindowResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  StartInputDeviceMaintenanceWindowResponse
newStartInputDeviceMaintenanceWindowResponse :: Int -> StartInputDeviceMaintenanceWindowResponse
newStartInputDeviceMaintenanceWindowResponse
  Int
pHttpStatus_ =
    StartInputDeviceMaintenanceWindowResponse'
      { $sel:httpStatus:StartInputDeviceMaintenanceWindowResponse' :: Int
httpStatus =
          Int
pHttpStatus_
      }

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

instance
  Prelude.NFData
    StartInputDeviceMaintenanceWindowResponse
  where
  rnf :: StartInputDeviceMaintenanceWindowResponse -> ()
rnf StartInputDeviceMaintenanceWindowResponse' {Int
httpStatus :: Int
$sel:httpStatus:StartInputDeviceMaintenanceWindowResponse' :: StartInputDeviceMaintenanceWindowResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus