{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.EFS.DescribeLifecycleConfiguration
-- 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)
--
-- Returns the current @LifecycleConfiguration@ object for the specified
-- Amazon EFS file system. EFS lifecycle management uses the
-- @LifecycleConfiguration@ object to identify which files to move to the
-- EFS Infrequent Access (IA) storage class. For a file system without a
-- @LifecycleConfiguration@ object, the call returns an empty array in the
-- response.
--
-- When EFS Intelligent Tiering is enabled,
-- @TransitionToPrimaryStorageClass@ has a value of @AFTER_1_ACCESS@.
--
-- This operation requires permissions for the
-- @elasticfilesystem:DescribeLifecycleConfiguration@ operation.
module Amazonka.EFS.DescribeLifecycleConfiguration
  ( -- * Creating a Request
    DescribeLifecycleConfiguration (..),
    newDescribeLifecycleConfiguration,

    -- * Request Lenses
    describeLifecycleConfiguration_fileSystemId,

    -- * Destructuring the Response
    LifecycleConfigurationDescription (..),
    newLifecycleConfigurationDescription,

    -- * Response Lenses
    lifecycleConfigurationDescription_lifecyclePolicies,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.EFS.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newDescribeLifecycleConfiguration' smart constructor.
data DescribeLifecycleConfiguration = DescribeLifecycleConfiguration'
  { -- | The ID of the file system whose @LifecycleConfiguration@ object you want
    -- to retrieve (String).
    DescribeLifecycleConfiguration -> Text
fileSystemId :: Prelude.Text
  }
  deriving (DescribeLifecycleConfiguration
-> DescribeLifecycleConfiguration -> Bool
(DescribeLifecycleConfiguration
 -> DescribeLifecycleConfiguration -> Bool)
-> (DescribeLifecycleConfiguration
    -> DescribeLifecycleConfiguration -> Bool)
-> Eq DescribeLifecycleConfiguration
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DescribeLifecycleConfiguration
-> DescribeLifecycleConfiguration -> Bool
$c/= :: DescribeLifecycleConfiguration
-> DescribeLifecycleConfiguration -> Bool
== :: DescribeLifecycleConfiguration
-> DescribeLifecycleConfiguration -> Bool
$c== :: DescribeLifecycleConfiguration
-> DescribeLifecycleConfiguration -> Bool
Prelude.Eq, ReadPrec [DescribeLifecycleConfiguration]
ReadPrec DescribeLifecycleConfiguration
Int -> ReadS DescribeLifecycleConfiguration
ReadS [DescribeLifecycleConfiguration]
(Int -> ReadS DescribeLifecycleConfiguration)
-> ReadS [DescribeLifecycleConfiguration]
-> ReadPrec DescribeLifecycleConfiguration
-> ReadPrec [DescribeLifecycleConfiguration]
-> Read DescribeLifecycleConfiguration
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DescribeLifecycleConfiguration]
$creadListPrec :: ReadPrec [DescribeLifecycleConfiguration]
readPrec :: ReadPrec DescribeLifecycleConfiguration
$creadPrec :: ReadPrec DescribeLifecycleConfiguration
readList :: ReadS [DescribeLifecycleConfiguration]
$creadList :: ReadS [DescribeLifecycleConfiguration]
readsPrec :: Int -> ReadS DescribeLifecycleConfiguration
$creadsPrec :: Int -> ReadS DescribeLifecycleConfiguration
Prelude.Read, Int -> DescribeLifecycleConfiguration -> ShowS
[DescribeLifecycleConfiguration] -> ShowS
DescribeLifecycleConfiguration -> String
(Int -> DescribeLifecycleConfiguration -> ShowS)
-> (DescribeLifecycleConfiguration -> String)
-> ([DescribeLifecycleConfiguration] -> ShowS)
-> Show DescribeLifecycleConfiguration
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DescribeLifecycleConfiguration] -> ShowS
$cshowList :: [DescribeLifecycleConfiguration] -> ShowS
show :: DescribeLifecycleConfiguration -> String
$cshow :: DescribeLifecycleConfiguration -> String
showsPrec :: Int -> DescribeLifecycleConfiguration -> ShowS
$cshowsPrec :: Int -> DescribeLifecycleConfiguration -> ShowS
Prelude.Show, (forall x.
 DescribeLifecycleConfiguration
 -> Rep DescribeLifecycleConfiguration x)
-> (forall x.
    Rep DescribeLifecycleConfiguration x
    -> DescribeLifecycleConfiguration)
-> Generic DescribeLifecycleConfiguration
forall x.
Rep DescribeLifecycleConfiguration x
-> DescribeLifecycleConfiguration
forall x.
DescribeLifecycleConfiguration
-> Rep DescribeLifecycleConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DescribeLifecycleConfiguration x
-> DescribeLifecycleConfiguration
$cfrom :: forall x.
DescribeLifecycleConfiguration
-> Rep DescribeLifecycleConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'DescribeLifecycleConfiguration' 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:
--
-- 'fileSystemId', 'describeLifecycleConfiguration_fileSystemId' - The ID of the file system whose @LifecycleConfiguration@ object you want
-- to retrieve (String).
newDescribeLifecycleConfiguration ::
  -- | 'fileSystemId'
  Prelude.Text ->
  DescribeLifecycleConfiguration
newDescribeLifecycleConfiguration :: Text -> DescribeLifecycleConfiguration
newDescribeLifecycleConfiguration Text
pFileSystemId_ =
  DescribeLifecycleConfiguration' :: Text -> DescribeLifecycleConfiguration
DescribeLifecycleConfiguration'
    { $sel:fileSystemId:DescribeLifecycleConfiguration' :: Text
fileSystemId =
        Text
pFileSystemId_
    }

-- | The ID of the file system whose @LifecycleConfiguration@ object you want
-- to retrieve (String).
describeLifecycleConfiguration_fileSystemId :: Lens.Lens' DescribeLifecycleConfiguration Prelude.Text
describeLifecycleConfiguration_fileSystemId :: (Text -> f Text)
-> DescribeLifecycleConfiguration
-> f DescribeLifecycleConfiguration
describeLifecycleConfiguration_fileSystemId = (DescribeLifecycleConfiguration -> Text)
-> (DescribeLifecycleConfiguration
    -> Text -> DescribeLifecycleConfiguration)
-> Lens
     DescribeLifecycleConfiguration
     DescribeLifecycleConfiguration
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DescribeLifecycleConfiguration' {Text
fileSystemId :: Text
$sel:fileSystemId:DescribeLifecycleConfiguration' :: DescribeLifecycleConfiguration -> Text
fileSystemId} -> Text
fileSystemId) (\s :: DescribeLifecycleConfiguration
s@DescribeLifecycleConfiguration' {} Text
a -> DescribeLifecycleConfiguration
s {$sel:fileSystemId:DescribeLifecycleConfiguration' :: Text
fileSystemId = Text
a} :: DescribeLifecycleConfiguration)

instance
  Core.AWSRequest
    DescribeLifecycleConfiguration
  where
  type
    AWSResponse DescribeLifecycleConfiguration =
      LifecycleConfigurationDescription
  request :: DescribeLifecycleConfiguration
-> Request DescribeLifecycleConfiguration
request = Service
-> DescribeLifecycleConfiguration
-> Request DescribeLifecycleConfiguration
forall a. ToRequest a => Service -> a -> Request a
Request.get Service
defaultService
  response :: Logger
-> Service
-> Proxy DescribeLifecycleConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeLifecycleConfiguration)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse DescribeLifecycleConfiguration))
-> Logger
-> Service
-> Proxy DescribeLifecycleConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DescribeLifecycleConfiguration)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      (\Int
s ResponseHeaders
h Object
x -> Object -> Either String LifecycleConfigurationDescription
forall a. FromJSON a => Object -> Either String a
Core.eitherParseJSON Object
x)

instance
  Prelude.Hashable
    DescribeLifecycleConfiguration

instance
  Prelude.NFData
    DescribeLifecycleConfiguration

instance
  Core.ToHeaders
    DescribeLifecycleConfiguration
  where
  toHeaders :: DescribeLifecycleConfiguration -> ResponseHeaders
toHeaders = ResponseHeaders
-> DescribeLifecycleConfiguration -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const ResponseHeaders
forall a. Monoid a => a
Prelude.mempty

instance Core.ToPath DescribeLifecycleConfiguration where
  toPath :: DescribeLifecycleConfiguration -> ByteString
toPath DescribeLifecycleConfiguration' {Text
fileSystemId :: Text
$sel:fileSystemId:DescribeLifecycleConfiguration' :: DescribeLifecycleConfiguration -> Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/2015-02-01/file-systems/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
fileSystemId,
        ByteString
"/lifecycle-configuration"
      ]

instance Core.ToQuery DescribeLifecycleConfiguration where
  toQuery :: DescribeLifecycleConfiguration -> QueryString
toQuery = QueryString -> DescribeLifecycleConfiguration -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty