{-# 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.ResilienceHub.Types.TerraformSource
-- 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.ResilienceHub.Types.TerraformSource 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

-- | The Terraform s3 state file you need to import.
--
-- /See:/ 'newTerraformSource' smart constructor.
data TerraformSource = TerraformSource'
  { -- | The Terraform s3 state file you need to import.
    TerraformSource -> Text
s3StateFileUrl :: Prelude.Text
  }
  deriving (TerraformSource -> TerraformSource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: TerraformSource -> TerraformSource -> Bool
$c/= :: TerraformSource -> TerraformSource -> Bool
== :: TerraformSource -> TerraformSource -> Bool
$c== :: TerraformSource -> TerraformSource -> Bool
Prelude.Eq, ReadPrec [TerraformSource]
ReadPrec TerraformSource
Int -> ReadS TerraformSource
ReadS [TerraformSource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [TerraformSource]
$creadListPrec :: ReadPrec [TerraformSource]
readPrec :: ReadPrec TerraformSource
$creadPrec :: ReadPrec TerraformSource
readList :: ReadS [TerraformSource]
$creadList :: ReadS [TerraformSource]
readsPrec :: Int -> ReadS TerraformSource
$creadsPrec :: Int -> ReadS TerraformSource
Prelude.Read, Int -> TerraformSource -> ShowS
[TerraformSource] -> ShowS
TerraformSource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [TerraformSource] -> ShowS
$cshowList :: [TerraformSource] -> ShowS
show :: TerraformSource -> String
$cshow :: TerraformSource -> String
showsPrec :: Int -> TerraformSource -> ShowS
$cshowsPrec :: Int -> TerraformSource -> ShowS
Prelude.Show, forall x. Rep TerraformSource x -> TerraformSource
forall x. TerraformSource -> Rep TerraformSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep TerraformSource x -> TerraformSource
$cfrom :: forall x. TerraformSource -> Rep TerraformSource x
Prelude.Generic)

-- |
-- Create a value of 'TerraformSource' 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:
--
-- 's3StateFileUrl', 'terraformSource_s3StateFileUrl' - The Terraform s3 state file you need to import.
newTerraformSource ::
  -- | 's3StateFileUrl'
  Prelude.Text ->
  TerraformSource
newTerraformSource :: Text -> TerraformSource
newTerraformSource Text
pS3StateFileUrl_ =
  TerraformSource' {$sel:s3StateFileUrl:TerraformSource' :: Text
s3StateFileUrl = Text
pS3StateFileUrl_}

-- | The Terraform s3 state file you need to import.
terraformSource_s3StateFileUrl :: Lens.Lens' TerraformSource Prelude.Text
terraformSource_s3StateFileUrl :: Lens' TerraformSource Text
terraformSource_s3StateFileUrl = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\TerraformSource' {Text
s3StateFileUrl :: Text
$sel:s3StateFileUrl:TerraformSource' :: TerraformSource -> Text
s3StateFileUrl} -> Text
s3StateFileUrl) (\s :: TerraformSource
s@TerraformSource' {} Text
a -> TerraformSource
s {$sel:s3StateFileUrl:TerraformSource' :: Text
s3StateFileUrl = Text
a} :: TerraformSource)

instance Data.FromJSON TerraformSource where
  parseJSON :: Value -> Parser TerraformSource
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"TerraformSource"
      ( \Object
x ->
          Text -> TerraformSource
TerraformSource'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser a
Data..: Key
"s3StateFileUrl")
      )

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

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

instance Data.ToJSON TerraformSource where
  toJSON :: TerraformSource -> Value
toJSON TerraformSource' {Text
s3StateFileUrl :: Text
$sel:s3StateFileUrl:TerraformSource' :: TerraformSource -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"s3StateFileUrl" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
s3StateFileUrl)
          ]
      )