{-# 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 #-}
module Amazonka.Location.BatchDeleteGeofence
(
BatchDeleteGeofence (..),
newBatchDeleteGeofence,
batchDeleteGeofence_collectionName,
batchDeleteGeofence_geofenceIds,
BatchDeleteGeofenceResponse (..),
newBatchDeleteGeofenceResponse,
batchDeleteGeofenceResponse_httpStatus,
batchDeleteGeofenceResponse_errors,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.Location.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data BatchDeleteGeofence = BatchDeleteGeofence'
{
BatchDeleteGeofence -> Text
collectionName :: Prelude.Text,
BatchDeleteGeofence -> NonEmpty Text
geofenceIds :: Prelude.NonEmpty Prelude.Text
}
deriving (BatchDeleteGeofence -> BatchDeleteGeofence -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDeleteGeofence -> BatchDeleteGeofence -> Bool
$c/= :: BatchDeleteGeofence -> BatchDeleteGeofence -> Bool
== :: BatchDeleteGeofence -> BatchDeleteGeofence -> Bool
$c== :: BatchDeleteGeofence -> BatchDeleteGeofence -> Bool
Prelude.Eq, ReadPrec [BatchDeleteGeofence]
ReadPrec BatchDeleteGeofence
Int -> ReadS BatchDeleteGeofence
ReadS [BatchDeleteGeofence]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDeleteGeofence]
$creadListPrec :: ReadPrec [BatchDeleteGeofence]
readPrec :: ReadPrec BatchDeleteGeofence
$creadPrec :: ReadPrec BatchDeleteGeofence
readList :: ReadS [BatchDeleteGeofence]
$creadList :: ReadS [BatchDeleteGeofence]
readsPrec :: Int -> ReadS BatchDeleteGeofence
$creadsPrec :: Int -> ReadS BatchDeleteGeofence
Prelude.Read, Int -> BatchDeleteGeofence -> ShowS
[BatchDeleteGeofence] -> ShowS
BatchDeleteGeofence -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDeleteGeofence] -> ShowS
$cshowList :: [BatchDeleteGeofence] -> ShowS
show :: BatchDeleteGeofence -> String
$cshow :: BatchDeleteGeofence -> String
showsPrec :: Int -> BatchDeleteGeofence -> ShowS
$cshowsPrec :: Int -> BatchDeleteGeofence -> ShowS
Prelude.Show, forall x. Rep BatchDeleteGeofence x -> BatchDeleteGeofence
forall x. BatchDeleteGeofence -> Rep BatchDeleteGeofence x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep BatchDeleteGeofence x -> BatchDeleteGeofence
$cfrom :: forall x. BatchDeleteGeofence -> Rep BatchDeleteGeofence x
Prelude.Generic)
newBatchDeleteGeofence ::
Prelude.Text ->
Prelude.NonEmpty Prelude.Text ->
BatchDeleteGeofence
newBatchDeleteGeofence :: Text -> NonEmpty Text -> BatchDeleteGeofence
newBatchDeleteGeofence Text
pCollectionName_ NonEmpty Text
pGeofenceIds_ =
BatchDeleteGeofence'
{ $sel:collectionName:BatchDeleteGeofence' :: Text
collectionName =
Text
pCollectionName_,
$sel:geofenceIds:BatchDeleteGeofence' :: NonEmpty Text
geofenceIds = 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
pGeofenceIds_
}
batchDeleteGeofence_collectionName :: Lens.Lens' BatchDeleteGeofence Prelude.Text
batchDeleteGeofence_collectionName :: Lens' BatchDeleteGeofence Text
batchDeleteGeofence_collectionName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteGeofence' {Text
collectionName :: Text
$sel:collectionName:BatchDeleteGeofence' :: BatchDeleteGeofence -> Text
collectionName} -> Text
collectionName) (\s :: BatchDeleteGeofence
s@BatchDeleteGeofence' {} Text
a -> BatchDeleteGeofence
s {$sel:collectionName:BatchDeleteGeofence' :: Text
collectionName = Text
a} :: BatchDeleteGeofence)
batchDeleteGeofence_geofenceIds :: Lens.Lens' BatchDeleteGeofence (Prelude.NonEmpty Prelude.Text)
batchDeleteGeofence_geofenceIds :: Lens' BatchDeleteGeofence (NonEmpty Text)
batchDeleteGeofence_geofenceIds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteGeofence' {NonEmpty Text
geofenceIds :: NonEmpty Text
$sel:geofenceIds:BatchDeleteGeofence' :: BatchDeleteGeofence -> NonEmpty Text
geofenceIds} -> NonEmpty Text
geofenceIds) (\s :: BatchDeleteGeofence
s@BatchDeleteGeofence' {} NonEmpty Text
a -> BatchDeleteGeofence
s {$sel:geofenceIds:BatchDeleteGeofence' :: NonEmpty Text
geofenceIds = NonEmpty Text
a} :: BatchDeleteGeofence) 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 BatchDeleteGeofence where
type
AWSResponse BatchDeleteGeofence =
BatchDeleteGeofenceResponse
request :: (Service -> Service)
-> BatchDeleteGeofence -> Request BatchDeleteGeofence
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 BatchDeleteGeofence
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchDeleteGeofence)))
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 ->
Int -> [BatchDeleteGeofenceError] -> BatchDeleteGeofenceResponse
BatchDeleteGeofenceResponse'
forall (f :: * -> *) a b. Functor 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))
forall (f :: * -> *) a b. Applicative f => 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)
)
instance Prelude.Hashable BatchDeleteGeofence where
hashWithSalt :: Int -> BatchDeleteGeofence -> Int
hashWithSalt Int
_salt BatchDeleteGeofence' {NonEmpty Text
Text
geofenceIds :: NonEmpty Text
collectionName :: Text
$sel:geofenceIds:BatchDeleteGeofence' :: BatchDeleteGeofence -> NonEmpty Text
$sel:collectionName:BatchDeleteGeofence' :: BatchDeleteGeofence -> Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
collectionName
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` NonEmpty Text
geofenceIds
instance Prelude.NFData BatchDeleteGeofence where
rnf :: BatchDeleteGeofence -> ()
rnf BatchDeleteGeofence' {NonEmpty Text
Text
geofenceIds :: NonEmpty Text
collectionName :: Text
$sel:geofenceIds:BatchDeleteGeofence' :: BatchDeleteGeofence -> NonEmpty Text
$sel:collectionName:BatchDeleteGeofence' :: BatchDeleteGeofence -> Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Text
collectionName
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf NonEmpty Text
geofenceIds
instance Data.ToHeaders BatchDeleteGeofence where
toHeaders :: BatchDeleteGeofence -> 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 BatchDeleteGeofence where
toJSON :: BatchDeleteGeofence -> Value
toJSON BatchDeleteGeofence' {NonEmpty Text
Text
geofenceIds :: NonEmpty Text
collectionName :: Text
$sel:geofenceIds:BatchDeleteGeofence' :: BatchDeleteGeofence -> NonEmpty Text
$sel:collectionName:BatchDeleteGeofence' :: BatchDeleteGeofence -> Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[forall a. a -> Maybe a
Prelude.Just (Key
"GeofenceIds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= NonEmpty Text
geofenceIds)]
)
instance Data.ToPath BatchDeleteGeofence where
toPath :: BatchDeleteGeofence -> ByteString
toPath BatchDeleteGeofence' {NonEmpty Text
Text
geofenceIds :: NonEmpty Text
collectionName :: Text
$sel:geofenceIds:BatchDeleteGeofence' :: BatchDeleteGeofence -> NonEmpty Text
$sel:collectionName:BatchDeleteGeofence' :: BatchDeleteGeofence -> Text
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/geofencing/v0/collections/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
collectionName,
ByteString
"/delete-geofences"
]
instance Data.ToQuery BatchDeleteGeofence where
toQuery :: BatchDeleteGeofence -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data BatchDeleteGeofenceResponse = BatchDeleteGeofenceResponse'
{
BatchDeleteGeofenceResponse -> Int
httpStatus :: Prelude.Int,
BatchDeleteGeofenceResponse -> [BatchDeleteGeofenceError]
errors :: [BatchDeleteGeofenceError]
}
deriving (BatchDeleteGeofenceResponse -> BatchDeleteGeofenceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: BatchDeleteGeofenceResponse -> BatchDeleteGeofenceResponse -> Bool
$c/= :: BatchDeleteGeofenceResponse -> BatchDeleteGeofenceResponse -> Bool
== :: BatchDeleteGeofenceResponse -> BatchDeleteGeofenceResponse -> Bool
$c== :: BatchDeleteGeofenceResponse -> BatchDeleteGeofenceResponse -> Bool
Prelude.Eq, ReadPrec [BatchDeleteGeofenceResponse]
ReadPrec BatchDeleteGeofenceResponse
Int -> ReadS BatchDeleteGeofenceResponse
ReadS [BatchDeleteGeofenceResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [BatchDeleteGeofenceResponse]
$creadListPrec :: ReadPrec [BatchDeleteGeofenceResponse]
readPrec :: ReadPrec BatchDeleteGeofenceResponse
$creadPrec :: ReadPrec BatchDeleteGeofenceResponse
readList :: ReadS [BatchDeleteGeofenceResponse]
$creadList :: ReadS [BatchDeleteGeofenceResponse]
readsPrec :: Int -> ReadS BatchDeleteGeofenceResponse
$creadsPrec :: Int -> ReadS BatchDeleteGeofenceResponse
Prelude.Read, Int -> BatchDeleteGeofenceResponse -> ShowS
[BatchDeleteGeofenceResponse] -> ShowS
BatchDeleteGeofenceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [BatchDeleteGeofenceResponse] -> ShowS
$cshowList :: [BatchDeleteGeofenceResponse] -> ShowS
show :: BatchDeleteGeofenceResponse -> String
$cshow :: BatchDeleteGeofenceResponse -> String
showsPrec :: Int -> BatchDeleteGeofenceResponse -> ShowS
$cshowsPrec :: Int -> BatchDeleteGeofenceResponse -> ShowS
Prelude.Show, forall x.
Rep BatchDeleteGeofenceResponse x -> BatchDeleteGeofenceResponse
forall x.
BatchDeleteGeofenceResponse -> Rep BatchDeleteGeofenceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep BatchDeleteGeofenceResponse x -> BatchDeleteGeofenceResponse
$cfrom :: forall x.
BatchDeleteGeofenceResponse -> Rep BatchDeleteGeofenceResponse x
Prelude.Generic)
newBatchDeleteGeofenceResponse ::
Prelude.Int ->
BatchDeleteGeofenceResponse
newBatchDeleteGeofenceResponse :: Int -> BatchDeleteGeofenceResponse
newBatchDeleteGeofenceResponse Int
pHttpStatus_ =
BatchDeleteGeofenceResponse'
{ $sel:httpStatus:BatchDeleteGeofenceResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:errors:BatchDeleteGeofenceResponse' :: [BatchDeleteGeofenceError]
errors = forall a. Monoid a => a
Prelude.mempty
}
batchDeleteGeofenceResponse_httpStatus :: Lens.Lens' BatchDeleteGeofenceResponse Prelude.Int
batchDeleteGeofenceResponse_httpStatus :: Lens' BatchDeleteGeofenceResponse Int
batchDeleteGeofenceResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteGeofenceResponse' {Int
httpStatus :: Int
$sel:httpStatus:BatchDeleteGeofenceResponse' :: BatchDeleteGeofenceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: BatchDeleteGeofenceResponse
s@BatchDeleteGeofenceResponse' {} Int
a -> BatchDeleteGeofenceResponse
s {$sel:httpStatus:BatchDeleteGeofenceResponse' :: Int
httpStatus = Int
a} :: BatchDeleteGeofenceResponse)
batchDeleteGeofenceResponse_errors :: Lens.Lens' BatchDeleteGeofenceResponse [BatchDeleteGeofenceError]
batchDeleteGeofenceResponse_errors :: Lens' BatchDeleteGeofenceResponse [BatchDeleteGeofenceError]
batchDeleteGeofenceResponse_errors = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\BatchDeleteGeofenceResponse' {[BatchDeleteGeofenceError]
errors :: [BatchDeleteGeofenceError]
$sel:errors:BatchDeleteGeofenceResponse' :: BatchDeleteGeofenceResponse -> [BatchDeleteGeofenceError]
errors} -> [BatchDeleteGeofenceError]
errors) (\s :: BatchDeleteGeofenceResponse
s@BatchDeleteGeofenceResponse' {} [BatchDeleteGeofenceError]
a -> BatchDeleteGeofenceResponse
s {$sel:errors:BatchDeleteGeofenceResponse' :: [BatchDeleteGeofenceError]
errors = [BatchDeleteGeofenceError]
a} :: BatchDeleteGeofenceResponse) 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 Prelude.NFData BatchDeleteGeofenceResponse where
rnf :: BatchDeleteGeofenceResponse -> ()
rnf BatchDeleteGeofenceResponse' {Int
[BatchDeleteGeofenceError]
errors :: [BatchDeleteGeofenceError]
httpStatus :: Int
$sel:errors:BatchDeleteGeofenceResponse' :: BatchDeleteGeofenceResponse -> [BatchDeleteGeofenceError]
$sel:httpStatus:BatchDeleteGeofenceResponse' :: BatchDeleteGeofenceResponse -> Int
..} =
forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [BatchDeleteGeofenceError]
errors