{-# 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.ImageBuilder.GetInfrastructureConfiguration
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Gets an infrastructure configuration.
module Amazonka.ImageBuilder.GetInfrastructureConfiguration
  ( -- * Creating a Request
    GetInfrastructureConfiguration (..),
    newGetInfrastructureConfiguration,

    -- * Request Lenses
    getInfrastructureConfiguration_infrastructureConfigurationArn,

    -- * Destructuring the Response
    GetInfrastructureConfigurationResponse (..),
    newGetInfrastructureConfigurationResponse,

    -- * Response Lenses
    getInfrastructureConfigurationResponse_infrastructureConfiguration,
    getInfrastructureConfigurationResponse_requestId,
    getInfrastructureConfigurationResponse_httpStatus,
  )
where

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

-- | GetInfrastructureConfiguration request object.
--
-- /See:/ 'newGetInfrastructureConfiguration' smart constructor.
data GetInfrastructureConfiguration = GetInfrastructureConfiguration'
  { -- | The Amazon Resource Name (ARN) of the infrastructure configuration that
    -- you want to retrieve.
    GetInfrastructureConfiguration -> Text
infrastructureConfigurationArn :: Prelude.Text
  }
  deriving (GetInfrastructureConfiguration
-> GetInfrastructureConfiguration -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInfrastructureConfiguration
-> GetInfrastructureConfiguration -> Bool
$c/= :: GetInfrastructureConfiguration
-> GetInfrastructureConfiguration -> Bool
== :: GetInfrastructureConfiguration
-> GetInfrastructureConfiguration -> Bool
$c== :: GetInfrastructureConfiguration
-> GetInfrastructureConfiguration -> Bool
Prelude.Eq, ReadPrec [GetInfrastructureConfiguration]
ReadPrec GetInfrastructureConfiguration
Int -> ReadS GetInfrastructureConfiguration
ReadS [GetInfrastructureConfiguration]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInfrastructureConfiguration]
$creadListPrec :: ReadPrec [GetInfrastructureConfiguration]
readPrec :: ReadPrec GetInfrastructureConfiguration
$creadPrec :: ReadPrec GetInfrastructureConfiguration
readList :: ReadS [GetInfrastructureConfiguration]
$creadList :: ReadS [GetInfrastructureConfiguration]
readsPrec :: Int -> ReadS GetInfrastructureConfiguration
$creadsPrec :: Int -> ReadS GetInfrastructureConfiguration
Prelude.Read, Int -> GetInfrastructureConfiguration -> ShowS
[GetInfrastructureConfiguration] -> ShowS
GetInfrastructureConfiguration -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInfrastructureConfiguration] -> ShowS
$cshowList :: [GetInfrastructureConfiguration] -> ShowS
show :: GetInfrastructureConfiguration -> String
$cshow :: GetInfrastructureConfiguration -> String
showsPrec :: Int -> GetInfrastructureConfiguration -> ShowS
$cshowsPrec :: Int -> GetInfrastructureConfiguration -> ShowS
Prelude.Show, forall x.
Rep GetInfrastructureConfiguration x
-> GetInfrastructureConfiguration
forall x.
GetInfrastructureConfiguration
-> Rep GetInfrastructureConfiguration x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetInfrastructureConfiguration x
-> GetInfrastructureConfiguration
$cfrom :: forall x.
GetInfrastructureConfiguration
-> Rep GetInfrastructureConfiguration x
Prelude.Generic)

-- |
-- Create a value of 'GetInfrastructureConfiguration' 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:
--
-- 'infrastructureConfigurationArn', 'getInfrastructureConfiguration_infrastructureConfigurationArn' - The Amazon Resource Name (ARN) of the infrastructure configuration that
-- you want to retrieve.
newGetInfrastructureConfiguration ::
  -- | 'infrastructureConfigurationArn'
  Prelude.Text ->
  GetInfrastructureConfiguration
newGetInfrastructureConfiguration :: Text -> GetInfrastructureConfiguration
newGetInfrastructureConfiguration
  Text
pInfrastructureConfigurationArn_ =
    GetInfrastructureConfiguration'
      { $sel:infrastructureConfigurationArn:GetInfrastructureConfiguration' :: Text
infrastructureConfigurationArn =
          Text
pInfrastructureConfigurationArn_
      }

-- | The Amazon Resource Name (ARN) of the infrastructure configuration that
-- you want to retrieve.
getInfrastructureConfiguration_infrastructureConfigurationArn :: Lens.Lens' GetInfrastructureConfiguration Prelude.Text
getInfrastructureConfiguration_infrastructureConfigurationArn :: Lens' GetInfrastructureConfiguration Text
getInfrastructureConfiguration_infrastructureConfigurationArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInfrastructureConfiguration' {Text
infrastructureConfigurationArn :: Text
$sel:infrastructureConfigurationArn:GetInfrastructureConfiguration' :: GetInfrastructureConfiguration -> Text
infrastructureConfigurationArn} -> Text
infrastructureConfigurationArn) (\s :: GetInfrastructureConfiguration
s@GetInfrastructureConfiguration' {} Text
a -> GetInfrastructureConfiguration
s {$sel:infrastructureConfigurationArn:GetInfrastructureConfiguration' :: Text
infrastructureConfigurationArn = Text
a} :: GetInfrastructureConfiguration)

instance
  Core.AWSRequest
    GetInfrastructureConfiguration
  where
  type
    AWSResponse GetInfrastructureConfiguration =
      GetInfrastructureConfigurationResponse
  request :: (Service -> Service)
-> GetInfrastructureConfiguration
-> Request GetInfrastructureConfiguration
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.get (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy GetInfrastructureConfiguration
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse GetInfrastructureConfiguration)))
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 ->
          Maybe InfrastructureConfiguration
-> Maybe Text -> Int -> GetInfrastructureConfigurationResponse
GetInfrastructureConfigurationResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"infrastructureConfiguration")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"requestId")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

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

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

instance
  Data.ToHeaders
    GetInfrastructureConfiguration
  where
  toHeaders :: GetInfrastructureConfiguration -> 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.ToPath GetInfrastructureConfiguration where
  toPath :: GetInfrastructureConfiguration -> ByteString
toPath =
    forall a b. a -> b -> a
Prelude.const ByteString
"/GetInfrastructureConfiguration"

instance Data.ToQuery GetInfrastructureConfiguration where
  toQuery :: GetInfrastructureConfiguration -> QueryString
toQuery GetInfrastructureConfiguration' {Text
infrastructureConfigurationArn :: Text
$sel:infrastructureConfigurationArn:GetInfrastructureConfiguration' :: GetInfrastructureConfiguration -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"infrastructureConfigurationArn"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
infrastructureConfigurationArn
      ]

-- | GetInfrastructureConfiguration response object.
--
-- /See:/ 'newGetInfrastructureConfigurationResponse' smart constructor.
data GetInfrastructureConfigurationResponse = GetInfrastructureConfigurationResponse'
  { -- | The infrastructure configuration object.
    GetInfrastructureConfigurationResponse
-> Maybe InfrastructureConfiguration
infrastructureConfiguration :: Prelude.Maybe InfrastructureConfiguration,
    -- | The request ID that uniquely identifies this request.
    GetInfrastructureConfigurationResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    GetInfrastructureConfigurationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (GetInfrastructureConfigurationResponse
-> GetInfrastructureConfigurationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: GetInfrastructureConfigurationResponse
-> GetInfrastructureConfigurationResponse -> Bool
$c/= :: GetInfrastructureConfigurationResponse
-> GetInfrastructureConfigurationResponse -> Bool
== :: GetInfrastructureConfigurationResponse
-> GetInfrastructureConfigurationResponse -> Bool
$c== :: GetInfrastructureConfigurationResponse
-> GetInfrastructureConfigurationResponse -> Bool
Prelude.Eq, ReadPrec [GetInfrastructureConfigurationResponse]
ReadPrec GetInfrastructureConfigurationResponse
Int -> ReadS GetInfrastructureConfigurationResponse
ReadS [GetInfrastructureConfigurationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [GetInfrastructureConfigurationResponse]
$creadListPrec :: ReadPrec [GetInfrastructureConfigurationResponse]
readPrec :: ReadPrec GetInfrastructureConfigurationResponse
$creadPrec :: ReadPrec GetInfrastructureConfigurationResponse
readList :: ReadS [GetInfrastructureConfigurationResponse]
$creadList :: ReadS [GetInfrastructureConfigurationResponse]
readsPrec :: Int -> ReadS GetInfrastructureConfigurationResponse
$creadsPrec :: Int -> ReadS GetInfrastructureConfigurationResponse
Prelude.Read, Int -> GetInfrastructureConfigurationResponse -> ShowS
[GetInfrastructureConfigurationResponse] -> ShowS
GetInfrastructureConfigurationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [GetInfrastructureConfigurationResponse] -> ShowS
$cshowList :: [GetInfrastructureConfigurationResponse] -> ShowS
show :: GetInfrastructureConfigurationResponse -> String
$cshow :: GetInfrastructureConfigurationResponse -> String
showsPrec :: Int -> GetInfrastructureConfigurationResponse -> ShowS
$cshowsPrec :: Int -> GetInfrastructureConfigurationResponse -> ShowS
Prelude.Show, forall x.
Rep GetInfrastructureConfigurationResponse x
-> GetInfrastructureConfigurationResponse
forall x.
GetInfrastructureConfigurationResponse
-> Rep GetInfrastructureConfigurationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep GetInfrastructureConfigurationResponse x
-> GetInfrastructureConfigurationResponse
$cfrom :: forall x.
GetInfrastructureConfigurationResponse
-> Rep GetInfrastructureConfigurationResponse x
Prelude.Generic)

-- |
-- Create a value of 'GetInfrastructureConfigurationResponse' 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:
--
-- 'infrastructureConfiguration', 'getInfrastructureConfigurationResponse_infrastructureConfiguration' - The infrastructure configuration object.
--
-- 'requestId', 'getInfrastructureConfigurationResponse_requestId' - The request ID that uniquely identifies this request.
--
-- 'httpStatus', 'getInfrastructureConfigurationResponse_httpStatus' - The response's http status code.
newGetInfrastructureConfigurationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  GetInfrastructureConfigurationResponse
newGetInfrastructureConfigurationResponse :: Int -> GetInfrastructureConfigurationResponse
newGetInfrastructureConfigurationResponse
  Int
pHttpStatus_ =
    GetInfrastructureConfigurationResponse'
      { $sel:infrastructureConfiguration:GetInfrastructureConfigurationResponse' :: Maybe InfrastructureConfiguration
infrastructureConfiguration =
          forall a. Maybe a
Prelude.Nothing,
        $sel:requestId:GetInfrastructureConfigurationResponse' :: Maybe Text
requestId = forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:GetInfrastructureConfigurationResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | The infrastructure configuration object.
getInfrastructureConfigurationResponse_infrastructureConfiguration :: Lens.Lens' GetInfrastructureConfigurationResponse (Prelude.Maybe InfrastructureConfiguration)
getInfrastructureConfigurationResponse_infrastructureConfiguration :: Lens'
  GetInfrastructureConfigurationResponse
  (Maybe InfrastructureConfiguration)
getInfrastructureConfigurationResponse_infrastructureConfiguration = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInfrastructureConfigurationResponse' {Maybe InfrastructureConfiguration
infrastructureConfiguration :: Maybe InfrastructureConfiguration
$sel:infrastructureConfiguration:GetInfrastructureConfigurationResponse' :: GetInfrastructureConfigurationResponse
-> Maybe InfrastructureConfiguration
infrastructureConfiguration} -> Maybe InfrastructureConfiguration
infrastructureConfiguration) (\s :: GetInfrastructureConfigurationResponse
s@GetInfrastructureConfigurationResponse' {} Maybe InfrastructureConfiguration
a -> GetInfrastructureConfigurationResponse
s {$sel:infrastructureConfiguration:GetInfrastructureConfigurationResponse' :: Maybe InfrastructureConfiguration
infrastructureConfiguration = Maybe InfrastructureConfiguration
a} :: GetInfrastructureConfigurationResponse)

-- | The request ID that uniquely identifies this request.
getInfrastructureConfigurationResponse_requestId :: Lens.Lens' GetInfrastructureConfigurationResponse (Prelude.Maybe Prelude.Text)
getInfrastructureConfigurationResponse_requestId :: Lens' GetInfrastructureConfigurationResponse (Maybe Text)
getInfrastructureConfigurationResponse_requestId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInfrastructureConfigurationResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:GetInfrastructureConfigurationResponse' :: GetInfrastructureConfigurationResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: GetInfrastructureConfigurationResponse
s@GetInfrastructureConfigurationResponse' {} Maybe Text
a -> GetInfrastructureConfigurationResponse
s {$sel:requestId:GetInfrastructureConfigurationResponse' :: Maybe Text
requestId = Maybe Text
a} :: GetInfrastructureConfigurationResponse)

-- | The response's http status code.
getInfrastructureConfigurationResponse_httpStatus :: Lens.Lens' GetInfrastructureConfigurationResponse Prelude.Int
getInfrastructureConfigurationResponse_httpStatus :: Lens' GetInfrastructureConfigurationResponse Int
getInfrastructureConfigurationResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\GetInfrastructureConfigurationResponse' {Int
httpStatus :: Int
$sel:httpStatus:GetInfrastructureConfigurationResponse' :: GetInfrastructureConfigurationResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: GetInfrastructureConfigurationResponse
s@GetInfrastructureConfigurationResponse' {} Int
a -> GetInfrastructureConfigurationResponse
s {$sel:httpStatus:GetInfrastructureConfigurationResponse' :: Int
httpStatus = Int
a} :: GetInfrastructureConfigurationResponse)

instance
  Prelude.NFData
    GetInfrastructureConfigurationResponse
  where
  rnf :: GetInfrastructureConfigurationResponse -> ()
rnf GetInfrastructureConfigurationResponse' {Int
Maybe Text
Maybe InfrastructureConfiguration
httpStatus :: Int
requestId :: Maybe Text
infrastructureConfiguration :: Maybe InfrastructureConfiguration
$sel:httpStatus:GetInfrastructureConfigurationResponse' :: GetInfrastructureConfigurationResponse -> Int
$sel:requestId:GetInfrastructureConfigurationResponse' :: GetInfrastructureConfigurationResponse -> Maybe Text
$sel:infrastructureConfiguration:GetInfrastructureConfigurationResponse' :: GetInfrastructureConfigurationResponse
-> Maybe InfrastructureConfiguration
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe InfrastructureConfiguration
infrastructureConfiguration
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
requestId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus