{-# 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.FMS.AssociateThirdPartyFirewall
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Sets the Firewall Manager policy administrator as a tenant administrator
-- of a third-party firewall service. A tenant is an instance of the
-- third-party firewall service that\'s associated with your Amazon Web
-- Services customer account.
module Amazonka.FMS.AssociateThirdPartyFirewall
  ( -- * Creating a Request
    AssociateThirdPartyFirewall (..),
    newAssociateThirdPartyFirewall,

    -- * Request Lenses
    associateThirdPartyFirewall_thirdPartyFirewall,

    -- * Destructuring the Response
    AssociateThirdPartyFirewallResponse (..),
    newAssociateThirdPartyFirewallResponse,

    -- * Response Lenses
    associateThirdPartyFirewallResponse_thirdPartyFirewallStatus,
    associateThirdPartyFirewallResponse_httpStatus,
  )
where

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

-- | /See:/ 'newAssociateThirdPartyFirewall' smart constructor.
data AssociateThirdPartyFirewall = AssociateThirdPartyFirewall'
  { -- | The name of the third-party firewall vendor.
    AssociateThirdPartyFirewall -> ThirdPartyFirewall
thirdPartyFirewall :: ThirdPartyFirewall
  }
  deriving (AssociateThirdPartyFirewall -> AssociateThirdPartyFirewall -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateThirdPartyFirewall -> AssociateThirdPartyFirewall -> Bool
$c/= :: AssociateThirdPartyFirewall -> AssociateThirdPartyFirewall -> Bool
== :: AssociateThirdPartyFirewall -> AssociateThirdPartyFirewall -> Bool
$c== :: AssociateThirdPartyFirewall -> AssociateThirdPartyFirewall -> Bool
Prelude.Eq, ReadPrec [AssociateThirdPartyFirewall]
ReadPrec AssociateThirdPartyFirewall
Int -> ReadS AssociateThirdPartyFirewall
ReadS [AssociateThirdPartyFirewall]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateThirdPartyFirewall]
$creadListPrec :: ReadPrec [AssociateThirdPartyFirewall]
readPrec :: ReadPrec AssociateThirdPartyFirewall
$creadPrec :: ReadPrec AssociateThirdPartyFirewall
readList :: ReadS [AssociateThirdPartyFirewall]
$creadList :: ReadS [AssociateThirdPartyFirewall]
readsPrec :: Int -> ReadS AssociateThirdPartyFirewall
$creadsPrec :: Int -> ReadS AssociateThirdPartyFirewall
Prelude.Read, Int -> AssociateThirdPartyFirewall -> ShowS
[AssociateThirdPartyFirewall] -> ShowS
AssociateThirdPartyFirewall -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateThirdPartyFirewall] -> ShowS
$cshowList :: [AssociateThirdPartyFirewall] -> ShowS
show :: AssociateThirdPartyFirewall -> String
$cshow :: AssociateThirdPartyFirewall -> String
showsPrec :: Int -> AssociateThirdPartyFirewall -> ShowS
$cshowsPrec :: Int -> AssociateThirdPartyFirewall -> ShowS
Prelude.Show, forall x.
Rep AssociateThirdPartyFirewall x -> AssociateThirdPartyFirewall
forall x.
AssociateThirdPartyFirewall -> Rep AssociateThirdPartyFirewall x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateThirdPartyFirewall x -> AssociateThirdPartyFirewall
$cfrom :: forall x.
AssociateThirdPartyFirewall -> Rep AssociateThirdPartyFirewall x
Prelude.Generic)

-- |
-- Create a value of 'AssociateThirdPartyFirewall' 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:
--
-- 'thirdPartyFirewall', 'associateThirdPartyFirewall_thirdPartyFirewall' - The name of the third-party firewall vendor.
newAssociateThirdPartyFirewall ::
  -- | 'thirdPartyFirewall'
  ThirdPartyFirewall ->
  AssociateThirdPartyFirewall
newAssociateThirdPartyFirewall :: ThirdPartyFirewall -> AssociateThirdPartyFirewall
newAssociateThirdPartyFirewall ThirdPartyFirewall
pThirdPartyFirewall_ =
  AssociateThirdPartyFirewall'
    { $sel:thirdPartyFirewall:AssociateThirdPartyFirewall' :: ThirdPartyFirewall
thirdPartyFirewall =
        ThirdPartyFirewall
pThirdPartyFirewall_
    }

-- | The name of the third-party firewall vendor.
associateThirdPartyFirewall_thirdPartyFirewall :: Lens.Lens' AssociateThirdPartyFirewall ThirdPartyFirewall
associateThirdPartyFirewall_thirdPartyFirewall :: Lens' AssociateThirdPartyFirewall ThirdPartyFirewall
associateThirdPartyFirewall_thirdPartyFirewall = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateThirdPartyFirewall' {ThirdPartyFirewall
thirdPartyFirewall :: ThirdPartyFirewall
$sel:thirdPartyFirewall:AssociateThirdPartyFirewall' :: AssociateThirdPartyFirewall -> ThirdPartyFirewall
thirdPartyFirewall} -> ThirdPartyFirewall
thirdPartyFirewall) (\s :: AssociateThirdPartyFirewall
s@AssociateThirdPartyFirewall' {} ThirdPartyFirewall
a -> AssociateThirdPartyFirewall
s {$sel:thirdPartyFirewall:AssociateThirdPartyFirewall' :: ThirdPartyFirewall
thirdPartyFirewall = ThirdPartyFirewall
a} :: AssociateThirdPartyFirewall)

instance Core.AWSRequest AssociateThirdPartyFirewall where
  type
    AWSResponse AssociateThirdPartyFirewall =
      AssociateThirdPartyFirewallResponse
  request :: (Service -> Service)
-> AssociateThirdPartyFirewall
-> Request AssociateThirdPartyFirewall
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 AssociateThirdPartyFirewall
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse AssociateThirdPartyFirewall)))
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 ThirdPartyFirewallAssociationStatus
-> Int -> AssociateThirdPartyFirewallResponse
AssociateThirdPartyFirewallResponse'
            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
"ThirdPartyFirewallStatus")
            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 AssociateThirdPartyFirewall where
  hashWithSalt :: Int -> AssociateThirdPartyFirewall -> Int
hashWithSalt Int
_salt AssociateThirdPartyFirewall' {ThirdPartyFirewall
thirdPartyFirewall :: ThirdPartyFirewall
$sel:thirdPartyFirewall:AssociateThirdPartyFirewall' :: AssociateThirdPartyFirewall -> ThirdPartyFirewall
..} =
    Int
_salt forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ThirdPartyFirewall
thirdPartyFirewall

instance Prelude.NFData AssociateThirdPartyFirewall where
  rnf :: AssociateThirdPartyFirewall -> ()
rnf AssociateThirdPartyFirewall' {ThirdPartyFirewall
thirdPartyFirewall :: ThirdPartyFirewall
$sel:thirdPartyFirewall:AssociateThirdPartyFirewall' :: AssociateThirdPartyFirewall -> ThirdPartyFirewall
..} =
    forall a. NFData a => a -> ()
Prelude.rnf ThirdPartyFirewall
thirdPartyFirewall

instance Data.ToHeaders AssociateThirdPartyFirewall where
  toHeaders :: AssociateThirdPartyFirewall -> 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
"AWSFMS_20180101.AssociateThirdPartyFirewall" ::
                          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 AssociateThirdPartyFirewall where
  toJSON :: AssociateThirdPartyFirewall -> Value
toJSON AssociateThirdPartyFirewall' {ThirdPartyFirewall
thirdPartyFirewall :: ThirdPartyFirewall
$sel:thirdPartyFirewall:AssociateThirdPartyFirewall' :: AssociateThirdPartyFirewall -> ThirdPartyFirewall
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ forall a. a -> Maybe a
Prelude.Just
              (Key
"ThirdPartyFirewall" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= ThirdPartyFirewall
thirdPartyFirewall)
          ]
      )

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

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

-- | /See:/ 'newAssociateThirdPartyFirewallResponse' smart constructor.
data AssociateThirdPartyFirewallResponse = AssociateThirdPartyFirewallResponse'
  { -- | The current status for setting a Firewall Manager policy
    -- administrator\'s account as an administrator of the third-party firewall
    -- tenant.
    --
    -- -   @ONBOARDING@ - The Firewall Manager policy administrator is being
    --     designated as a tenant administrator.
    --
    -- -   @ONBOARD_COMPLETE@ - The Firewall Manager policy administrator is
    --     designated as a tenant administrator.
    --
    -- -   @OFFBOARDING@ - The Firewall Manager policy administrator is being
    --     removed as a tenant administrator.
    --
    -- -   @OFFBOARD_COMPLETE@ - The Firewall Manager policy administrator has
    --     been removed as a tenant administrator.
    --
    -- -   @NOT_EXIST@ - The Firewall Manager policy administrator doesn\'t
    --     exist as a tenant administrator.
    AssociateThirdPartyFirewallResponse
-> Maybe ThirdPartyFirewallAssociationStatus
thirdPartyFirewallStatus :: Prelude.Maybe ThirdPartyFirewallAssociationStatus,
    -- | The response's http status code.
    AssociateThirdPartyFirewallResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (AssociateThirdPartyFirewallResponse
-> AssociateThirdPartyFirewallResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateThirdPartyFirewallResponse
-> AssociateThirdPartyFirewallResponse -> Bool
$c/= :: AssociateThirdPartyFirewallResponse
-> AssociateThirdPartyFirewallResponse -> Bool
== :: AssociateThirdPartyFirewallResponse
-> AssociateThirdPartyFirewallResponse -> Bool
$c== :: AssociateThirdPartyFirewallResponse
-> AssociateThirdPartyFirewallResponse -> Bool
Prelude.Eq, ReadPrec [AssociateThirdPartyFirewallResponse]
ReadPrec AssociateThirdPartyFirewallResponse
Int -> ReadS AssociateThirdPartyFirewallResponse
ReadS [AssociateThirdPartyFirewallResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateThirdPartyFirewallResponse]
$creadListPrec :: ReadPrec [AssociateThirdPartyFirewallResponse]
readPrec :: ReadPrec AssociateThirdPartyFirewallResponse
$creadPrec :: ReadPrec AssociateThirdPartyFirewallResponse
readList :: ReadS [AssociateThirdPartyFirewallResponse]
$creadList :: ReadS [AssociateThirdPartyFirewallResponse]
readsPrec :: Int -> ReadS AssociateThirdPartyFirewallResponse
$creadsPrec :: Int -> ReadS AssociateThirdPartyFirewallResponse
Prelude.Read, Int -> AssociateThirdPartyFirewallResponse -> ShowS
[AssociateThirdPartyFirewallResponse] -> ShowS
AssociateThirdPartyFirewallResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateThirdPartyFirewallResponse] -> ShowS
$cshowList :: [AssociateThirdPartyFirewallResponse] -> ShowS
show :: AssociateThirdPartyFirewallResponse -> String
$cshow :: AssociateThirdPartyFirewallResponse -> String
showsPrec :: Int -> AssociateThirdPartyFirewallResponse -> ShowS
$cshowsPrec :: Int -> AssociateThirdPartyFirewallResponse -> ShowS
Prelude.Show, forall x.
Rep AssociateThirdPartyFirewallResponse x
-> AssociateThirdPartyFirewallResponse
forall x.
AssociateThirdPartyFirewallResponse
-> Rep AssociateThirdPartyFirewallResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateThirdPartyFirewallResponse x
-> AssociateThirdPartyFirewallResponse
$cfrom :: forall x.
AssociateThirdPartyFirewallResponse
-> Rep AssociateThirdPartyFirewallResponse x
Prelude.Generic)

-- |
-- Create a value of 'AssociateThirdPartyFirewallResponse' 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:
--
-- 'thirdPartyFirewallStatus', 'associateThirdPartyFirewallResponse_thirdPartyFirewallStatus' - The current status for setting a Firewall Manager policy
-- administrator\'s account as an administrator of the third-party firewall
-- tenant.
--
-- -   @ONBOARDING@ - The Firewall Manager policy administrator is being
--     designated as a tenant administrator.
--
-- -   @ONBOARD_COMPLETE@ - The Firewall Manager policy administrator is
--     designated as a tenant administrator.
--
-- -   @OFFBOARDING@ - The Firewall Manager policy administrator is being
--     removed as a tenant administrator.
--
-- -   @OFFBOARD_COMPLETE@ - The Firewall Manager policy administrator has
--     been removed as a tenant administrator.
--
-- -   @NOT_EXIST@ - The Firewall Manager policy administrator doesn\'t
--     exist as a tenant administrator.
--
-- 'httpStatus', 'associateThirdPartyFirewallResponse_httpStatus' - The response's http status code.
newAssociateThirdPartyFirewallResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  AssociateThirdPartyFirewallResponse
newAssociateThirdPartyFirewallResponse :: Int -> AssociateThirdPartyFirewallResponse
newAssociateThirdPartyFirewallResponse Int
pHttpStatus_ =
  AssociateThirdPartyFirewallResponse'
    { $sel:thirdPartyFirewallStatus:AssociateThirdPartyFirewallResponse' :: Maybe ThirdPartyFirewallAssociationStatus
thirdPartyFirewallStatus =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:AssociateThirdPartyFirewallResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The current status for setting a Firewall Manager policy
-- administrator\'s account as an administrator of the third-party firewall
-- tenant.
--
-- -   @ONBOARDING@ - The Firewall Manager policy administrator is being
--     designated as a tenant administrator.
--
-- -   @ONBOARD_COMPLETE@ - The Firewall Manager policy administrator is
--     designated as a tenant administrator.
--
-- -   @OFFBOARDING@ - The Firewall Manager policy administrator is being
--     removed as a tenant administrator.
--
-- -   @OFFBOARD_COMPLETE@ - The Firewall Manager policy administrator has
--     been removed as a tenant administrator.
--
-- -   @NOT_EXIST@ - The Firewall Manager policy administrator doesn\'t
--     exist as a tenant administrator.
associateThirdPartyFirewallResponse_thirdPartyFirewallStatus :: Lens.Lens' AssociateThirdPartyFirewallResponse (Prelude.Maybe ThirdPartyFirewallAssociationStatus)
associateThirdPartyFirewallResponse_thirdPartyFirewallStatus :: Lens'
  AssociateThirdPartyFirewallResponse
  (Maybe ThirdPartyFirewallAssociationStatus)
associateThirdPartyFirewallResponse_thirdPartyFirewallStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateThirdPartyFirewallResponse' {Maybe ThirdPartyFirewallAssociationStatus
thirdPartyFirewallStatus :: Maybe ThirdPartyFirewallAssociationStatus
$sel:thirdPartyFirewallStatus:AssociateThirdPartyFirewallResponse' :: AssociateThirdPartyFirewallResponse
-> Maybe ThirdPartyFirewallAssociationStatus
thirdPartyFirewallStatus} -> Maybe ThirdPartyFirewallAssociationStatus
thirdPartyFirewallStatus) (\s :: AssociateThirdPartyFirewallResponse
s@AssociateThirdPartyFirewallResponse' {} Maybe ThirdPartyFirewallAssociationStatus
a -> AssociateThirdPartyFirewallResponse
s {$sel:thirdPartyFirewallStatus:AssociateThirdPartyFirewallResponse' :: Maybe ThirdPartyFirewallAssociationStatus
thirdPartyFirewallStatus = Maybe ThirdPartyFirewallAssociationStatus
a} :: AssociateThirdPartyFirewallResponse)

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

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