{-# 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.CreateRouteCalculator
-- 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 route calculator resource in your AWS account.
--
-- You can send requests to a route calculator resource to estimate travel
-- time, distance, and get directions. A route calculator sources traffic
-- and road network data from your chosen data provider.
module Amazonka.Location.CreateRouteCalculator
  ( -- * Creating a Request
    CreateRouteCalculator (..),
    newCreateRouteCalculator,

    -- * Request Lenses
    createRouteCalculator_description,
    createRouteCalculator_tags,
    createRouteCalculator_calculatorName,
    createRouteCalculator_dataSource,
    createRouteCalculator_pricingPlan,

    -- * Destructuring the Response
    CreateRouteCalculatorResponse (..),
    newCreateRouteCalculatorResponse,

    -- * Response Lenses
    createRouteCalculatorResponse_httpStatus,
    createRouteCalculatorResponse_calculatorArn,
    createRouteCalculatorResponse_calculatorName,
    createRouteCalculatorResponse_createTime,
  )
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:/ 'newCreateRouteCalculator' smart constructor.
data CreateRouteCalculator = CreateRouteCalculator'
  { -- | The optional description for the route calculator resource.
    CreateRouteCalculator -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Applies one or more tags to the route calculator resource. A tag is a
    -- key-value pair helps manage, identify, search, and filter your resources
    -- by labelling them.
    --
    -- -   For example: { @\"tag1\" : \"value1\"@, @\"tag2\" : \"value2\"@}
    --
    -- 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: + - = . _ : \/ \@.
    CreateRouteCalculator -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the route calculator resource.
    --
    -- Requirements:
    --
    -- -   Can use alphanumeric characters (A–Z, a–z, 0–9) , hyphens (-),
    --     periods (.), and underscores (_).
    --
    -- -   Must be a unique Route calculator resource name.
    --
    -- -   No spaces allowed. For example, @ExampleRouteCalculator@.
    CreateRouteCalculator -> Text
calculatorName :: Prelude.Text,
    -- | Specifies the data provider of traffic and road network data.
    --
    -- This field is case-sensitive. Enter the valid values as shown. For
    -- example, entering @HERE@ returns an error. Route calculators that use
    -- Esri as a data source only calculate routes that are shorter than 400
    -- km.
    --
    -- 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://doc.arcgis.com/en/arcgis-online/reference/network-coverage.htm Esri details on street networks and traffic 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/routing-api/dev_guide/topics/coverage/car-routing.html HERE car routing coverage>
    --     and
    --     <https://developer.here.com/documentation/routing-api/dev_guide/topics/coverage/truck-routing.html HERE truck routing coverage>.
    --
    -- 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/.
    CreateRouteCalculator -> Text
dataSource :: Prelude.Text,
    -- | Specifies the pricing plan for your route calculator resource.
    --
    -- For additional details and restrictions on each pricing plan option, see
    -- <https://aws.amazon.com/location/pricing/ Amazon Location Service pricing>.
    CreateRouteCalculator -> PricingPlan
pricingPlan :: PricingPlan
  }
  deriving (CreateRouteCalculator -> CreateRouteCalculator -> Bool
(CreateRouteCalculator -> CreateRouteCalculator -> Bool)
-> (CreateRouteCalculator -> CreateRouteCalculator -> Bool)
-> Eq CreateRouteCalculator
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRouteCalculator -> CreateRouteCalculator -> Bool
$c/= :: CreateRouteCalculator -> CreateRouteCalculator -> Bool
== :: CreateRouteCalculator -> CreateRouteCalculator -> Bool
$c== :: CreateRouteCalculator -> CreateRouteCalculator -> Bool
Prelude.Eq, ReadPrec [CreateRouteCalculator]
ReadPrec CreateRouteCalculator
Int -> ReadS CreateRouteCalculator
ReadS [CreateRouteCalculator]
(Int -> ReadS CreateRouteCalculator)
-> ReadS [CreateRouteCalculator]
-> ReadPrec CreateRouteCalculator
-> ReadPrec [CreateRouteCalculator]
-> Read CreateRouteCalculator
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRouteCalculator]
$creadListPrec :: ReadPrec [CreateRouteCalculator]
readPrec :: ReadPrec CreateRouteCalculator
$creadPrec :: ReadPrec CreateRouteCalculator
readList :: ReadS [CreateRouteCalculator]
$creadList :: ReadS [CreateRouteCalculator]
readsPrec :: Int -> ReadS CreateRouteCalculator
$creadsPrec :: Int -> ReadS CreateRouteCalculator
Prelude.Read, Int -> CreateRouteCalculator -> ShowS
[CreateRouteCalculator] -> ShowS
CreateRouteCalculator -> String
(Int -> CreateRouteCalculator -> ShowS)
-> (CreateRouteCalculator -> String)
-> ([CreateRouteCalculator] -> ShowS)
-> Show CreateRouteCalculator
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRouteCalculator] -> ShowS
$cshowList :: [CreateRouteCalculator] -> ShowS
show :: CreateRouteCalculator -> String
$cshow :: CreateRouteCalculator -> String
showsPrec :: Int -> CreateRouteCalculator -> ShowS
$cshowsPrec :: Int -> CreateRouteCalculator -> ShowS
Prelude.Show, (forall x. CreateRouteCalculator -> Rep CreateRouteCalculator x)
-> (forall x. Rep CreateRouteCalculator x -> CreateRouteCalculator)
-> Generic CreateRouteCalculator
forall x. Rep CreateRouteCalculator x -> CreateRouteCalculator
forall x. CreateRouteCalculator -> Rep CreateRouteCalculator x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateRouteCalculator x -> CreateRouteCalculator
$cfrom :: forall x. CreateRouteCalculator -> Rep CreateRouteCalculator x
Prelude.Generic)

-- |
-- Create a value of 'CreateRouteCalculator' 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:
--
-- 'description', 'createRouteCalculator_description' - The optional description for the route calculator resource.
--
-- 'tags', 'createRouteCalculator_tags' - Applies one or more tags to the route calculator resource. A tag is a
-- key-value pair helps manage, identify, search, and filter your resources
-- by labelling them.
--
-- -   For example: { @\"tag1\" : \"value1\"@, @\"tag2\" : \"value2\"@}
--
-- 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: + - = . _ : \/ \@.
--
-- 'calculatorName', 'createRouteCalculator_calculatorName' - The name of the route calculator resource.
--
-- Requirements:
--
-- -   Can use alphanumeric characters (A–Z, a–z, 0–9) , hyphens (-),
--     periods (.), and underscores (_).
--
-- -   Must be a unique Route calculator resource name.
--
-- -   No spaces allowed. For example, @ExampleRouteCalculator@.
--
-- 'dataSource', 'createRouteCalculator_dataSource' - Specifies the data provider of traffic and road network data.
--
-- This field is case-sensitive. Enter the valid values as shown. For
-- example, entering @HERE@ returns an error. Route calculators that use
-- Esri as a data source only calculate routes that are shorter than 400
-- km.
--
-- 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://doc.arcgis.com/en/arcgis-online/reference/network-coverage.htm Esri details on street networks and traffic 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/routing-api/dev_guide/topics/coverage/car-routing.html HERE car routing coverage>
--     and
--     <https://developer.here.com/documentation/routing-api/dev_guide/topics/coverage/truck-routing.html HERE truck routing coverage>.
--
-- 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/.
--
-- 'pricingPlan', 'createRouteCalculator_pricingPlan' - Specifies the pricing plan for your route calculator resource.
--
-- For additional details and restrictions on each pricing plan option, see
-- <https://aws.amazon.com/location/pricing/ Amazon Location Service pricing>.
newCreateRouteCalculator ::
  -- | 'calculatorName'
  Prelude.Text ->
  -- | 'dataSource'
  Prelude.Text ->
  -- | 'pricingPlan'
  PricingPlan ->
  CreateRouteCalculator
newCreateRouteCalculator :: Text -> Text -> PricingPlan -> CreateRouteCalculator
newCreateRouteCalculator
  Text
pCalculatorName_
  Text
pDataSource_
  PricingPlan
pPricingPlan_ =
    CreateRouteCalculator' :: Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> PricingPlan
-> CreateRouteCalculator
CreateRouteCalculator'
      { $sel:description:CreateRouteCalculator' :: Maybe Text
description =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateRouteCalculator' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:calculatorName:CreateRouteCalculator' :: Text
calculatorName = Text
pCalculatorName_,
        $sel:dataSource:CreateRouteCalculator' :: Text
dataSource = Text
pDataSource_,
        $sel:pricingPlan:CreateRouteCalculator' :: PricingPlan
pricingPlan = PricingPlan
pPricingPlan_
      }

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

-- | Applies one or more tags to the route calculator resource. A tag is a
-- key-value pair helps manage, identify, search, and filter your resources
-- by labelling them.
--
-- -   For example: { @\"tag1\" : \"value1\"@, @\"tag2\" : \"value2\"@}
--
-- 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: + - = . _ : \/ \@.
createRouteCalculator_tags :: Lens.Lens' CreateRouteCalculator (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createRouteCalculator_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateRouteCalculator -> f CreateRouteCalculator
createRouteCalculator_tags = (CreateRouteCalculator -> Maybe (HashMap Text Text))
-> (CreateRouteCalculator
    -> Maybe (HashMap Text Text) -> CreateRouteCalculator)
-> Lens
     CreateRouteCalculator
     CreateRouteCalculator
     (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 (\CreateRouteCalculator' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateRouteCalculator' :: CreateRouteCalculator -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateRouteCalculator
s@CreateRouteCalculator' {} Maybe (HashMap Text Text)
a -> CreateRouteCalculator
s {$sel:tags:CreateRouteCalculator' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateRouteCalculator) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateRouteCalculator -> f CreateRouteCalculator)
-> ((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)))
-> CreateRouteCalculator
-> f CreateRouteCalculator
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

-- | The name of the route calculator resource.
--
-- Requirements:
--
-- -   Can use alphanumeric characters (A–Z, a–z, 0–9) , hyphens (-),
--     periods (.), and underscores (_).
--
-- -   Must be a unique Route calculator resource name.
--
-- -   No spaces allowed. For example, @ExampleRouteCalculator@.
createRouteCalculator_calculatorName :: Lens.Lens' CreateRouteCalculator Prelude.Text
createRouteCalculator_calculatorName :: (Text -> f Text)
-> CreateRouteCalculator -> f CreateRouteCalculator
createRouteCalculator_calculatorName = (CreateRouteCalculator -> Text)
-> (CreateRouteCalculator -> Text -> CreateRouteCalculator)
-> Lens CreateRouteCalculator CreateRouteCalculator Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteCalculator' {Text
calculatorName :: Text
$sel:calculatorName:CreateRouteCalculator' :: CreateRouteCalculator -> Text
calculatorName} -> Text
calculatorName) (\s :: CreateRouteCalculator
s@CreateRouteCalculator' {} Text
a -> CreateRouteCalculator
s {$sel:calculatorName:CreateRouteCalculator' :: Text
calculatorName = Text
a} :: CreateRouteCalculator)

-- | Specifies the data provider of traffic and road network data.
--
-- This field is case-sensitive. Enter the valid values as shown. For
-- example, entering @HERE@ returns an error. Route calculators that use
-- Esri as a data source only calculate routes that are shorter than 400
-- km.
--
-- 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://doc.arcgis.com/en/arcgis-online/reference/network-coverage.htm Esri details on street networks and traffic 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/routing-api/dev_guide/topics/coverage/car-routing.html HERE car routing coverage>
--     and
--     <https://developer.here.com/documentation/routing-api/dev_guide/topics/coverage/truck-routing.html HERE truck routing coverage>.
--
-- 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/.
createRouteCalculator_dataSource :: Lens.Lens' CreateRouteCalculator Prelude.Text
createRouteCalculator_dataSource :: (Text -> f Text)
-> CreateRouteCalculator -> f CreateRouteCalculator
createRouteCalculator_dataSource = (CreateRouteCalculator -> Text)
-> (CreateRouteCalculator -> Text -> CreateRouteCalculator)
-> Lens CreateRouteCalculator CreateRouteCalculator Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteCalculator' {Text
dataSource :: Text
$sel:dataSource:CreateRouteCalculator' :: CreateRouteCalculator -> Text
dataSource} -> Text
dataSource) (\s :: CreateRouteCalculator
s@CreateRouteCalculator' {} Text
a -> CreateRouteCalculator
s {$sel:dataSource:CreateRouteCalculator' :: Text
dataSource = Text
a} :: CreateRouteCalculator)

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

instance Core.AWSRequest CreateRouteCalculator where
  type
    AWSResponse CreateRouteCalculator =
      CreateRouteCalculatorResponse
  request :: CreateRouteCalculator -> Request CreateRouteCalculator
request = Service -> CreateRouteCalculator -> Request CreateRouteCalculator
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateRouteCalculator
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateRouteCalculator)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateRouteCalculator))
-> Logger
-> Service
-> Proxy CreateRouteCalculator
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateRouteCalculator)))
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 -> Text -> Text -> POSIX -> CreateRouteCalculatorResponse
CreateRouteCalculatorResponse'
            (Int -> Text -> Text -> POSIX -> CreateRouteCalculatorResponse)
-> Either String Int
-> Either
     String (Text -> Text -> POSIX -> CreateRouteCalculatorResponse)
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 (Text -> Text -> POSIX -> CreateRouteCalculatorResponse)
-> Either String Text
-> Either String (Text -> POSIX -> CreateRouteCalculatorResponse)
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
"CalculatorArn")
            Either String (Text -> POSIX -> CreateRouteCalculatorResponse)
-> Either String Text
-> Either String (POSIX -> CreateRouteCalculatorResponse)
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
"CalculatorName")
            Either String (POSIX -> CreateRouteCalculatorResponse)
-> Either String POSIX
-> Either String CreateRouteCalculatorResponse
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")
      )

instance Prelude.Hashable CreateRouteCalculator

instance Prelude.NFData CreateRouteCalculator

instance Core.ToHeaders CreateRouteCalculator where
  toHeaders :: CreateRouteCalculator -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateRouteCalculator -> 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 CreateRouteCalculator where
  toJSON :: CreateRouteCalculator -> Value
toJSON CreateRouteCalculator' {Maybe Text
Maybe (HashMap Text Text)
Text
PricingPlan
pricingPlan :: PricingPlan
dataSource :: Text
calculatorName :: Text
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
$sel:pricingPlan:CreateRouteCalculator' :: CreateRouteCalculator -> PricingPlan
$sel:dataSource:CreateRouteCalculator' :: CreateRouteCalculator -> Text
$sel:calculatorName:CreateRouteCalculator' :: CreateRouteCalculator -> Text
$sel:tags:CreateRouteCalculator' :: CreateRouteCalculator -> Maybe (HashMap Text Text)
$sel:description:CreateRouteCalculator' :: CreateRouteCalculator -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (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
"CalculatorName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
calculatorName),
            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
"PricingPlan" Text -> PricingPlan -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PricingPlan
pricingPlan)
          ]
      )

instance Core.ToPath CreateRouteCalculator where
  toPath :: CreateRouteCalculator -> ByteString
toPath = ByteString -> CreateRouteCalculator -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/routes/v0/calculators"

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

-- | /See:/ 'newCreateRouteCalculatorResponse' smart constructor.
data CreateRouteCalculatorResponse = CreateRouteCalculatorResponse'
  { -- | The response's http status code.
    CreateRouteCalculatorResponse -> Int
httpStatus :: Prelude.Int,
    -- | The Amazon Resource Name (ARN) for the route calculator resource. Use
    -- the ARN when you specify a resource across all AWS.
    --
    -- -   Format example:
    --     @arn:aws:geo:region:account-id:route-calculator\/ExampleCalculator@
    CreateRouteCalculatorResponse -> Text
calculatorArn :: Prelude.Text,
    -- | The name of the route calculator resource.
    --
    -- -   For example, @ExampleRouteCalculator@.
    CreateRouteCalculatorResponse -> Text
calculatorName :: Prelude.Text,
    -- | The timestamp when the route calculator resource was created in
    -- <https://www.iso.org/iso-8601-date-and-time-format.html ISO 8601>
    -- format: @YYYY-MM-DDThh:mm:ss.sssZ@.
    --
    -- -   For example, @2020–07-2T12:15:20.000Z+01:00@
    CreateRouteCalculatorResponse -> POSIX
createTime :: Core.POSIX
  }
  deriving (CreateRouteCalculatorResponse
-> CreateRouteCalculatorResponse -> Bool
(CreateRouteCalculatorResponse
 -> CreateRouteCalculatorResponse -> Bool)
-> (CreateRouteCalculatorResponse
    -> CreateRouteCalculatorResponse -> Bool)
-> Eq CreateRouteCalculatorResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateRouteCalculatorResponse
-> CreateRouteCalculatorResponse -> Bool
$c/= :: CreateRouteCalculatorResponse
-> CreateRouteCalculatorResponse -> Bool
== :: CreateRouteCalculatorResponse
-> CreateRouteCalculatorResponse -> Bool
$c== :: CreateRouteCalculatorResponse
-> CreateRouteCalculatorResponse -> Bool
Prelude.Eq, ReadPrec [CreateRouteCalculatorResponse]
ReadPrec CreateRouteCalculatorResponse
Int -> ReadS CreateRouteCalculatorResponse
ReadS [CreateRouteCalculatorResponse]
(Int -> ReadS CreateRouteCalculatorResponse)
-> ReadS [CreateRouteCalculatorResponse]
-> ReadPrec CreateRouteCalculatorResponse
-> ReadPrec [CreateRouteCalculatorResponse]
-> Read CreateRouteCalculatorResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateRouteCalculatorResponse]
$creadListPrec :: ReadPrec [CreateRouteCalculatorResponse]
readPrec :: ReadPrec CreateRouteCalculatorResponse
$creadPrec :: ReadPrec CreateRouteCalculatorResponse
readList :: ReadS [CreateRouteCalculatorResponse]
$creadList :: ReadS [CreateRouteCalculatorResponse]
readsPrec :: Int -> ReadS CreateRouteCalculatorResponse
$creadsPrec :: Int -> ReadS CreateRouteCalculatorResponse
Prelude.Read, Int -> CreateRouteCalculatorResponse -> ShowS
[CreateRouteCalculatorResponse] -> ShowS
CreateRouteCalculatorResponse -> String
(Int -> CreateRouteCalculatorResponse -> ShowS)
-> (CreateRouteCalculatorResponse -> String)
-> ([CreateRouteCalculatorResponse] -> ShowS)
-> Show CreateRouteCalculatorResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateRouteCalculatorResponse] -> ShowS
$cshowList :: [CreateRouteCalculatorResponse] -> ShowS
show :: CreateRouteCalculatorResponse -> String
$cshow :: CreateRouteCalculatorResponse -> String
showsPrec :: Int -> CreateRouteCalculatorResponse -> ShowS
$cshowsPrec :: Int -> CreateRouteCalculatorResponse -> ShowS
Prelude.Show, (forall x.
 CreateRouteCalculatorResponse
 -> Rep CreateRouteCalculatorResponse x)
-> (forall x.
    Rep CreateRouteCalculatorResponse x
    -> CreateRouteCalculatorResponse)
-> Generic CreateRouteCalculatorResponse
forall x.
Rep CreateRouteCalculatorResponse x
-> CreateRouteCalculatorResponse
forall x.
CreateRouteCalculatorResponse
-> Rep CreateRouteCalculatorResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateRouteCalculatorResponse x
-> CreateRouteCalculatorResponse
$cfrom :: forall x.
CreateRouteCalculatorResponse
-> Rep CreateRouteCalculatorResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateRouteCalculatorResponse' 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', 'createRouteCalculatorResponse_httpStatus' - The response's http status code.
--
-- 'calculatorArn', 'createRouteCalculatorResponse_calculatorArn' - The Amazon Resource Name (ARN) for the route calculator resource. Use
-- the ARN when you specify a resource across all AWS.
--
-- -   Format example:
--     @arn:aws:geo:region:account-id:route-calculator\/ExampleCalculator@
--
-- 'calculatorName', 'createRouteCalculatorResponse_calculatorName' - The name of the route calculator resource.
--
-- -   For example, @ExampleRouteCalculator@.
--
-- 'createTime', 'createRouteCalculatorResponse_createTime' - The timestamp when the route calculator resource was created in
-- <https://www.iso.org/iso-8601-date-and-time-format.html ISO 8601>
-- format: @YYYY-MM-DDThh:mm:ss.sssZ@.
--
-- -   For example, @2020–07-2T12:15:20.000Z+01:00@
newCreateRouteCalculatorResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'calculatorArn'
  Prelude.Text ->
  -- | 'calculatorName'
  Prelude.Text ->
  -- | 'createTime'
  Prelude.UTCTime ->
  CreateRouteCalculatorResponse
newCreateRouteCalculatorResponse :: Int -> Text -> Text -> UTCTime -> CreateRouteCalculatorResponse
newCreateRouteCalculatorResponse
  Int
pHttpStatus_
  Text
pCalculatorArn_
  Text
pCalculatorName_
  UTCTime
pCreateTime_ =
    CreateRouteCalculatorResponse' :: Int -> Text -> Text -> POSIX -> CreateRouteCalculatorResponse
CreateRouteCalculatorResponse'
      { $sel:httpStatus:CreateRouteCalculatorResponse' :: Int
httpStatus =
          Int
pHttpStatus_,
        $sel:calculatorArn:CreateRouteCalculatorResponse' :: Text
calculatorArn = Text
pCalculatorArn_,
        $sel:calculatorName:CreateRouteCalculatorResponse' :: Text
calculatorName = Text
pCalculatorName_,
        $sel:createTime:CreateRouteCalculatorResponse' :: 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_
      }

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

-- | The Amazon Resource Name (ARN) for the route calculator resource. Use
-- the ARN when you specify a resource across all AWS.
--
-- -   Format example:
--     @arn:aws:geo:region:account-id:route-calculator\/ExampleCalculator@
createRouteCalculatorResponse_calculatorArn :: Lens.Lens' CreateRouteCalculatorResponse Prelude.Text
createRouteCalculatorResponse_calculatorArn :: (Text -> f Text)
-> CreateRouteCalculatorResponse -> f CreateRouteCalculatorResponse
createRouteCalculatorResponse_calculatorArn = (CreateRouteCalculatorResponse -> Text)
-> (CreateRouteCalculatorResponse
    -> Text -> CreateRouteCalculatorResponse)
-> Lens
     CreateRouteCalculatorResponse
     CreateRouteCalculatorResponse
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteCalculatorResponse' {Text
calculatorArn :: Text
$sel:calculatorArn:CreateRouteCalculatorResponse' :: CreateRouteCalculatorResponse -> Text
calculatorArn} -> Text
calculatorArn) (\s :: CreateRouteCalculatorResponse
s@CreateRouteCalculatorResponse' {} Text
a -> CreateRouteCalculatorResponse
s {$sel:calculatorArn:CreateRouteCalculatorResponse' :: Text
calculatorArn = Text
a} :: CreateRouteCalculatorResponse)

-- | The name of the route calculator resource.
--
-- -   For example, @ExampleRouteCalculator@.
createRouteCalculatorResponse_calculatorName :: Lens.Lens' CreateRouteCalculatorResponse Prelude.Text
createRouteCalculatorResponse_calculatorName :: (Text -> f Text)
-> CreateRouteCalculatorResponse -> f CreateRouteCalculatorResponse
createRouteCalculatorResponse_calculatorName = (CreateRouteCalculatorResponse -> Text)
-> (CreateRouteCalculatorResponse
    -> Text -> CreateRouteCalculatorResponse)
-> Lens
     CreateRouteCalculatorResponse
     CreateRouteCalculatorResponse
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteCalculatorResponse' {Text
calculatorName :: Text
$sel:calculatorName:CreateRouteCalculatorResponse' :: CreateRouteCalculatorResponse -> Text
calculatorName} -> Text
calculatorName) (\s :: CreateRouteCalculatorResponse
s@CreateRouteCalculatorResponse' {} Text
a -> CreateRouteCalculatorResponse
s {$sel:calculatorName:CreateRouteCalculatorResponse' :: Text
calculatorName = Text
a} :: CreateRouteCalculatorResponse)

-- | The timestamp when the route calculator resource was created in
-- <https://www.iso.org/iso-8601-date-and-time-format.html ISO 8601>
-- format: @YYYY-MM-DDThh:mm:ss.sssZ@.
--
-- -   For example, @2020–07-2T12:15:20.000Z+01:00@
createRouteCalculatorResponse_createTime :: Lens.Lens' CreateRouteCalculatorResponse Prelude.UTCTime
createRouteCalculatorResponse_createTime :: (UTCTime -> f UTCTime)
-> CreateRouteCalculatorResponse -> f CreateRouteCalculatorResponse
createRouteCalculatorResponse_createTime = (CreateRouteCalculatorResponse -> POSIX)
-> (CreateRouteCalculatorResponse
    -> POSIX -> CreateRouteCalculatorResponse)
-> Lens
     CreateRouteCalculatorResponse
     CreateRouteCalculatorResponse
     POSIX
     POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateRouteCalculatorResponse' {POSIX
createTime :: POSIX
$sel:createTime:CreateRouteCalculatorResponse' :: CreateRouteCalculatorResponse -> POSIX
createTime} -> POSIX
createTime) (\s :: CreateRouteCalculatorResponse
s@CreateRouteCalculatorResponse' {} POSIX
a -> CreateRouteCalculatorResponse
s {$sel:createTime:CreateRouteCalculatorResponse' :: POSIX
createTime = POSIX
a} :: CreateRouteCalculatorResponse) ((POSIX -> f POSIX)
 -> CreateRouteCalculatorResponse
 -> f CreateRouteCalculatorResponse)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> CreateRouteCalculatorResponse
-> f CreateRouteCalculatorResponse
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

instance Prelude.NFData CreateRouteCalculatorResponse