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

    -- * Request Lenses
    deleteStudio_clientToken,
    deleteStudio_studioId,

    -- * Destructuring the Response
    DeleteStudioResponse (..),
    newDeleteStudioResponse,

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

-- |
-- Create a value of 'DeleteStudio' 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', 'deleteStudio_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', 'deleteStudio_studioId' - The studio ID.
newDeleteStudio ::
  -- | 'studioId'
  Prelude.Text ->
  DeleteStudio
newDeleteStudio :: Text -> DeleteStudio
newDeleteStudio Text
pStudioId_ =
  DeleteStudio' :: Maybe Text -> Text -> DeleteStudio
DeleteStudio'
    { $sel:clientToken:DeleteStudio' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:studioId:DeleteStudio' :: Text
studioId = Text
pStudioId_
    }

-- | 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.
deleteStudio_clientToken :: Lens.Lens' DeleteStudio (Prelude.Maybe Prelude.Text)
deleteStudio_clientToken :: (Maybe Text -> f (Maybe Text)) -> DeleteStudio -> f DeleteStudio
deleteStudio_clientToken = (DeleteStudio -> Maybe Text)
-> (DeleteStudio -> Maybe Text -> DeleteStudio)
-> Lens DeleteStudio DeleteStudio (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStudio' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:DeleteStudio' :: DeleteStudio -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: DeleteStudio
s@DeleteStudio' {} Maybe Text
a -> DeleteStudio
s {$sel:clientToken:DeleteStudio' :: Maybe Text
clientToken = Maybe Text
a} :: DeleteStudio)

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

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

instance Prelude.NFData DeleteStudio

instance Core.ToHeaders DeleteStudio where
  toHeaders :: DeleteStudio -> ResponseHeaders
toHeaders DeleteStudio' {Maybe Text
Text
studioId :: Text
clientToken :: Maybe Text
$sel:studioId:DeleteStudio' :: DeleteStudio -> Text
$sel:clientToken:DeleteStudio' :: DeleteStudio -> 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 DeleteStudio where
  toPath :: DeleteStudio -> ByteString
toPath DeleteStudio' {Maybe Text
Text
studioId :: Text
clientToken :: Maybe Text
$sel:studioId:DeleteStudio' :: DeleteStudio -> Text
$sel:clientToken:DeleteStudio' :: DeleteStudio -> 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]

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

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

-- |
-- Create a value of 'DeleteStudioResponse' 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:
--
-- 'studio', 'deleteStudioResponse_studio' - Information about a studio.
--
-- 'httpStatus', 'deleteStudioResponse_httpStatus' - The response's http status code.
newDeleteStudioResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteStudioResponse
newDeleteStudioResponse :: Int -> DeleteStudioResponse
newDeleteStudioResponse Int
pHttpStatus_ =
  DeleteStudioResponse' :: Maybe Studio -> Int -> DeleteStudioResponse
DeleteStudioResponse'
    { $sel:studio:DeleteStudioResponse' :: Maybe Studio
studio = Maybe Studio
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:DeleteStudioResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about a studio.
deleteStudioResponse_studio :: Lens.Lens' DeleteStudioResponse (Prelude.Maybe Studio)
deleteStudioResponse_studio :: (Maybe Studio -> f (Maybe Studio))
-> DeleteStudioResponse -> f DeleteStudioResponse
deleteStudioResponse_studio = (DeleteStudioResponse -> Maybe Studio)
-> (DeleteStudioResponse -> Maybe Studio -> DeleteStudioResponse)
-> Lens
     DeleteStudioResponse
     DeleteStudioResponse
     (Maybe Studio)
     (Maybe Studio)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteStudioResponse' {Maybe Studio
studio :: Maybe Studio
$sel:studio:DeleteStudioResponse' :: DeleteStudioResponse -> Maybe Studio
studio} -> Maybe Studio
studio) (\s :: DeleteStudioResponse
s@DeleteStudioResponse' {} Maybe Studio
a -> DeleteStudioResponse
s {$sel:studio:DeleteStudioResponse' :: Maybe Studio
studio = Maybe Studio
a} :: DeleteStudioResponse)

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

instance Prelude.NFData DeleteStudioResponse