{-# 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.RobOMaker.BatchDeleteWorlds
-- 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 one or more worlds in a batch operation.
module Amazonka.RobOMaker.BatchDeleteWorlds
  ( -- * Creating a Request
    BatchDeleteWorlds (..),
    newBatchDeleteWorlds,

    -- * Request Lenses
    batchDeleteWorlds_worlds,

    -- * Destructuring the Response
    BatchDeleteWorldsResponse (..),
    newBatchDeleteWorldsResponse,

    -- * Response Lenses
    batchDeleteWorldsResponse_unprocessedWorlds,
    batchDeleteWorldsResponse_httpStatus,
  )
where

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

-- | /See:/ 'newBatchDeleteWorlds' smart constructor.
data BatchDeleteWorlds = BatchDeleteWorlds'
  { -- | A list of Amazon Resource Names (arns) that correspond to worlds to
    -- delete.
    BatchDeleteWorlds -> NonEmpty Text
worlds :: Prelude.NonEmpty Prelude.Text
  }
  deriving (BatchDeleteWorlds -> BatchDeleteWorlds -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDeleteWorlds -> BatchDeleteWorlds -> Bool
$c/= :: BatchDeleteWorlds -> BatchDeleteWorlds -> Bool
== :: BatchDeleteWorlds -> BatchDeleteWorlds -> Bool
$c== :: BatchDeleteWorlds -> BatchDeleteWorlds -> Bool
Prelude.Eq, ReadPrec [BatchDeleteWorlds]
ReadPrec BatchDeleteWorlds
Int -> ReadS BatchDeleteWorlds
ReadS [BatchDeleteWorlds]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDeleteWorlds]
$creadListPrec :: ReadPrec [BatchDeleteWorlds]
readPrec :: ReadPrec BatchDeleteWorlds
$creadPrec :: ReadPrec BatchDeleteWorlds
readList :: ReadS [BatchDeleteWorlds]
$creadList :: ReadS [BatchDeleteWorlds]
readsPrec :: Int -> ReadS BatchDeleteWorlds
$creadsPrec :: Int -> ReadS BatchDeleteWorlds
Prelude.Read, Int -> BatchDeleteWorlds -> ShowS
[BatchDeleteWorlds] -> ShowS
BatchDeleteWorlds -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDeleteWorlds] -> ShowS
$cshowList :: [BatchDeleteWorlds] -> ShowS
show :: BatchDeleteWorlds -> String
$cshow :: BatchDeleteWorlds -> String
showsPrec :: Int -> BatchDeleteWorlds -> ShowS
$cshowsPrec :: Int -> BatchDeleteWorlds -> ShowS
Prelude.Show, forall x. Rep BatchDeleteWorlds x -> BatchDeleteWorlds
forall x. BatchDeleteWorlds -> Rep BatchDeleteWorlds x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchDeleteWorlds x -> BatchDeleteWorlds
$cfrom :: forall x. BatchDeleteWorlds -> Rep BatchDeleteWorlds x
Prelude.Generic)

-- |
-- Create a value of 'BatchDeleteWorlds' 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:
--
-- 'worlds', 'batchDeleteWorlds_worlds' - A list of Amazon Resource Names (arns) that correspond to worlds to
-- delete.
newBatchDeleteWorlds ::
  -- | 'worlds'
  Prelude.NonEmpty Prelude.Text ->
  BatchDeleteWorlds
newBatchDeleteWorlds :: NonEmpty Text -> BatchDeleteWorlds
newBatchDeleteWorlds NonEmpty Text
pWorlds_ =
  BatchDeleteWorlds'
    { $sel:worlds:BatchDeleteWorlds' :: NonEmpty Text
worlds =
        forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pWorlds_
    }

-- | A list of Amazon Resource Names (arns) that correspond to worlds to
-- delete.
batchDeleteWorlds_worlds :: Lens.Lens' BatchDeleteWorlds (Prelude.NonEmpty Prelude.Text)
batchDeleteWorlds_worlds :: Lens' BatchDeleteWorlds (NonEmpty Text)
batchDeleteWorlds_worlds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteWorlds' {NonEmpty Text
worlds :: NonEmpty Text
$sel:worlds:BatchDeleteWorlds' :: BatchDeleteWorlds -> NonEmpty Text
worlds} -> NonEmpty Text
worlds) (\s :: BatchDeleteWorlds
s@BatchDeleteWorlds' {} NonEmpty Text
a -> BatchDeleteWorlds
s {$sel:worlds:BatchDeleteWorlds' :: NonEmpty Text
worlds = NonEmpty Text
a} :: BatchDeleteWorlds) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest BatchDeleteWorlds where
  type
    AWSResponse BatchDeleteWorlds =
      BatchDeleteWorldsResponse
  request :: (Service -> Service)
-> BatchDeleteWorlds -> Request BatchDeleteWorlds
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy BatchDeleteWorlds
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse BatchDeleteWorlds)))
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 (NonEmpty Text) -> Int -> BatchDeleteWorldsResponse
BatchDeleteWorldsResponse'
            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
"unprocessedWorlds")
            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 BatchDeleteWorlds where
  hashWithSalt :: Int -> BatchDeleteWorlds -> Int
hashWithSalt Int
_salt BatchDeleteWorlds' {NonEmpty Text
worlds :: NonEmpty Text
$sel:worlds:BatchDeleteWorlds' :: BatchDeleteWorlds -> NonEmpty Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
worlds

instance Prelude.NFData BatchDeleteWorlds where
  rnf :: BatchDeleteWorlds -> ()
rnf BatchDeleteWorlds' {NonEmpty Text
worlds :: NonEmpty Text
$sel:worlds:BatchDeleteWorlds' :: BatchDeleteWorlds -> NonEmpty Text
..} = forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
worlds

instance Data.ToHeaders BatchDeleteWorlds where
  toHeaders :: BatchDeleteWorlds -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON BatchDeleteWorlds where
  toJSON :: BatchDeleteWorlds -> Value
toJSON BatchDeleteWorlds' {NonEmpty Text
worlds :: NonEmpty Text
$sel:worlds:BatchDeleteWorlds' :: BatchDeleteWorlds -> NonEmpty Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"worlds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
worlds)]
      )

instance Data.ToPath BatchDeleteWorlds where
  toPath :: BatchDeleteWorlds -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/batchDeleteWorlds"

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

-- | /See:/ 'newBatchDeleteWorldsResponse' smart constructor.
data BatchDeleteWorldsResponse = BatchDeleteWorldsResponse'
  { -- | A list of unprocessed worlds associated with the call. These worlds were
    -- not deleted.
    BatchDeleteWorldsResponse -> Maybe (NonEmpty Text)
unprocessedWorlds :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    -- | The response's http status code.
    BatchDeleteWorldsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (BatchDeleteWorldsResponse -> BatchDeleteWorldsResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDeleteWorldsResponse -> BatchDeleteWorldsResponse -> Bool
$c/= :: BatchDeleteWorldsResponse -> BatchDeleteWorldsResponse -> Bool
== :: BatchDeleteWorldsResponse -> BatchDeleteWorldsResponse -> Bool
$c== :: BatchDeleteWorldsResponse -> BatchDeleteWorldsResponse -> Bool
Prelude.Eq, ReadPrec [BatchDeleteWorldsResponse]
ReadPrec BatchDeleteWorldsResponse
Int -> ReadS BatchDeleteWorldsResponse
ReadS [BatchDeleteWorldsResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDeleteWorldsResponse]
$creadListPrec :: ReadPrec [BatchDeleteWorldsResponse]
readPrec :: ReadPrec BatchDeleteWorldsResponse
$creadPrec :: ReadPrec BatchDeleteWorldsResponse
readList :: ReadS [BatchDeleteWorldsResponse]
$creadList :: ReadS [BatchDeleteWorldsResponse]
readsPrec :: Int -> ReadS BatchDeleteWorldsResponse
$creadsPrec :: Int -> ReadS BatchDeleteWorldsResponse
Prelude.Read, Int -> BatchDeleteWorldsResponse -> ShowS
[BatchDeleteWorldsResponse] -> ShowS
BatchDeleteWorldsResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDeleteWorldsResponse] -> ShowS
$cshowList :: [BatchDeleteWorldsResponse] -> ShowS
show :: BatchDeleteWorldsResponse -> String
$cshow :: BatchDeleteWorldsResponse -> String
showsPrec :: Int -> BatchDeleteWorldsResponse -> ShowS
$cshowsPrec :: Int -> BatchDeleteWorldsResponse -> ShowS
Prelude.Show, forall x.
Rep BatchDeleteWorldsResponse x -> BatchDeleteWorldsResponse
forall x.
BatchDeleteWorldsResponse -> Rep BatchDeleteWorldsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchDeleteWorldsResponse x -> BatchDeleteWorldsResponse
$cfrom :: forall x.
BatchDeleteWorldsResponse -> Rep BatchDeleteWorldsResponse x
Prelude.Generic)

-- |
-- Create a value of 'BatchDeleteWorldsResponse' 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:
--
-- 'unprocessedWorlds', 'batchDeleteWorldsResponse_unprocessedWorlds' - A list of unprocessed worlds associated with the call. These worlds were
-- not deleted.
--
-- 'httpStatus', 'batchDeleteWorldsResponse_httpStatus' - The response's http status code.
newBatchDeleteWorldsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  BatchDeleteWorldsResponse
newBatchDeleteWorldsResponse :: Int -> BatchDeleteWorldsResponse
newBatchDeleteWorldsResponse Int
pHttpStatus_ =
  BatchDeleteWorldsResponse'
    { $sel:unprocessedWorlds:BatchDeleteWorldsResponse' :: Maybe (NonEmpty Text)
unprocessedWorlds =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:BatchDeleteWorldsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | A list of unprocessed worlds associated with the call. These worlds were
-- not deleted.
batchDeleteWorldsResponse_unprocessedWorlds :: Lens.Lens' BatchDeleteWorldsResponse (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
batchDeleteWorldsResponse_unprocessedWorlds :: Lens' BatchDeleteWorldsResponse (Maybe (NonEmpty Text))
batchDeleteWorldsResponse_unprocessedWorlds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteWorldsResponse' {Maybe (NonEmpty Text)
unprocessedWorlds :: Maybe (NonEmpty Text)
$sel:unprocessedWorlds:BatchDeleteWorldsResponse' :: BatchDeleteWorldsResponse -> Maybe (NonEmpty Text)
unprocessedWorlds} -> Maybe (NonEmpty Text)
unprocessedWorlds) (\s :: BatchDeleteWorldsResponse
s@BatchDeleteWorldsResponse' {} Maybe (NonEmpty Text)
a -> BatchDeleteWorldsResponse
s {$sel:unprocessedWorlds:BatchDeleteWorldsResponse' :: Maybe (NonEmpty Text)
unprocessedWorlds = Maybe (NonEmpty Text)
a} :: BatchDeleteWorldsResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.NFData BatchDeleteWorldsResponse where
  rnf :: BatchDeleteWorldsResponse -> ()
rnf BatchDeleteWorldsResponse' {Int
Maybe (NonEmpty Text)
httpStatus :: Int
unprocessedWorlds :: Maybe (NonEmpty Text)
$sel:httpStatus:BatchDeleteWorldsResponse' :: BatchDeleteWorldsResponse -> Int
$sel:unprocessedWorlds:BatchDeleteWorldsResponse' :: BatchDeleteWorldsResponse -> Maybe (NonEmpty Text)
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe (NonEmpty Text)
unprocessedWorlds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus