{-# 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.Omics.BatchDeleteReadSet
-- 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 read sets.
module Amazonka.Omics.BatchDeleteReadSet
  ( -- * Creating a Request
    BatchDeleteReadSet (..),
    newBatchDeleteReadSet,

    -- * Request Lenses
    batchDeleteReadSet_ids,
    batchDeleteReadSet_sequenceStoreId,

    -- * Destructuring the Response
    BatchDeleteReadSetResponse (..),
    newBatchDeleteReadSetResponse,

    -- * Response Lenses
    batchDeleteReadSetResponse_errors,
    batchDeleteReadSetResponse_httpStatus,
  )
where

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

-- | /See:/ 'newBatchDeleteReadSet' smart constructor.
data BatchDeleteReadSet = BatchDeleteReadSet'
  { -- | The read sets\' IDs.
    BatchDeleteReadSet -> NonEmpty Text
ids :: Prelude.NonEmpty Prelude.Text,
    -- | The read sets\' sequence store ID.
    BatchDeleteReadSet -> Text
sequenceStoreId :: Prelude.Text
  }
  deriving (BatchDeleteReadSet -> BatchDeleteReadSet -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDeleteReadSet -> BatchDeleteReadSet -> Bool
$c/= :: BatchDeleteReadSet -> BatchDeleteReadSet -> Bool
== :: BatchDeleteReadSet -> BatchDeleteReadSet -> Bool
$c== :: BatchDeleteReadSet -> BatchDeleteReadSet -> Bool
Prelude.Eq, ReadPrec [BatchDeleteReadSet]
ReadPrec BatchDeleteReadSet
Int -> ReadS BatchDeleteReadSet
ReadS [BatchDeleteReadSet]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDeleteReadSet]
$creadListPrec :: ReadPrec [BatchDeleteReadSet]
readPrec :: ReadPrec BatchDeleteReadSet
$creadPrec :: ReadPrec BatchDeleteReadSet
readList :: ReadS [BatchDeleteReadSet]
$creadList :: ReadS [BatchDeleteReadSet]
readsPrec :: Int -> ReadS BatchDeleteReadSet
$creadsPrec :: Int -> ReadS BatchDeleteReadSet
Prelude.Read, Int -> BatchDeleteReadSet -> ShowS
[BatchDeleteReadSet] -> ShowS
BatchDeleteReadSet -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDeleteReadSet] -> ShowS
$cshowList :: [BatchDeleteReadSet] -> ShowS
show :: BatchDeleteReadSet -> String
$cshow :: BatchDeleteReadSet -> String
showsPrec :: Int -> BatchDeleteReadSet -> ShowS
$cshowsPrec :: Int -> BatchDeleteReadSet -> ShowS
Prelude.Show, forall x. Rep BatchDeleteReadSet x -> BatchDeleteReadSet
forall x. BatchDeleteReadSet -> Rep BatchDeleteReadSet x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchDeleteReadSet x -> BatchDeleteReadSet
$cfrom :: forall x. BatchDeleteReadSet -> Rep BatchDeleteReadSet x
Prelude.Generic)

-- |
-- Create a value of 'BatchDeleteReadSet' 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:
--
-- 'ids', 'batchDeleteReadSet_ids' - The read sets\' IDs.
--
-- 'sequenceStoreId', 'batchDeleteReadSet_sequenceStoreId' - The read sets\' sequence store ID.
newBatchDeleteReadSet ::
  -- | 'ids'
  Prelude.NonEmpty Prelude.Text ->
  -- | 'sequenceStoreId'
  Prelude.Text ->
  BatchDeleteReadSet
newBatchDeleteReadSet :: NonEmpty Text -> Text -> BatchDeleteReadSet
newBatchDeleteReadSet NonEmpty Text
pIds_ Text
pSequenceStoreId_ =
  BatchDeleteReadSet'
    { $sel:ids:BatchDeleteReadSet' :: NonEmpty Text
ids =
        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
pIds_,
      $sel:sequenceStoreId:BatchDeleteReadSet' :: Text
sequenceStoreId = Text
pSequenceStoreId_
    }

-- | The read sets\' IDs.
batchDeleteReadSet_ids :: Lens.Lens' BatchDeleteReadSet (Prelude.NonEmpty Prelude.Text)
batchDeleteReadSet_ids :: Lens' BatchDeleteReadSet (NonEmpty Text)
batchDeleteReadSet_ids = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteReadSet' {NonEmpty Text
ids :: NonEmpty Text
$sel:ids:BatchDeleteReadSet' :: BatchDeleteReadSet -> NonEmpty Text
ids} -> NonEmpty Text
ids) (\s :: BatchDeleteReadSet
s@BatchDeleteReadSet' {} NonEmpty Text
a -> BatchDeleteReadSet
s {$sel:ids:BatchDeleteReadSet' :: NonEmpty Text
ids = NonEmpty Text
a} :: BatchDeleteReadSet) 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

-- | The read sets\' sequence store ID.
batchDeleteReadSet_sequenceStoreId :: Lens.Lens' BatchDeleteReadSet Prelude.Text
batchDeleteReadSet_sequenceStoreId :: Lens' BatchDeleteReadSet Text
batchDeleteReadSet_sequenceStoreId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteReadSet' {Text
sequenceStoreId :: Text
$sel:sequenceStoreId:BatchDeleteReadSet' :: BatchDeleteReadSet -> Text
sequenceStoreId} -> Text
sequenceStoreId) (\s :: BatchDeleteReadSet
s@BatchDeleteReadSet' {} Text
a -> BatchDeleteReadSet
s {$sel:sequenceStoreId:BatchDeleteReadSet' :: Text
sequenceStoreId = Text
a} :: BatchDeleteReadSet)

instance Core.AWSRequest BatchDeleteReadSet where
  type
    AWSResponse BatchDeleteReadSet =
      BatchDeleteReadSetResponse
  request :: (Service -> Service)
-> BatchDeleteReadSet -> Request BatchDeleteReadSet
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 BatchDeleteReadSet
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse BatchDeleteReadSet)))
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 [ReadSetBatchError] -> Int -> BatchDeleteReadSetResponse
BatchDeleteReadSetResponse'
            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
"errors" forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty)
            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 BatchDeleteReadSet where
  hashWithSalt :: Int -> BatchDeleteReadSet -> Int
hashWithSalt Int
_salt BatchDeleteReadSet' {NonEmpty Text
Text
sequenceStoreId :: Text
ids :: NonEmpty Text
$sel:sequenceStoreId:BatchDeleteReadSet' :: BatchDeleteReadSet -> Text
$sel:ids:BatchDeleteReadSet' :: BatchDeleteReadSet -> NonEmpty Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
ids
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
sequenceStoreId

instance Prelude.NFData BatchDeleteReadSet where
  rnf :: BatchDeleteReadSet -> ()
rnf BatchDeleteReadSet' {NonEmpty Text
Text
sequenceStoreId :: Text
ids :: NonEmpty Text
$sel:sequenceStoreId:BatchDeleteReadSet' :: BatchDeleteReadSet -> Text
$sel:ids:BatchDeleteReadSet' :: BatchDeleteReadSet -> NonEmpty Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
ids
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
sequenceStoreId

instance Data.ToHeaders BatchDeleteReadSet where
  toHeaders :: BatchDeleteReadSet -> 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 BatchDeleteReadSet where
  toJSON :: BatchDeleteReadSet -> Value
toJSON BatchDeleteReadSet' {NonEmpty Text
Text
sequenceStoreId :: Text
ids :: NonEmpty Text
$sel:sequenceStoreId:BatchDeleteReadSet' :: BatchDeleteReadSet -> Text
$sel:ids:BatchDeleteReadSet' :: BatchDeleteReadSet -> NonEmpty Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [forall a. a -> Maybe a
Prelude.Just (Key
"ids" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
ids)]
      )

instance Data.ToPath BatchDeleteReadSet where
  toPath :: BatchDeleteReadSet -> ByteString
toPath BatchDeleteReadSet' {NonEmpty Text
Text
sequenceStoreId :: Text
ids :: NonEmpty Text
$sel:sequenceStoreId:BatchDeleteReadSet' :: BatchDeleteReadSet -> Text
$sel:ids:BatchDeleteReadSet' :: BatchDeleteReadSet -> NonEmpty Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/sequencestore/",
        forall a. ToByteString a => a -> ByteString
Data.toBS Text
sequenceStoreId,
        ByteString
"/readset/batch/delete"
      ]

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

-- | /See:/ 'newBatchDeleteReadSetResponse' smart constructor.
data BatchDeleteReadSetResponse = BatchDeleteReadSetResponse'
  { -- | Errors returned by individual delete operations.
    BatchDeleteReadSetResponse -> Maybe [ReadSetBatchError]
errors :: Prelude.Maybe [ReadSetBatchError],
    -- | The response's http status code.
    BatchDeleteReadSetResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (BatchDeleteReadSetResponse -> BatchDeleteReadSetResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDeleteReadSetResponse -> BatchDeleteReadSetResponse -> Bool
$c/= :: BatchDeleteReadSetResponse -> BatchDeleteReadSetResponse -> Bool
== :: BatchDeleteReadSetResponse -> BatchDeleteReadSetResponse -> Bool
$c== :: BatchDeleteReadSetResponse -> BatchDeleteReadSetResponse -> Bool
Prelude.Eq, ReadPrec [BatchDeleteReadSetResponse]
ReadPrec BatchDeleteReadSetResponse
Int -> ReadS BatchDeleteReadSetResponse
ReadS [BatchDeleteReadSetResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDeleteReadSetResponse]
$creadListPrec :: ReadPrec [BatchDeleteReadSetResponse]
readPrec :: ReadPrec BatchDeleteReadSetResponse
$creadPrec :: ReadPrec BatchDeleteReadSetResponse
readList :: ReadS [BatchDeleteReadSetResponse]
$creadList :: ReadS [BatchDeleteReadSetResponse]
readsPrec :: Int -> ReadS BatchDeleteReadSetResponse
$creadsPrec :: Int -> ReadS BatchDeleteReadSetResponse
Prelude.Read, Int -> BatchDeleteReadSetResponse -> ShowS
[BatchDeleteReadSetResponse] -> ShowS
BatchDeleteReadSetResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDeleteReadSetResponse] -> ShowS
$cshowList :: [BatchDeleteReadSetResponse] -> ShowS
show :: BatchDeleteReadSetResponse -> String
$cshow :: BatchDeleteReadSetResponse -> String
showsPrec :: Int -> BatchDeleteReadSetResponse -> ShowS
$cshowsPrec :: Int -> BatchDeleteReadSetResponse -> ShowS
Prelude.Show, forall x.
Rep BatchDeleteReadSetResponse x -> BatchDeleteReadSetResponse
forall x.
BatchDeleteReadSetResponse -> Rep BatchDeleteReadSetResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchDeleteReadSetResponse x -> BatchDeleteReadSetResponse
$cfrom :: forall x.
BatchDeleteReadSetResponse -> Rep BatchDeleteReadSetResponse x
Prelude.Generic)

-- |
-- Create a value of 'BatchDeleteReadSetResponse' 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:
--
-- 'errors', 'batchDeleteReadSetResponse_errors' - Errors returned by individual delete operations.
--
-- 'httpStatus', 'batchDeleteReadSetResponse_httpStatus' - The response's http status code.
newBatchDeleteReadSetResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  BatchDeleteReadSetResponse
newBatchDeleteReadSetResponse :: Int -> BatchDeleteReadSetResponse
newBatchDeleteReadSetResponse Int
pHttpStatus_ =
  BatchDeleteReadSetResponse'
    { $sel:errors:BatchDeleteReadSetResponse' :: Maybe [ReadSetBatchError]
errors =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:BatchDeleteReadSetResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Errors returned by individual delete operations.
batchDeleteReadSetResponse_errors :: Lens.Lens' BatchDeleteReadSetResponse (Prelude.Maybe [ReadSetBatchError])
batchDeleteReadSetResponse_errors :: Lens' BatchDeleteReadSetResponse (Maybe [ReadSetBatchError])
batchDeleteReadSetResponse_errors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteReadSetResponse' {Maybe [ReadSetBatchError]
errors :: Maybe [ReadSetBatchError]
$sel:errors:BatchDeleteReadSetResponse' :: BatchDeleteReadSetResponse -> Maybe [ReadSetBatchError]
errors} -> Maybe [ReadSetBatchError]
errors) (\s :: BatchDeleteReadSetResponse
s@BatchDeleteReadSetResponse' {} Maybe [ReadSetBatchError]
a -> BatchDeleteReadSetResponse
s {$sel:errors:BatchDeleteReadSetResponse' :: Maybe [ReadSetBatchError]
errors = Maybe [ReadSetBatchError]
a} :: BatchDeleteReadSetResponse) 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.
batchDeleteReadSetResponse_httpStatus :: Lens.Lens' BatchDeleteReadSetResponse Prelude.Int
batchDeleteReadSetResponse_httpStatus :: Lens' BatchDeleteReadSetResponse Int
batchDeleteReadSetResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteReadSetResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchDeleteReadSetResponse' :: BatchDeleteReadSetResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchDeleteReadSetResponse
s@BatchDeleteReadSetResponse' {} Int
a -> BatchDeleteReadSetResponse
s {$sel:httpStatus:BatchDeleteReadSetResponse' :: Int
httpStatus = Int
a} :: BatchDeleteReadSetResponse)

instance Prelude.NFData BatchDeleteReadSetResponse where
  rnf :: BatchDeleteReadSetResponse -> ()
rnf BatchDeleteReadSetResponse' {Int
Maybe [ReadSetBatchError]
httpStatus :: Int
errors :: Maybe [ReadSetBatchError]
$sel:httpStatus:BatchDeleteReadSetResponse' :: BatchDeleteReadSetResponse -> Int
$sel:errors:BatchDeleteReadSetResponse' :: BatchDeleteReadSetResponse -> Maybe [ReadSetBatchError]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [ReadSetBatchError]
errors
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus