{-# 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 #-}
module Amazonka.ApplicationCostProfiler.Types.SourceS3Location where
import Amazonka.ApplicationCostProfiler.Types.S3BucketRegion
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
data SourceS3Location = SourceS3Location'
{
SourceS3Location -> Maybe S3BucketRegion
region :: Prelude.Maybe S3BucketRegion,
SourceS3Location -> Text
bucket :: Prelude.Text,
SourceS3Location -> Text
key :: Prelude.Text
}
deriving (SourceS3Location -> SourceS3Location -> Bool
(SourceS3Location -> SourceS3Location -> Bool)
-> (SourceS3Location -> SourceS3Location -> Bool)
-> Eq SourceS3Location
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SourceS3Location -> SourceS3Location -> Bool
$c/= :: SourceS3Location -> SourceS3Location -> Bool
== :: SourceS3Location -> SourceS3Location -> Bool
$c== :: SourceS3Location -> SourceS3Location -> Bool
Prelude.Eq, ReadPrec [SourceS3Location]
ReadPrec SourceS3Location
Int -> ReadS SourceS3Location
ReadS [SourceS3Location]
(Int -> ReadS SourceS3Location)
-> ReadS [SourceS3Location]
-> ReadPrec SourceS3Location
-> ReadPrec [SourceS3Location]
-> Read SourceS3Location
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SourceS3Location]
$creadListPrec :: ReadPrec [SourceS3Location]
readPrec :: ReadPrec SourceS3Location
$creadPrec :: ReadPrec SourceS3Location
readList :: ReadS [SourceS3Location]
$creadList :: ReadS [SourceS3Location]
readsPrec :: Int -> ReadS SourceS3Location
$creadsPrec :: Int -> ReadS SourceS3Location
Prelude.Read, Int -> SourceS3Location -> ShowS
[SourceS3Location] -> ShowS
SourceS3Location -> String
(Int -> SourceS3Location -> ShowS)
-> (SourceS3Location -> String)
-> ([SourceS3Location] -> ShowS)
-> Show SourceS3Location
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SourceS3Location] -> ShowS
$cshowList :: [SourceS3Location] -> ShowS
show :: SourceS3Location -> String
$cshow :: SourceS3Location -> String
showsPrec :: Int -> SourceS3Location -> ShowS
$cshowsPrec :: Int -> SourceS3Location -> ShowS
Prelude.Show, (forall x. SourceS3Location -> Rep SourceS3Location x)
-> (forall x. Rep SourceS3Location x -> SourceS3Location)
-> Generic SourceS3Location
forall x. Rep SourceS3Location x -> SourceS3Location
forall x. SourceS3Location -> Rep SourceS3Location x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SourceS3Location x -> SourceS3Location
$cfrom :: forall x. SourceS3Location -> Rep SourceS3Location x
Prelude.Generic)
newSourceS3Location ::
Prelude.Text ->
Prelude.Text ->
SourceS3Location
newSourceS3Location :: Text -> Text -> SourceS3Location
newSourceS3Location Text
pBucket_ Text
pKey_ =
SourceS3Location' :: Maybe S3BucketRegion -> Text -> Text -> SourceS3Location
SourceS3Location'
{ $sel:region:SourceS3Location' :: Maybe S3BucketRegion
region = Maybe S3BucketRegion
forall a. Maybe a
Prelude.Nothing,
$sel:bucket:SourceS3Location' :: Text
bucket = Text
pBucket_,
$sel:key:SourceS3Location' :: Text
key = Text
pKey_
}
sourceS3Location_region :: Lens.Lens' SourceS3Location (Prelude.Maybe S3BucketRegion)
sourceS3Location_region :: (Maybe S3BucketRegion -> f (Maybe S3BucketRegion))
-> SourceS3Location -> f SourceS3Location
sourceS3Location_region = (SourceS3Location -> Maybe S3BucketRegion)
-> (SourceS3Location -> Maybe S3BucketRegion -> SourceS3Location)
-> Lens
SourceS3Location
SourceS3Location
(Maybe S3BucketRegion)
(Maybe S3BucketRegion)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceS3Location' {Maybe S3BucketRegion
region :: Maybe S3BucketRegion
$sel:region:SourceS3Location' :: SourceS3Location -> Maybe S3BucketRegion
region} -> Maybe S3BucketRegion
region) (\s :: SourceS3Location
s@SourceS3Location' {} Maybe S3BucketRegion
a -> SourceS3Location
s {$sel:region:SourceS3Location' :: Maybe S3BucketRegion
region = Maybe S3BucketRegion
a} :: SourceS3Location)
sourceS3Location_bucket :: Lens.Lens' SourceS3Location Prelude.Text
sourceS3Location_bucket :: (Text -> f Text) -> SourceS3Location -> f SourceS3Location
sourceS3Location_bucket = (SourceS3Location -> Text)
-> (SourceS3Location -> Text -> SourceS3Location)
-> Lens SourceS3Location SourceS3Location Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceS3Location' {Text
bucket :: Text
$sel:bucket:SourceS3Location' :: SourceS3Location -> Text
bucket} -> Text
bucket) (\s :: SourceS3Location
s@SourceS3Location' {} Text
a -> SourceS3Location
s {$sel:bucket:SourceS3Location' :: Text
bucket = Text
a} :: SourceS3Location)
sourceS3Location_key :: Lens.Lens' SourceS3Location Prelude.Text
sourceS3Location_key :: (Text -> f Text) -> SourceS3Location -> f SourceS3Location
sourceS3Location_key = (SourceS3Location -> Text)
-> (SourceS3Location -> Text -> SourceS3Location)
-> Lens SourceS3Location SourceS3Location Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SourceS3Location' {Text
key :: Text
$sel:key:SourceS3Location' :: SourceS3Location -> Text
key} -> Text
key) (\s :: SourceS3Location
s@SourceS3Location' {} Text
a -> SourceS3Location
s {$sel:key:SourceS3Location' :: Text
key = Text
a} :: SourceS3Location)
instance Prelude.Hashable SourceS3Location
instance Prelude.NFData SourceS3Location
instance Core.ToJSON SourceS3Location where
toJSON :: SourceS3Location -> Value
toJSON SourceS3Location' {Maybe S3BucketRegion
Text
key :: Text
bucket :: Text
region :: Maybe S3BucketRegion
$sel:key:SourceS3Location' :: SourceS3Location -> Text
$sel:bucket:SourceS3Location' :: SourceS3Location -> Text
$sel:region:SourceS3Location' :: SourceS3Location -> Maybe S3BucketRegion
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"region" Text -> S3BucketRegion -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (S3BucketRegion -> Pair) -> Maybe S3BucketRegion -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3BucketRegion
region,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"bucket" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
bucket),
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"key" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
key)
]
)