{-# 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.CreateMap
(
CreateMap (..),
newCreateMap,
createMap_description,
createMap_pricingPlan,
createMap_tags,
createMap_configuration,
createMap_mapName,
CreateMapResponse (..),
newCreateMapResponse,
createMapResponse_httpStatus,
createMapResponse_createTime,
createMapResponse_mapArn,
createMapResponse_mapName,
)
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 CreateMap = CreateMap'
{
CreateMap -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
CreateMap -> Maybe PricingPlan
pricingPlan :: Prelude.Maybe PricingPlan,
CreateMap -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
CreateMap -> MapConfiguration
configuration :: MapConfiguration,
CreateMap -> Text
mapName :: Prelude.Text
}
deriving (CreateMap -> CreateMap -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMap -> CreateMap -> Bool
$c/= :: CreateMap -> CreateMap -> Bool
== :: CreateMap -> CreateMap -> Bool
$c== :: CreateMap -> CreateMap -> Bool
Prelude.Eq, ReadPrec [CreateMap]
ReadPrec CreateMap
Int -> ReadS CreateMap
ReadS [CreateMap]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMap]
$creadListPrec :: ReadPrec [CreateMap]
readPrec :: ReadPrec CreateMap
$creadPrec :: ReadPrec CreateMap
readList :: ReadS [CreateMap]
$creadList :: ReadS [CreateMap]
readsPrec :: Int -> ReadS CreateMap
$creadsPrec :: Int -> ReadS CreateMap
Prelude.Read, Int -> CreateMap -> ShowS
[CreateMap] -> ShowS
CreateMap -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMap] -> ShowS
$cshowList :: [CreateMap] -> ShowS
show :: CreateMap -> String
$cshow :: CreateMap -> String
showsPrec :: Int -> CreateMap -> ShowS
$cshowsPrec :: Int -> CreateMap -> ShowS
Prelude.Show, forall x. Rep CreateMap x -> CreateMap
forall x. CreateMap -> Rep CreateMap x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateMap x -> CreateMap
$cfrom :: forall x. CreateMap -> Rep CreateMap x
Prelude.Generic)
newCreateMap ::
MapConfiguration ->
Prelude.Text ->
CreateMap
newCreateMap :: MapConfiguration -> Text -> CreateMap
newCreateMap MapConfiguration
pConfiguration_ Text
pMapName_ =
CreateMap'
{ $sel:description:CreateMap' :: Maybe Text
description = forall a. Maybe a
Prelude.Nothing,
$sel:pricingPlan:CreateMap' :: Maybe PricingPlan
pricingPlan = forall a. Maybe a
Prelude.Nothing,
$sel:tags:CreateMap' :: Maybe (HashMap Text Text)
tags = forall a. Maybe a
Prelude.Nothing,
$sel:configuration:CreateMap' :: MapConfiguration
configuration = MapConfiguration
pConfiguration_,
$sel:mapName:CreateMap' :: Text
mapName = Text
pMapName_
}
createMap_description :: Lens.Lens' CreateMap (Prelude.Maybe Prelude.Text)
createMap_description :: Lens' CreateMap (Maybe Text)
createMap_description = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMap' {Maybe Text
description :: Maybe Text
$sel:description:CreateMap' :: CreateMap -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateMap
s@CreateMap' {} Maybe Text
a -> CreateMap
s {$sel:description:CreateMap' :: Maybe Text
description = Maybe Text
a} :: CreateMap)
createMap_pricingPlan :: Lens.Lens' CreateMap (Prelude.Maybe PricingPlan)
createMap_pricingPlan :: Lens' CreateMap (Maybe PricingPlan)
createMap_pricingPlan = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMap' {Maybe PricingPlan
pricingPlan :: Maybe PricingPlan
$sel:pricingPlan:CreateMap' :: CreateMap -> Maybe PricingPlan
pricingPlan} -> Maybe PricingPlan
pricingPlan) (\s :: CreateMap
s@CreateMap' {} Maybe PricingPlan
a -> CreateMap
s {$sel:pricingPlan:CreateMap' :: Maybe PricingPlan
pricingPlan = Maybe PricingPlan
a} :: CreateMap)
createMap_tags :: Lens.Lens' CreateMap (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createMap_tags :: Lens' CreateMap (Maybe (HashMap Text Text))
createMap_tags = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMap' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateMap' :: CreateMap -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateMap
s@CreateMap' {} Maybe (HashMap Text Text)
a -> CreateMap
s {$sel:tags:CreateMap' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateMap) 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
createMap_configuration :: Lens.Lens' CreateMap MapConfiguration
createMap_configuration :: Lens' CreateMap MapConfiguration
createMap_configuration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMap' {MapConfiguration
configuration :: MapConfiguration
$sel:configuration:CreateMap' :: CreateMap -> MapConfiguration
configuration} -> MapConfiguration
configuration) (\s :: CreateMap
s@CreateMap' {} MapConfiguration
a -> CreateMap
s {$sel:configuration:CreateMap' :: MapConfiguration
configuration = MapConfiguration
a} :: CreateMap)
createMap_mapName :: Lens.Lens' CreateMap Prelude.Text
createMap_mapName :: Lens' CreateMap Text
createMap_mapName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMap' {Text
mapName :: Text
$sel:mapName:CreateMap' :: CreateMap -> Text
mapName} -> Text
mapName) (\s :: CreateMap
s@CreateMap' {} Text
a -> CreateMap
s {$sel:mapName:CreateMap' :: Text
mapName = Text
a} :: CreateMap)
instance Core.AWSRequest CreateMap where
type AWSResponse CreateMap = CreateMapResponse
request :: (Service -> Service) -> CreateMap -> Request CreateMap
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 CreateMap
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateMap)))
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 -> ISO8601 -> Text -> Text -> CreateMapResponse
CreateMapResponse'
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 a
Data..:> Key
"CreateTime")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"MapArn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String a
Data..:> Key
"MapName")
)
instance Prelude.Hashable CreateMap where
hashWithSalt :: Int -> CreateMap -> Int
hashWithSalt Int
_salt CreateMap' {Maybe Text
Maybe (HashMap Text Text)
Maybe PricingPlan
Text
MapConfiguration
mapName :: Text
configuration :: MapConfiguration
tags :: Maybe (HashMap Text Text)
pricingPlan :: Maybe PricingPlan
description :: Maybe Text
$sel:mapName:CreateMap' :: CreateMap -> Text
$sel:configuration:CreateMap' :: CreateMap -> MapConfiguration
$sel:tags:CreateMap' :: CreateMap -> Maybe (HashMap Text Text)
$sel:pricingPlan:CreateMap' :: CreateMap -> Maybe PricingPlan
$sel:description:CreateMap' :: CreateMap -> Maybe Text
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
description
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe PricingPlan
pricingPlan
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe (HashMap Text Text)
tags
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` MapConfiguration
configuration
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
mapName
instance Prelude.NFData CreateMap where
rnf :: CreateMap -> ()
rnf CreateMap' {Maybe Text
Maybe (HashMap Text Text)
Maybe PricingPlan
Text
MapConfiguration
mapName :: Text
configuration :: MapConfiguration
tags :: Maybe (HashMap Text Text)
pricingPlan :: Maybe PricingPlan
description :: Maybe Text
$sel:mapName:CreateMap' :: CreateMap -> Text
$sel:configuration:CreateMap' :: CreateMap -> MapConfiguration
$sel:tags:CreateMap' :: CreateMap -> Maybe (HashMap Text Text)
$sel:pricingPlan:CreateMap' :: CreateMap -> Maybe PricingPlan
$sel:description:CreateMap' :: CreateMap -> Maybe Text
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
description
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe PricingPlan
pricingPlan
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe (HashMap Text Text)
tags
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf MapConfiguration
configuration
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
mapName
instance Data.ToHeaders CreateMap where
toHeaders :: CreateMap -> 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 CreateMap where
toJSON :: CreateMap -> Value
toJSON CreateMap' {Maybe Text
Maybe (HashMap Text Text)
Maybe PricingPlan
Text
MapConfiguration
mapName :: Text
configuration :: MapConfiguration
tags :: Maybe (HashMap Text Text)
pricingPlan :: Maybe PricingPlan
description :: Maybe Text
$sel:mapName:CreateMap' :: CreateMap -> Text
$sel:configuration:CreateMap' :: CreateMap -> MapConfiguration
$sel:tags:CreateMap' :: CreateMap -> Maybe (HashMap Text Text)
$sel:pricingPlan:CreateMap' :: CreateMap -> Maybe PricingPlan
$sel:description:CreateMap' :: CreateMap -> Maybe Text
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"Description" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
(Key
"PricingPlan" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PricingPlan
pricingPlan,
(Key
"Tags" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
forall a. a -> Maybe a
Prelude.Just (Key
"Configuration" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= MapConfiguration
configuration),
forall a. a -> Maybe a
Prelude.Just (Key
"MapName" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
mapName)
]
)
instance Data.ToPath CreateMap where
toPath :: CreateMap -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/maps/v0/maps"
instance Data.ToQuery CreateMap where
toQuery :: CreateMap -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data CreateMapResponse = CreateMapResponse'
{
CreateMapResponse -> Int
httpStatus :: Prelude.Int,
CreateMapResponse -> ISO8601
createTime :: Data.ISO8601,
CreateMapResponse -> Text
mapArn :: Prelude.Text,
CreateMapResponse -> Text
mapName :: Prelude.Text
}
deriving (CreateMapResponse -> CreateMapResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateMapResponse -> CreateMapResponse -> Bool
$c/= :: CreateMapResponse -> CreateMapResponse -> Bool
== :: CreateMapResponse -> CreateMapResponse -> Bool
$c== :: CreateMapResponse -> CreateMapResponse -> Bool
Prelude.Eq, ReadPrec [CreateMapResponse]
ReadPrec CreateMapResponse
Int -> ReadS CreateMapResponse
ReadS [CreateMapResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateMapResponse]
$creadListPrec :: ReadPrec [CreateMapResponse]
readPrec :: ReadPrec CreateMapResponse
$creadPrec :: ReadPrec CreateMapResponse
readList :: ReadS [CreateMapResponse]
$creadList :: ReadS [CreateMapResponse]
readsPrec :: Int -> ReadS CreateMapResponse
$creadsPrec :: Int -> ReadS CreateMapResponse
Prelude.Read, Int -> CreateMapResponse -> ShowS
[CreateMapResponse] -> ShowS
CreateMapResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateMapResponse] -> ShowS
$cshowList :: [CreateMapResponse] -> ShowS
show :: CreateMapResponse -> String
$cshow :: CreateMapResponse -> String
showsPrec :: Int -> CreateMapResponse -> ShowS
$cshowsPrec :: Int -> CreateMapResponse -> ShowS
Prelude.Show, forall x. Rep CreateMapResponse x -> CreateMapResponse
forall x. CreateMapResponse -> Rep CreateMapResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateMapResponse x -> CreateMapResponse
$cfrom :: forall x. CreateMapResponse -> Rep CreateMapResponse x
Prelude.Generic)
newCreateMapResponse ::
Prelude.Int ->
Prelude.UTCTime ->
Prelude.Text ->
Prelude.Text ->
CreateMapResponse
newCreateMapResponse :: Int -> UTCTime -> Text -> Text -> CreateMapResponse
newCreateMapResponse
Int
pHttpStatus_
UTCTime
pCreateTime_
Text
pMapArn_
Text
pMapName_ =
CreateMapResponse'
{ $sel:httpStatus:CreateMapResponse' :: Int
httpStatus = Int
pHttpStatus_,
$sel:createTime:CreateMapResponse' :: ISO8601
createTime = forall (a :: Format). Iso' (Time a) UTCTime
Data._Time forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreateTime_,
$sel:mapArn:CreateMapResponse' :: Text
mapArn = Text
pMapArn_,
$sel:mapName:CreateMapResponse' :: Text
mapName = Text
pMapName_
}
createMapResponse_httpStatus :: Lens.Lens' CreateMapResponse Prelude.Int
createMapResponse_httpStatus :: Lens' CreateMapResponse Int
createMapResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMapResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateMapResponse' :: CreateMapResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateMapResponse
s@CreateMapResponse' {} Int
a -> CreateMapResponse
s {$sel:httpStatus:CreateMapResponse' :: Int
httpStatus = Int
a} :: CreateMapResponse)
createMapResponse_createTime :: Lens.Lens' CreateMapResponse Prelude.UTCTime
createMapResponse_createTime :: Lens' CreateMapResponse UTCTime
createMapResponse_createTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMapResponse' {ISO8601
createTime :: ISO8601
$sel:createTime:CreateMapResponse' :: CreateMapResponse -> ISO8601
createTime} -> ISO8601
createTime) (\s :: CreateMapResponse
s@CreateMapResponse' {} ISO8601
a -> CreateMapResponse
s {$sel:createTime:CreateMapResponse' :: ISO8601
createTime = ISO8601
a} :: CreateMapResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (a :: Format). Iso' (Time a) UTCTime
Data._Time
createMapResponse_mapArn :: Lens.Lens' CreateMapResponse Prelude.Text
createMapResponse_mapArn :: Lens' CreateMapResponse Text
createMapResponse_mapArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMapResponse' {Text
mapArn :: Text
$sel:mapArn:CreateMapResponse' :: CreateMapResponse -> Text
mapArn} -> Text
mapArn) (\s :: CreateMapResponse
s@CreateMapResponse' {} Text
a -> CreateMapResponse
s {$sel:mapArn:CreateMapResponse' :: Text
mapArn = Text
a} :: CreateMapResponse)
createMapResponse_mapName :: Lens.Lens' CreateMapResponse Prelude.Text
createMapResponse_mapName :: Lens' CreateMapResponse Text
createMapResponse_mapName = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateMapResponse' {Text
mapName :: Text
$sel:mapName:CreateMapResponse' :: CreateMapResponse -> Text
mapName} -> Text
mapName) (\s :: CreateMapResponse
s@CreateMapResponse' {} Text
a -> CreateMapResponse
s {$sel:mapName:CreateMapResponse' :: Text
mapName = Text
a} :: CreateMapResponse)
instance Prelude.NFData CreateMapResponse where
rnf :: CreateMapResponse -> ()
rnf CreateMapResponse' {Int
Text
ISO8601
mapName :: Text
mapArn :: Text
createTime :: ISO8601
httpStatus :: Int
$sel:mapName:CreateMapResponse' :: CreateMapResponse -> Text
$sel:mapArn:CreateMapResponse' :: CreateMapResponse -> Text
$sel:createTime:CreateMapResponse' :: CreateMapResponse -> ISO8601
$sel:httpStatus:CreateMapResponse' :: CreateMapResponse -> 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 ISO8601
createTime
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
mapArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
mapName