{-# 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.ElasticBeanstalk.Types.EnvironmentInfoDescription
-- 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.ElasticBeanstalk.Types.EnvironmentInfoDescription where

import qualified Amazonka.Core as Core
import Amazonka.ElasticBeanstalk.Types.EnvironmentInfoType
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | The information retrieved from the Amazon EC2 instances.
--
-- /See:/ 'newEnvironmentInfoDescription' smart constructor.
data EnvironmentInfoDescription = EnvironmentInfoDescription'
  { -- | The time stamp when this information was retrieved.
    EnvironmentInfoDescription -> Maybe ISO8601
sampleTimestamp :: Prelude.Maybe Core.ISO8601,
    -- | The Amazon EC2 Instance ID for this information.
    EnvironmentInfoDescription -> Maybe Text
ec2InstanceId :: Prelude.Maybe Prelude.Text,
    -- | The type of information retrieved.
    EnvironmentInfoDescription -> Maybe EnvironmentInfoType
infoType :: Prelude.Maybe EnvironmentInfoType,
    -- | The retrieved information. Currently contains a presigned Amazon S3 URL.
    -- The files are deleted after 15 minutes.
    --
    -- Anyone in possession of this URL can access the files before they are
    -- deleted. Make the URL available only to trusted parties.
    EnvironmentInfoDescription -> Maybe Text
message :: Prelude.Maybe Prelude.Text
  }
  deriving (EnvironmentInfoDescription -> EnvironmentInfoDescription -> Bool
(EnvironmentInfoDescription -> EnvironmentInfoDescription -> Bool)
-> (EnvironmentInfoDescription
    -> EnvironmentInfoDescription -> Bool)
-> Eq EnvironmentInfoDescription
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnvironmentInfoDescription -> EnvironmentInfoDescription -> Bool
$c/= :: EnvironmentInfoDescription -> EnvironmentInfoDescription -> Bool
== :: EnvironmentInfoDescription -> EnvironmentInfoDescription -> Bool
$c== :: EnvironmentInfoDescription -> EnvironmentInfoDescription -> Bool
Prelude.Eq, ReadPrec [EnvironmentInfoDescription]
ReadPrec EnvironmentInfoDescription
Int -> ReadS EnvironmentInfoDescription
ReadS [EnvironmentInfoDescription]
(Int -> ReadS EnvironmentInfoDescription)
-> ReadS [EnvironmentInfoDescription]
-> ReadPrec EnvironmentInfoDescription
-> ReadPrec [EnvironmentInfoDescription]
-> Read EnvironmentInfoDescription
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnvironmentInfoDescription]
$creadListPrec :: ReadPrec [EnvironmentInfoDescription]
readPrec :: ReadPrec EnvironmentInfoDescription
$creadPrec :: ReadPrec EnvironmentInfoDescription
readList :: ReadS [EnvironmentInfoDescription]
$creadList :: ReadS [EnvironmentInfoDescription]
readsPrec :: Int -> ReadS EnvironmentInfoDescription
$creadsPrec :: Int -> ReadS EnvironmentInfoDescription
Prelude.Read, Int -> EnvironmentInfoDescription -> ShowS
[EnvironmentInfoDescription] -> ShowS
EnvironmentInfoDescription -> String
(Int -> EnvironmentInfoDescription -> ShowS)
-> (EnvironmentInfoDescription -> String)
-> ([EnvironmentInfoDescription] -> ShowS)
-> Show EnvironmentInfoDescription
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnvironmentInfoDescription] -> ShowS
$cshowList :: [EnvironmentInfoDescription] -> ShowS
show :: EnvironmentInfoDescription -> String
$cshow :: EnvironmentInfoDescription -> String
showsPrec :: Int -> EnvironmentInfoDescription -> ShowS
$cshowsPrec :: Int -> EnvironmentInfoDescription -> ShowS
Prelude.Show, (forall x.
 EnvironmentInfoDescription -> Rep EnvironmentInfoDescription x)
-> (forall x.
    Rep EnvironmentInfoDescription x -> EnvironmentInfoDescription)
-> Generic EnvironmentInfoDescription
forall x.
Rep EnvironmentInfoDescription x -> EnvironmentInfoDescription
forall x.
EnvironmentInfoDescription -> Rep EnvironmentInfoDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EnvironmentInfoDescription x -> EnvironmentInfoDescription
$cfrom :: forall x.
EnvironmentInfoDescription -> Rep EnvironmentInfoDescription x
Prelude.Generic)

-- |
-- Create a value of 'EnvironmentInfoDescription' 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:
--
-- 'sampleTimestamp', 'environmentInfoDescription_sampleTimestamp' - The time stamp when this information was retrieved.
--
-- 'ec2InstanceId', 'environmentInfoDescription_ec2InstanceId' - The Amazon EC2 Instance ID for this information.
--
-- 'infoType', 'environmentInfoDescription_infoType' - The type of information retrieved.
--
-- 'message', 'environmentInfoDescription_message' - The retrieved information. Currently contains a presigned Amazon S3 URL.
-- The files are deleted after 15 minutes.
--
-- Anyone in possession of this URL can access the files before they are
-- deleted. Make the URL available only to trusted parties.
newEnvironmentInfoDescription ::
  EnvironmentInfoDescription
newEnvironmentInfoDescription :: EnvironmentInfoDescription
newEnvironmentInfoDescription =
  EnvironmentInfoDescription' :: Maybe ISO8601
-> Maybe Text
-> Maybe EnvironmentInfoType
-> Maybe Text
-> EnvironmentInfoDescription
EnvironmentInfoDescription'
    { $sel:sampleTimestamp:EnvironmentInfoDescription' :: Maybe ISO8601
sampleTimestamp =
        Maybe ISO8601
forall a. Maybe a
Prelude.Nothing,
      $sel:ec2InstanceId:EnvironmentInfoDescription' :: Maybe Text
ec2InstanceId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:infoType:EnvironmentInfoDescription' :: Maybe EnvironmentInfoType
infoType = Maybe EnvironmentInfoType
forall a. Maybe a
Prelude.Nothing,
      $sel:message:EnvironmentInfoDescription' :: Maybe Text
message = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The time stamp when this information was retrieved.
environmentInfoDescription_sampleTimestamp :: Lens.Lens' EnvironmentInfoDescription (Prelude.Maybe Prelude.UTCTime)
environmentInfoDescription_sampleTimestamp :: (Maybe UTCTime -> f (Maybe UTCTime))
-> EnvironmentInfoDescription -> f EnvironmentInfoDescription
environmentInfoDescription_sampleTimestamp = (EnvironmentInfoDescription -> Maybe ISO8601)
-> (EnvironmentInfoDescription
    -> Maybe ISO8601 -> EnvironmentInfoDescription)
-> Lens
     EnvironmentInfoDescription
     EnvironmentInfoDescription
     (Maybe ISO8601)
     (Maybe ISO8601)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentInfoDescription' {Maybe ISO8601
sampleTimestamp :: Maybe ISO8601
$sel:sampleTimestamp:EnvironmentInfoDescription' :: EnvironmentInfoDescription -> Maybe ISO8601
sampleTimestamp} -> Maybe ISO8601
sampleTimestamp) (\s :: EnvironmentInfoDescription
s@EnvironmentInfoDescription' {} Maybe ISO8601
a -> EnvironmentInfoDescription
s {$sel:sampleTimestamp:EnvironmentInfoDescription' :: Maybe ISO8601
sampleTimestamp = Maybe ISO8601
a} :: EnvironmentInfoDescription) ((Maybe ISO8601 -> f (Maybe ISO8601))
 -> EnvironmentInfoDescription -> f EnvironmentInfoDescription)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe ISO8601 -> f (Maybe ISO8601))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> EnvironmentInfoDescription
-> f EnvironmentInfoDescription
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso ISO8601 ISO8601 UTCTime UTCTime
-> Iso
     (Maybe ISO8601) (Maybe ISO8601) (Maybe UTCTime) (Maybe UTCTime)
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 ISO8601 ISO8601 UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The Amazon EC2 Instance ID for this information.
environmentInfoDescription_ec2InstanceId :: Lens.Lens' EnvironmentInfoDescription (Prelude.Maybe Prelude.Text)
environmentInfoDescription_ec2InstanceId :: (Maybe Text -> f (Maybe Text))
-> EnvironmentInfoDescription -> f EnvironmentInfoDescription
environmentInfoDescription_ec2InstanceId = (EnvironmentInfoDescription -> Maybe Text)
-> (EnvironmentInfoDescription
    -> Maybe Text -> EnvironmentInfoDescription)
-> Lens
     EnvironmentInfoDescription
     EnvironmentInfoDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentInfoDescription' {Maybe Text
ec2InstanceId :: Maybe Text
$sel:ec2InstanceId:EnvironmentInfoDescription' :: EnvironmentInfoDescription -> Maybe Text
ec2InstanceId} -> Maybe Text
ec2InstanceId) (\s :: EnvironmentInfoDescription
s@EnvironmentInfoDescription' {} Maybe Text
a -> EnvironmentInfoDescription
s {$sel:ec2InstanceId:EnvironmentInfoDescription' :: Maybe Text
ec2InstanceId = Maybe Text
a} :: EnvironmentInfoDescription)

-- | The type of information retrieved.
environmentInfoDescription_infoType :: Lens.Lens' EnvironmentInfoDescription (Prelude.Maybe EnvironmentInfoType)
environmentInfoDescription_infoType :: (Maybe EnvironmentInfoType -> f (Maybe EnvironmentInfoType))
-> EnvironmentInfoDescription -> f EnvironmentInfoDescription
environmentInfoDescription_infoType = (EnvironmentInfoDescription -> Maybe EnvironmentInfoType)
-> (EnvironmentInfoDescription
    -> Maybe EnvironmentInfoType -> EnvironmentInfoDescription)
-> Lens
     EnvironmentInfoDescription
     EnvironmentInfoDescription
     (Maybe EnvironmentInfoType)
     (Maybe EnvironmentInfoType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentInfoDescription' {Maybe EnvironmentInfoType
infoType :: Maybe EnvironmentInfoType
$sel:infoType:EnvironmentInfoDescription' :: EnvironmentInfoDescription -> Maybe EnvironmentInfoType
infoType} -> Maybe EnvironmentInfoType
infoType) (\s :: EnvironmentInfoDescription
s@EnvironmentInfoDescription' {} Maybe EnvironmentInfoType
a -> EnvironmentInfoDescription
s {$sel:infoType:EnvironmentInfoDescription' :: Maybe EnvironmentInfoType
infoType = Maybe EnvironmentInfoType
a} :: EnvironmentInfoDescription)

-- | The retrieved information. Currently contains a presigned Amazon S3 URL.
-- The files are deleted after 15 minutes.
--
-- Anyone in possession of this URL can access the files before they are
-- deleted. Make the URL available only to trusted parties.
environmentInfoDescription_message :: Lens.Lens' EnvironmentInfoDescription (Prelude.Maybe Prelude.Text)
environmentInfoDescription_message :: (Maybe Text -> f (Maybe Text))
-> EnvironmentInfoDescription -> f EnvironmentInfoDescription
environmentInfoDescription_message = (EnvironmentInfoDescription -> Maybe Text)
-> (EnvironmentInfoDescription
    -> Maybe Text -> EnvironmentInfoDescription)
-> Lens
     EnvironmentInfoDescription
     EnvironmentInfoDescription
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnvironmentInfoDescription' {Maybe Text
message :: Maybe Text
$sel:message:EnvironmentInfoDescription' :: EnvironmentInfoDescription -> Maybe Text
message} -> Maybe Text
message) (\s :: EnvironmentInfoDescription
s@EnvironmentInfoDescription' {} Maybe Text
a -> EnvironmentInfoDescription
s {$sel:message:EnvironmentInfoDescription' :: Maybe Text
message = Maybe Text
a} :: EnvironmentInfoDescription)

instance Core.FromXML EnvironmentInfoDescription where
  parseXML :: [Node] -> Either String EnvironmentInfoDescription
parseXML [Node]
x =
    Maybe ISO8601
-> Maybe Text
-> Maybe EnvironmentInfoType
-> Maybe Text
-> EnvironmentInfoDescription
EnvironmentInfoDescription'
      (Maybe ISO8601
 -> Maybe Text
 -> Maybe EnvironmentInfoType
 -> Maybe Text
 -> EnvironmentInfoDescription)
-> Either String (Maybe ISO8601)
-> Either
     String
     (Maybe Text
      -> Maybe EnvironmentInfoType
      -> Maybe Text
      -> EnvironmentInfoDescription)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe ISO8601)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"SampleTimestamp")
      Either
  String
  (Maybe Text
   -> Maybe EnvironmentInfoType
   -> Maybe Text
   -> EnvironmentInfoDescription)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe EnvironmentInfoType
      -> Maybe Text -> EnvironmentInfoDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Ec2InstanceId")
      Either
  String
  (Maybe EnvironmentInfoType
   -> Maybe Text -> EnvironmentInfoDescription)
-> Either String (Maybe EnvironmentInfoType)
-> Either String (Maybe Text -> EnvironmentInfoDescription)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe EnvironmentInfoType)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"InfoType")
      Either String (Maybe Text -> EnvironmentInfoDescription)
-> Either String (Maybe Text)
-> Either String EnvironmentInfoDescription
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Message")

instance Prelude.Hashable EnvironmentInfoDescription

instance Prelude.NFData EnvironmentInfoDescription