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

    -- * Request Lenses
    deleteStudioComponent_clientToken,
    deleteStudioComponent_studioId,
    deleteStudioComponent_studioComponentId,

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

    -- * Response Lenses
    deleteStudioComponentResponse_studioComponent,
    deleteStudioComponentResponse_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:/ 'newDeleteStudioComponent' smart constructor.
data DeleteStudioComponent = DeleteStudioComponent'
  { -- | 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.
    DeleteStudioComponent -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | The studio ID.
    DeleteStudioComponent -> Text
studioId :: Prelude.Text,
    -- | The studio component ID.
    DeleteStudioComponent -> Text
studioComponentId :: Prelude.Text
  }
  deriving (DeleteStudioComponent -> DeleteStudioComponent -> Bool
(DeleteStudioComponent -> DeleteStudioComponent -> Bool)
-> (DeleteStudioComponent -> DeleteStudioComponent -> Bool)
-> Eq DeleteStudioComponent
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]
(Int -> ReadS DeleteStudioComponent)
-> ReadS [DeleteStudioComponent]
-> ReadPrec DeleteStudioComponent
-> ReadPrec [DeleteStudioComponent]
-> Read 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
(Int -> DeleteStudioComponent -> ShowS)
-> (DeleteStudioComponent -> String)
-> ([DeleteStudioComponent] -> ShowS)
-> Show DeleteStudioComponent
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. DeleteStudioComponent -> Rep DeleteStudioComponent x)
-> (forall x. Rep DeleteStudioComponent x -> DeleteStudioComponent)
-> Generic DeleteStudioComponent
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' - 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', 'deleteStudioComponent_studioId' - The studio ID.
--
-- 'studioComponentId', 'deleteStudioComponent_studioComponentId' - The studio component ID.
newDeleteStudioComponent ::
  -- | 'studioId'
  Prelude.Text ->
  -- | 'studioComponentId'
  Prelude.Text ->
  DeleteStudioComponent
newDeleteStudioComponent :: Text -> Text -> DeleteStudioComponent
newDeleteStudioComponent
  Text
pStudioId_
  Text
pStudioComponentId_ =
    DeleteStudioComponent' :: Maybe Text -> Text -> Text -> DeleteStudioComponent
DeleteStudioComponent'
      { $sel:clientToken:DeleteStudioComponent' :: Maybe Text
clientToken =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:studioId:DeleteStudioComponent' :: Text
studioId = Text
pStudioId_,
        $sel:studioComponentId:DeleteStudioComponent' :: Text
studioComponentId = Text
pStudioComponentId_
      }

-- | 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.
deleteStudioComponent_clientToken :: Lens.Lens' DeleteStudioComponent (Prelude.Maybe Prelude.Text)
deleteStudioComponent_clientToken :: (Maybe Text -> f (Maybe Text))
-> DeleteStudioComponent -> f DeleteStudioComponent
deleteStudioComponent_clientToken = (DeleteStudioComponent -> Maybe Text)
-> (DeleteStudioComponent -> Maybe Text -> DeleteStudioComponent)
-> Lens
     DeleteStudioComponent
     DeleteStudioComponent
     (Maybe Text)
     (Maybe Text)
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 ID.
deleteStudioComponent_studioId :: Lens.Lens' DeleteStudioComponent Prelude.Text
deleteStudioComponent_studioId :: (Text -> f Text)
-> DeleteStudioComponent -> f DeleteStudioComponent
deleteStudioComponent_studioId = (DeleteStudioComponent -> Text)
-> (DeleteStudioComponent -> Text -> DeleteStudioComponent)
-> Lens DeleteStudioComponent DeleteStudioComponent Text Text
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)

-- | The studio component ID.
deleteStudioComponent_studioComponentId :: Lens.Lens' DeleteStudioComponent Prelude.Text
deleteStudioComponent_studioComponentId :: (Text -> f Text)
-> DeleteStudioComponent -> f DeleteStudioComponent
deleteStudioComponent_studioComponentId = (DeleteStudioComponent -> Text)
-> (DeleteStudioComponent -> Text -> DeleteStudioComponent)
-> Lens DeleteStudioComponent DeleteStudioComponent Text Text
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)

instance Core.AWSRequest DeleteStudioComponent where
  type
    AWSResponse DeleteStudioComponent =
      DeleteStudioComponentResponse
  request :: DeleteStudioComponent -> Request DeleteStudioComponent
request = Service -> DeleteStudioComponent -> Request DeleteStudioComponent
forall a. ToRequest a => Service -> a -> Request a
Request.delete Service
defaultService
  response :: Logger
-> Service
-> Proxy DeleteStudioComponent
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteStudioComponent)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DeleteStudioComponent))
-> Logger
-> Service
-> Proxy DeleteStudioComponent
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteStudioComponent)))
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 StudioComponent -> Int -> DeleteStudioComponentResponse
DeleteStudioComponentResponse'
            (Maybe StudioComponent -> Int -> DeleteStudioComponentResponse)
-> Either String (Maybe StudioComponent)
-> Either String (Int -> DeleteStudioComponentResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe StudioComponent)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"studioComponent")
            Either String (Int -> DeleteStudioComponentResponse)
-> Either String Int -> Either String DeleteStudioComponentResponse
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 DeleteStudioComponent

instance Prelude.NFData DeleteStudioComponent

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

instance Core.ToQuery DeleteStudioComponent where
  toQuery :: DeleteStudioComponent -> QueryString
toQuery = QueryString -> DeleteStudioComponent -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(DeleteStudioComponentResponse
 -> DeleteStudioComponentResponse -> Bool)
-> (DeleteStudioComponentResponse
    -> DeleteStudioComponentResponse -> Bool)
-> Eq DeleteStudioComponentResponse
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, ReadPrec [DeleteStudioComponentResponse]
ReadPrec DeleteStudioComponentResponse
Int -> ReadS DeleteStudioComponentResponse
ReadS [DeleteStudioComponentResponse]
(Int -> ReadS DeleteStudioComponentResponse)
-> ReadS [DeleteStudioComponentResponse]
-> ReadPrec DeleteStudioComponentResponse
-> ReadPrec [DeleteStudioComponentResponse]
-> Read DeleteStudioComponentResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteStudioComponentResponse]
$creadListPrec :: ReadPrec [DeleteStudioComponentResponse]
readPrec :: ReadPrec DeleteStudioComponentResponse
$creadPrec :: ReadPrec DeleteStudioComponentResponse
readList :: ReadS [DeleteStudioComponentResponse]
$creadList :: ReadS [DeleteStudioComponentResponse]
readsPrec :: Int -> ReadS DeleteStudioComponentResponse
$creadsPrec :: Int -> ReadS DeleteStudioComponentResponse
Prelude.Read, Int -> DeleteStudioComponentResponse -> ShowS
[DeleteStudioComponentResponse] -> ShowS
DeleteStudioComponentResponse -> String
(Int -> DeleteStudioComponentResponse -> ShowS)
-> (DeleteStudioComponentResponse -> String)
-> ([DeleteStudioComponentResponse] -> ShowS)
-> Show DeleteStudioComponentResponse
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.
 DeleteStudioComponentResponse
 -> Rep DeleteStudioComponentResponse x)
-> (forall x.
    Rep DeleteStudioComponentResponse x
    -> DeleteStudioComponentResponse)
-> Generic DeleteStudioComponentResponse
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' :: Maybe StudioComponent -> Int -> DeleteStudioComponentResponse
DeleteStudioComponentResponse'
    { $sel:studioComponent:DeleteStudioComponentResponse' :: Maybe StudioComponent
studioComponent =
        Maybe 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 :: (Maybe StudioComponent -> f (Maybe StudioComponent))
-> DeleteStudioComponentResponse -> f DeleteStudioComponentResponse
deleteStudioComponentResponse_studioComponent = (DeleteStudioComponentResponse -> Maybe StudioComponent)
-> (DeleteStudioComponentResponse
    -> Maybe StudioComponent -> DeleteStudioComponentResponse)
-> Lens
     DeleteStudioComponentResponse
     DeleteStudioComponentResponse
     (Maybe StudioComponent)
     (Maybe 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 :: (Int -> f Int)
-> DeleteStudioComponentResponse -> f DeleteStudioComponentResponse
deleteStudioComponentResponse_httpStatus = (DeleteStudioComponentResponse -> Int)
-> (DeleteStudioComponentResponse
    -> Int -> DeleteStudioComponentResponse)
-> Lens
     DeleteStudioComponentResponse DeleteStudioComponentResponse Int Int
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