{-# 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.EMRContainers.Types.Certificate
-- 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.EMRContainers.Types.Certificate 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 entity representing certificate data generated for managed endpoint.
--
-- /See:/ 'newCertificate' smart constructor.
data Certificate = Certificate'
  { -- | The ARN of the certificate generated for managed endpoint.
    Certificate -> Maybe Text
certificateArn :: Prelude.Maybe Prelude.Text,
    -- | The base64 encoded PEM certificate data generated for managed endpoint.
    Certificate -> Maybe Text
certificateData :: Prelude.Maybe Prelude.Text
  }
  deriving (Certificate -> Certificate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Certificate -> Certificate -> Bool
$c/= :: Certificate -> Certificate -> Bool
== :: Certificate -> Certificate -> Bool
$c== :: Certificate -> Certificate -> Bool
Prelude.Eq, ReadPrec [Certificate]
ReadPrec Certificate
Int -> ReadS Certificate
ReadS [Certificate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Certificate]
$creadListPrec :: ReadPrec [Certificate]
readPrec :: ReadPrec Certificate
$creadPrec :: ReadPrec Certificate
readList :: ReadS [Certificate]
$creadList :: ReadS [Certificate]
readsPrec :: Int -> ReadS Certificate
$creadsPrec :: Int -> ReadS Certificate
Prelude.Read, Int -> Certificate -> ShowS
[Certificate] -> ShowS
Certificate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Certificate] -> ShowS
$cshowList :: [Certificate] -> ShowS
show :: Certificate -> String
$cshow :: Certificate -> String
showsPrec :: Int -> Certificate -> ShowS
$cshowsPrec :: Int -> Certificate -> ShowS
Prelude.Show, forall x. Rep Certificate x -> Certificate
forall x. Certificate -> Rep Certificate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Certificate x -> Certificate
$cfrom :: forall x. Certificate -> Rep Certificate x
Prelude.Generic)

-- |
-- Create a value of 'Certificate' 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:
--
-- 'certificateArn', 'certificate_certificateArn' - The ARN of the certificate generated for managed endpoint.
--
-- 'certificateData', 'certificate_certificateData' - The base64 encoded PEM certificate data generated for managed endpoint.
newCertificate ::
  Certificate
newCertificate :: Certificate
newCertificate =
  Certificate'
    { $sel:certificateArn:Certificate' :: Maybe Text
certificateArn = forall a. Maybe a
Prelude.Nothing,
      $sel:certificateData:Certificate' :: Maybe Text
certificateData = forall a. Maybe a
Prelude.Nothing
    }

-- | The ARN of the certificate generated for managed endpoint.
certificate_certificateArn :: Lens.Lens' Certificate (Prelude.Maybe Prelude.Text)
certificate_certificateArn :: Lens' Certificate (Maybe Text)
certificate_certificateArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Certificate' {Maybe Text
certificateArn :: Maybe Text
$sel:certificateArn:Certificate' :: Certificate -> Maybe Text
certificateArn} -> Maybe Text
certificateArn) (\s :: Certificate
s@Certificate' {} Maybe Text
a -> Certificate
s {$sel:certificateArn:Certificate' :: Maybe Text
certificateArn = Maybe Text
a} :: Certificate)

-- | The base64 encoded PEM certificate data generated for managed endpoint.
certificate_certificateData :: Lens.Lens' Certificate (Prelude.Maybe Prelude.Text)
certificate_certificateData :: Lens' Certificate (Maybe Text)
certificate_certificateData = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Certificate' {Maybe Text
certificateData :: Maybe Text
$sel:certificateData:Certificate' :: Certificate -> Maybe Text
certificateData} -> Maybe Text
certificateData) (\s :: Certificate
s@Certificate' {} Maybe Text
a -> Certificate
s {$sel:certificateData:Certificate' :: Maybe Text
certificateData = Maybe Text
a} :: Certificate)

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

instance Prelude.Hashable Certificate where
  hashWithSalt :: Int -> Certificate -> Int
hashWithSalt Int
_salt Certificate' {Maybe Text
certificateData :: Maybe Text
certificateArn :: Maybe Text
$sel:certificateData:Certificate' :: Certificate -> Maybe Text
$sel:certificateArn:Certificate' :: Certificate -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
certificateArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
certificateData

instance Prelude.NFData Certificate where
  rnf :: Certificate -> ()
rnf Certificate' {Maybe Text
certificateData :: Maybe Text
certificateArn :: Maybe Text
$sel:certificateData:Certificate' :: Certificate -> Maybe Text
$sel:certificateArn:Certificate' :: Certificate -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
certificateArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
certificateData