{-# 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.DisableVpcClassicLinkDnsSupport
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Disables ClassicLink DNS support for a VPC. If disabled, DNS hostnames
-- resolve to public IP addresses when addressed between a linked
-- EC2-Classic instance and instances in the VPC to which it\'s linked. 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.
--
-- 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/.
module Amazonka.EC2.DisableVpcClassicLinkDnsSupport
  ( -- * Creating a Request
    DisableVpcClassicLinkDnsSupport (..),
    newDisableVpcClassicLinkDnsSupport,

    -- * Request Lenses
    disableVpcClassicLinkDnsSupport_vpcId,

    -- * Destructuring the Response
    DisableVpcClassicLinkDnsSupportResponse (..),
    newDisableVpcClassicLinkDnsSupportResponse,

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

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

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

instance
  Core.AWSRequest
    DisableVpcClassicLinkDnsSupport
  where
  type
    AWSResponse DisableVpcClassicLinkDnsSupport =
      DisableVpcClassicLinkDnsSupportResponse
  request :: (Service -> Service)
-> DisableVpcClassicLinkDnsSupport
-> Request DisableVpcClassicLinkDnsSupport
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 DisableVpcClassicLinkDnsSupport
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse DisableVpcClassicLinkDnsSupport)))
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 -> DisableVpcClassicLinkDnsSupportResponse
DisableVpcClassicLinkDnsSupportResponse'
            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
    DisableVpcClassicLinkDnsSupport
  where
  hashWithSalt :: Int -> DisableVpcClassicLinkDnsSupport -> Int
hashWithSalt
    Int
_salt
    DisableVpcClassicLinkDnsSupport' {Maybe Text
vpcId :: Maybe Text
$sel:vpcId:DisableVpcClassicLinkDnsSupport' :: DisableVpcClassicLinkDnsSupport -> Maybe Text
..} =
      Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
vpcId

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

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

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

instance Data.ToQuery DisableVpcClassicLinkDnsSupport where
  toQuery :: DisableVpcClassicLinkDnsSupport -> QueryString
toQuery DisableVpcClassicLinkDnsSupport' {Maybe Text
vpcId :: Maybe Text
$sel:vpcId:DisableVpcClassicLinkDnsSupport' :: DisableVpcClassicLinkDnsSupport -> Maybe Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ( ByteString
"DisableVpcClassicLinkDnsSupport" ::
                      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:/ 'newDisableVpcClassicLinkDnsSupportResponse' smart constructor.
data DisableVpcClassicLinkDnsSupportResponse = DisableVpcClassicLinkDnsSupportResponse'
  { -- | Returns @true@ if the request succeeds; otherwise, it returns an error.
    DisableVpcClassicLinkDnsSupportResponse -> Maybe Bool
return' :: Prelude.Maybe Prelude.Bool,
    -- | The response's http status code.
    DisableVpcClassicLinkDnsSupportResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DisableVpcClassicLinkDnsSupportResponse
-> DisableVpcClassicLinkDnsSupportResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DisableVpcClassicLinkDnsSupportResponse
-> DisableVpcClassicLinkDnsSupportResponse -> Bool
$c/= :: DisableVpcClassicLinkDnsSupportResponse
-> DisableVpcClassicLinkDnsSupportResponse -> Bool
== :: DisableVpcClassicLinkDnsSupportResponse
-> DisableVpcClassicLinkDnsSupportResponse -> Bool
$c== :: DisableVpcClassicLinkDnsSupportResponse
-> DisableVpcClassicLinkDnsSupportResponse -> Bool
Prelude.Eq, ReadPrec [DisableVpcClassicLinkDnsSupportResponse]
ReadPrec DisableVpcClassicLinkDnsSupportResponse
Int -> ReadS DisableVpcClassicLinkDnsSupportResponse
ReadS [DisableVpcClassicLinkDnsSupportResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DisableVpcClassicLinkDnsSupportResponse]
$creadListPrec :: ReadPrec [DisableVpcClassicLinkDnsSupportResponse]
readPrec :: ReadPrec DisableVpcClassicLinkDnsSupportResponse
$creadPrec :: ReadPrec DisableVpcClassicLinkDnsSupportResponse
readList :: ReadS [DisableVpcClassicLinkDnsSupportResponse]
$creadList :: ReadS [DisableVpcClassicLinkDnsSupportResponse]
readsPrec :: Int -> ReadS DisableVpcClassicLinkDnsSupportResponse
$creadsPrec :: Int -> ReadS DisableVpcClassicLinkDnsSupportResponse
Prelude.Read, Int -> DisableVpcClassicLinkDnsSupportResponse -> ShowS
[DisableVpcClassicLinkDnsSupportResponse] -> ShowS
DisableVpcClassicLinkDnsSupportResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DisableVpcClassicLinkDnsSupportResponse] -> ShowS
$cshowList :: [DisableVpcClassicLinkDnsSupportResponse] -> ShowS
show :: DisableVpcClassicLinkDnsSupportResponse -> String
$cshow :: DisableVpcClassicLinkDnsSupportResponse -> String
showsPrec :: Int -> DisableVpcClassicLinkDnsSupportResponse -> ShowS
$cshowsPrec :: Int -> DisableVpcClassicLinkDnsSupportResponse -> ShowS
Prelude.Show, forall x.
Rep DisableVpcClassicLinkDnsSupportResponse x
-> DisableVpcClassicLinkDnsSupportResponse
forall x.
DisableVpcClassicLinkDnsSupportResponse
-> Rep DisableVpcClassicLinkDnsSupportResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DisableVpcClassicLinkDnsSupportResponse x
-> DisableVpcClassicLinkDnsSupportResponse
$cfrom :: forall x.
DisableVpcClassicLinkDnsSupportResponse
-> Rep DisableVpcClassicLinkDnsSupportResponse x
Prelude.Generic)

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

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

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

instance
  Prelude.NFData
    DisableVpcClassicLinkDnsSupportResponse
  where
  rnf :: DisableVpcClassicLinkDnsSupportResponse -> ()
rnf DisableVpcClassicLinkDnsSupportResponse' {Int
Maybe Bool
httpStatus :: Int
return' :: Maybe Bool
$sel:httpStatus:DisableVpcClassicLinkDnsSupportResponse' :: DisableVpcClassicLinkDnsSupportResponse -> Int
$sel:return':DisableVpcClassicLinkDnsSupportResponse' :: DisableVpcClassicLinkDnsSupportResponse -> 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