{-# 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.Nimble.DeleteStreamingSession
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Deletes streaming session resource.
--
-- After invoking this operation, use GetStreamingSession to poll the
-- resource until it transitions to a @DELETED@ state.
--
-- A streaming session will count against your streaming session quota
-- until it is marked @DELETED@.
module Amazonka.Nimble.DeleteStreamingSession
  ( -- * Creating a Request
    DeleteStreamingSession (..),
    newDeleteStreamingSession,

    -- * Request Lenses
    deleteStreamingSession_clientToken,
    deleteStreamingSession_sessionId,
    deleteStreamingSession_studioId,

    -- * Destructuring the Response
    DeleteStreamingSessionResponse (..),
    newDeleteStreamingSessionResponse,

    -- * Response Lenses
    deleteStreamingSessionResponse_session,
    deleteStreamingSessionResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteStreamingSession' smart constructor.
data DeleteStreamingSession = DeleteStreamingSession'
  { -- | Unique, case-sensitive identifier that you provide to ensure the
    -- idempotency of the request. If you don’t specify a client token, the
    -- Amazon Web Services SDK automatically generates a client token and uses
    -- it for the request to ensure idempotency.
    DeleteStreamingSession -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The streaming session ID.
    DeleteStreamingSession -> Text
sessionId :: Prelude.Text,
    -- | The studio ID.
    DeleteStreamingSession -> Text
studioId :: Prelude.Text
  }
  deriving (DeleteStreamingSession -> DeleteStreamingSession -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteStreamingSession -> DeleteStreamingSession -> Bool
$c/= :: DeleteStreamingSession -> DeleteStreamingSession -> Bool
== :: DeleteStreamingSession -> DeleteStreamingSession -> Bool
$c== :: DeleteStreamingSession -> DeleteStreamingSession -> Bool
Prelude.Eq, ReadPrec [DeleteStreamingSession]
ReadPrec DeleteStreamingSession
Int -> ReadS DeleteStreamingSession
ReadS [DeleteStreamingSession]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteStreamingSession]
$creadListPrec :: ReadPrec [DeleteStreamingSession]
readPrec :: ReadPrec DeleteStreamingSession
$creadPrec :: ReadPrec DeleteStreamingSession
readList :: ReadS [DeleteStreamingSession]
$creadList :: ReadS [DeleteStreamingSession]
readsPrec :: Int -> ReadS DeleteStreamingSession
$creadsPrec :: Int -> ReadS DeleteStreamingSession
Prelude.Read, Int -> DeleteStreamingSession -> ShowS
[DeleteStreamingSession] -> ShowS
DeleteStreamingSession -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteStreamingSession] -> ShowS
$cshowList :: [DeleteStreamingSession] -> ShowS
show :: DeleteStreamingSession -> String
$cshow :: DeleteStreamingSession -> String
showsPrec :: Int -> DeleteStreamingSession -> ShowS
$cshowsPrec :: Int -> DeleteStreamingSession -> ShowS
Prelude.Show, forall x. Rep DeleteStreamingSession x -> DeleteStreamingSession
forall x. DeleteStreamingSession -> Rep DeleteStreamingSession x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteStreamingSession x -> DeleteStreamingSession
$cfrom :: forall x. DeleteStreamingSession -> Rep DeleteStreamingSession x
Prelude.Generic)

-- |
-- Create a value of 'DeleteStreamingSession' 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:
--
-- 'clientToken', 'deleteStreamingSession_clientToken' - Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request. If you don’t specify a client token, the
-- Amazon Web Services SDK automatically generates a client token and uses
-- it for the request to ensure idempotency.
--
-- 'sessionId', 'deleteStreamingSession_sessionId' - The streaming session ID.
--
-- 'studioId', 'deleteStreamingSession_studioId' - The studio ID.
newDeleteStreamingSession ::
  -- | 'sessionId'
  Prelude.Text ->
  -- | 'studioId'
  Prelude.Text ->
  DeleteStreamingSession
newDeleteStreamingSession :: Text -> Text -> DeleteStreamingSession
newDeleteStreamingSession Text
pSessionId_ Text
pStudioId_ =
  DeleteStreamingSession'
    { $sel:clientToken:DeleteStreamingSession' :: Maybe Text
clientToken =
        forall a. Maybe a
Prelude.Nothing,
      $sel:sessionId:DeleteStreamingSession' :: Text
sessionId = Text
pSessionId_,
      $sel:studioId:DeleteStreamingSession' :: Text
studioId = Text
pStudioId_
    }

-- | Unique, case-sensitive identifier that you provide to ensure the
-- idempotency of the request. If you don’t specify a client token, the
-- Amazon Web Services SDK automatically generates a client token and uses
-- it for the request to ensure idempotency.
deleteStreamingSession_clientToken :: Lens.Lens' DeleteStreamingSession (Prelude.Maybe Prelude.Text)
deleteStreamingSession_clientToken :: Lens' DeleteStreamingSession (Maybe Text)
deleteStreamingSession_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStreamingSession' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:DeleteStreamingSession' :: DeleteStreamingSession -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: DeleteStreamingSession
s@DeleteStreamingSession' {} Maybe Text
a -> DeleteStreamingSession
s {$sel:clientToken:DeleteStreamingSession' :: Maybe Text
clientToken = Maybe Text
a} :: DeleteStreamingSession)

-- | The streaming session ID.
deleteStreamingSession_sessionId :: Lens.Lens' DeleteStreamingSession Prelude.Text
deleteStreamingSession_sessionId :: Lens' DeleteStreamingSession Text
deleteStreamingSession_sessionId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStreamingSession' {Text
sessionId :: Text
$sel:sessionId:DeleteStreamingSession' :: DeleteStreamingSession -> Text
sessionId} -> Text
sessionId) (\s :: DeleteStreamingSession
s@DeleteStreamingSession' {} Text
a -> DeleteStreamingSession
s {$sel:sessionId:DeleteStreamingSession' :: Text
sessionId = Text
a} :: DeleteStreamingSession)

-- | The studio ID.
deleteStreamingSession_studioId :: Lens.Lens' DeleteStreamingSession Prelude.Text
deleteStreamingSession_studioId :: Lens' DeleteStreamingSession Text
deleteStreamingSession_studioId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStreamingSession' {Text
studioId :: Text
$sel:studioId:DeleteStreamingSession' :: DeleteStreamingSession -> Text
studioId} -> Text
studioId) (\s :: DeleteStreamingSession
s@DeleteStreamingSession' {} Text
a -> DeleteStreamingSession
s {$sel:studioId:DeleteStreamingSession' :: Text
studioId = Text
a} :: DeleteStreamingSession)

instance Core.AWSRequest DeleteStreamingSession where
  type
    AWSResponse DeleteStreamingSession =
      DeleteStreamingSessionResponse
  request :: (Service -> Service)
-> DeleteStreamingSession -> Request DeleteStreamingSession
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.delete (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy DeleteStreamingSession
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteStreamingSession)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe StreamingSession -> Int -> DeleteStreamingSessionResponse
DeleteStreamingSessionResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"session")
            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 DeleteStreamingSession where
  hashWithSalt :: Int -> DeleteStreamingSession -> Int
hashWithSalt Int
_salt DeleteStreamingSession' {Maybe Text
Text
studioId :: Text
sessionId :: Text
clientToken :: Maybe Text
$sel:studioId:DeleteStreamingSession' :: DeleteStreamingSession -> Text
$sel:sessionId:DeleteStreamingSession' :: DeleteStreamingSession -> Text
$sel:clientToken:DeleteStreamingSession' :: DeleteStreamingSession -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
clientToken
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sessionId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
studioId

instance Prelude.NFData DeleteStreamingSession where
  rnf :: DeleteStreamingSession -> ()
rnf DeleteStreamingSession' {Maybe Text
Text
studioId :: Text
sessionId :: Text
clientToken :: Maybe Text
$sel:studioId:DeleteStreamingSession' :: DeleteStreamingSession -> Text
$sel:sessionId:DeleteStreamingSession' :: DeleteStreamingSession -> Text
$sel:clientToken:DeleteStreamingSession' :: DeleteStreamingSession -> Maybe Text
..} =
    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 Text
sessionId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
studioId

instance Data.ToHeaders DeleteStreamingSession where
  toHeaders :: DeleteStreamingSession -> ResponseHeaders
toHeaders DeleteStreamingSession' {Maybe Text
Text
studioId :: Text
sessionId :: Text
clientToken :: Maybe Text
$sel:studioId:DeleteStreamingSession' :: DeleteStreamingSession -> Text
$sel:sessionId:DeleteStreamingSession' :: DeleteStreamingSession -> Text
$sel:clientToken:DeleteStreamingSession' :: DeleteStreamingSession -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"X-Amz-Client-Token" forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# Maybe Text
clientToken,
        HeaderName
"Content-Type"
          forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# (ByteString
"application/x-amz-json-1.1" :: Prelude.ByteString)
      ]

instance Data.ToPath DeleteStreamingSession where
  toPath :: DeleteStreamingSession -> ByteString
toPath DeleteStreamingSession' {Maybe Text
Text
studioId :: Text
sessionId :: Text
clientToken :: Maybe Text
$sel:studioId:DeleteStreamingSession' :: DeleteStreamingSession -> Text
$sel:sessionId:DeleteStreamingSession' :: DeleteStreamingSession -> Text
$sel:clientToken:DeleteStreamingSession' :: DeleteStreamingSession -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2020-08-01/studios/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
studioId,
        ByteString
"/streaming-sessions/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
sessionId
      ]

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

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

-- |
-- Create a value of 'DeleteStreamingSessionResponse' 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:
--
-- 'session', 'deleteStreamingSessionResponse_session' - The session.
--
-- 'httpStatus', 'deleteStreamingSessionResponse_httpStatus' - The response's http status code.
newDeleteStreamingSessionResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteStreamingSessionResponse
newDeleteStreamingSessionResponse :: Int -> DeleteStreamingSessionResponse
newDeleteStreamingSessionResponse Int
pHttpStatus_ =
  DeleteStreamingSessionResponse'
    { $sel:session:DeleteStreamingSessionResponse' :: Maybe StreamingSession
session =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteStreamingSessionResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The session.
deleteStreamingSessionResponse_session :: Lens.Lens' DeleteStreamingSessionResponse (Prelude.Maybe StreamingSession)
deleteStreamingSessionResponse_session :: Lens' DeleteStreamingSessionResponse (Maybe StreamingSession)
deleteStreamingSessionResponse_session = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStreamingSessionResponse' {Maybe StreamingSession
session :: Maybe StreamingSession
$sel:session:DeleteStreamingSessionResponse' :: DeleteStreamingSessionResponse -> Maybe StreamingSession
session} -> Maybe StreamingSession
session) (\s :: DeleteStreamingSessionResponse
s@DeleteStreamingSessionResponse' {} Maybe StreamingSession
a -> DeleteStreamingSessionResponse
s {$sel:session:DeleteStreamingSessionResponse' :: Maybe StreamingSession
session = Maybe StreamingSession
a} :: DeleteStreamingSessionResponse)

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

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