{-# 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.Location.CreatePlaceIndex
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a place index resource in your AWS account, which supports
-- functions with geospatial data sourced from your chosen data provider.
module Amazonka.Location.CreatePlaceIndex
  ( -- * Creating a Request
    CreatePlaceIndex (..),
    newCreatePlaceIndex,

    -- * Request Lenses
    createPlaceIndex_dataSourceConfiguration,
    createPlaceIndex_description,
    createPlaceIndex_tags,
    createPlaceIndex_dataSource,
    createPlaceIndex_indexName,
    createPlaceIndex_pricingPlan,

    -- * Destructuring the Response
    CreatePlaceIndexResponse (..),
    newCreatePlaceIndexResponse,

    -- * Response Lenses
    createPlaceIndexResponse_httpStatus,
    createPlaceIndexResponse_createTime,
    createPlaceIndexResponse_indexArn,
    createPlaceIndexResponse_indexName,
  )
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

-- | /See:/ 'newCreatePlaceIndex' smart constructor.
data CreatePlaceIndex = CreatePlaceIndex'
  { -- | Specifies the data storage option requesting Places.
    CreatePlaceIndex -> Maybe DataSourceConfiguration
dataSourceConfiguration :: Prelude.Maybe DataSourceConfiguration,
    -- | The optional description for the place index resource.
    CreatePlaceIndex -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Applies one or more tags to the place index resource. A tag is a
    -- key-value pair helps manage, identify, search, and filter your resources
    -- by labelling them.
    --
    -- Format: @\"key\" : \"value\"@
    --
    -- Restrictions:
    --
    -- -   Maximum 50 tags per resource
    --
    -- -   Each resource tag must be unique with a maximum of one value.
    --
    -- -   Maximum key length: 128 Unicode characters in UTF-8
    --
    -- -   Maximum value length: 256 Unicode characters in UTF-8
    --
    -- -   Can use alphanumeric characters (A–Z, a–z, 0–9), and the following
    --     characters: + - = . _ : \/ \@.
    CreatePlaceIndex -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Specifies the data provider of geospatial data.
    --
    -- This field is case-sensitive. Enter the valid values as shown. For
    -- example, entering @HERE@ returns an error.
    --
    -- Valid values include:
    --
    -- -   @Esri@ – For additional information about
    --     <https://docs.aws.amazon.com/location/latest/developerguide/esri.html Esri>\'s
    --     coverage in your region of interest, see
    --     <https://developers.arcgis.com/rest/geocode/api-reference/geocode-coverage.htm Esri details on geocoding coverage>.
    --
    -- -   @Here@ – For additional information about
    --     <https://docs.aws.amazon.com/location/latest/developerguide/HERE.html HERE Technologies>\'
    --     coverage in your region of interest, see
    --     <https://developer.here.com/documentation/geocoder/dev_guide/topics/coverage-geocoder.html HERE details on goecoding coverage>.
    --
    --     Place index resources using HERE Technologies as a data provider
    --     can\'t
    --     <https://docs.aws.amazon.com/location-places/latest/APIReference/API_DataSourceConfiguration.html store results>
    --     for locations in Japan. For more information, see the
    --     <https://aws.amazon.com/service-terms/ AWS Service Terms> for Amazon
    --     Location Service.
    --
    -- For additional information , see
    -- <https://docs.aws.amazon.com/location/latest/developerguide/what-is-data-provider.html Data providers>
    -- on the /Amazon Location Service Developer Guide/.
    CreatePlaceIndex -> Text
dataSource :: Prelude.Text,
    -- | The name of the place index resource.
    --
    -- Requirements:
    --
    -- -   Contain only alphanumeric characters (A–Z, a–z, 0–9), hyphens (-),
    --     periods (.), and underscores (_).
    --
    -- -   Must be a unique place index resource name.
    --
    -- -   No spaces allowed. For example, @ExamplePlaceIndex@.
    CreatePlaceIndex -> Text
indexName :: Prelude.Text,
    -- | Specifies the pricing plan for your place index resource.
    --
    -- For additional details and restrictions on each pricing plan option, see
    -- <https://aws.amazon.com/location/pricing/ Amazon Location Service pricing>.
    CreatePlaceIndex -> PricingPlan
pricingPlan :: PricingPlan
  }
  deriving (CreatePlaceIndex -> CreatePlaceIndex -> Bool
(CreatePlaceIndex -> CreatePlaceIndex -> Bool)
-> (CreatePlaceIndex -> CreatePlaceIndex -> Bool)
-> Eq CreatePlaceIndex
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePlaceIndex -> CreatePlaceIndex -> Bool
$c/= :: CreatePlaceIndex -> CreatePlaceIndex -> Bool
== :: CreatePlaceIndex -> CreatePlaceIndex -> Bool
$c== :: CreatePlaceIndex -> CreatePlaceIndex -> Bool
Prelude.Eq, ReadPrec [CreatePlaceIndex]
ReadPrec CreatePlaceIndex
Int -> ReadS CreatePlaceIndex
ReadS [CreatePlaceIndex]
(Int -> ReadS CreatePlaceIndex)
-> ReadS [CreatePlaceIndex]
-> ReadPrec CreatePlaceIndex
-> ReadPrec [CreatePlaceIndex]
-> Read CreatePlaceIndex
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePlaceIndex]
$creadListPrec :: ReadPrec [CreatePlaceIndex]
readPrec :: ReadPrec CreatePlaceIndex
$creadPrec :: ReadPrec CreatePlaceIndex
readList :: ReadS [CreatePlaceIndex]
$creadList :: ReadS [CreatePlaceIndex]
readsPrec :: Int -> ReadS CreatePlaceIndex
$creadsPrec :: Int -> ReadS CreatePlaceIndex
Prelude.Read, Int -> CreatePlaceIndex -> ShowS
[CreatePlaceIndex] -> ShowS
CreatePlaceIndex -> String
(Int -> CreatePlaceIndex -> ShowS)
-> (CreatePlaceIndex -> String)
-> ([CreatePlaceIndex] -> ShowS)
-> Show CreatePlaceIndex
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePlaceIndex] -> ShowS
$cshowList :: [CreatePlaceIndex] -> ShowS
show :: CreatePlaceIndex -> String
$cshow :: CreatePlaceIndex -> String
showsPrec :: Int -> CreatePlaceIndex -> ShowS
$cshowsPrec :: Int -> CreatePlaceIndex -> ShowS
Prelude.Show, (forall x. CreatePlaceIndex -> Rep CreatePlaceIndex x)
-> (forall x. Rep CreatePlaceIndex x -> CreatePlaceIndex)
-> Generic CreatePlaceIndex
forall x. Rep CreatePlaceIndex x -> CreatePlaceIndex
forall x. CreatePlaceIndex -> Rep CreatePlaceIndex x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreatePlaceIndex x -> CreatePlaceIndex
$cfrom :: forall x. CreatePlaceIndex -> Rep CreatePlaceIndex x
Prelude.Generic)

-- |
-- Create a value of 'CreatePlaceIndex' 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:
--
-- 'dataSourceConfiguration', 'createPlaceIndex_dataSourceConfiguration' - Specifies the data storage option requesting Places.
--
-- 'description', 'createPlaceIndex_description' - The optional description for the place index resource.
--
-- 'tags', 'createPlaceIndex_tags' - Applies one or more tags to the place index resource. A tag is a
-- key-value pair helps manage, identify, search, and filter your resources
-- by labelling them.
--
-- Format: @\"key\" : \"value\"@
--
-- Restrictions:
--
-- -   Maximum 50 tags per resource
--
-- -   Each resource tag must be unique with a maximum of one value.
--
-- -   Maximum key length: 128 Unicode characters in UTF-8
--
-- -   Maximum value length: 256 Unicode characters in UTF-8
--
-- -   Can use alphanumeric characters (A–Z, a–z, 0–9), and the following
--     characters: + - = . _ : \/ \@.
--
-- 'dataSource', 'createPlaceIndex_dataSource' - Specifies the data provider of geospatial data.
--
-- This field is case-sensitive. Enter the valid values as shown. For
-- example, entering @HERE@ returns an error.
--
-- Valid values include:
--
-- -   @Esri@ – For additional information about
--     <https://docs.aws.amazon.com/location/latest/developerguide/esri.html Esri>\'s
--     coverage in your region of interest, see
--     <https://developers.arcgis.com/rest/geocode/api-reference/geocode-coverage.htm Esri details on geocoding coverage>.
--
-- -   @Here@ – For additional information about
--     <https://docs.aws.amazon.com/location/latest/developerguide/HERE.html HERE Technologies>\'
--     coverage in your region of interest, see
--     <https://developer.here.com/documentation/geocoder/dev_guide/topics/coverage-geocoder.html HERE details on goecoding coverage>.
--
--     Place index resources using HERE Technologies as a data provider
--     can\'t
--     <https://docs.aws.amazon.com/location-places/latest/APIReference/API_DataSourceConfiguration.html store results>
--     for locations in Japan. For more information, see the
--     <https://aws.amazon.com/service-terms/ AWS Service Terms> for Amazon
--     Location Service.
--
-- For additional information , see
-- <https://docs.aws.amazon.com/location/latest/developerguide/what-is-data-provider.html Data providers>
-- on the /Amazon Location Service Developer Guide/.
--
-- 'indexName', 'createPlaceIndex_indexName' - The name of the place index resource.
--
-- Requirements:
--
-- -   Contain only alphanumeric characters (A–Z, a–z, 0–9), hyphens (-),
--     periods (.), and underscores (_).
--
-- -   Must be a unique place index resource name.
--
-- -   No spaces allowed. For example, @ExamplePlaceIndex@.
--
-- 'pricingPlan', 'createPlaceIndex_pricingPlan' - Specifies the pricing plan for your place index resource.
--
-- For additional details and restrictions on each pricing plan option, see
-- <https://aws.amazon.com/location/pricing/ Amazon Location Service pricing>.
newCreatePlaceIndex ::
  -- | 'dataSource'
  Prelude.Text ->
  -- | 'indexName'
  Prelude.Text ->
  -- | 'pricingPlan'
  PricingPlan ->
  CreatePlaceIndex
newCreatePlaceIndex :: Text -> Text -> PricingPlan -> CreatePlaceIndex
newCreatePlaceIndex
  Text
pDataSource_
  Text
pIndexName_
  PricingPlan
pPricingPlan_ =
    CreatePlaceIndex' :: Maybe DataSourceConfiguration
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> PricingPlan
-> CreatePlaceIndex
CreatePlaceIndex'
      { $sel:dataSourceConfiguration:CreatePlaceIndex' :: Maybe DataSourceConfiguration
dataSourceConfiguration =
          Maybe DataSourceConfiguration
forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreatePlaceIndex' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreatePlaceIndex' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:dataSource:CreatePlaceIndex' :: Text
dataSource = Text
pDataSource_,
        $sel:indexName:CreatePlaceIndex' :: Text
indexName = Text
pIndexName_,
        $sel:pricingPlan:CreatePlaceIndex' :: PricingPlan
pricingPlan = PricingPlan
pPricingPlan_
      }

-- | Specifies the data storage option requesting Places.
createPlaceIndex_dataSourceConfiguration :: Lens.Lens' CreatePlaceIndex (Prelude.Maybe DataSourceConfiguration)
createPlaceIndex_dataSourceConfiguration :: (Maybe DataSourceConfiguration
 -> f (Maybe DataSourceConfiguration))
-> CreatePlaceIndex -> f CreatePlaceIndex
createPlaceIndex_dataSourceConfiguration = (CreatePlaceIndex -> Maybe DataSourceConfiguration)
-> (CreatePlaceIndex
    -> Maybe DataSourceConfiguration -> CreatePlaceIndex)
-> Lens
     CreatePlaceIndex
     CreatePlaceIndex
     (Maybe DataSourceConfiguration)
     (Maybe DataSourceConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlaceIndex' {Maybe DataSourceConfiguration
dataSourceConfiguration :: Maybe DataSourceConfiguration
$sel:dataSourceConfiguration:CreatePlaceIndex' :: CreatePlaceIndex -> Maybe DataSourceConfiguration
dataSourceConfiguration} -> Maybe DataSourceConfiguration
dataSourceConfiguration) (\s :: CreatePlaceIndex
s@CreatePlaceIndex' {} Maybe DataSourceConfiguration
a -> CreatePlaceIndex
s {$sel:dataSourceConfiguration:CreatePlaceIndex' :: Maybe DataSourceConfiguration
dataSourceConfiguration = Maybe DataSourceConfiguration
a} :: CreatePlaceIndex)

-- | The optional description for the place index resource.
createPlaceIndex_description :: Lens.Lens' CreatePlaceIndex (Prelude.Maybe Prelude.Text)
createPlaceIndex_description :: (Maybe Text -> f (Maybe Text))
-> CreatePlaceIndex -> f CreatePlaceIndex
createPlaceIndex_description = (CreatePlaceIndex -> Maybe Text)
-> (CreatePlaceIndex -> Maybe Text -> CreatePlaceIndex)
-> Lens CreatePlaceIndex CreatePlaceIndex (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlaceIndex' {Maybe Text
description :: Maybe Text
$sel:description:CreatePlaceIndex' :: CreatePlaceIndex -> Maybe Text
description} -> Maybe Text
description) (\s :: CreatePlaceIndex
s@CreatePlaceIndex' {} Maybe Text
a -> CreatePlaceIndex
s {$sel:description:CreatePlaceIndex' :: Maybe Text
description = Maybe Text
a} :: CreatePlaceIndex)

-- | Applies one or more tags to the place index resource. A tag is a
-- key-value pair helps manage, identify, search, and filter your resources
-- by labelling them.
--
-- Format: @\"key\" : \"value\"@
--
-- Restrictions:
--
-- -   Maximum 50 tags per resource
--
-- -   Each resource tag must be unique with a maximum of one value.
--
-- -   Maximum key length: 128 Unicode characters in UTF-8
--
-- -   Maximum value length: 256 Unicode characters in UTF-8
--
-- -   Can use alphanumeric characters (A–Z, a–z, 0–9), and the following
--     characters: + - = . _ : \/ \@.
createPlaceIndex_tags :: Lens.Lens' CreatePlaceIndex (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createPlaceIndex_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreatePlaceIndex -> f CreatePlaceIndex
createPlaceIndex_tags = (CreatePlaceIndex -> Maybe (HashMap Text Text))
-> (CreatePlaceIndex
    -> Maybe (HashMap Text Text) -> CreatePlaceIndex)
-> Lens
     CreatePlaceIndex
     CreatePlaceIndex
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlaceIndex' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreatePlaceIndex' :: CreatePlaceIndex -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreatePlaceIndex
s@CreatePlaceIndex' {} Maybe (HashMap Text Text)
a -> CreatePlaceIndex
s {$sel:tags:CreatePlaceIndex' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreatePlaceIndex) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreatePlaceIndex -> f CreatePlaceIndex)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreatePlaceIndex
-> f CreatePlaceIndex
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
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 AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specifies the data provider of geospatial data.
--
-- This field is case-sensitive. Enter the valid values as shown. For
-- example, entering @HERE@ returns an error.
--
-- Valid values include:
--
-- -   @Esri@ – For additional information about
--     <https://docs.aws.amazon.com/location/latest/developerguide/esri.html Esri>\'s
--     coverage in your region of interest, see
--     <https://developers.arcgis.com/rest/geocode/api-reference/geocode-coverage.htm Esri details on geocoding coverage>.
--
-- -   @Here@ – For additional information about
--     <https://docs.aws.amazon.com/location/latest/developerguide/HERE.html HERE Technologies>\'
--     coverage in your region of interest, see
--     <https://developer.here.com/documentation/geocoder/dev_guide/topics/coverage-geocoder.html HERE details on goecoding coverage>.
--
--     Place index resources using HERE Technologies as a data provider
--     can\'t
--     <https://docs.aws.amazon.com/location-places/latest/APIReference/API_DataSourceConfiguration.html store results>
--     for locations in Japan. For more information, see the
--     <https://aws.amazon.com/service-terms/ AWS Service Terms> for Amazon
--     Location Service.
--
-- For additional information , see
-- <https://docs.aws.amazon.com/location/latest/developerguide/what-is-data-provider.html Data providers>
-- on the /Amazon Location Service Developer Guide/.
createPlaceIndex_dataSource :: Lens.Lens' CreatePlaceIndex Prelude.Text
createPlaceIndex_dataSource :: (Text -> f Text) -> CreatePlaceIndex -> f CreatePlaceIndex
createPlaceIndex_dataSource = (CreatePlaceIndex -> Text)
-> (CreatePlaceIndex -> Text -> CreatePlaceIndex)
-> Lens CreatePlaceIndex CreatePlaceIndex Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlaceIndex' {Text
dataSource :: Text
$sel:dataSource:CreatePlaceIndex' :: CreatePlaceIndex -> Text
dataSource} -> Text
dataSource) (\s :: CreatePlaceIndex
s@CreatePlaceIndex' {} Text
a -> CreatePlaceIndex
s {$sel:dataSource:CreatePlaceIndex' :: Text
dataSource = Text
a} :: CreatePlaceIndex)

-- | The name of the place index resource.
--
-- Requirements:
--
-- -   Contain only alphanumeric characters (A–Z, a–z, 0–9), hyphens (-),
--     periods (.), and underscores (_).
--
-- -   Must be a unique place index resource name.
--
-- -   No spaces allowed. For example, @ExamplePlaceIndex@.
createPlaceIndex_indexName :: Lens.Lens' CreatePlaceIndex Prelude.Text
createPlaceIndex_indexName :: (Text -> f Text) -> CreatePlaceIndex -> f CreatePlaceIndex
createPlaceIndex_indexName = (CreatePlaceIndex -> Text)
-> (CreatePlaceIndex -> Text -> CreatePlaceIndex)
-> Lens CreatePlaceIndex CreatePlaceIndex Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlaceIndex' {Text
indexName :: Text
$sel:indexName:CreatePlaceIndex' :: CreatePlaceIndex -> Text
indexName} -> Text
indexName) (\s :: CreatePlaceIndex
s@CreatePlaceIndex' {} Text
a -> CreatePlaceIndex
s {$sel:indexName:CreatePlaceIndex' :: Text
indexName = Text
a} :: CreatePlaceIndex)

-- | Specifies the pricing plan for your place index resource.
--
-- For additional details and restrictions on each pricing plan option, see
-- <https://aws.amazon.com/location/pricing/ Amazon Location Service pricing>.
createPlaceIndex_pricingPlan :: Lens.Lens' CreatePlaceIndex PricingPlan
createPlaceIndex_pricingPlan :: (PricingPlan -> f PricingPlan)
-> CreatePlaceIndex -> f CreatePlaceIndex
createPlaceIndex_pricingPlan = (CreatePlaceIndex -> PricingPlan)
-> (CreatePlaceIndex -> PricingPlan -> CreatePlaceIndex)
-> Lens CreatePlaceIndex CreatePlaceIndex PricingPlan PricingPlan
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlaceIndex' {PricingPlan
pricingPlan :: PricingPlan
$sel:pricingPlan:CreatePlaceIndex' :: CreatePlaceIndex -> PricingPlan
pricingPlan} -> PricingPlan
pricingPlan) (\s :: CreatePlaceIndex
s@CreatePlaceIndex' {} PricingPlan
a -> CreatePlaceIndex
s {$sel:pricingPlan:CreatePlaceIndex' :: PricingPlan
pricingPlan = PricingPlan
a} :: CreatePlaceIndex)

instance Core.AWSRequest CreatePlaceIndex where
  type
    AWSResponse CreatePlaceIndex =
      CreatePlaceIndexResponse
  request :: CreatePlaceIndex -> Request CreatePlaceIndex
request = Service -> CreatePlaceIndex -> Request CreatePlaceIndex
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreatePlaceIndex
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreatePlaceIndex)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreatePlaceIndex))
-> Logger
-> Service
-> Proxy CreatePlaceIndex
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreatePlaceIndex)))
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 -> POSIX -> Text -> Text -> CreatePlaceIndexResponse
CreatePlaceIndexResponse'
            (Int -> POSIX -> Text -> Text -> CreatePlaceIndexResponse)
-> Either String Int
-> Either
     String (POSIX -> Text -> Text -> CreatePlaceIndexResponse)
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 (POSIX -> Text -> Text -> CreatePlaceIndexResponse)
-> Either String POSIX
-> Either String (Text -> Text -> CreatePlaceIndexResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String POSIX
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"CreateTime")
            Either String (Text -> Text -> CreatePlaceIndexResponse)
-> Either String Text
-> Either String (Text -> CreatePlaceIndexResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"IndexArn")
            Either String (Text -> CreatePlaceIndexResponse)
-> Either String Text -> Either String CreatePlaceIndexResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String Text
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"IndexName")
      )

instance Prelude.Hashable CreatePlaceIndex

instance Prelude.NFData CreatePlaceIndex

instance Core.ToHeaders CreatePlaceIndex where
  toHeaders :: CreatePlaceIndex -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreatePlaceIndex -> 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 CreatePlaceIndex where
  toJSON :: CreatePlaceIndex -> Value
toJSON CreatePlaceIndex' {Maybe Text
Maybe (HashMap Text Text)
Maybe DataSourceConfiguration
Text
PricingPlan
pricingPlan :: PricingPlan
indexName :: Text
dataSource :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
dataSourceConfiguration :: Maybe DataSourceConfiguration
$sel:pricingPlan:CreatePlaceIndex' :: CreatePlaceIndex -> PricingPlan
$sel:indexName:CreatePlaceIndex' :: CreatePlaceIndex -> Text
$sel:dataSource:CreatePlaceIndex' :: CreatePlaceIndex -> Text
$sel:tags:CreatePlaceIndex' :: CreatePlaceIndex -> Maybe (HashMap Text Text)
$sel:description:CreatePlaceIndex' :: CreatePlaceIndex -> Maybe Text
$sel:dataSourceConfiguration:CreatePlaceIndex' :: CreatePlaceIndex -> Maybe DataSourceConfiguration
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DataSourceConfiguration" Text -> DataSourceConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (DataSourceConfiguration -> Pair)
-> Maybe DataSourceConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe DataSourceConfiguration
dataSourceConfiguration,
            (Text
"Description" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
description,
            (Text
"Tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DataSource" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
dataSource),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"IndexName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
indexName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"PricingPlan" Text -> PricingPlan -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PricingPlan
pricingPlan)
          ]
      )

instance Core.ToPath CreatePlaceIndex where
  toPath :: CreatePlaceIndex -> ByteString
toPath = ByteString -> CreatePlaceIndex -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/places/v0/indexes"

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

-- | /See:/ 'newCreatePlaceIndexResponse' smart constructor.
data CreatePlaceIndexResponse = CreatePlaceIndexResponse'
  { -- | The response's http status code.
    CreatePlaceIndexResponse -> Int
httpStatus :: Prelude.Int,
    -- | The timestamp for when the place index resource was created in
    -- <https://www.iso.org/iso-8601-date-and-time-format.html ISO 8601>
    -- format: @YYYY-MM-DDThh:mm:ss.sssZ@.
    CreatePlaceIndexResponse -> POSIX
createTime :: Core.POSIX,
    -- | The Amazon Resource Name (ARN) for the place index resource. Used to
    -- specify a resource across AWS.
    --
    -- -   Format example:
    --     @arn:aws:geo:region:account-id:place-index\/ExamplePlaceIndex@
    CreatePlaceIndexResponse -> Text
indexArn :: Prelude.Text,
    -- | The name for the place index resource.
    CreatePlaceIndexResponse -> Text
indexName :: Prelude.Text
  }
  deriving (CreatePlaceIndexResponse -> CreatePlaceIndexResponse -> Bool
(CreatePlaceIndexResponse -> CreatePlaceIndexResponse -> Bool)
-> (CreatePlaceIndexResponse -> CreatePlaceIndexResponse -> Bool)
-> Eq CreatePlaceIndexResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreatePlaceIndexResponse -> CreatePlaceIndexResponse -> Bool
$c/= :: CreatePlaceIndexResponse -> CreatePlaceIndexResponse -> Bool
== :: CreatePlaceIndexResponse -> CreatePlaceIndexResponse -> Bool
$c== :: CreatePlaceIndexResponse -> CreatePlaceIndexResponse -> Bool
Prelude.Eq, ReadPrec [CreatePlaceIndexResponse]
ReadPrec CreatePlaceIndexResponse
Int -> ReadS CreatePlaceIndexResponse
ReadS [CreatePlaceIndexResponse]
(Int -> ReadS CreatePlaceIndexResponse)
-> ReadS [CreatePlaceIndexResponse]
-> ReadPrec CreatePlaceIndexResponse
-> ReadPrec [CreatePlaceIndexResponse]
-> Read CreatePlaceIndexResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreatePlaceIndexResponse]
$creadListPrec :: ReadPrec [CreatePlaceIndexResponse]
readPrec :: ReadPrec CreatePlaceIndexResponse
$creadPrec :: ReadPrec CreatePlaceIndexResponse
readList :: ReadS [CreatePlaceIndexResponse]
$creadList :: ReadS [CreatePlaceIndexResponse]
readsPrec :: Int -> ReadS CreatePlaceIndexResponse
$creadsPrec :: Int -> ReadS CreatePlaceIndexResponse
Prelude.Read, Int -> CreatePlaceIndexResponse -> ShowS
[CreatePlaceIndexResponse] -> ShowS
CreatePlaceIndexResponse -> String
(Int -> CreatePlaceIndexResponse -> ShowS)
-> (CreatePlaceIndexResponse -> String)
-> ([CreatePlaceIndexResponse] -> ShowS)
-> Show CreatePlaceIndexResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreatePlaceIndexResponse] -> ShowS
$cshowList :: [CreatePlaceIndexResponse] -> ShowS
show :: CreatePlaceIndexResponse -> String
$cshow :: CreatePlaceIndexResponse -> String
showsPrec :: Int -> CreatePlaceIndexResponse -> ShowS
$cshowsPrec :: Int -> CreatePlaceIndexResponse -> ShowS
Prelude.Show, (forall x.
 CreatePlaceIndexResponse -> Rep CreatePlaceIndexResponse x)
-> (forall x.
    Rep CreatePlaceIndexResponse x -> CreatePlaceIndexResponse)
-> Generic CreatePlaceIndexResponse
forall x.
Rep CreatePlaceIndexResponse x -> CreatePlaceIndexResponse
forall x.
CreatePlaceIndexResponse -> Rep CreatePlaceIndexResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreatePlaceIndexResponse x -> CreatePlaceIndexResponse
$cfrom :: forall x.
CreatePlaceIndexResponse -> Rep CreatePlaceIndexResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreatePlaceIndexResponse' 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:
--
-- 'httpStatus', 'createPlaceIndexResponse_httpStatus' - The response's http status code.
--
-- 'createTime', 'createPlaceIndexResponse_createTime' - The timestamp for when the place index resource was created in
-- <https://www.iso.org/iso-8601-date-and-time-format.html ISO 8601>
-- format: @YYYY-MM-DDThh:mm:ss.sssZ@.
--
-- 'indexArn', 'createPlaceIndexResponse_indexArn' - The Amazon Resource Name (ARN) for the place index resource. Used to
-- specify a resource across AWS.
--
-- -   Format example:
--     @arn:aws:geo:region:account-id:place-index\/ExamplePlaceIndex@
--
-- 'indexName', 'createPlaceIndexResponse_indexName' - The name for the place index resource.
newCreatePlaceIndexResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'createTime'
  Prelude.UTCTime ->
  -- | 'indexArn'
  Prelude.Text ->
  -- | 'indexName'
  Prelude.Text ->
  CreatePlaceIndexResponse
newCreatePlaceIndexResponse :: Int -> UTCTime -> Text -> Text -> CreatePlaceIndexResponse
newCreatePlaceIndexResponse
  Int
pHttpStatus_
  UTCTime
pCreateTime_
  Text
pIndexArn_
  Text
pIndexName_ =
    CreatePlaceIndexResponse' :: Int -> POSIX -> Text -> Text -> CreatePlaceIndexResponse
CreatePlaceIndexResponse'
      { $sel:httpStatus:CreatePlaceIndexResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:createTime:CreatePlaceIndexResponse' :: POSIX
createTime = Tagged UTCTime (Identity UTCTime) -> Tagged POSIX (Identity POSIX)
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time (Tagged UTCTime (Identity UTCTime)
 -> Tagged POSIX (Identity POSIX))
-> UTCTime -> POSIX
forall t b. AReview t b -> b -> t
Lens.# UTCTime
pCreateTime_,
        $sel:indexArn:CreatePlaceIndexResponse' :: Text
indexArn = Text
pIndexArn_,
        $sel:indexName:CreatePlaceIndexResponse' :: Text
indexName = Text
pIndexName_
      }

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

-- | The timestamp for when the place index resource was created in
-- <https://www.iso.org/iso-8601-date-and-time-format.html ISO 8601>
-- format: @YYYY-MM-DDThh:mm:ss.sssZ@.
createPlaceIndexResponse_createTime :: Lens.Lens' CreatePlaceIndexResponse Prelude.UTCTime
createPlaceIndexResponse_createTime :: (UTCTime -> f UTCTime)
-> CreatePlaceIndexResponse -> f CreatePlaceIndexResponse
createPlaceIndexResponse_createTime = (CreatePlaceIndexResponse -> POSIX)
-> (CreatePlaceIndexResponse -> POSIX -> CreatePlaceIndexResponse)
-> Lens
     CreatePlaceIndexResponse CreatePlaceIndexResponse POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlaceIndexResponse' {POSIX
createTime :: POSIX
$sel:createTime:CreatePlaceIndexResponse' :: CreatePlaceIndexResponse -> POSIX
createTime} -> POSIX
createTime) (\s :: CreatePlaceIndexResponse
s@CreatePlaceIndexResponse' {} POSIX
a -> CreatePlaceIndexResponse
s {$sel:createTime:CreatePlaceIndexResponse' :: POSIX
createTime = POSIX
a} :: CreatePlaceIndexResponse) ((POSIX -> f POSIX)
 -> CreatePlaceIndexResponse -> f CreatePlaceIndexResponse)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> CreatePlaceIndexResponse
-> f CreatePlaceIndexResponse
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (UTCTime -> f UTCTime) -> POSIX -> f POSIX
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The Amazon Resource Name (ARN) for the place index resource. Used to
-- specify a resource across AWS.
--
-- -   Format example:
--     @arn:aws:geo:region:account-id:place-index\/ExamplePlaceIndex@
createPlaceIndexResponse_indexArn :: Lens.Lens' CreatePlaceIndexResponse Prelude.Text
createPlaceIndexResponse_indexArn :: (Text -> f Text)
-> CreatePlaceIndexResponse -> f CreatePlaceIndexResponse
createPlaceIndexResponse_indexArn = (CreatePlaceIndexResponse -> Text)
-> (CreatePlaceIndexResponse -> Text -> CreatePlaceIndexResponse)
-> Lens CreatePlaceIndexResponse CreatePlaceIndexResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlaceIndexResponse' {Text
indexArn :: Text
$sel:indexArn:CreatePlaceIndexResponse' :: CreatePlaceIndexResponse -> Text
indexArn} -> Text
indexArn) (\s :: CreatePlaceIndexResponse
s@CreatePlaceIndexResponse' {} Text
a -> CreatePlaceIndexResponse
s {$sel:indexArn:CreatePlaceIndexResponse' :: Text
indexArn = Text
a} :: CreatePlaceIndexResponse)

-- | The name for the place index resource.
createPlaceIndexResponse_indexName :: Lens.Lens' CreatePlaceIndexResponse Prelude.Text
createPlaceIndexResponse_indexName :: (Text -> f Text)
-> CreatePlaceIndexResponse -> f CreatePlaceIndexResponse
createPlaceIndexResponse_indexName = (CreatePlaceIndexResponse -> Text)
-> (CreatePlaceIndexResponse -> Text -> CreatePlaceIndexResponse)
-> Lens CreatePlaceIndexResponse CreatePlaceIndexResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreatePlaceIndexResponse' {Text
indexName :: Text
$sel:indexName:CreatePlaceIndexResponse' :: CreatePlaceIndexResponse -> Text
indexName} -> Text
indexName) (\s :: CreatePlaceIndexResponse
s@CreatePlaceIndexResponse' {} Text
a -> CreatePlaceIndexResponse
s {$sel:indexName:CreatePlaceIndexResponse' :: Text
indexName = Text
a} :: CreatePlaceIndexResponse)

instance Prelude.NFData CreatePlaceIndexResponse