{-# 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.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
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
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]
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
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. 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'
{ $sel:region:SourceS3Location' :: Maybe S3BucketRegion
region = 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 :: Lens' SourceS3Location (Maybe S3BucketRegion)
sourceS3Location_region = 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 :: Lens' SourceS3Location Text
sourceS3Location_bucket = 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 :: Lens' SourceS3Location Text
sourceS3Location_key = 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 where
hashWithSalt :: Int -> SourceS3Location -> Int
hashWithSalt Int
_salt 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
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe S3BucketRegion
region
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
bucket
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
key
instance Prelude.NFData SourceS3Location where
rnf :: SourceS3Location -> ()
rnf 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
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe S3BucketRegion
region
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
bucket
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
key
instance Data.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
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"region" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3BucketRegion
region,
forall a. a -> Maybe a
Prelude.Just (Key
"bucket" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
bucket),
forall a. a -> Maybe a
Prelude.Just (Key
"key" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
key)
]
)