{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Glue.Types.Location
-- 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)
module Amazonka.Glue.Types.Location where

import qualified Amazonka.Core as Core
import Amazonka.Glue.Types.CodeGenNodeArg
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The location of resources.
--
-- /See:/ 'newLocation' smart constructor.
data Location = Location'
  { -- | An Amazon DynamoDB table location.
    Location -> Maybe [CodeGenNodeArg]
dynamoDB :: Prelude.Maybe [CodeGenNodeArg],
    -- | A JDBC location.
    Location -> Maybe [CodeGenNodeArg]
jdbc :: Prelude.Maybe [CodeGenNodeArg],
    -- | An Amazon Simple Storage Service (Amazon S3) location.
    Location -> Maybe [CodeGenNodeArg]
s3 :: Prelude.Maybe [CodeGenNodeArg]
  }
  deriving (Location -> Location -> Bool
(Location -> Location -> Bool)
-> (Location -> Location -> Bool) -> Eq Location
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Location -> Location -> Bool
$c/= :: Location -> Location -> Bool
== :: Location -> Location -> Bool
$c== :: Location -> Location -> Bool
Prelude.Eq, ReadPrec [Location]
ReadPrec Location
Int -> ReadS Location
ReadS [Location]
(Int -> ReadS Location)
-> ReadS [Location]
-> ReadPrec Location
-> ReadPrec [Location]
-> Read Location
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Location]
$creadListPrec :: ReadPrec [Location]
readPrec :: ReadPrec Location
$creadPrec :: ReadPrec Location
readList :: ReadS [Location]
$creadList :: ReadS [Location]
readsPrec :: Int -> ReadS Location
$creadsPrec :: Int -> ReadS Location
Prelude.Read, Int -> Location -> ShowS
[Location] -> ShowS
Location -> String
(Int -> Location -> ShowS)
-> (Location -> String) -> ([Location] -> ShowS) -> Show Location
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Location] -> ShowS
$cshowList :: [Location] -> ShowS
show :: Location -> String
$cshow :: Location -> String
showsPrec :: Int -> Location -> ShowS
$cshowsPrec :: Int -> Location -> ShowS
Prelude.Show, (forall x. Location -> Rep Location x)
-> (forall x. Rep Location x -> Location) -> Generic Location
forall x. Rep Location x -> Location
forall x. Location -> Rep Location x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Location x -> Location
$cfrom :: forall x. Location -> Rep Location x
Prelude.Generic)

-- |
-- Create a value of 'Location' 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:
--
-- 'dynamoDB', 'location_dynamoDB' - An Amazon DynamoDB table location.
--
-- 'jdbc', 'location_jdbc' - A JDBC location.
--
-- 's3', 'location_s3' - An Amazon Simple Storage Service (Amazon S3) location.
newLocation ::
  Location
newLocation :: Location
newLocation =
  Location' :: Maybe [CodeGenNodeArg]
-> Maybe [CodeGenNodeArg] -> Maybe [CodeGenNodeArg] -> Location
Location'
    { $sel:dynamoDB:Location' :: Maybe [CodeGenNodeArg]
dynamoDB = Maybe [CodeGenNodeArg]
forall a. Maybe a
Prelude.Nothing,
      $sel:jdbc:Location' :: Maybe [CodeGenNodeArg]
jdbc = Maybe [CodeGenNodeArg]
forall a. Maybe a
Prelude.Nothing,
      $sel:s3:Location' :: Maybe [CodeGenNodeArg]
s3 = Maybe [CodeGenNodeArg]
forall a. Maybe a
Prelude.Nothing
    }

-- | An Amazon DynamoDB table location.
location_dynamoDB :: Lens.Lens' Location (Prelude.Maybe [CodeGenNodeArg])
location_dynamoDB :: (Maybe [CodeGenNodeArg] -> f (Maybe [CodeGenNodeArg]))
-> Location -> f Location
location_dynamoDB = (Location -> Maybe [CodeGenNodeArg])
-> (Location -> Maybe [CodeGenNodeArg] -> Location)
-> Lens
     Location Location (Maybe [CodeGenNodeArg]) (Maybe [CodeGenNodeArg])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Location' {Maybe [CodeGenNodeArg]
dynamoDB :: Maybe [CodeGenNodeArg]
$sel:dynamoDB:Location' :: Location -> Maybe [CodeGenNodeArg]
dynamoDB} -> Maybe [CodeGenNodeArg]
dynamoDB) (\s :: Location
s@Location' {} Maybe [CodeGenNodeArg]
a -> Location
s {$sel:dynamoDB:Location' :: Maybe [CodeGenNodeArg]
dynamoDB = Maybe [CodeGenNodeArg]
a} :: Location) ((Maybe [CodeGenNodeArg] -> f (Maybe [CodeGenNodeArg]))
 -> Location -> f Location)
-> ((Maybe [CodeGenNodeArg] -> f (Maybe [CodeGenNodeArg]))
    -> Maybe [CodeGenNodeArg] -> f (Maybe [CodeGenNodeArg]))
-> (Maybe [CodeGenNodeArg] -> f (Maybe [CodeGenNodeArg]))
-> Location
-> f Location
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CodeGenNodeArg] [CodeGenNodeArg] [CodeGenNodeArg] [CodeGenNodeArg]
-> Iso
     (Maybe [CodeGenNodeArg])
     (Maybe [CodeGenNodeArg])
     (Maybe [CodeGenNodeArg])
     (Maybe [CodeGenNodeArg])
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
  [CodeGenNodeArg] [CodeGenNodeArg] [CodeGenNodeArg] [CodeGenNodeArg]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A JDBC location.
location_jdbc :: Lens.Lens' Location (Prelude.Maybe [CodeGenNodeArg])
location_jdbc :: (Maybe [CodeGenNodeArg] -> f (Maybe [CodeGenNodeArg]))
-> Location -> f Location
location_jdbc = (Location -> Maybe [CodeGenNodeArg])
-> (Location -> Maybe [CodeGenNodeArg] -> Location)
-> Lens
     Location Location (Maybe [CodeGenNodeArg]) (Maybe [CodeGenNodeArg])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Location' {Maybe [CodeGenNodeArg]
jdbc :: Maybe [CodeGenNodeArg]
$sel:jdbc:Location' :: Location -> Maybe [CodeGenNodeArg]
jdbc} -> Maybe [CodeGenNodeArg]
jdbc) (\s :: Location
s@Location' {} Maybe [CodeGenNodeArg]
a -> Location
s {$sel:jdbc:Location' :: Maybe [CodeGenNodeArg]
jdbc = Maybe [CodeGenNodeArg]
a} :: Location) ((Maybe [CodeGenNodeArg] -> f (Maybe [CodeGenNodeArg]))
 -> Location -> f Location)
-> ((Maybe [CodeGenNodeArg] -> f (Maybe [CodeGenNodeArg]))
    -> Maybe [CodeGenNodeArg] -> f (Maybe [CodeGenNodeArg]))
-> (Maybe [CodeGenNodeArg] -> f (Maybe [CodeGenNodeArg]))
-> Location
-> f Location
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CodeGenNodeArg] [CodeGenNodeArg] [CodeGenNodeArg] [CodeGenNodeArg]
-> Iso
     (Maybe [CodeGenNodeArg])
     (Maybe [CodeGenNodeArg])
     (Maybe [CodeGenNodeArg])
     (Maybe [CodeGenNodeArg])
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
  [CodeGenNodeArg] [CodeGenNodeArg] [CodeGenNodeArg] [CodeGenNodeArg]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | An Amazon Simple Storage Service (Amazon S3) location.
location_s3 :: Lens.Lens' Location (Prelude.Maybe [CodeGenNodeArg])
location_s3 :: (Maybe [CodeGenNodeArg] -> f (Maybe [CodeGenNodeArg]))
-> Location -> f Location
location_s3 = (Location -> Maybe [CodeGenNodeArg])
-> (Location -> Maybe [CodeGenNodeArg] -> Location)
-> Lens
     Location Location (Maybe [CodeGenNodeArg]) (Maybe [CodeGenNodeArg])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Location' {Maybe [CodeGenNodeArg]
s3 :: Maybe [CodeGenNodeArg]
$sel:s3:Location' :: Location -> Maybe [CodeGenNodeArg]
s3} -> Maybe [CodeGenNodeArg]
s3) (\s :: Location
s@Location' {} Maybe [CodeGenNodeArg]
a -> Location
s {$sel:s3:Location' :: Maybe [CodeGenNodeArg]
s3 = Maybe [CodeGenNodeArg]
a} :: Location) ((Maybe [CodeGenNodeArg] -> f (Maybe [CodeGenNodeArg]))
 -> Location -> f Location)
-> ((Maybe [CodeGenNodeArg] -> f (Maybe [CodeGenNodeArg]))
    -> Maybe [CodeGenNodeArg] -> f (Maybe [CodeGenNodeArg]))
-> (Maybe [CodeGenNodeArg] -> f (Maybe [CodeGenNodeArg]))
-> Location
-> f Location
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [CodeGenNodeArg] [CodeGenNodeArg] [CodeGenNodeArg] [CodeGenNodeArg]
-> Iso
     (Maybe [CodeGenNodeArg])
     (Maybe [CodeGenNodeArg])
     (Maybe [CodeGenNodeArg])
     (Maybe [CodeGenNodeArg])
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
  [CodeGenNodeArg] [CodeGenNodeArg] [CodeGenNodeArg] [CodeGenNodeArg]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Prelude.Hashable Location

instance Prelude.NFData Location

instance Core.ToJSON Location where
  toJSON :: Location -> Value
toJSON Location' {Maybe [CodeGenNodeArg]
s3 :: Maybe [CodeGenNodeArg]
jdbc :: Maybe [CodeGenNodeArg]
dynamoDB :: Maybe [CodeGenNodeArg]
$sel:s3:Location' :: Location -> Maybe [CodeGenNodeArg]
$sel:jdbc:Location' :: Location -> Maybe [CodeGenNodeArg]
$sel:dynamoDB:Location' :: Location -> Maybe [CodeGenNodeArg]
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"DynamoDB" Text -> [CodeGenNodeArg] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([CodeGenNodeArg] -> Pair) -> Maybe [CodeGenNodeArg] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CodeGenNodeArg]
dynamoDB,
            (Text
"Jdbc" Text -> [CodeGenNodeArg] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([CodeGenNodeArg] -> Pair) -> Maybe [CodeGenNodeArg] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CodeGenNodeArg]
jdbc,
            (Text
"S3" Text -> [CodeGenNodeArg] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([CodeGenNodeArg] -> Pair) -> Maybe [CodeGenNodeArg] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [CodeGenNodeArg]
s3
          ]
      )