{-# 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.Lens as Lens
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
(BatchDeleteGeofence -> BatchDeleteGeofence -> Bool)
-> (BatchDeleteGeofence -> BatchDeleteGeofence -> Bool)
-> Eq BatchDeleteGeofence
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]
(Int -> ReadS BatchDeleteGeofence)
-> ReadS [BatchDeleteGeofence]
-> ReadPrec BatchDeleteGeofence
-> ReadPrec [BatchDeleteGeofence]
-> Read 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
(Int -> BatchDeleteGeofence -> ShowS)
-> (BatchDeleteGeofence -> String)
-> ([BatchDeleteGeofence] -> ShowS)
-> Show BatchDeleteGeofence
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. BatchDeleteGeofence -> Rep BatchDeleteGeofence x)
-> (forall x. Rep BatchDeleteGeofence x -> BatchDeleteGeofence)
-> Generic BatchDeleteGeofence
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' :: Text -> NonEmpty Text -> BatchDeleteGeofence
BatchDeleteGeofence'
{ $sel:collectionName:BatchDeleteGeofence' :: Text
collectionName =
Text
pCollectionName_,
$sel:geofenceIds:BatchDeleteGeofence' :: NonEmpty Text
geofenceIds = Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pGeofenceIds_
}
batchDeleteGeofence_collectionName :: Lens.Lens' BatchDeleteGeofence Prelude.Text
batchDeleteGeofence_collectionName :: (Text -> f Text) -> BatchDeleteGeofence -> f BatchDeleteGeofence
batchDeleteGeofence_collectionName = (BatchDeleteGeofence -> Text)
-> (BatchDeleteGeofence -> Text -> BatchDeleteGeofence)
-> Lens BatchDeleteGeofence BatchDeleteGeofence Text Text
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 :: (NonEmpty Text -> f (NonEmpty Text))
-> BatchDeleteGeofence -> f BatchDeleteGeofence
batchDeleteGeofence_geofenceIds = (BatchDeleteGeofence -> NonEmpty Text)
-> (BatchDeleteGeofence -> NonEmpty Text -> BatchDeleteGeofence)
-> Lens
BatchDeleteGeofence
BatchDeleteGeofence
(NonEmpty Text)
(NonEmpty Text)
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) ((NonEmpty Text -> f (NonEmpty Text))
-> BatchDeleteGeofence -> f BatchDeleteGeofence)
-> ((NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> BatchDeleteGeofence
-> f BatchDeleteGeofence
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
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 :: BatchDeleteGeofence -> Request BatchDeleteGeofence
request = Service -> BatchDeleteGeofence -> Request BatchDeleteGeofence
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy BatchDeleteGeofence
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchDeleteGeofence)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse BatchDeleteGeofence))
-> Logger
-> Service
-> Proxy BatchDeleteGeofence
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse BatchDeleteGeofence)))
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 ->
Int -> [BatchDeleteGeofenceError] -> BatchDeleteGeofenceResponse
BatchDeleteGeofenceResponse'
(Int -> [BatchDeleteGeofenceError] -> BatchDeleteGeofenceResponse)
-> Either String Int
-> Either
String ([BatchDeleteGeofenceError] -> BatchDeleteGeofenceResponse)
forall (f :: * -> *) a b. Functor 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))
Either
String ([BatchDeleteGeofenceError] -> BatchDeleteGeofenceResponse)
-> Either String [BatchDeleteGeofenceError]
-> Either String BatchDeleteGeofenceResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe [BatchDeleteGeofenceError])
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"Errors" Either String (Maybe [BatchDeleteGeofenceError])
-> [BatchDeleteGeofenceError]
-> Either String [BatchDeleteGeofenceError]
forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ [BatchDeleteGeofenceError]
forall a. Monoid a => a
Prelude.mempty)
)
instance Prelude.Hashable BatchDeleteGeofence
instance Prelude.NFData BatchDeleteGeofence
instance Core.ToHeaders BatchDeleteGeofence where
toHeaders :: BatchDeleteGeofence -> ResponseHeaders
toHeaders =
ResponseHeaders -> BatchDeleteGeofence -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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.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
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GeofenceIds" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
geofenceIds)]
)
instance Core.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
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/geofencing/v0/collections/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
collectionName,
ByteString
"/delete-geofences"
]
instance Core.ToQuery BatchDeleteGeofence where
toQuery :: BatchDeleteGeofence -> QueryString
toQuery = QueryString -> BatchDeleteGeofence -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data BatchDeleteGeofenceResponse = BatchDeleteGeofenceResponse'
{
BatchDeleteGeofenceResponse -> Int
httpStatus :: Prelude.Int,
BatchDeleteGeofenceResponse -> [BatchDeleteGeofenceError]
errors :: [BatchDeleteGeofenceError]
}
deriving (BatchDeleteGeofenceResponse -> BatchDeleteGeofenceResponse -> Bool
(BatchDeleteGeofenceResponse
-> BatchDeleteGeofenceResponse -> Bool)
-> (BatchDeleteGeofenceResponse
-> BatchDeleteGeofenceResponse -> Bool)
-> Eq BatchDeleteGeofenceResponse
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]
(Int -> ReadS BatchDeleteGeofenceResponse)
-> ReadS [BatchDeleteGeofenceResponse]
-> ReadPrec BatchDeleteGeofenceResponse
-> ReadPrec [BatchDeleteGeofenceResponse]
-> Read 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
(Int -> BatchDeleteGeofenceResponse -> ShowS)
-> (BatchDeleteGeofenceResponse -> String)
-> ([BatchDeleteGeofenceResponse] -> ShowS)
-> Show BatchDeleteGeofenceResponse
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.
BatchDeleteGeofenceResponse -> Rep BatchDeleteGeofenceResponse x)
-> (forall x.
Rep BatchDeleteGeofenceResponse x -> BatchDeleteGeofenceResponse)
-> Generic BatchDeleteGeofenceResponse
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' :: Int -> [BatchDeleteGeofenceError] -> BatchDeleteGeofenceResponse
BatchDeleteGeofenceResponse'
{ $sel:httpStatus:BatchDeleteGeofenceResponse' :: Int
httpStatus =
Int
pHttpStatus_,
$sel:errors:BatchDeleteGeofenceResponse' :: [BatchDeleteGeofenceError]
errors = [BatchDeleteGeofenceError]
forall a. Monoid a => a
Prelude.mempty
}
batchDeleteGeofenceResponse_httpStatus :: Lens.Lens' BatchDeleteGeofenceResponse Prelude.Int
batchDeleteGeofenceResponse_httpStatus :: (Int -> f Int)
-> BatchDeleteGeofenceResponse -> f BatchDeleteGeofenceResponse
batchDeleteGeofenceResponse_httpStatus = (BatchDeleteGeofenceResponse -> Int)
-> (BatchDeleteGeofenceResponse
-> Int -> BatchDeleteGeofenceResponse)
-> Lens
BatchDeleteGeofenceResponse BatchDeleteGeofenceResponse Int Int
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 :: ([BatchDeleteGeofenceError] -> f [BatchDeleteGeofenceError])
-> BatchDeleteGeofenceResponse -> f BatchDeleteGeofenceResponse
batchDeleteGeofenceResponse_errors = (BatchDeleteGeofenceResponse -> [BatchDeleteGeofenceError])
-> (BatchDeleteGeofenceResponse
-> [BatchDeleteGeofenceError] -> BatchDeleteGeofenceResponse)
-> Lens
BatchDeleteGeofenceResponse
BatchDeleteGeofenceResponse
[BatchDeleteGeofenceError]
[BatchDeleteGeofenceError]
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) (([BatchDeleteGeofenceError] -> f [BatchDeleteGeofenceError])
-> BatchDeleteGeofenceResponse -> f BatchDeleteGeofenceResponse)
-> (([BatchDeleteGeofenceError] -> f [BatchDeleteGeofenceError])
-> [BatchDeleteGeofenceError] -> f [BatchDeleteGeofenceError])
-> ([BatchDeleteGeofenceError] -> f [BatchDeleteGeofenceError])
-> BatchDeleteGeofenceResponse
-> f BatchDeleteGeofenceResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([BatchDeleteGeofenceError] -> f [BatchDeleteGeofenceError])
-> [BatchDeleteGeofenceError] -> f [BatchDeleteGeofenceError]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
instance Prelude.NFData BatchDeleteGeofenceResponse