{-# 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.GroundStation.Types.S3RecordingConfig
-- 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.GroundStation.Types.S3RecordingConfig where

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

-- | Information about an S3 recording @Config@.
--
-- /See:/ 'newS3RecordingConfig' smart constructor.
data S3RecordingConfig = S3RecordingConfig'
  { -- | S3 Key prefix to prefice data files.
    S3RecordingConfig -> Maybe Text
prefix :: Prelude.Maybe Prelude.Text,
    -- | ARN of the bucket to record to.
    S3RecordingConfig -> Text
bucketArn :: Prelude.Text,
    -- | ARN of the role Ground Station assumes to write data to the bucket.
    S3RecordingConfig -> Text
roleArn :: Prelude.Text
  }
  deriving (S3RecordingConfig -> S3RecordingConfig -> Bool
(S3RecordingConfig -> S3RecordingConfig -> Bool)
-> (S3RecordingConfig -> S3RecordingConfig -> Bool)
-> Eq S3RecordingConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: S3RecordingConfig -> S3RecordingConfig -> Bool
$c/= :: S3RecordingConfig -> S3RecordingConfig -> Bool
== :: S3RecordingConfig -> S3RecordingConfig -> Bool
$c== :: S3RecordingConfig -> S3RecordingConfig -> Bool
Prelude.Eq, ReadPrec [S3RecordingConfig]
ReadPrec S3RecordingConfig
Int -> ReadS S3RecordingConfig
ReadS [S3RecordingConfig]
(Int -> ReadS S3RecordingConfig)
-> ReadS [S3RecordingConfig]
-> ReadPrec S3RecordingConfig
-> ReadPrec [S3RecordingConfig]
-> Read S3RecordingConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [S3RecordingConfig]
$creadListPrec :: ReadPrec [S3RecordingConfig]
readPrec :: ReadPrec S3RecordingConfig
$creadPrec :: ReadPrec S3RecordingConfig
readList :: ReadS [S3RecordingConfig]
$creadList :: ReadS [S3RecordingConfig]
readsPrec :: Int -> ReadS S3RecordingConfig
$creadsPrec :: Int -> ReadS S3RecordingConfig
Prelude.Read, Int -> S3RecordingConfig -> ShowS
[S3RecordingConfig] -> ShowS
S3RecordingConfig -> String
(Int -> S3RecordingConfig -> ShowS)
-> (S3RecordingConfig -> String)
-> ([S3RecordingConfig] -> ShowS)
-> Show S3RecordingConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [S3RecordingConfig] -> ShowS
$cshowList :: [S3RecordingConfig] -> ShowS
show :: S3RecordingConfig -> String
$cshow :: S3RecordingConfig -> String
showsPrec :: Int -> S3RecordingConfig -> ShowS
$cshowsPrec :: Int -> S3RecordingConfig -> ShowS
Prelude.Show, (forall x. S3RecordingConfig -> Rep S3RecordingConfig x)
-> (forall x. Rep S3RecordingConfig x -> S3RecordingConfig)
-> Generic S3RecordingConfig
forall x. Rep S3RecordingConfig x -> S3RecordingConfig
forall x. S3RecordingConfig -> Rep S3RecordingConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep S3RecordingConfig x -> S3RecordingConfig
$cfrom :: forall x. S3RecordingConfig -> Rep S3RecordingConfig x
Prelude.Generic)

-- |
-- Create a value of 'S3RecordingConfig' 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:
--
-- 'prefix', 's3RecordingConfig_prefix' - S3 Key prefix to prefice data files.
--
-- 'bucketArn', 's3RecordingConfig_bucketArn' - ARN of the bucket to record to.
--
-- 'roleArn', 's3RecordingConfig_roleArn' - ARN of the role Ground Station assumes to write data to the bucket.
newS3RecordingConfig ::
  -- | 'bucketArn'
  Prelude.Text ->
  -- | 'roleArn'
  Prelude.Text ->
  S3RecordingConfig
newS3RecordingConfig :: Text -> Text -> S3RecordingConfig
newS3RecordingConfig Text
pBucketArn_ Text
pRoleArn_ =
  S3RecordingConfig' :: Maybe Text -> Text -> Text -> S3RecordingConfig
S3RecordingConfig'
    { $sel:prefix:S3RecordingConfig' :: Maybe Text
prefix = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:bucketArn:S3RecordingConfig' :: Text
bucketArn = Text
pBucketArn_,
      $sel:roleArn:S3RecordingConfig' :: Text
roleArn = Text
pRoleArn_
    }

-- | S3 Key prefix to prefice data files.
s3RecordingConfig_prefix :: Lens.Lens' S3RecordingConfig (Prelude.Maybe Prelude.Text)
s3RecordingConfig_prefix :: (Maybe Text -> f (Maybe Text))
-> S3RecordingConfig -> f S3RecordingConfig
s3RecordingConfig_prefix = (S3RecordingConfig -> Maybe Text)
-> (S3RecordingConfig -> Maybe Text -> S3RecordingConfig)
-> Lens
     S3RecordingConfig S3RecordingConfig (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3RecordingConfig' {Maybe Text
prefix :: Maybe Text
$sel:prefix:S3RecordingConfig' :: S3RecordingConfig -> Maybe Text
prefix} -> Maybe Text
prefix) (\s :: S3RecordingConfig
s@S3RecordingConfig' {} Maybe Text
a -> S3RecordingConfig
s {$sel:prefix:S3RecordingConfig' :: Maybe Text
prefix = Maybe Text
a} :: S3RecordingConfig)

-- | ARN of the bucket to record to.
s3RecordingConfig_bucketArn :: Lens.Lens' S3RecordingConfig Prelude.Text
s3RecordingConfig_bucketArn :: (Text -> f Text) -> S3RecordingConfig -> f S3RecordingConfig
s3RecordingConfig_bucketArn = (S3RecordingConfig -> Text)
-> (S3RecordingConfig -> Text -> S3RecordingConfig)
-> Lens S3RecordingConfig S3RecordingConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3RecordingConfig' {Text
bucketArn :: Text
$sel:bucketArn:S3RecordingConfig' :: S3RecordingConfig -> Text
bucketArn} -> Text
bucketArn) (\s :: S3RecordingConfig
s@S3RecordingConfig' {} Text
a -> S3RecordingConfig
s {$sel:bucketArn:S3RecordingConfig' :: Text
bucketArn = Text
a} :: S3RecordingConfig)

-- | ARN of the role Ground Station assumes to write data to the bucket.
s3RecordingConfig_roleArn :: Lens.Lens' S3RecordingConfig Prelude.Text
s3RecordingConfig_roleArn :: (Text -> f Text) -> S3RecordingConfig -> f S3RecordingConfig
s3RecordingConfig_roleArn = (S3RecordingConfig -> Text)
-> (S3RecordingConfig -> Text -> S3RecordingConfig)
-> Lens S3RecordingConfig S3RecordingConfig Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\S3RecordingConfig' {Text
roleArn :: Text
$sel:roleArn:S3RecordingConfig' :: S3RecordingConfig -> Text
roleArn} -> Text
roleArn) (\s :: S3RecordingConfig
s@S3RecordingConfig' {} Text
a -> S3RecordingConfig
s {$sel:roleArn:S3RecordingConfig' :: Text
roleArn = Text
a} :: S3RecordingConfig)

instance Core.FromJSON S3RecordingConfig where
  parseJSON :: Value -> Parser S3RecordingConfig
parseJSON =
    String
-> (Object -> Parser S3RecordingConfig)
-> Value
-> Parser S3RecordingConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"S3RecordingConfig"
      ( \Object
x ->
          Maybe Text -> Text -> Text -> S3RecordingConfig
S3RecordingConfig'
            (Maybe Text -> Text -> Text -> S3RecordingConfig)
-> Parser (Maybe Text)
-> Parser (Text -> Text -> S3RecordingConfig)
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
"prefix")
            Parser (Text -> Text -> S3RecordingConfig)
-> Parser Text -> Parser (Text -> S3RecordingConfig)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"bucketArn")
            Parser (Text -> S3RecordingConfig)
-> Parser Text -> Parser S3RecordingConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"roleArn")
      )

instance Prelude.Hashable S3RecordingConfig

instance Prelude.NFData S3RecordingConfig

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