{-# 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.InstanceAssociationOutputLocation
-- 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.InstanceAssociationOutputLocation where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.SSM.Types.S3OutputLocation

-- | An S3 bucket where you want to store the results of this request.
--
-- For the minimal permissions required to enable Amazon S3 output for an
-- association, see
-- <https://docs.aws.amazon.com/systems-manager/latest/userguide/sysman-state-assoc.html Creating associations>
-- in the /Systems Manager User Guide/.
--
-- /See:/ 'newInstanceAssociationOutputLocation' smart constructor.
data InstanceAssociationOutputLocation = InstanceAssociationOutputLocation'
  { -- | An S3 bucket where you want to store the results of this request.
    InstanceAssociationOutputLocation -> Maybe S3OutputLocation
s3Location :: Prelude.Maybe S3OutputLocation
  }
  deriving (InstanceAssociationOutputLocation
-> InstanceAssociationOutputLocation -> Bool
(InstanceAssociationOutputLocation
 -> InstanceAssociationOutputLocation -> Bool)
-> (InstanceAssociationOutputLocation
    -> InstanceAssociationOutputLocation -> Bool)
-> Eq InstanceAssociationOutputLocation
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceAssociationOutputLocation
-> InstanceAssociationOutputLocation -> Bool
$c/= :: InstanceAssociationOutputLocation
-> InstanceAssociationOutputLocation -> Bool
== :: InstanceAssociationOutputLocation
-> InstanceAssociationOutputLocation -> Bool
$c== :: InstanceAssociationOutputLocation
-> InstanceAssociationOutputLocation -> Bool
Prelude.Eq, ReadPrec [InstanceAssociationOutputLocation]
ReadPrec InstanceAssociationOutputLocation
Int -> ReadS InstanceAssociationOutputLocation
ReadS [InstanceAssociationOutputLocation]
(Int -> ReadS InstanceAssociationOutputLocation)
-> ReadS [InstanceAssociationOutputLocation]
-> ReadPrec InstanceAssociationOutputLocation
-> ReadPrec [InstanceAssociationOutputLocation]
-> Read InstanceAssociationOutputLocation
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceAssociationOutputLocation]
$creadListPrec :: ReadPrec [InstanceAssociationOutputLocation]
readPrec :: ReadPrec InstanceAssociationOutputLocation
$creadPrec :: ReadPrec InstanceAssociationOutputLocation
readList :: ReadS [InstanceAssociationOutputLocation]
$creadList :: ReadS [InstanceAssociationOutputLocation]
readsPrec :: Int -> ReadS InstanceAssociationOutputLocation
$creadsPrec :: Int -> ReadS InstanceAssociationOutputLocation
Prelude.Read, Int -> InstanceAssociationOutputLocation -> ShowS
[InstanceAssociationOutputLocation] -> ShowS
InstanceAssociationOutputLocation -> String
(Int -> InstanceAssociationOutputLocation -> ShowS)
-> (InstanceAssociationOutputLocation -> String)
-> ([InstanceAssociationOutputLocation] -> ShowS)
-> Show InstanceAssociationOutputLocation
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceAssociationOutputLocation] -> ShowS
$cshowList :: [InstanceAssociationOutputLocation] -> ShowS
show :: InstanceAssociationOutputLocation -> String
$cshow :: InstanceAssociationOutputLocation -> String
showsPrec :: Int -> InstanceAssociationOutputLocation -> ShowS
$cshowsPrec :: Int -> InstanceAssociationOutputLocation -> ShowS
Prelude.Show, (forall x.
 InstanceAssociationOutputLocation
 -> Rep InstanceAssociationOutputLocation x)
-> (forall x.
    Rep InstanceAssociationOutputLocation x
    -> InstanceAssociationOutputLocation)
-> Generic InstanceAssociationOutputLocation
forall x.
Rep InstanceAssociationOutputLocation x
-> InstanceAssociationOutputLocation
forall x.
InstanceAssociationOutputLocation
-> Rep InstanceAssociationOutputLocation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep InstanceAssociationOutputLocation x
-> InstanceAssociationOutputLocation
$cfrom :: forall x.
InstanceAssociationOutputLocation
-> Rep InstanceAssociationOutputLocation x
Prelude.Generic)

-- |
-- Create a value of 'InstanceAssociationOutputLocation' 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', 'instanceAssociationOutputLocation_s3Location' - An S3 bucket where you want to store the results of this request.
newInstanceAssociationOutputLocation ::
  InstanceAssociationOutputLocation
newInstanceAssociationOutputLocation :: InstanceAssociationOutputLocation
newInstanceAssociationOutputLocation =
  InstanceAssociationOutputLocation' :: Maybe S3OutputLocation -> InstanceAssociationOutputLocation
InstanceAssociationOutputLocation'
    { $sel:s3Location:InstanceAssociationOutputLocation' :: Maybe S3OutputLocation
s3Location =
        Maybe S3OutputLocation
forall a. Maybe a
Prelude.Nothing
    }

-- | An S3 bucket where you want to store the results of this request.
instanceAssociationOutputLocation_s3Location :: Lens.Lens' InstanceAssociationOutputLocation (Prelude.Maybe S3OutputLocation)
instanceAssociationOutputLocation_s3Location :: (Maybe S3OutputLocation -> f (Maybe S3OutputLocation))
-> InstanceAssociationOutputLocation
-> f InstanceAssociationOutputLocation
instanceAssociationOutputLocation_s3Location = (InstanceAssociationOutputLocation -> Maybe S3OutputLocation)
-> (InstanceAssociationOutputLocation
    -> Maybe S3OutputLocation -> InstanceAssociationOutputLocation)
-> Lens
     InstanceAssociationOutputLocation
     InstanceAssociationOutputLocation
     (Maybe S3OutputLocation)
     (Maybe S3OutputLocation)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceAssociationOutputLocation' {Maybe S3OutputLocation
s3Location :: Maybe S3OutputLocation
$sel:s3Location:InstanceAssociationOutputLocation' :: InstanceAssociationOutputLocation -> Maybe S3OutputLocation
s3Location} -> Maybe S3OutputLocation
s3Location) (\s :: InstanceAssociationOutputLocation
s@InstanceAssociationOutputLocation' {} Maybe S3OutputLocation
a -> InstanceAssociationOutputLocation
s {$sel:s3Location:InstanceAssociationOutputLocation' :: Maybe S3OutputLocation
s3Location = Maybe S3OutputLocation
a} :: InstanceAssociationOutputLocation)

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

instance
  Prelude.Hashable
    InstanceAssociationOutputLocation

instance
  Prelude.NFData
    InstanceAssociationOutputLocation

instance
  Core.ToJSON
    InstanceAssociationOutputLocation
  where
  toJSON :: InstanceAssociationOutputLocation -> Value
toJSON InstanceAssociationOutputLocation' {Maybe S3OutputLocation
s3Location :: Maybe S3OutputLocation
$sel:s3Location:InstanceAssociationOutputLocation' :: InstanceAssociationOutputLocation -> Maybe S3OutputLocation
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [(Text
"S3Location" Text -> S3OutputLocation -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (S3OutputLocation -> Pair) -> Maybe S3OutputLocation -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe S3OutputLocation
s3Location]
      )