{-# 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.M2.Types.ExternalLocation
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.M2.Types.ExternalLocation where

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

-- | Defines an external storage location.
--
-- /See:/ 'newExternalLocation' smart constructor.
data ExternalLocation = ExternalLocation'
  { -- | The URI of the Amazon S3 bucket.
    ExternalLocation -> Maybe Text
s3Location :: Prelude.Maybe Prelude.Text
  }
  deriving (ExternalLocation -> ExternalLocation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ExternalLocation -> ExternalLocation -> Bool
$c/= :: ExternalLocation -> ExternalLocation -> Bool
== :: ExternalLocation -> ExternalLocation -> Bool
$c== :: ExternalLocation -> ExternalLocation -> Bool
Prelude.Eq, ReadPrec [ExternalLocation]
ReadPrec ExternalLocation
Int -> ReadS ExternalLocation
ReadS [ExternalLocation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ExternalLocation]
$creadListPrec :: ReadPrec [ExternalLocation]
readPrec :: ReadPrec ExternalLocation
$creadPrec :: ReadPrec ExternalLocation
readList :: ReadS [ExternalLocation]
$creadList :: ReadS [ExternalLocation]
readsPrec :: Int -> ReadS ExternalLocation
$creadsPrec :: Int -> ReadS ExternalLocation
Prelude.Read, Int -> ExternalLocation -> ShowS
[ExternalLocation] -> ShowS
ExternalLocation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ExternalLocation] -> ShowS
$cshowList :: [ExternalLocation] -> ShowS
show :: ExternalLocation -> String
$cshow :: ExternalLocation -> String
showsPrec :: Int -> ExternalLocation -> ShowS
$cshowsPrec :: Int -> ExternalLocation -> ShowS
Prelude.Show, forall x. Rep ExternalLocation x -> ExternalLocation
forall x. ExternalLocation -> Rep ExternalLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ExternalLocation x -> ExternalLocation
$cfrom :: forall x. ExternalLocation -> Rep ExternalLocation x
Prelude.Generic)

-- |
-- Create a value of 'ExternalLocation' 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:
--
-- 's3Location', 'externalLocation_s3Location' - The URI of the Amazon S3 bucket.
newExternalLocation ::
  ExternalLocation
newExternalLocation :: ExternalLocation
newExternalLocation =
  ExternalLocation' {$sel:s3Location:ExternalLocation' :: Maybe Text
s3Location = forall a. Maybe a
Prelude.Nothing}

-- | The URI of the Amazon S3 bucket.
externalLocation_s3Location :: Lens.Lens' ExternalLocation (Prelude.Maybe Prelude.Text)
externalLocation_s3Location :: Lens' ExternalLocation (Maybe Text)
externalLocation_s3Location = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ExternalLocation' {Maybe Text
s3Location :: Maybe Text
$sel:s3Location:ExternalLocation' :: ExternalLocation -> Maybe Text
s3Location} -> Maybe Text
s3Location) (\s :: ExternalLocation
s@ExternalLocation' {} Maybe Text
a -> ExternalLocation
s {$sel:s3Location:ExternalLocation' :: Maybe Text
s3Location = Maybe Text
a} :: ExternalLocation)

instance Prelude.Hashable ExternalLocation where
  hashWithSalt :: Int -> ExternalLocation -> Int
hashWithSalt Int
_salt ExternalLocation' {Maybe Text
s3Location :: Maybe Text
$sel:s3Location:ExternalLocation' :: ExternalLocation -> Maybe Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3Location

instance Prelude.NFData ExternalLocation where
  rnf :: ExternalLocation -> ()
rnf ExternalLocation' {Maybe Text
s3Location :: Maybe Text
$sel:s3Location:ExternalLocation' :: ExternalLocation -> Maybe Text
..} = forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3Location

instance Data.ToJSON ExternalLocation where
  toJSON :: ExternalLocation -> Value
toJSON ExternalLocation' {Maybe Text
s3Location :: Maybe Text
$sel:s3Location:ExternalLocation' :: ExternalLocation -> Maybe Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Key
"s3Location" 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 Text
s3Location]
      )