{-# 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.SSM.Types.OutputSource
-- 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.SSM.Types.OutputSource where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about the source where the association execution details are
-- stored.
--
-- /See:/ 'newOutputSource' smart constructor.
data OutputSource = OutputSource'
  { -- | The ID of the output source, for example the URL of an S3 bucket.
    OutputSource -> Maybe Text
outputSourceId :: Prelude.Maybe Prelude.Text,
    -- | The type of source where the association execution details are stored,
    -- for example, Amazon S3.
    OutputSource -> Maybe Text
outputSourceType :: Prelude.Maybe Prelude.Text
  }
  deriving (OutputSource -> OutputSource -> Bool
(OutputSource -> OutputSource -> Bool)
-> (OutputSource -> OutputSource -> Bool) -> Eq OutputSource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: OutputSource -> OutputSource -> Bool
$c/= :: OutputSource -> OutputSource -> Bool
== :: OutputSource -> OutputSource -> Bool
$c== :: OutputSource -> OutputSource -> Bool
Prelude.Eq, ReadPrec [OutputSource]
ReadPrec OutputSource
Int -> ReadS OutputSource
ReadS [OutputSource]
(Int -> ReadS OutputSource)
-> ReadS [OutputSource]
-> ReadPrec OutputSource
-> ReadPrec [OutputSource]
-> Read OutputSource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [OutputSource]
$creadListPrec :: ReadPrec [OutputSource]
readPrec :: ReadPrec OutputSource
$creadPrec :: ReadPrec OutputSource
readList :: ReadS [OutputSource]
$creadList :: ReadS [OutputSource]
readsPrec :: Int -> ReadS OutputSource
$creadsPrec :: Int -> ReadS OutputSource
Prelude.Read, Int -> OutputSource -> ShowS
[OutputSource] -> ShowS
OutputSource -> String
(Int -> OutputSource -> ShowS)
-> (OutputSource -> String)
-> ([OutputSource] -> ShowS)
-> Show OutputSource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [OutputSource] -> ShowS
$cshowList :: [OutputSource] -> ShowS
show :: OutputSource -> String
$cshow :: OutputSource -> String
showsPrec :: Int -> OutputSource -> ShowS
$cshowsPrec :: Int -> OutputSource -> ShowS
Prelude.Show, (forall x. OutputSource -> Rep OutputSource x)
-> (forall x. Rep OutputSource x -> OutputSource)
-> Generic OutputSource
forall x. Rep OutputSource x -> OutputSource
forall x. OutputSource -> Rep OutputSource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep OutputSource x -> OutputSource
$cfrom :: forall x. OutputSource -> Rep OutputSource x
Prelude.Generic)

-- |
-- Create a value of 'OutputSource' 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:
--
-- 'outputSourceId', 'outputSource_outputSourceId' - The ID of the output source, for example the URL of an S3 bucket.
--
-- 'outputSourceType', 'outputSource_outputSourceType' - The type of source where the association execution details are stored,
-- for example, Amazon S3.
newOutputSource ::
  OutputSource
newOutputSource :: OutputSource
newOutputSource =
  OutputSource' :: Maybe Text -> Maybe Text -> OutputSource
OutputSource'
    { $sel:outputSourceId:OutputSource' :: Maybe Text
outputSourceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:outputSourceType:OutputSource' :: Maybe Text
outputSourceType = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the output source, for example the URL of an S3 bucket.
outputSource_outputSourceId :: Lens.Lens' OutputSource (Prelude.Maybe Prelude.Text)
outputSource_outputSourceId :: (Maybe Text -> f (Maybe Text)) -> OutputSource -> f OutputSource
outputSource_outputSourceId = (OutputSource -> Maybe Text)
-> (OutputSource -> Maybe Text -> OutputSource)
-> Lens OutputSource OutputSource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputSource' {Maybe Text
outputSourceId :: Maybe Text
$sel:outputSourceId:OutputSource' :: OutputSource -> Maybe Text
outputSourceId} -> Maybe Text
outputSourceId) (\s :: OutputSource
s@OutputSource' {} Maybe Text
a -> OutputSource
s {$sel:outputSourceId:OutputSource' :: Maybe Text
outputSourceId = Maybe Text
a} :: OutputSource)

-- | The type of source where the association execution details are stored,
-- for example, Amazon S3.
outputSource_outputSourceType :: Lens.Lens' OutputSource (Prelude.Maybe Prelude.Text)
outputSource_outputSourceType :: (Maybe Text -> f (Maybe Text)) -> OutputSource -> f OutputSource
outputSource_outputSourceType = (OutputSource -> Maybe Text)
-> (OutputSource -> Maybe Text -> OutputSource)
-> Lens OutputSource OutputSource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\OutputSource' {Maybe Text
outputSourceType :: Maybe Text
$sel:outputSourceType:OutputSource' :: OutputSource -> Maybe Text
outputSourceType} -> Maybe Text
outputSourceType) (\s :: OutputSource
s@OutputSource' {} Maybe Text
a -> OutputSource
s {$sel:outputSourceType:OutputSource' :: Maybe Text
outputSourceType = Maybe Text
a} :: OutputSource)

instance Core.FromJSON OutputSource where
  parseJSON :: Value -> Parser OutputSource
parseJSON =
    String
-> (Object -> Parser OutputSource) -> Value -> Parser OutputSource
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"OutputSource"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> OutputSource
OutputSource'
            (Maybe Text -> Maybe Text -> OutputSource)
-> Parser (Maybe Text) -> Parser (Maybe Text -> OutputSource)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OutputSourceId")
            Parser (Maybe Text -> OutputSource)
-> Parser (Maybe Text) -> Parser OutputSource
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OutputSourceType")
      )

instance Prelude.Hashable OutputSource

instance Prelude.NFData OutputSource