{-# 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.DeleteStudioComponent
-- 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 a studio component resource.
module Amazonka.Nimble.DeleteStudioComponent
  ( -- * Creating a Request
    DeleteStudioComponent (..),
    newDeleteStudioComponent,

    -- * Request Lenses
    deleteStudioComponent_clientToken,
    deleteStudioComponent_studioComponentId,
    deleteStudioComponent_studioId,

    -- * Destructuring the Response
    DeleteStudioComponentResponse (..),
    newDeleteStudioComponentResponse,

    -- * Response Lenses
    deleteStudioComponentResponse_studioComponent,
    deleteStudioComponentResponse_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:/ 'newDeleteStudioComponent' smart constructor.
data DeleteStudioComponent = DeleteStudioComponent'
  { -- | 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.
    DeleteStudioComponent -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The studio component ID.
    DeleteStudioComponent -> Text
studioComponentId :: Prelude.Text,
    -- | The studio ID.
    DeleteStudioComponent -> Text
studioId :: Prelude.Text
  }
  deriving (DeleteStudioComponent -> DeleteStudioComponent -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteStudioComponent -> DeleteStudioComponent -> Bool
$c/= :: DeleteStudioComponent -> DeleteStudioComponent -> Bool
== :: DeleteStudioComponent -> DeleteStudioComponent -> Bool
$c== :: DeleteStudioComponent -> DeleteStudioComponent -> Bool
Prelude.Eq, ReadPrec [DeleteStudioComponent]
ReadPrec DeleteStudioComponent
Int -> ReadS DeleteStudioComponent
ReadS [DeleteStudioComponent]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteStudioComponent]
$creadListPrec :: ReadPrec [DeleteStudioComponent]
readPrec :: ReadPrec DeleteStudioComponent
$creadPrec :: ReadPrec DeleteStudioComponent
readList :: ReadS [DeleteStudioComponent]
$creadList :: ReadS [DeleteStudioComponent]
readsPrec :: Int -> ReadS DeleteStudioComponent
$creadsPrec :: Int -> ReadS DeleteStudioComponent
Prelude.Read, Int -> DeleteStudioComponent -> ShowS
[DeleteStudioComponent] -> ShowS
DeleteStudioComponent -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteStudioComponent] -> ShowS
$cshowList :: [DeleteStudioComponent] -> ShowS
show :: DeleteStudioComponent -> String
$cshow :: DeleteStudioComponent -> String
showsPrec :: Int -> DeleteStudioComponent -> ShowS
$cshowsPrec :: Int -> DeleteStudioComponent -> ShowS
Prelude.Show, forall x. Rep DeleteStudioComponent x -> DeleteStudioComponent
forall x. DeleteStudioComponent -> Rep DeleteStudioComponent x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DeleteStudioComponent x -> DeleteStudioComponent
$cfrom :: forall x. DeleteStudioComponent -> Rep DeleteStudioComponent x
Prelude.Generic)

-- |
-- Create a value of 'DeleteStudioComponent' 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', 'deleteStudioComponent_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.
--
-- 'studioComponentId', 'deleteStudioComponent_studioComponentId' - The studio component ID.
--
-- 'studioId', 'deleteStudioComponent_studioId' - The studio ID.
newDeleteStudioComponent ::
  -- | 'studioComponentId'
  Prelude.Text ->
  -- | 'studioId'
  Prelude.Text ->
  DeleteStudioComponent
newDeleteStudioComponent :: Text -> Text -> DeleteStudioComponent
newDeleteStudioComponent
  Text
pStudioComponentId_
  Text
pStudioId_ =
    DeleteStudioComponent'
      { $sel:clientToken:DeleteStudioComponent' :: Maybe Text
clientToken =
          forall a. Maybe a
Prelude.Nothing,
        $sel:studioComponentId:DeleteStudioComponent' :: Text
studioComponentId = Text
pStudioComponentId_,
        $sel:studioId:DeleteStudioComponent' :: 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.
deleteStudioComponent_clientToken :: Lens.Lens' DeleteStudioComponent (Prelude.Maybe Prelude.Text)
deleteStudioComponent_clientToken :: Lens' DeleteStudioComponent (Maybe Text)
deleteStudioComponent_clientToken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStudioComponent' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:DeleteStudioComponent' :: DeleteStudioComponent -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: DeleteStudioComponent
s@DeleteStudioComponent' {} Maybe Text
a -> DeleteStudioComponent
s {$sel:clientToken:DeleteStudioComponent' :: Maybe Text
clientToken = Maybe Text
a} :: DeleteStudioComponent)

-- | The studio component ID.
deleteStudioComponent_studioComponentId :: Lens.Lens' DeleteStudioComponent Prelude.Text
deleteStudioComponent_studioComponentId :: Lens' DeleteStudioComponent Text
deleteStudioComponent_studioComponentId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStudioComponent' {Text
studioComponentId :: Text
$sel:studioComponentId:DeleteStudioComponent' :: DeleteStudioComponent -> Text
studioComponentId} -> Text
studioComponentId) (\s :: DeleteStudioComponent
s@DeleteStudioComponent' {} Text
a -> DeleteStudioComponent
s {$sel:studioComponentId:DeleteStudioComponent' :: Text
studioComponentId = Text
a} :: DeleteStudioComponent)

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

instance Core.AWSRequest DeleteStudioComponent where
  type
    AWSResponse DeleteStudioComponent =
      DeleteStudioComponentResponse
  request :: (Service -> Service)
-> DeleteStudioComponent -> Request DeleteStudioComponent
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 DeleteStudioComponent
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteStudioComponent)))
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 StudioComponent -> Int -> DeleteStudioComponentResponse
DeleteStudioComponentResponse'
            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
"studioComponent")
            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 DeleteStudioComponent where
  hashWithSalt :: Int -> DeleteStudioComponent -> Int
hashWithSalt Int
_salt DeleteStudioComponent' {Maybe Text
Text
studioId :: Text
studioComponentId :: Text
clientToken :: Maybe Text
$sel:studioId:DeleteStudioComponent' :: DeleteStudioComponent -> Text
$sel:studioComponentId:DeleteStudioComponent' :: DeleteStudioComponent -> Text
$sel:clientToken:DeleteStudioComponent' :: DeleteStudioComponent -> 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
studioComponentId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
studioId

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

instance Data.ToHeaders DeleteStudioComponent where
  toHeaders :: DeleteStudioComponent -> ResponseHeaders
toHeaders DeleteStudioComponent' {Maybe Text
Text
studioId :: Text
studioComponentId :: Text
clientToken :: Maybe Text
$sel:studioId:DeleteStudioComponent' :: DeleteStudioComponent -> Text
$sel:studioComponentId:DeleteStudioComponent' :: DeleteStudioComponent -> Text
$sel:clientToken:DeleteStudioComponent' :: DeleteStudioComponent -> 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 DeleteStudioComponent where
  toPath :: DeleteStudioComponent -> ByteString
toPath DeleteStudioComponent' {Maybe Text
Text
studioId :: Text
studioComponentId :: Text
clientToken :: Maybe Text
$sel:studioId:DeleteStudioComponent' :: DeleteStudioComponent -> Text
$sel:studioComponentId:DeleteStudioComponent' :: DeleteStudioComponent -> Text
$sel:clientToken:DeleteStudioComponent' :: DeleteStudioComponent -> 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
"/studio-components/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
studioComponentId
      ]

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

-- | /See:/ 'newDeleteStudioComponentResponse' smart constructor.
data DeleteStudioComponentResponse = DeleteStudioComponentResponse'
  { -- | Information about the studio component.
    DeleteStudioComponentResponse -> Maybe StudioComponent
studioComponent :: Prelude.Maybe StudioComponent,
    -- | The response's http status code.
    DeleteStudioComponentResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteStudioComponentResponse
-> DeleteStudioComponentResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteStudioComponentResponse
-> DeleteStudioComponentResponse -> Bool
$c/= :: DeleteStudioComponentResponse
-> DeleteStudioComponentResponse -> Bool
== :: DeleteStudioComponentResponse
-> DeleteStudioComponentResponse -> Bool
$c== :: DeleteStudioComponentResponse
-> DeleteStudioComponentResponse -> Bool
Prelude.Eq, Int -> DeleteStudioComponentResponse -> ShowS
[DeleteStudioComponentResponse] -> ShowS
DeleteStudioComponentResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteStudioComponentResponse] -> ShowS
$cshowList :: [DeleteStudioComponentResponse] -> ShowS
show :: DeleteStudioComponentResponse -> String
$cshow :: DeleteStudioComponentResponse -> String
showsPrec :: Int -> DeleteStudioComponentResponse -> ShowS
$cshowsPrec :: Int -> DeleteStudioComponentResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteStudioComponentResponse x
-> DeleteStudioComponentResponse
forall x.
DeleteStudioComponentResponse
-> Rep DeleteStudioComponentResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteStudioComponentResponse x
-> DeleteStudioComponentResponse
$cfrom :: forall x.
DeleteStudioComponentResponse
-> Rep DeleteStudioComponentResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteStudioComponentResponse' 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:
--
-- 'studioComponent', 'deleteStudioComponentResponse_studioComponent' - Information about the studio component.
--
-- 'httpStatus', 'deleteStudioComponentResponse_httpStatus' - The response's http status code.
newDeleteStudioComponentResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteStudioComponentResponse
newDeleteStudioComponentResponse :: Int -> DeleteStudioComponentResponse
newDeleteStudioComponentResponse Int
pHttpStatus_ =
  DeleteStudioComponentResponse'
    { $sel:studioComponent:DeleteStudioComponentResponse' :: Maybe StudioComponent
studioComponent =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteStudioComponentResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the studio component.
deleteStudioComponentResponse_studioComponent :: Lens.Lens' DeleteStudioComponentResponse (Prelude.Maybe StudioComponent)
deleteStudioComponentResponse_studioComponent :: Lens' DeleteStudioComponentResponse (Maybe StudioComponent)
deleteStudioComponentResponse_studioComponent = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStudioComponentResponse' {Maybe StudioComponent
studioComponent :: Maybe StudioComponent
$sel:studioComponent:DeleteStudioComponentResponse' :: DeleteStudioComponentResponse -> Maybe StudioComponent
studioComponent} -> Maybe StudioComponent
studioComponent) (\s :: DeleteStudioComponentResponse
s@DeleteStudioComponentResponse' {} Maybe StudioComponent
a -> DeleteStudioComponentResponse
s {$sel:studioComponent:DeleteStudioComponentResponse' :: Maybe StudioComponent
studioComponent = Maybe StudioComponent
a} :: DeleteStudioComponentResponse)

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

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