{-# 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.MGN.ArchiveApplication
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Archive application.
module Amazonka.MGN.ArchiveApplication
  ( -- * Creating a Request
    ArchiveApplication (..),
    newArchiveApplication,

    -- * Request Lenses
    archiveApplication_applicationID,

    -- * Destructuring the Response
    Application (..),
    newApplication,

    -- * Response Lenses
    application_applicationAggregatedStatus,
    application_applicationID,
    application_arn,
    application_creationDateTime,
    application_description,
    application_isArchived,
    application_lastModifiedDateTime,
    application_name,
    application_tags,
    application_waveID,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import Amazonka.MGN.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

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

-- |
-- Create a value of 'ArchiveApplication' 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:
--
-- 'applicationID', 'archiveApplication_applicationID' - Application ID.
newArchiveApplication ::
  -- | 'applicationID'
  Prelude.Text ->
  ArchiveApplication
newArchiveApplication :: Text -> ArchiveApplication
newArchiveApplication Text
pApplicationID_ =
  ArchiveApplication'
    { $sel:applicationID:ArchiveApplication' :: Text
applicationID =
        Text
pApplicationID_
    }

-- | Application ID.
archiveApplication_applicationID :: Lens.Lens' ArchiveApplication Prelude.Text
archiveApplication_applicationID :: Lens' ArchiveApplication Text
archiveApplication_applicationID = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ArchiveApplication' {Text
applicationID :: Text
$sel:applicationID:ArchiveApplication' :: ArchiveApplication -> Text
applicationID} -> Text
applicationID) (\s :: ArchiveApplication
s@ArchiveApplication' {} Text
a -> ArchiveApplication
s {$sel:applicationID:ArchiveApplication' :: Text
applicationID = Text
a} :: ArchiveApplication)

instance Core.AWSRequest ArchiveApplication where
  type AWSResponse ArchiveApplication = Application
  request :: (Service -> Service)
-> ArchiveApplication -> Request ArchiveApplication
request Service -> Service
overrides =
    forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy ArchiveApplication
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ArchiveApplication)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      (\Int
s ResponseHeaders
h Object
x -> forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)

instance Prelude.Hashable ArchiveApplication where
  hashWithSalt :: Int -> ArchiveApplication -> Int
hashWithSalt Int
_salt ArchiveApplication' {Text
applicationID :: Text
$sel:applicationID:ArchiveApplication' :: ArchiveApplication -> Text
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
applicationID

instance Prelude.NFData ArchiveApplication where
  rnf :: ArchiveApplication -> ()
rnf ArchiveApplication' {Text
applicationID :: Text
$sel:applicationID:ArchiveApplication' :: ArchiveApplication -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
applicationID

instance Data.ToHeaders ArchiveApplication where
  toHeaders :: ArchiveApplication -> ResponseHeaders
toHeaders =
    forall a b. a -> b -> a
Prelude.const
      ( forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"Content-Type"
              forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Data.ToJSON ArchiveApplication where
  toJSON :: ArchiveApplication -> Value
toJSON ArchiveApplication' {Text
applicationID :: Text
$sel:applicationID:ArchiveApplication' :: ArchiveApplication -> Text
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"applicationID" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
applicationID)
          ]
      )

instance Data.ToPath ArchiveApplication where
  toPath :: ArchiveApplication -> ByteString
toPath = forall a b. a -> b -> a
Prelude.const ByteString
"/ArchiveApplication"

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