{-# 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.GameLift.DeleteVpcPeeringAuthorization
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Cancels a pending VPC peering authorization for the specified VPC. If
-- you need to delete an existing VPC peering connection, use
-- <https://docs.aws.amazon.com/gamelift/latest/apireference/API_DeleteVpcPeeringConnection.html DeleteVpcPeeringConnection>.
--
-- __Related actions__
--
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/reference-awssdk.html#reference-awssdk-resources-fleets All APIs by task>
module Amazonka.GameLift.DeleteVpcPeeringAuthorization
  ( -- * Creating a Request
    DeleteVpcPeeringAuthorization (..),
    newDeleteVpcPeeringAuthorization,

    -- * Request Lenses
    deleteVpcPeeringAuthorization_gameLiftAwsAccountId,
    deleteVpcPeeringAuthorization_peerVpcId,

    -- * Destructuring the Response
    DeleteVpcPeeringAuthorizationResponse (..),
    newDeleteVpcPeeringAuthorizationResponse,

    -- * Response Lenses
    deleteVpcPeeringAuthorizationResponse_httpStatus,
  )
where

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

-- | /See:/ 'newDeleteVpcPeeringAuthorization' smart constructor.
data DeleteVpcPeeringAuthorization = DeleteVpcPeeringAuthorization'
  { -- | A unique identifier for the Amazon Web Services account that you use to
    -- manage your GameLift fleet. You can find your Account ID in the Amazon
    -- Web Services Management Console under account settings.
    DeleteVpcPeeringAuthorization -> Text
gameLiftAwsAccountId :: Prelude.Text,
    -- | A unique identifier for a VPC with resources to be accessed by your
    -- GameLift fleet. The VPC must be in the same Region as your fleet. To
    -- look up a VPC ID, use the
    -- <https://console.aws.amazon.com/vpc/ VPC Dashboard> in the Amazon Web
    -- Services Management Console. Learn more about VPC peering in
    -- <https://docs.aws.amazon.com/gamelift/latest/developerguide/vpc-peering.html VPC Peering with GameLift Fleets>.
    DeleteVpcPeeringAuthorization -> Text
peerVpcId :: Prelude.Text
  }
  deriving (DeleteVpcPeeringAuthorization
-> DeleteVpcPeeringAuthorization -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteVpcPeeringAuthorization
-> DeleteVpcPeeringAuthorization -> Bool
$c/= :: DeleteVpcPeeringAuthorization
-> DeleteVpcPeeringAuthorization -> Bool
== :: DeleteVpcPeeringAuthorization
-> DeleteVpcPeeringAuthorization -> Bool
$c== :: DeleteVpcPeeringAuthorization
-> DeleteVpcPeeringAuthorization -> Bool
Prelude.Eq, ReadPrec [DeleteVpcPeeringAuthorization]
ReadPrec DeleteVpcPeeringAuthorization
Int -> ReadS DeleteVpcPeeringAuthorization
ReadS [DeleteVpcPeeringAuthorization]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteVpcPeeringAuthorization]
$creadListPrec :: ReadPrec [DeleteVpcPeeringAuthorization]
readPrec :: ReadPrec DeleteVpcPeeringAuthorization
$creadPrec :: ReadPrec DeleteVpcPeeringAuthorization
readList :: ReadS [DeleteVpcPeeringAuthorization]
$creadList :: ReadS [DeleteVpcPeeringAuthorization]
readsPrec :: Int -> ReadS DeleteVpcPeeringAuthorization
$creadsPrec :: Int -> ReadS DeleteVpcPeeringAuthorization
Prelude.Read, Int -> DeleteVpcPeeringAuthorization -> ShowS
[DeleteVpcPeeringAuthorization] -> ShowS
DeleteVpcPeeringAuthorization -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteVpcPeeringAuthorization] -> ShowS
$cshowList :: [DeleteVpcPeeringAuthorization] -> ShowS
show :: DeleteVpcPeeringAuthorization -> String
$cshow :: DeleteVpcPeeringAuthorization -> String
showsPrec :: Int -> DeleteVpcPeeringAuthorization -> ShowS
$cshowsPrec :: Int -> DeleteVpcPeeringAuthorization -> ShowS
Prelude.Show, forall x.
Rep DeleteVpcPeeringAuthorization x
-> DeleteVpcPeeringAuthorization
forall x.
DeleteVpcPeeringAuthorization
-> Rep DeleteVpcPeeringAuthorization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteVpcPeeringAuthorization x
-> DeleteVpcPeeringAuthorization
$cfrom :: forall x.
DeleteVpcPeeringAuthorization
-> Rep DeleteVpcPeeringAuthorization x
Prelude.Generic)

-- |
-- Create a value of 'DeleteVpcPeeringAuthorization' 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:
--
-- 'gameLiftAwsAccountId', 'deleteVpcPeeringAuthorization_gameLiftAwsAccountId' - A unique identifier for the Amazon Web Services account that you use to
-- manage your GameLift fleet. You can find your Account ID in the Amazon
-- Web Services Management Console under account settings.
--
-- 'peerVpcId', 'deleteVpcPeeringAuthorization_peerVpcId' - A unique identifier for a VPC with resources to be accessed by your
-- GameLift fleet. The VPC must be in the same Region as your fleet. To
-- look up a VPC ID, use the
-- <https://console.aws.amazon.com/vpc/ VPC Dashboard> in the Amazon Web
-- Services Management Console. Learn more about VPC peering in
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/vpc-peering.html VPC Peering with GameLift Fleets>.
newDeleteVpcPeeringAuthorization ::
  -- | 'gameLiftAwsAccountId'
  Prelude.Text ->
  -- | 'peerVpcId'
  Prelude.Text ->
  DeleteVpcPeeringAuthorization
newDeleteVpcPeeringAuthorization :: Text -> Text -> DeleteVpcPeeringAuthorization
newDeleteVpcPeeringAuthorization
  Text
pGameLiftAwsAccountId_
  Text
pPeerVpcId_ =
    DeleteVpcPeeringAuthorization'
      { $sel:gameLiftAwsAccountId:DeleteVpcPeeringAuthorization' :: Text
gameLiftAwsAccountId =
          Text
pGameLiftAwsAccountId_,
        $sel:peerVpcId:DeleteVpcPeeringAuthorization' :: Text
peerVpcId = Text
pPeerVpcId_
      }

-- | A unique identifier for the Amazon Web Services account that you use to
-- manage your GameLift fleet. You can find your Account ID in the Amazon
-- Web Services Management Console under account settings.
deleteVpcPeeringAuthorization_gameLiftAwsAccountId :: Lens.Lens' DeleteVpcPeeringAuthorization Prelude.Text
deleteVpcPeeringAuthorization_gameLiftAwsAccountId :: Lens' DeleteVpcPeeringAuthorization Text
deleteVpcPeeringAuthorization_gameLiftAwsAccountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteVpcPeeringAuthorization' {Text
gameLiftAwsAccountId :: Text
$sel:gameLiftAwsAccountId:DeleteVpcPeeringAuthorization' :: DeleteVpcPeeringAuthorization -> Text
gameLiftAwsAccountId} -> Text
gameLiftAwsAccountId) (\s :: DeleteVpcPeeringAuthorization
s@DeleteVpcPeeringAuthorization' {} Text
a -> DeleteVpcPeeringAuthorization
s {$sel:gameLiftAwsAccountId:DeleteVpcPeeringAuthorization' :: Text
gameLiftAwsAccountId = Text
a} :: DeleteVpcPeeringAuthorization)

-- | A unique identifier for a VPC with resources to be accessed by your
-- GameLift fleet. The VPC must be in the same Region as your fleet. To
-- look up a VPC ID, use the
-- <https://console.aws.amazon.com/vpc/ VPC Dashboard> in the Amazon Web
-- Services Management Console. Learn more about VPC peering in
-- <https://docs.aws.amazon.com/gamelift/latest/developerguide/vpc-peering.html VPC Peering with GameLift Fleets>.
deleteVpcPeeringAuthorization_peerVpcId :: Lens.Lens' DeleteVpcPeeringAuthorization Prelude.Text
deleteVpcPeeringAuthorization_peerVpcId :: Lens' DeleteVpcPeeringAuthorization Text
deleteVpcPeeringAuthorization_peerVpcId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DeleteVpcPeeringAuthorization' {Text
peerVpcId :: Text
$sel:peerVpcId:DeleteVpcPeeringAuthorization' :: DeleteVpcPeeringAuthorization -> Text
peerVpcId} -> Text
peerVpcId) (\s :: DeleteVpcPeeringAuthorization
s@DeleteVpcPeeringAuthorization' {} Text
a -> DeleteVpcPeeringAuthorization
s {$sel:peerVpcId:DeleteVpcPeeringAuthorization' :: Text
peerVpcId = Text
a} :: DeleteVpcPeeringAuthorization)

instance
  Core.AWSRequest
    DeleteVpcPeeringAuthorization
  where
  type
    AWSResponse DeleteVpcPeeringAuthorization =
      DeleteVpcPeeringAuthorizationResponse
  request :: (Service -> Service)
-> DeleteVpcPeeringAuthorization
-> Request DeleteVpcPeeringAuthorization
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 DeleteVpcPeeringAuthorization
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse DeleteVpcPeeringAuthorization)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
      ( \Int
s ResponseHeaders
h ()
x ->
          Int -> DeleteVpcPeeringAuthorizationResponse
DeleteVpcPeeringAuthorizationResponse'
            forall (f :: * -> *) a b. Functor 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
    DeleteVpcPeeringAuthorization
  where
  hashWithSalt :: Int -> DeleteVpcPeeringAuthorization -> Int
hashWithSalt Int
_salt DeleteVpcPeeringAuthorization' {Text
peerVpcId :: Text
gameLiftAwsAccountId :: Text
$sel:peerVpcId:DeleteVpcPeeringAuthorization' :: DeleteVpcPeeringAuthorization -> Text
$sel:gameLiftAwsAccountId:DeleteVpcPeeringAuthorization' :: DeleteVpcPeeringAuthorization -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
gameLiftAwsAccountId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
peerVpcId

instance Prelude.NFData DeleteVpcPeeringAuthorization where
  rnf :: DeleteVpcPeeringAuthorization -> ()
rnf DeleteVpcPeeringAuthorization' {Text
peerVpcId :: Text
gameLiftAwsAccountId :: Text
$sel:peerVpcId:DeleteVpcPeeringAuthorization' :: DeleteVpcPeeringAuthorization -> Text
$sel:gameLiftAwsAccountId:DeleteVpcPeeringAuthorization' :: DeleteVpcPeeringAuthorization -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
gameLiftAwsAccountId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
peerVpcId

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

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

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

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

-- | /See:/ 'newDeleteVpcPeeringAuthorizationResponse' smart constructor.
data DeleteVpcPeeringAuthorizationResponse = DeleteVpcPeeringAuthorizationResponse'
  { -- | The response's http status code.
    DeleteVpcPeeringAuthorizationResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (DeleteVpcPeeringAuthorizationResponse
-> DeleteVpcPeeringAuthorizationResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DeleteVpcPeeringAuthorizationResponse
-> DeleteVpcPeeringAuthorizationResponse -> Bool
$c/= :: DeleteVpcPeeringAuthorizationResponse
-> DeleteVpcPeeringAuthorizationResponse -> Bool
== :: DeleteVpcPeeringAuthorizationResponse
-> DeleteVpcPeeringAuthorizationResponse -> Bool
$c== :: DeleteVpcPeeringAuthorizationResponse
-> DeleteVpcPeeringAuthorizationResponse -> Bool
Prelude.Eq, ReadPrec [DeleteVpcPeeringAuthorizationResponse]
ReadPrec DeleteVpcPeeringAuthorizationResponse
Int -> ReadS DeleteVpcPeeringAuthorizationResponse
ReadS [DeleteVpcPeeringAuthorizationResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DeleteVpcPeeringAuthorizationResponse]
$creadListPrec :: ReadPrec [DeleteVpcPeeringAuthorizationResponse]
readPrec :: ReadPrec DeleteVpcPeeringAuthorizationResponse
$creadPrec :: ReadPrec DeleteVpcPeeringAuthorizationResponse
readList :: ReadS [DeleteVpcPeeringAuthorizationResponse]
$creadList :: ReadS [DeleteVpcPeeringAuthorizationResponse]
readsPrec :: Int -> ReadS DeleteVpcPeeringAuthorizationResponse
$creadsPrec :: Int -> ReadS DeleteVpcPeeringAuthorizationResponse
Prelude.Read, Int -> DeleteVpcPeeringAuthorizationResponse -> ShowS
[DeleteVpcPeeringAuthorizationResponse] -> ShowS
DeleteVpcPeeringAuthorizationResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DeleteVpcPeeringAuthorizationResponse] -> ShowS
$cshowList :: [DeleteVpcPeeringAuthorizationResponse] -> ShowS
show :: DeleteVpcPeeringAuthorizationResponse -> String
$cshow :: DeleteVpcPeeringAuthorizationResponse -> String
showsPrec :: Int -> DeleteVpcPeeringAuthorizationResponse -> ShowS
$cshowsPrec :: Int -> DeleteVpcPeeringAuthorizationResponse -> ShowS
Prelude.Show, forall x.
Rep DeleteVpcPeeringAuthorizationResponse x
-> DeleteVpcPeeringAuthorizationResponse
forall x.
DeleteVpcPeeringAuthorizationResponse
-> Rep DeleteVpcPeeringAuthorizationResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep DeleteVpcPeeringAuthorizationResponse x
-> DeleteVpcPeeringAuthorizationResponse
$cfrom :: forall x.
DeleteVpcPeeringAuthorizationResponse
-> Rep DeleteVpcPeeringAuthorizationResponse x
Prelude.Generic)

-- |
-- Create a value of 'DeleteVpcPeeringAuthorizationResponse' 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:
--
-- 'httpStatus', 'deleteVpcPeeringAuthorizationResponse_httpStatus' - The response's http status code.
newDeleteVpcPeeringAuthorizationResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  DeleteVpcPeeringAuthorizationResponse
newDeleteVpcPeeringAuthorizationResponse :: Int -> DeleteVpcPeeringAuthorizationResponse
newDeleteVpcPeeringAuthorizationResponse Int
pHttpStatus_ =
  DeleteVpcPeeringAuthorizationResponse'
    { $sel:httpStatus:DeleteVpcPeeringAuthorizationResponse' :: Int
httpStatus =
        Int
pHttpStatus_
    }

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

instance
  Prelude.NFData
    DeleteVpcPeeringAuthorizationResponse
  where
  rnf :: DeleteVpcPeeringAuthorizationResponse -> ()
rnf DeleteVpcPeeringAuthorizationResponse' {Int
httpStatus :: Int
$sel:httpStatus:DeleteVpcPeeringAuthorizationResponse' :: DeleteVpcPeeringAuthorizationResponse -> Int
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus