{-# 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.CreateTracker
-- 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 tracker resource in your AWS account, which lets you retrieve
-- current and historical location of devices.
module Amazonka.Location.CreateTracker
  ( -- * Creating a Request
    CreateTracker (..),
    newCreateTracker,

    -- * Request Lenses
    createTracker_pricingPlanDataSource,
    createTracker_kmsKeyId,
    createTracker_description,
    createTracker_tags,
    createTracker_positionFiltering,
    createTracker_pricingPlan,
    createTracker_trackerName,

    -- * Destructuring the Response
    CreateTrackerResponse (..),
    newCreateTrackerResponse,

    -- * Response Lenses
    createTrackerResponse_httpStatus,
    createTrackerResponse_createTime,
    createTrackerResponse_trackerArn,
    createTrackerResponse_trackerName,
  )
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:/ 'newCreateTracker' smart constructor.
data CreateTracker = CreateTracker'
  { -- | Specifies the data provider for the tracker resource.
    --
    -- -   Required value for the following pricing plans:
    --     @MobileAssetTracking @| @MobileAssetManagement@
    --
    -- For more information about
    -- <https://aws.amazon.com/location/data-providers/ Data Providers>, and
    -- <https://aws.amazon.com/location/pricing/ Pricing plans>, see the Amazon
    -- Location Service product page.
    --
    -- Amazon Location Service only uses @PricingPlanDataSource@ to calculate
    -- billing for your tracker resource. Your data will not be shared with the
    -- data provider, and will remain in your AWS account or Region unless you
    -- move it.
    --
    -- Valid values: @Esri@ | @Here@
    CreateTracker -> Maybe Text
pricingPlanDataSource :: Prelude.Maybe Prelude.Text,
    -- | A key identifier for an
    -- <https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html AWS KMS customer managed key>.
    -- Enter a key ID, key ARN, alias name, or alias ARN.
    CreateTracker -> Maybe Text
kmsKeyId :: Prelude.Maybe Prelude.Text,
    -- | An optional description for the tracker resource.
    CreateTracker -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | Applies one or more tags to the tracker 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: + - = . _ : \/ \@.
    CreateTracker -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | Specifies the position filtering for the tracker resource.
    --
    -- Valid values:
    --
    -- -   @TimeBased@ - Location updates are evaluated against linked geofence
    --     collections, but not every location update is stored. If your update
    --     frequency is more often than 30 seconds, only one update per 30
    --     seconds is stored for each unique device ID.
    --
    -- -   @DistanceBased@ - If the device has moved less than 30 m (98.4 ft),
    --     location updates are ignored. Location updates within this distance
    --     are neither evaluated against linked geofence collections, nor
    --     stored. This helps control costs by reducing the number of geofence
    --     evaluations and device positions to retrieve. Distance-based
    --     filtering can also reduce the jitter effect when displaying device
    --     trajectory on a map.
    --
    -- This field is optional. If not specified, the default value is
    -- @TimeBased@.
    CreateTracker -> Maybe PositionFiltering
positionFiltering :: Prelude.Maybe PositionFiltering,
    -- | Specifies the pricing plan for the tracker resource.
    --
    -- For additional details and restrictions on each pricing plan option, see
    -- <https://aws.amazon.com/location/pricing/ Amazon Location Service pricing>.
    CreateTracker -> PricingPlan
pricingPlan :: PricingPlan,
    -- | The name for the tracker resource.
    --
    -- Requirements:
    --
    -- -   Contain only alphanumeric characters (A-Z, a-z, 0-9) , hyphens (-),
    --     periods (.), and underscores (_).
    --
    -- -   Must be a unique tracker resource name.
    --
    -- -   No spaces allowed. For example, @ExampleTracker@.
    CreateTracker -> Text
trackerName :: Prelude.Text
  }
  deriving (CreateTracker -> CreateTracker -> Bool
(CreateTracker -> CreateTracker -> Bool)
-> (CreateTracker -> CreateTracker -> Bool) -> Eq CreateTracker
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateTracker -> CreateTracker -> Bool
$c/= :: CreateTracker -> CreateTracker -> Bool
== :: CreateTracker -> CreateTracker -> Bool
$c== :: CreateTracker -> CreateTracker -> Bool
Prelude.Eq, ReadPrec [CreateTracker]
ReadPrec CreateTracker
Int -> ReadS CreateTracker
ReadS [CreateTracker]
(Int -> ReadS CreateTracker)
-> ReadS [CreateTracker]
-> ReadPrec CreateTracker
-> ReadPrec [CreateTracker]
-> Read CreateTracker
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateTracker]
$creadListPrec :: ReadPrec [CreateTracker]
readPrec :: ReadPrec CreateTracker
$creadPrec :: ReadPrec CreateTracker
readList :: ReadS [CreateTracker]
$creadList :: ReadS [CreateTracker]
readsPrec :: Int -> ReadS CreateTracker
$creadsPrec :: Int -> ReadS CreateTracker
Prelude.Read, Int -> CreateTracker -> ShowS
[CreateTracker] -> ShowS
CreateTracker -> String
(Int -> CreateTracker -> ShowS)
-> (CreateTracker -> String)
-> ([CreateTracker] -> ShowS)
-> Show CreateTracker
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateTracker] -> ShowS
$cshowList :: [CreateTracker] -> ShowS
show :: CreateTracker -> String
$cshow :: CreateTracker -> String
showsPrec :: Int -> CreateTracker -> ShowS
$cshowsPrec :: Int -> CreateTracker -> ShowS
Prelude.Show, (forall x. CreateTracker -> Rep CreateTracker x)
-> (forall x. Rep CreateTracker x -> CreateTracker)
-> Generic CreateTracker
forall x. Rep CreateTracker x -> CreateTracker
forall x. CreateTracker -> Rep CreateTracker x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateTracker x -> CreateTracker
$cfrom :: forall x. CreateTracker -> Rep CreateTracker x
Prelude.Generic)

-- |
-- Create a value of 'CreateTracker' 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:
--
-- 'pricingPlanDataSource', 'createTracker_pricingPlanDataSource' - Specifies the data provider for the tracker resource.
--
-- -   Required value for the following pricing plans:
--     @MobileAssetTracking @| @MobileAssetManagement@
--
-- For more information about
-- <https://aws.amazon.com/location/data-providers/ Data Providers>, and
-- <https://aws.amazon.com/location/pricing/ Pricing plans>, see the Amazon
-- Location Service product page.
--
-- Amazon Location Service only uses @PricingPlanDataSource@ to calculate
-- billing for your tracker resource. Your data will not be shared with the
-- data provider, and will remain in your AWS account or Region unless you
-- move it.
--
-- Valid values: @Esri@ | @Here@
--
-- 'kmsKeyId', 'createTracker_kmsKeyId' - A key identifier for an
-- <https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html AWS KMS customer managed key>.
-- Enter a key ID, key ARN, alias name, or alias ARN.
--
-- 'description', 'createTracker_description' - An optional description for the tracker resource.
--
-- 'tags', 'createTracker_tags' - Applies one or more tags to the tracker 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: + - = . _ : \/ \@.
--
-- 'positionFiltering', 'createTracker_positionFiltering' - Specifies the position filtering for the tracker resource.
--
-- Valid values:
--
-- -   @TimeBased@ - Location updates are evaluated against linked geofence
--     collections, but not every location update is stored. If your update
--     frequency is more often than 30 seconds, only one update per 30
--     seconds is stored for each unique device ID.
--
-- -   @DistanceBased@ - If the device has moved less than 30 m (98.4 ft),
--     location updates are ignored. Location updates within this distance
--     are neither evaluated against linked geofence collections, nor
--     stored. This helps control costs by reducing the number of geofence
--     evaluations and device positions to retrieve. Distance-based
--     filtering can also reduce the jitter effect when displaying device
--     trajectory on a map.
--
-- This field is optional. If not specified, the default value is
-- @TimeBased@.
--
-- 'pricingPlan', 'createTracker_pricingPlan' - Specifies the pricing plan for the tracker resource.
--
-- For additional details and restrictions on each pricing plan option, see
-- <https://aws.amazon.com/location/pricing/ Amazon Location Service pricing>.
--
-- 'trackerName', 'createTracker_trackerName' - The name for the tracker resource.
--
-- Requirements:
--
-- -   Contain only alphanumeric characters (A-Z, a-z, 0-9) , hyphens (-),
--     periods (.), and underscores (_).
--
-- -   Must be a unique tracker resource name.
--
-- -   No spaces allowed. For example, @ExampleTracker@.
newCreateTracker ::
  -- | 'pricingPlan'
  PricingPlan ->
  -- | 'trackerName'
  Prelude.Text ->
  CreateTracker
newCreateTracker :: PricingPlan -> Text -> CreateTracker
newCreateTracker PricingPlan
pPricingPlan_ Text
pTrackerName_ =
  CreateTracker' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Maybe PositionFiltering
-> PricingPlan
-> Text
-> CreateTracker
CreateTracker'
    { $sel:pricingPlanDataSource:CreateTracker' :: Maybe Text
pricingPlanDataSource =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:kmsKeyId:CreateTracker' :: Maybe Text
kmsKeyId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:CreateTracker' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateTracker' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:positionFiltering:CreateTracker' :: Maybe PositionFiltering
positionFiltering = Maybe PositionFiltering
forall a. Maybe a
Prelude.Nothing,
      $sel:pricingPlan:CreateTracker' :: PricingPlan
pricingPlan = PricingPlan
pPricingPlan_,
      $sel:trackerName:CreateTracker' :: Text
trackerName = Text
pTrackerName_
    }

-- | Specifies the data provider for the tracker resource.
--
-- -   Required value for the following pricing plans:
--     @MobileAssetTracking @| @MobileAssetManagement@
--
-- For more information about
-- <https://aws.amazon.com/location/data-providers/ Data Providers>, and
-- <https://aws.amazon.com/location/pricing/ Pricing plans>, see the Amazon
-- Location Service product page.
--
-- Amazon Location Service only uses @PricingPlanDataSource@ to calculate
-- billing for your tracker resource. Your data will not be shared with the
-- data provider, and will remain in your AWS account or Region unless you
-- move it.
--
-- Valid values: @Esri@ | @Here@
createTracker_pricingPlanDataSource :: Lens.Lens' CreateTracker (Prelude.Maybe Prelude.Text)
createTracker_pricingPlanDataSource :: (Maybe Text -> f (Maybe Text)) -> CreateTracker -> f CreateTracker
createTracker_pricingPlanDataSource = (CreateTracker -> Maybe Text)
-> (CreateTracker -> Maybe Text -> CreateTracker)
-> Lens CreateTracker CreateTracker (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTracker' {Maybe Text
pricingPlanDataSource :: Maybe Text
$sel:pricingPlanDataSource:CreateTracker' :: CreateTracker -> Maybe Text
pricingPlanDataSource} -> Maybe Text
pricingPlanDataSource) (\s :: CreateTracker
s@CreateTracker' {} Maybe Text
a -> CreateTracker
s {$sel:pricingPlanDataSource:CreateTracker' :: Maybe Text
pricingPlanDataSource = Maybe Text
a} :: CreateTracker)

-- | A key identifier for an
-- <https://docs.aws.amazon.com/kms/latest/developerguide/create-keys.html AWS KMS customer managed key>.
-- Enter a key ID, key ARN, alias name, or alias ARN.
createTracker_kmsKeyId :: Lens.Lens' CreateTracker (Prelude.Maybe Prelude.Text)
createTracker_kmsKeyId :: (Maybe Text -> f (Maybe Text)) -> CreateTracker -> f CreateTracker
createTracker_kmsKeyId = (CreateTracker -> Maybe Text)
-> (CreateTracker -> Maybe Text -> CreateTracker)
-> Lens CreateTracker CreateTracker (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTracker' {Maybe Text
kmsKeyId :: Maybe Text
$sel:kmsKeyId:CreateTracker' :: CreateTracker -> Maybe Text
kmsKeyId} -> Maybe Text
kmsKeyId) (\s :: CreateTracker
s@CreateTracker' {} Maybe Text
a -> CreateTracker
s {$sel:kmsKeyId:CreateTracker' :: Maybe Text
kmsKeyId = Maybe Text
a} :: CreateTracker)

-- | An optional description for the tracker resource.
createTracker_description :: Lens.Lens' CreateTracker (Prelude.Maybe Prelude.Text)
createTracker_description :: (Maybe Text -> f (Maybe Text)) -> CreateTracker -> f CreateTracker
createTracker_description = (CreateTracker -> Maybe Text)
-> (CreateTracker -> Maybe Text -> CreateTracker)
-> Lens CreateTracker CreateTracker (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTracker' {Maybe Text
description :: Maybe Text
$sel:description:CreateTracker' :: CreateTracker -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateTracker
s@CreateTracker' {} Maybe Text
a -> CreateTracker
s {$sel:description:CreateTracker' :: Maybe Text
description = Maybe Text
a} :: CreateTracker)

-- | Applies one or more tags to the tracker 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: + - = . _ : \/ \@.
createTracker_tags :: Lens.Lens' CreateTracker (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createTracker_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateTracker -> f CreateTracker
createTracker_tags = (CreateTracker -> Maybe (HashMap Text Text))
-> (CreateTracker -> Maybe (HashMap Text Text) -> CreateTracker)
-> Lens
     CreateTracker
     CreateTracker
     (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 (\CreateTracker' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateTracker' :: CreateTracker -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateTracker
s@CreateTracker' {} Maybe (HashMap Text Text)
a -> CreateTracker
s {$sel:tags:CreateTracker' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateTracker) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateTracker -> f CreateTracker)
-> ((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)))
-> CreateTracker
-> f CreateTracker
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 position filtering for the tracker resource.
--
-- Valid values:
--
-- -   @TimeBased@ - Location updates are evaluated against linked geofence
--     collections, but not every location update is stored. If your update
--     frequency is more often than 30 seconds, only one update per 30
--     seconds is stored for each unique device ID.
--
-- -   @DistanceBased@ - If the device has moved less than 30 m (98.4 ft),
--     location updates are ignored. Location updates within this distance
--     are neither evaluated against linked geofence collections, nor
--     stored. This helps control costs by reducing the number of geofence
--     evaluations and device positions to retrieve. Distance-based
--     filtering can also reduce the jitter effect when displaying device
--     trajectory on a map.
--
-- This field is optional. If not specified, the default value is
-- @TimeBased@.
createTracker_positionFiltering :: Lens.Lens' CreateTracker (Prelude.Maybe PositionFiltering)
createTracker_positionFiltering :: (Maybe PositionFiltering -> f (Maybe PositionFiltering))
-> CreateTracker -> f CreateTracker
createTracker_positionFiltering = (CreateTracker -> Maybe PositionFiltering)
-> (CreateTracker -> Maybe PositionFiltering -> CreateTracker)
-> Lens
     CreateTracker
     CreateTracker
     (Maybe PositionFiltering)
     (Maybe PositionFiltering)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTracker' {Maybe PositionFiltering
positionFiltering :: Maybe PositionFiltering
$sel:positionFiltering:CreateTracker' :: CreateTracker -> Maybe PositionFiltering
positionFiltering} -> Maybe PositionFiltering
positionFiltering) (\s :: CreateTracker
s@CreateTracker' {} Maybe PositionFiltering
a -> CreateTracker
s {$sel:positionFiltering:CreateTracker' :: Maybe PositionFiltering
positionFiltering = Maybe PositionFiltering
a} :: CreateTracker)

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

-- | The name for the tracker resource.
--
-- Requirements:
--
-- -   Contain only alphanumeric characters (A-Z, a-z, 0-9) , hyphens (-),
--     periods (.), and underscores (_).
--
-- -   Must be a unique tracker resource name.
--
-- -   No spaces allowed. For example, @ExampleTracker@.
createTracker_trackerName :: Lens.Lens' CreateTracker Prelude.Text
createTracker_trackerName :: (Text -> f Text) -> CreateTracker -> f CreateTracker
createTracker_trackerName = (CreateTracker -> Text)
-> (CreateTracker -> Text -> CreateTracker)
-> Lens CreateTracker CreateTracker Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTracker' {Text
trackerName :: Text
$sel:trackerName:CreateTracker' :: CreateTracker -> Text
trackerName} -> Text
trackerName) (\s :: CreateTracker
s@CreateTracker' {} Text
a -> CreateTracker
s {$sel:trackerName:CreateTracker' :: Text
trackerName = Text
a} :: CreateTracker)

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

instance Prelude.Hashable CreateTracker

instance Prelude.NFData CreateTracker

instance Core.ToHeaders CreateTracker where
  toHeaders :: CreateTracker -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateTracker -> 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 CreateTracker where
  toJSON :: CreateTracker -> Value
toJSON CreateTracker' {Maybe Text
Maybe (HashMap Text Text)
Maybe PositionFiltering
Text
PricingPlan
trackerName :: Text
pricingPlan :: PricingPlan
positionFiltering :: Maybe PositionFiltering
tags :: Maybe (HashMap Text Text)
description :: Maybe Text
kmsKeyId :: Maybe Text
pricingPlanDataSource :: Maybe Text
$sel:trackerName:CreateTracker' :: CreateTracker -> Text
$sel:pricingPlan:CreateTracker' :: CreateTracker -> PricingPlan
$sel:positionFiltering:CreateTracker' :: CreateTracker -> Maybe PositionFiltering
$sel:tags:CreateTracker' :: CreateTracker -> Maybe (HashMap Text Text)
$sel:description:CreateTracker' :: CreateTracker -> Maybe Text
$sel:kmsKeyId:CreateTracker' :: CreateTracker -> Maybe Text
$sel:pricingPlanDataSource:CreateTracker' :: CreateTracker -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"PricingPlanDataSource" 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
pricingPlanDataSource,
            (Text
"KmsKeyId" 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
kmsKeyId,
            (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,
            (Text
"PositionFiltering" Text -> PositionFiltering -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (PositionFiltering -> Pair)
-> Maybe PositionFiltering -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe PositionFiltering
positionFiltering,
            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),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"TrackerName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
trackerName)
          ]
      )

instance Core.ToPath CreateTracker where
  toPath :: CreateTracker -> ByteString
toPath = ByteString -> CreateTracker -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/tracking/v0/trackers"

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

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

-- |
-- Create a value of 'CreateTrackerResponse' 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', 'createTrackerResponse_httpStatus' - The response's http status code.
--
-- 'createTime', 'createTrackerResponse_createTime' - The timestamp for when the tracker resource was created in
-- <https://www.iso.org/iso-8601-date-and-time-format.html ISO 8601>
-- format: @YYYY-MM-DDThh:mm:ss.sssZ@.
--
-- 'trackerArn', 'createTrackerResponse_trackerArn' - The Amazon Resource Name (ARN) for the tracker resource. Used when you
-- need to specify a resource across all AWS.
--
-- -   Format example:
--     @arn:aws:geo:region:account-id:tracker\/ExampleTracker@
--
-- 'trackerName', 'createTrackerResponse_trackerName' - The name of the tracker resource.
newCreateTrackerResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'createTime'
  Prelude.UTCTime ->
  -- | 'trackerArn'
  Prelude.Text ->
  -- | 'trackerName'
  Prelude.Text ->
  CreateTrackerResponse
newCreateTrackerResponse :: Int -> UTCTime -> Text -> Text -> CreateTrackerResponse
newCreateTrackerResponse
  Int
pHttpStatus_
  UTCTime
pCreateTime_
  Text
pTrackerArn_
  Text
pTrackerName_ =
    CreateTrackerResponse' :: Int -> POSIX -> Text -> Text -> CreateTrackerResponse
CreateTrackerResponse'
      { $sel:httpStatus:CreateTrackerResponse' :: Int
httpStatus = Int
pHttpStatus_,
        $sel:createTime:CreateTrackerResponse' :: 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:trackerArn:CreateTrackerResponse' :: Text
trackerArn = Text
pTrackerArn_,
        $sel:trackerName:CreateTrackerResponse' :: Text
trackerName = Text
pTrackerName_
      }

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

-- | The timestamp for when the tracker resource was created in
-- <https://www.iso.org/iso-8601-date-and-time-format.html ISO 8601>
-- format: @YYYY-MM-DDThh:mm:ss.sssZ@.
createTrackerResponse_createTime :: Lens.Lens' CreateTrackerResponse Prelude.UTCTime
createTrackerResponse_createTime :: (UTCTime -> f UTCTime)
-> CreateTrackerResponse -> f CreateTrackerResponse
createTrackerResponse_createTime = (CreateTrackerResponse -> POSIX)
-> (CreateTrackerResponse -> POSIX -> CreateTrackerResponse)
-> Lens CreateTrackerResponse CreateTrackerResponse POSIX POSIX
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrackerResponse' {POSIX
createTime :: POSIX
$sel:createTime:CreateTrackerResponse' :: CreateTrackerResponse -> POSIX
createTime} -> POSIX
createTime) (\s :: CreateTrackerResponse
s@CreateTrackerResponse' {} POSIX
a -> CreateTrackerResponse
s {$sel:createTime:CreateTrackerResponse' :: POSIX
createTime = POSIX
a} :: CreateTrackerResponse) ((POSIX -> f POSIX)
 -> CreateTrackerResponse -> f CreateTrackerResponse)
-> ((UTCTime -> f UTCTime) -> POSIX -> f POSIX)
-> (UTCTime -> f UTCTime)
-> CreateTrackerResponse
-> f CreateTrackerResponse
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 tracker resource. Used when you
-- need to specify a resource across all AWS.
--
-- -   Format example:
--     @arn:aws:geo:region:account-id:tracker\/ExampleTracker@
createTrackerResponse_trackerArn :: Lens.Lens' CreateTrackerResponse Prelude.Text
createTrackerResponse_trackerArn :: (Text -> f Text)
-> CreateTrackerResponse -> f CreateTrackerResponse
createTrackerResponse_trackerArn = (CreateTrackerResponse -> Text)
-> (CreateTrackerResponse -> Text -> CreateTrackerResponse)
-> Lens CreateTrackerResponse CreateTrackerResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrackerResponse' {Text
trackerArn :: Text
$sel:trackerArn:CreateTrackerResponse' :: CreateTrackerResponse -> Text
trackerArn} -> Text
trackerArn) (\s :: CreateTrackerResponse
s@CreateTrackerResponse' {} Text
a -> CreateTrackerResponse
s {$sel:trackerArn:CreateTrackerResponse' :: Text
trackerArn = Text
a} :: CreateTrackerResponse)

-- | The name of the tracker resource.
createTrackerResponse_trackerName :: Lens.Lens' CreateTrackerResponse Prelude.Text
createTrackerResponse_trackerName :: (Text -> f Text)
-> CreateTrackerResponse -> f CreateTrackerResponse
createTrackerResponse_trackerName = (CreateTrackerResponse -> Text)
-> (CreateTrackerResponse -> Text -> CreateTrackerResponse)
-> Lens CreateTrackerResponse CreateTrackerResponse Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateTrackerResponse' {Text
trackerName :: Text
$sel:trackerName:CreateTrackerResponse' :: CreateTrackerResponse -> Text
trackerName} -> Text
trackerName) (\s :: CreateTrackerResponse
s@CreateTrackerResponse' {} Text
a -> CreateTrackerResponse
s {$sel:trackerName:CreateTrackerResponse' :: Text
trackerName = Text
a} :: CreateTrackerResponse)

instance Prelude.NFData CreateTrackerResponse