{-# 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.DeleteStreamingImage
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Delete streaming image.
module Amazonka.Nimble.DeleteStreamingImage
  ( -- * Creating a Request
    DeleteStreamingImage (..),
    newDeleteStreamingImage,

    -- * Request Lenses
    deleteStreamingImage_clientToken,
    deleteStreamingImage_studioId,
    deleteStreamingImage_streamingImageId,

    -- * Destructuring the Response
    DeleteStreamingImageResponse (..),
    newDeleteStreamingImageResponse,

    -- * Response Lenses
    deleteStreamingImageResponse_streamingImage,
    deleteStreamingImageResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteStreamingImage' smart constructor.
data DeleteStreamingImage = DeleteStreamingImage'
  { -- | To make an idempotent API request using one of these actions, specify a
    -- client token in the request. You should not reuse the same client token
    -- for other API requests. If you retry a request that completed
    -- successfully using the same client token and the same parameters, the
    -- retry succeeds without performing any further actions. If you retry a
    -- successful request using the same client token, but one or more of the
    -- parameters are different, the retry fails with a ValidationException
    -- error.
    DeleteStreamingImage -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The studio ID.
    DeleteStreamingImage -> Text
studioId :: Prelude.Text,
    -- | The streaming image ID.
    DeleteStreamingImage -> Text
streamingImageId :: Prelude.Text
  }
  deriving (DeleteStreamingImage -> DeleteStreamingImage -> Bool
(DeleteStreamingImage -> DeleteStreamingImage -> Bool)
-> (DeleteStreamingImage -> DeleteStreamingImage -> Bool)
-> Eq DeleteStreamingImage
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteStreamingImage -> DeleteStreamingImage -> Bool
$c/= :: DeleteStreamingImage -> DeleteStreamingImage -> Bool
== :: DeleteStreamingImage -> DeleteStreamingImage -> Bool
$c== :: DeleteStreamingImage -> DeleteStreamingImage -> Bool
Prelude.Eq, ReadPrec [DeleteStreamingImage]
ReadPrec DeleteStreamingImage
Int -> ReadS DeleteStreamingImage
ReadS [DeleteStreamingImage]
(Int -> ReadS DeleteStreamingImage)
-> ReadS [DeleteStreamingImage]
-> ReadPrec DeleteStreamingImage
-> ReadPrec [DeleteStreamingImage]
-> Read DeleteStreamingImage
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteStreamingImage]
$creadListPrec :: ReadPrec [DeleteStreamingImage]
readPrec :: ReadPrec DeleteStreamingImage
$creadPrec :: ReadPrec DeleteStreamingImage
readList :: ReadS [DeleteStreamingImage]
$creadList :: ReadS [DeleteStreamingImage]
readsPrec :: Int -> ReadS DeleteStreamingImage
$creadsPrec :: Int -> ReadS DeleteStreamingImage
Prelude.Read, Int -> DeleteStreamingImage -> ShowS
[DeleteStreamingImage] -> ShowS
DeleteStreamingImage -> String
(Int -> DeleteStreamingImage -> ShowS)
-> (DeleteStreamingImage -> String)
-> ([DeleteStreamingImage] -> ShowS)
-> Show DeleteStreamingImage
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteStreamingImage] -> ShowS
$cshowList :: [DeleteStreamingImage] -> ShowS
show :: DeleteStreamingImage -> String
$cshow :: DeleteStreamingImage -> String
showsPrec :: Int -> DeleteStreamingImage -> ShowS
$cshowsPrec :: Int -> DeleteStreamingImage -> ShowS
Prelude.Show, (forall x. DeleteStreamingImage -> Rep DeleteStreamingImage x)
-> (forall x. Rep DeleteStreamingImage x -> DeleteStreamingImage)
-> Generic DeleteStreamingImage
forall x. Rep DeleteStreamingImage x -> DeleteStreamingImage
forall x. DeleteStreamingImage -> Rep DeleteStreamingImage x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteStreamingImage x -> DeleteStreamingImage
$cfrom :: forall x. DeleteStreamingImage -> Rep DeleteStreamingImage x
Prelude.Generic)

-- |
-- Create a value of 'DeleteStreamingImage' 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', 'deleteStreamingImage_clientToken' - To make an idempotent API request using one of these actions, specify a
-- client token in the request. You should not reuse the same client token
-- for other API requests. If you retry a request that completed
-- successfully using the same client token and the same parameters, the
-- retry succeeds without performing any further actions. If you retry a
-- successful request using the same client token, but one or more of the
-- parameters are different, the retry fails with a ValidationException
-- error.
--
-- 'studioId', 'deleteStreamingImage_studioId' - The studio ID.
--
-- 'streamingImageId', 'deleteStreamingImage_streamingImageId' - The streaming image ID.
newDeleteStreamingImage ::
  -- | 'studioId'
  Prelude.Text ->
  -- | 'streamingImageId'
  Prelude.Text ->
  DeleteStreamingImage
newDeleteStreamingImage :: Text -> Text -> DeleteStreamingImage
newDeleteStreamingImage Text
pStudioId_ Text
pStreamingImageId_ =
  DeleteStreamingImage' :: Maybe Text -> Text -> Text -> DeleteStreamingImage
DeleteStreamingImage'
    { $sel:clientToken:DeleteStreamingImage' :: Maybe Text
clientToken =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:studioId:DeleteStreamingImage' :: Text
studioId = Text
pStudioId_,
      $sel:streamingImageId:DeleteStreamingImage' :: Text
streamingImageId = Text
pStreamingImageId_
    }

-- | To make an idempotent API request using one of these actions, specify a
-- client token in the request. You should not reuse the same client token
-- for other API requests. If you retry a request that completed
-- successfully using the same client token and the same parameters, the
-- retry succeeds without performing any further actions. If you retry a
-- successful request using the same client token, but one or more of the
-- parameters are different, the retry fails with a ValidationException
-- error.
deleteStreamingImage_clientToken :: Lens.Lens' DeleteStreamingImage (Prelude.Maybe Prelude.Text)
deleteStreamingImage_clientToken :: (Maybe Text -> f (Maybe Text))
-> DeleteStreamingImage -> f DeleteStreamingImage
deleteStreamingImage_clientToken = (DeleteStreamingImage -> Maybe Text)
-> (DeleteStreamingImage -> Maybe Text -> DeleteStreamingImage)
-> Lens
     DeleteStreamingImage DeleteStreamingImage (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStreamingImage' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:DeleteStreamingImage' :: DeleteStreamingImage -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: DeleteStreamingImage
s@DeleteStreamingImage' {} Maybe Text
a -> DeleteStreamingImage
s {$sel:clientToken:DeleteStreamingImage' :: Maybe Text
clientToken = Maybe Text
a} :: DeleteStreamingImage)

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

-- | The streaming image ID.
deleteStreamingImage_streamingImageId :: Lens.Lens' DeleteStreamingImage Prelude.Text
deleteStreamingImage_streamingImageId :: (Text -> f Text) -> DeleteStreamingImage -> f DeleteStreamingImage
deleteStreamingImage_streamingImageId = (DeleteStreamingImage -> Text)
-> (DeleteStreamingImage -> Text -> DeleteStreamingImage)
-> Lens DeleteStreamingImage DeleteStreamingImage Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStreamingImage' {Text
streamingImageId :: Text
$sel:streamingImageId:DeleteStreamingImage' :: DeleteStreamingImage -> Text
streamingImageId} -> Text
streamingImageId) (\s :: DeleteStreamingImage
s@DeleteStreamingImage' {} Text
a -> DeleteStreamingImage
s {$sel:streamingImageId:DeleteStreamingImage' :: Text
streamingImageId = Text
a} :: DeleteStreamingImage)

instance Core.AWSRequest DeleteStreamingImage where
  type
    AWSResponse DeleteStreamingImage =
      DeleteStreamingImageResponse
  request :: DeleteStreamingImage -> Request DeleteStreamingImage
request = Service -> DeleteStreamingImage -> Request DeleteStreamingImage
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteStreamingImage
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteStreamingImage)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteStreamingImage))
-> Logger
-> Service
-> Proxy DeleteStreamingImage
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteStreamingImage)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe StreamingImage -> Int -> DeleteStreamingImageResponse
DeleteStreamingImageResponse'
            (Maybe StreamingImage -> Int -> DeleteStreamingImageResponse)
-> Either String (Maybe StreamingImage)
-> Either String (Int -> DeleteStreamingImageResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe StreamingImage)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"streamingImage")
            Either String (Int -> DeleteStreamingImageResponse)
-> Either String Int -> Either String DeleteStreamingImageResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable DeleteStreamingImage

instance Prelude.NFData DeleteStreamingImage

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

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

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

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

-- |
-- Create a value of 'DeleteStreamingImageResponse' 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:
--
-- 'streamingImage', 'deleteStreamingImageResponse_streamingImage' - The streaming image.
--
-- 'httpStatus', 'deleteStreamingImageResponse_httpStatus' - The response's http status code.
newDeleteStreamingImageResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteStreamingImageResponse
newDeleteStreamingImageResponse :: Int -> DeleteStreamingImageResponse
newDeleteStreamingImageResponse Int
pHttpStatus_ =
  DeleteStreamingImageResponse' :: Maybe StreamingImage -> Int -> DeleteStreamingImageResponse
DeleteStreamingImageResponse'
    { $sel:streamingImage:DeleteStreamingImageResponse' :: Maybe StreamingImage
streamingImage =
        Maybe StreamingImage
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteStreamingImageResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The streaming image.
deleteStreamingImageResponse_streamingImage :: Lens.Lens' DeleteStreamingImageResponse (Prelude.Maybe StreamingImage)
deleteStreamingImageResponse_streamingImage :: (Maybe StreamingImage -> f (Maybe StreamingImage))
-> DeleteStreamingImageResponse -> f DeleteStreamingImageResponse
deleteStreamingImageResponse_streamingImage = (DeleteStreamingImageResponse -> Maybe StreamingImage)
-> (DeleteStreamingImageResponse
    -> Maybe StreamingImage -> DeleteStreamingImageResponse)
-> Lens
     DeleteStreamingImageResponse
     DeleteStreamingImageResponse
     (Maybe StreamingImage)
     (Maybe StreamingImage)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStreamingImageResponse' {Maybe StreamingImage
streamingImage :: Maybe StreamingImage
$sel:streamingImage:DeleteStreamingImageResponse' :: DeleteStreamingImageResponse -> Maybe StreamingImage
streamingImage} -> Maybe StreamingImage
streamingImage) (\s :: DeleteStreamingImageResponse
s@DeleteStreamingImageResponse' {} Maybe StreamingImage
a -> DeleteStreamingImageResponse
s {$sel:streamingImage:DeleteStreamingImageResponse' :: Maybe StreamingImage
streamingImage = Maybe StreamingImage
a} :: DeleteStreamingImageResponse)

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

instance Prelude.NFData DeleteStreamingImageResponse