{-# 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.EC2.EnableVpcClassicLinkDnsSupport
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- We are retiring EC2-Classic. We recommend that you migrate from
-- EC2-Classic to a VPC. For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-migrate.html Migrate from EC2-Classic to a VPC>
-- in the /Amazon Elastic Compute Cloud User Guide/.
--
-- Enables a VPC to support DNS hostname resolution for ClassicLink. If
-- enabled, the DNS hostname of a linked EC2-Classic instance resolves to
-- its private IP address when addressed from an instance in the VPC to
-- which it\'s linked. Similarly, the DNS hostname of an instance in a VPC
-- resolves to its private IP address when addressed from a linked
-- EC2-Classic instance. For more information, see
-- <https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/vpc-classiclink.html ClassicLink>
-- in the /Amazon Elastic Compute Cloud User Guide/.
--
-- You must specify a VPC ID in the request.
module Amazonka.EC2.EnableVpcClassicLinkDnsSupport
  ( -- * Creating a Request
    EnableVpcClassicLinkDnsSupport (..),
    newEnableVpcClassicLinkDnsSupport,

    -- * Request Lenses
    enableVpcClassicLinkDnsSupport_vpcId,

    -- * Destructuring the Response
    EnableVpcClassicLinkDnsSupportResponse (..),
    newEnableVpcClassicLinkDnsSupportResponse,

    -- * Response Lenses
    enableVpcClassicLinkDnsSupportResponse_return,
    enableVpcClassicLinkDnsSupportResponse_httpStatus,
  )
where

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

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

-- |
-- Create a value of 'EnableVpcClassicLinkDnsSupport' 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:
--
-- 'vpcId', 'enableVpcClassicLinkDnsSupport_vpcId' - The ID of the VPC.
newEnableVpcClassicLinkDnsSupport ::
  EnableVpcClassicLinkDnsSupport
newEnableVpcClassicLinkDnsSupport :: EnableVpcClassicLinkDnsSupport
newEnableVpcClassicLinkDnsSupport =
  EnableVpcClassicLinkDnsSupport'
    { $sel:vpcId:EnableVpcClassicLinkDnsSupport' :: Maybe Text
vpcId =
        forall a. Maybe a
Prelude.Nothing
    }

-- | The ID of the VPC.
enableVpcClassicLinkDnsSupport_vpcId :: Lens.Lens' EnableVpcClassicLinkDnsSupport (Prelude.Maybe Prelude.Text)
enableVpcClassicLinkDnsSupport_vpcId :: Lens' EnableVpcClassicLinkDnsSupport (Maybe Text)
enableVpcClassicLinkDnsSupport_vpcId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableVpcClassicLinkDnsSupport' {Maybe Text
vpcId :: Maybe Text
$sel:vpcId:EnableVpcClassicLinkDnsSupport' :: EnableVpcClassicLinkDnsSupport -> Maybe Text
vpcId} -> Maybe Text
vpcId) (\s :: EnableVpcClassicLinkDnsSupport
s@EnableVpcClassicLinkDnsSupport' {} Maybe Text
a -> EnableVpcClassicLinkDnsSupport
s {$sel:vpcId:EnableVpcClassicLinkDnsSupport' :: Maybe Text
vpcId = Maybe Text
a} :: EnableVpcClassicLinkDnsSupport)

instance
  Core.AWSRequest
    EnableVpcClassicLinkDnsSupport
  where
  type
    AWSResponse EnableVpcClassicLinkDnsSupport =
      EnableVpcClassicLinkDnsSupportResponse
  request :: (Service -> Service)
-> EnableVpcClassicLinkDnsSupport
-> Request EnableVpcClassicLinkDnsSupport
request Service -> Service
overrides =
    forall a. ToRequest a => Service -> a -> Request a
Request.postQuery (Service -> Service
overrides Service
defaultService)
  response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy EnableVpcClassicLinkDnsSupport
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse EnableVpcClassicLinkDnsSupport)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXML
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe Bool -> Int -> EnableVpcClassicLinkDnsSupportResponse
EnableVpcClassicLinkDnsSupportResponse'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"return")
            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
    EnableVpcClassicLinkDnsSupport
  where
  hashWithSalt :: Int -> EnableVpcClassicLinkDnsSupport -> Int
hashWithSalt
    Int
_salt
    EnableVpcClassicLinkDnsSupport' {Maybe Text
vpcId :: Maybe Text
$sel:vpcId:EnableVpcClassicLinkDnsSupport' :: EnableVpcClassicLinkDnsSupport -> Maybe Text
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vpcId

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

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

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

instance Data.ToQuery EnableVpcClassicLinkDnsSupport where
  toQuery :: EnableVpcClassicLinkDnsSupport -> QueryString
toQuery EnableVpcClassicLinkDnsSupport' {Maybe Text
vpcId :: Maybe Text
$sel:vpcId:EnableVpcClassicLinkDnsSupport' :: EnableVpcClassicLinkDnsSupport -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ( ByteString
"EnableVpcClassicLinkDnsSupport" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2016-11-15" :: Prelude.ByteString),
        ByteString
"VpcId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
vpcId
      ]

-- | /See:/ 'newEnableVpcClassicLinkDnsSupportResponse' smart constructor.
data EnableVpcClassicLinkDnsSupportResponse = EnableVpcClassicLinkDnsSupportResponse'
  { -- | Returns @true@ if the request succeeds; otherwise, it returns an error.
    EnableVpcClassicLinkDnsSupportResponse -> Maybe Bool
return' :: Prelude.Maybe Prelude.Bool,
    -- | The response's http status code.
    EnableVpcClassicLinkDnsSupportResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (EnableVpcClassicLinkDnsSupportResponse
-> EnableVpcClassicLinkDnsSupportResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: EnableVpcClassicLinkDnsSupportResponse
-> EnableVpcClassicLinkDnsSupportResponse -> Bool
$c/= :: EnableVpcClassicLinkDnsSupportResponse
-> EnableVpcClassicLinkDnsSupportResponse -> Bool
== :: EnableVpcClassicLinkDnsSupportResponse
-> EnableVpcClassicLinkDnsSupportResponse -> Bool
$c== :: EnableVpcClassicLinkDnsSupportResponse
-> EnableVpcClassicLinkDnsSupportResponse -> Bool
Prelude.Eq, ReadPrec [EnableVpcClassicLinkDnsSupportResponse]
ReadPrec EnableVpcClassicLinkDnsSupportResponse
Int -> ReadS EnableVpcClassicLinkDnsSupportResponse
ReadS [EnableVpcClassicLinkDnsSupportResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [EnableVpcClassicLinkDnsSupportResponse]
$creadListPrec :: ReadPrec [EnableVpcClassicLinkDnsSupportResponse]
readPrec :: ReadPrec EnableVpcClassicLinkDnsSupportResponse
$creadPrec :: ReadPrec EnableVpcClassicLinkDnsSupportResponse
readList :: ReadS [EnableVpcClassicLinkDnsSupportResponse]
$creadList :: ReadS [EnableVpcClassicLinkDnsSupportResponse]
readsPrec :: Int -> ReadS EnableVpcClassicLinkDnsSupportResponse
$creadsPrec :: Int -> ReadS EnableVpcClassicLinkDnsSupportResponse
Prelude.Read, Int -> EnableVpcClassicLinkDnsSupportResponse -> ShowS
[EnableVpcClassicLinkDnsSupportResponse] -> ShowS
EnableVpcClassicLinkDnsSupportResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [EnableVpcClassicLinkDnsSupportResponse] -> ShowS
$cshowList :: [EnableVpcClassicLinkDnsSupportResponse] -> ShowS
show :: EnableVpcClassicLinkDnsSupportResponse -> String
$cshow :: EnableVpcClassicLinkDnsSupportResponse -> String
showsPrec :: Int -> EnableVpcClassicLinkDnsSupportResponse -> ShowS
$cshowsPrec :: Int -> EnableVpcClassicLinkDnsSupportResponse -> ShowS
Prelude.Show, forall x.
Rep EnableVpcClassicLinkDnsSupportResponse x
-> EnableVpcClassicLinkDnsSupportResponse
forall x.
EnableVpcClassicLinkDnsSupportResponse
-> Rep EnableVpcClassicLinkDnsSupportResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep EnableVpcClassicLinkDnsSupportResponse x
-> EnableVpcClassicLinkDnsSupportResponse
$cfrom :: forall x.
EnableVpcClassicLinkDnsSupportResponse
-> Rep EnableVpcClassicLinkDnsSupportResponse x
Prelude.Generic)

-- |
-- Create a value of 'EnableVpcClassicLinkDnsSupportResponse' 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:
--
-- 'return'', 'enableVpcClassicLinkDnsSupportResponse_return' - Returns @true@ if the request succeeds; otherwise, it returns an error.
--
-- 'httpStatus', 'enableVpcClassicLinkDnsSupportResponse_httpStatus' - The response's http status code.
newEnableVpcClassicLinkDnsSupportResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  EnableVpcClassicLinkDnsSupportResponse
newEnableVpcClassicLinkDnsSupportResponse :: Int -> EnableVpcClassicLinkDnsSupportResponse
newEnableVpcClassicLinkDnsSupportResponse
  Int
pHttpStatus_ =
    EnableVpcClassicLinkDnsSupportResponse'
      { $sel:return':EnableVpcClassicLinkDnsSupportResponse' :: Maybe Bool
return' =
          forall a. Maybe a
Prelude.Nothing,
        $sel:httpStatus:EnableVpcClassicLinkDnsSupportResponse' :: Int
httpStatus = Int
pHttpStatus_
      }

-- | Returns @true@ if the request succeeds; otherwise, it returns an error.
enableVpcClassicLinkDnsSupportResponse_return :: Lens.Lens' EnableVpcClassicLinkDnsSupportResponse (Prelude.Maybe Prelude.Bool)
enableVpcClassicLinkDnsSupportResponse_return :: Lens' EnableVpcClassicLinkDnsSupportResponse (Maybe Bool)
enableVpcClassicLinkDnsSupportResponse_return = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\EnableVpcClassicLinkDnsSupportResponse' {Maybe Bool
return' :: Maybe Bool
$sel:return':EnableVpcClassicLinkDnsSupportResponse' :: EnableVpcClassicLinkDnsSupportResponse -> Maybe Bool
return'} -> Maybe Bool
return') (\s :: EnableVpcClassicLinkDnsSupportResponse
s@EnableVpcClassicLinkDnsSupportResponse' {} Maybe Bool
a -> EnableVpcClassicLinkDnsSupportResponse
s {$sel:return':EnableVpcClassicLinkDnsSupportResponse' :: Maybe Bool
return' = Maybe Bool
a} :: EnableVpcClassicLinkDnsSupportResponse)

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

instance
  Prelude.NFData
    EnableVpcClassicLinkDnsSupportResponse
  where
  rnf :: EnableVpcClassicLinkDnsSupportResponse -> ()
rnf EnableVpcClassicLinkDnsSupportResponse' {Int
Maybe Bool
httpStatus :: Int
return' :: Maybe Bool
$sel:httpStatus:EnableVpcClassicLinkDnsSupportResponse' :: EnableVpcClassicLinkDnsSupportResponse -> Int
$sel:return':EnableVpcClassicLinkDnsSupportResponse' :: EnableVpcClassicLinkDnsSupportResponse -> Maybe Bool
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Bool
return'
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus