{-# 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.SageMaker.Types.CaptureContentTypeHeader
-- 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.SageMaker.Types.CaptureContentTypeHeader where

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

-- |
--
-- /See:/ 'newCaptureContentTypeHeader' smart constructor.
data CaptureContentTypeHeader = CaptureContentTypeHeader'
  { CaptureContentTypeHeader -> Maybe (NonEmpty Text)
csvContentTypes :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text),
    CaptureContentTypeHeader -> Maybe (NonEmpty Text)
jsonContentTypes :: Prelude.Maybe (Prelude.NonEmpty Prelude.Text)
  }
  deriving (CaptureContentTypeHeader -> CaptureContentTypeHeader -> Bool
(CaptureContentTypeHeader -> CaptureContentTypeHeader -> Bool)
-> (CaptureContentTypeHeader -> CaptureContentTypeHeader -> Bool)
-> Eq CaptureContentTypeHeader
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CaptureContentTypeHeader -> CaptureContentTypeHeader -> Bool
$c/= :: CaptureContentTypeHeader -> CaptureContentTypeHeader -> Bool
== :: CaptureContentTypeHeader -> CaptureContentTypeHeader -> Bool
$c== :: CaptureContentTypeHeader -> CaptureContentTypeHeader -> Bool
Prelude.Eq, ReadPrec [CaptureContentTypeHeader]
ReadPrec CaptureContentTypeHeader
Int -> ReadS CaptureContentTypeHeader
ReadS [CaptureContentTypeHeader]
(Int -> ReadS CaptureContentTypeHeader)
-> ReadS [CaptureContentTypeHeader]
-> ReadPrec CaptureContentTypeHeader
-> ReadPrec [CaptureContentTypeHeader]
-> Read CaptureContentTypeHeader
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CaptureContentTypeHeader]
$creadListPrec :: ReadPrec [CaptureContentTypeHeader]
readPrec :: ReadPrec CaptureContentTypeHeader
$creadPrec :: ReadPrec CaptureContentTypeHeader
readList :: ReadS [CaptureContentTypeHeader]
$creadList :: ReadS [CaptureContentTypeHeader]
readsPrec :: Int -> ReadS CaptureContentTypeHeader
$creadsPrec :: Int -> ReadS CaptureContentTypeHeader
Prelude.Read, Int -> CaptureContentTypeHeader -> ShowS
[CaptureContentTypeHeader] -> ShowS
CaptureContentTypeHeader -> String
(Int -> CaptureContentTypeHeader -> ShowS)
-> (CaptureContentTypeHeader -> String)
-> ([CaptureContentTypeHeader] -> ShowS)
-> Show CaptureContentTypeHeader
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CaptureContentTypeHeader] -> ShowS
$cshowList :: [CaptureContentTypeHeader] -> ShowS
show :: CaptureContentTypeHeader -> String
$cshow :: CaptureContentTypeHeader -> String
showsPrec :: Int -> CaptureContentTypeHeader -> ShowS
$cshowsPrec :: Int -> CaptureContentTypeHeader -> ShowS
Prelude.Show, (forall x.
 CaptureContentTypeHeader -> Rep CaptureContentTypeHeader x)
-> (forall x.
    Rep CaptureContentTypeHeader x -> CaptureContentTypeHeader)
-> Generic CaptureContentTypeHeader
forall x.
Rep CaptureContentTypeHeader x -> CaptureContentTypeHeader
forall x.
CaptureContentTypeHeader -> Rep CaptureContentTypeHeader x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CaptureContentTypeHeader x -> CaptureContentTypeHeader
$cfrom :: forall x.
CaptureContentTypeHeader -> Rep CaptureContentTypeHeader x
Prelude.Generic)

-- |
-- Create a value of 'CaptureContentTypeHeader' 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:
--
-- 'csvContentTypes', 'captureContentTypeHeader_csvContentTypes' -
--
-- 'jsonContentTypes', 'captureContentTypeHeader_jsonContentTypes' -
newCaptureContentTypeHeader ::
  CaptureContentTypeHeader
newCaptureContentTypeHeader :: CaptureContentTypeHeader
newCaptureContentTypeHeader =
  CaptureContentTypeHeader' :: Maybe (NonEmpty Text)
-> Maybe (NonEmpty Text) -> CaptureContentTypeHeader
CaptureContentTypeHeader'
    { $sel:csvContentTypes:CaptureContentTypeHeader' :: Maybe (NonEmpty Text)
csvContentTypes =
        Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing,
      $sel:jsonContentTypes:CaptureContentTypeHeader' :: Maybe (NonEmpty Text)
jsonContentTypes = Maybe (NonEmpty Text)
forall a. Maybe a
Prelude.Nothing
    }

-- |
captureContentTypeHeader_csvContentTypes :: Lens.Lens' CaptureContentTypeHeader (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
captureContentTypeHeader_csvContentTypes :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CaptureContentTypeHeader -> f CaptureContentTypeHeader
captureContentTypeHeader_csvContentTypes = (CaptureContentTypeHeader -> Maybe (NonEmpty Text))
-> (CaptureContentTypeHeader
    -> Maybe (NonEmpty Text) -> CaptureContentTypeHeader)
-> Lens
     CaptureContentTypeHeader
     CaptureContentTypeHeader
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptureContentTypeHeader' {Maybe (NonEmpty Text)
csvContentTypes :: Maybe (NonEmpty Text)
$sel:csvContentTypes:CaptureContentTypeHeader' :: CaptureContentTypeHeader -> Maybe (NonEmpty Text)
csvContentTypes} -> Maybe (NonEmpty Text)
csvContentTypes) (\s :: CaptureContentTypeHeader
s@CaptureContentTypeHeader' {} Maybe (NonEmpty Text)
a -> CaptureContentTypeHeader
s {$sel:csvContentTypes:CaptureContentTypeHeader' :: Maybe (NonEmpty Text)
csvContentTypes = Maybe (NonEmpty Text)
a} :: CaptureContentTypeHeader) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> CaptureContentTypeHeader -> f CaptureContentTypeHeader)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CaptureContentTypeHeader
-> f CaptureContentTypeHeader
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- |
captureContentTypeHeader_jsonContentTypes :: Lens.Lens' CaptureContentTypeHeader (Prelude.Maybe (Prelude.NonEmpty Prelude.Text))
captureContentTypeHeader_jsonContentTypes :: (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CaptureContentTypeHeader -> f CaptureContentTypeHeader
captureContentTypeHeader_jsonContentTypes = (CaptureContentTypeHeader -> Maybe (NonEmpty Text))
-> (CaptureContentTypeHeader
    -> Maybe (NonEmpty Text) -> CaptureContentTypeHeader)
-> Lens
     CaptureContentTypeHeader
     CaptureContentTypeHeader
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CaptureContentTypeHeader' {Maybe (NonEmpty Text)
jsonContentTypes :: Maybe (NonEmpty Text)
$sel:jsonContentTypes:CaptureContentTypeHeader' :: CaptureContentTypeHeader -> Maybe (NonEmpty Text)
jsonContentTypes} -> Maybe (NonEmpty Text)
jsonContentTypes) (\s :: CaptureContentTypeHeader
s@CaptureContentTypeHeader' {} Maybe (NonEmpty Text)
a -> CaptureContentTypeHeader
s {$sel:jsonContentTypes:CaptureContentTypeHeader' :: Maybe (NonEmpty Text)
jsonContentTypes = Maybe (NonEmpty Text)
a} :: CaptureContentTypeHeader) ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
 -> CaptureContentTypeHeader -> f CaptureContentTypeHeader)
-> ((Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
    -> Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> (Maybe (NonEmpty Text) -> f (Maybe (NonEmpty Text)))
-> CaptureContentTypeHeader
-> f CaptureContentTypeHeader
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
-> Iso
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
     (Maybe (NonEmpty Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (NonEmpty Text) (NonEmpty Text) (NonEmpty Text) (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance Prelude.Hashable CaptureContentTypeHeader

instance Prelude.NFData CaptureContentTypeHeader

instance Core.ToJSON CaptureContentTypeHeader where
  toJSON :: CaptureContentTypeHeader -> Value
toJSON CaptureContentTypeHeader' {Maybe (NonEmpty Text)
jsonContentTypes :: Maybe (NonEmpty Text)
csvContentTypes :: Maybe (NonEmpty Text)
$sel:jsonContentTypes:CaptureContentTypeHeader' :: CaptureContentTypeHeader -> Maybe (NonEmpty Text)
$sel:csvContentTypes:CaptureContentTypeHeader' :: CaptureContentTypeHeader -> Maybe (NonEmpty Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"CsvContentTypes" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
csvContentTypes,
            (Text
"JsonContentTypes" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (NonEmpty Text -> Pair) -> Maybe (NonEmpty Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Text)
jsonContentTypes
          ]
      )