{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# 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.Types.SecurityGroupRuleUpdate
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.EC2.Types.SecurityGroupRuleUpdate where

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

-- | Describes an update to a security group rule.
--
-- /See:/ 'newSecurityGroupRuleUpdate' smart constructor.
data SecurityGroupRuleUpdate = SecurityGroupRuleUpdate'
  { -- | Information about the security group rule.
    SecurityGroupRuleUpdate -> Maybe SecurityGroupRuleRequest
securityGroupRule :: Prelude.Maybe SecurityGroupRuleRequest,
    -- | The ID of the security group rule.
    SecurityGroupRuleUpdate -> Maybe Text
securityGroupRuleId :: Prelude.Maybe Prelude.Text
  }
  deriving (SecurityGroupRuleUpdate -> SecurityGroupRuleUpdate -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SecurityGroupRuleUpdate -> SecurityGroupRuleUpdate -> Bool
$c/= :: SecurityGroupRuleUpdate -> SecurityGroupRuleUpdate -> Bool
== :: SecurityGroupRuleUpdate -> SecurityGroupRuleUpdate -> Bool
$c== :: SecurityGroupRuleUpdate -> SecurityGroupRuleUpdate -> Bool
Prelude.Eq, ReadPrec [SecurityGroupRuleUpdate]
ReadPrec SecurityGroupRuleUpdate
Int -> ReadS SecurityGroupRuleUpdate
ReadS [SecurityGroupRuleUpdate]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SecurityGroupRuleUpdate]
$creadListPrec :: ReadPrec [SecurityGroupRuleUpdate]
readPrec :: ReadPrec SecurityGroupRuleUpdate
$creadPrec :: ReadPrec SecurityGroupRuleUpdate
readList :: ReadS [SecurityGroupRuleUpdate]
$creadList :: ReadS [SecurityGroupRuleUpdate]
readsPrec :: Int -> ReadS SecurityGroupRuleUpdate
$creadsPrec :: Int -> ReadS SecurityGroupRuleUpdate
Prelude.Read, Int -> SecurityGroupRuleUpdate -> ShowS
[SecurityGroupRuleUpdate] -> ShowS
SecurityGroupRuleUpdate -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SecurityGroupRuleUpdate] -> ShowS
$cshowList :: [SecurityGroupRuleUpdate] -> ShowS
show :: SecurityGroupRuleUpdate -> String
$cshow :: SecurityGroupRuleUpdate -> String
showsPrec :: Int -> SecurityGroupRuleUpdate -> ShowS
$cshowsPrec :: Int -> SecurityGroupRuleUpdate -> ShowS
Prelude.Show, forall x. Rep SecurityGroupRuleUpdate x -> SecurityGroupRuleUpdate
forall x. SecurityGroupRuleUpdate -> Rep SecurityGroupRuleUpdate x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SecurityGroupRuleUpdate x -> SecurityGroupRuleUpdate
$cfrom :: forall x. SecurityGroupRuleUpdate -> Rep SecurityGroupRuleUpdate x
Prelude.Generic)

-- |
-- Create a value of 'SecurityGroupRuleUpdate' 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:
--
-- 'securityGroupRule', 'securityGroupRuleUpdate_securityGroupRule' - Information about the security group rule.
--
-- 'securityGroupRuleId', 'securityGroupRuleUpdate_securityGroupRuleId' - The ID of the security group rule.
newSecurityGroupRuleUpdate ::
  SecurityGroupRuleUpdate
newSecurityGroupRuleUpdate :: SecurityGroupRuleUpdate
newSecurityGroupRuleUpdate =
  SecurityGroupRuleUpdate'
    { $sel:securityGroupRule:SecurityGroupRuleUpdate' :: Maybe SecurityGroupRuleRequest
securityGroupRule =
        forall a. Maybe a
Prelude.Nothing,
      $sel:securityGroupRuleId:SecurityGroupRuleUpdate' :: Maybe Text
securityGroupRuleId = forall a. Maybe a
Prelude.Nothing
    }

-- | Information about the security group rule.
securityGroupRuleUpdate_securityGroupRule :: Lens.Lens' SecurityGroupRuleUpdate (Prelude.Maybe SecurityGroupRuleRequest)
securityGroupRuleUpdate_securityGroupRule :: Lens' SecurityGroupRuleUpdate (Maybe SecurityGroupRuleRequest)
securityGroupRuleUpdate_securityGroupRule = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityGroupRuleUpdate' {Maybe SecurityGroupRuleRequest
securityGroupRule :: Maybe SecurityGroupRuleRequest
$sel:securityGroupRule:SecurityGroupRuleUpdate' :: SecurityGroupRuleUpdate -> Maybe SecurityGroupRuleRequest
securityGroupRule} -> Maybe SecurityGroupRuleRequest
securityGroupRule) (\s :: SecurityGroupRuleUpdate
s@SecurityGroupRuleUpdate' {} Maybe SecurityGroupRuleRequest
a -> SecurityGroupRuleUpdate
s {$sel:securityGroupRule:SecurityGroupRuleUpdate' :: Maybe SecurityGroupRuleRequest
securityGroupRule = Maybe SecurityGroupRuleRequest
a} :: SecurityGroupRuleUpdate)

-- | The ID of the security group rule.
securityGroupRuleUpdate_securityGroupRuleId :: Lens.Lens' SecurityGroupRuleUpdate (Prelude.Maybe Prelude.Text)
securityGroupRuleUpdate_securityGroupRuleId :: Lens' SecurityGroupRuleUpdate (Maybe Text)
securityGroupRuleUpdate_securityGroupRuleId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SecurityGroupRuleUpdate' {Maybe Text
securityGroupRuleId :: Maybe Text
$sel:securityGroupRuleId:SecurityGroupRuleUpdate' :: SecurityGroupRuleUpdate -> Maybe Text
securityGroupRuleId} -> Maybe Text
securityGroupRuleId) (\s :: SecurityGroupRuleUpdate
s@SecurityGroupRuleUpdate' {} Maybe Text
a -> SecurityGroupRuleUpdate
s {$sel:securityGroupRuleId:SecurityGroupRuleUpdate' :: Maybe Text
securityGroupRuleId = Maybe Text
a} :: SecurityGroupRuleUpdate)

instance Prelude.Hashable SecurityGroupRuleUpdate where
  hashWithSalt :: Int -> SecurityGroupRuleUpdate -> Int
hashWithSalt Int
_salt SecurityGroupRuleUpdate' {Maybe Text
Maybe SecurityGroupRuleRequest
securityGroupRuleId :: Maybe Text
securityGroupRule :: Maybe SecurityGroupRuleRequest
$sel:securityGroupRuleId:SecurityGroupRuleUpdate' :: SecurityGroupRuleUpdate -> Maybe Text
$sel:securityGroupRule:SecurityGroupRuleUpdate' :: SecurityGroupRuleUpdate -> Maybe SecurityGroupRuleRequest
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe SecurityGroupRuleRequest
securityGroupRule
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
securityGroupRuleId

instance Prelude.NFData SecurityGroupRuleUpdate where
  rnf :: SecurityGroupRuleUpdate -> ()
rnf SecurityGroupRuleUpdate' {Maybe Text
Maybe SecurityGroupRuleRequest
securityGroupRuleId :: Maybe Text
securityGroupRule :: Maybe SecurityGroupRuleRequest
$sel:securityGroupRuleId:SecurityGroupRuleUpdate' :: SecurityGroupRuleUpdate -> Maybe Text
$sel:securityGroupRule:SecurityGroupRuleUpdate' :: SecurityGroupRuleUpdate -> Maybe SecurityGroupRuleRequest
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe SecurityGroupRuleRequest
securityGroupRule
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
securityGroupRuleId

instance Data.ToQuery SecurityGroupRuleUpdate where
  toQuery :: SecurityGroupRuleUpdate -> QueryString
toQuery SecurityGroupRuleUpdate' {Maybe Text
Maybe SecurityGroupRuleRequest
securityGroupRuleId :: Maybe Text
securityGroupRule :: Maybe SecurityGroupRuleRequest
$sel:securityGroupRuleId:SecurityGroupRuleUpdate' :: SecurityGroupRuleUpdate -> Maybe Text
$sel:securityGroupRule:SecurityGroupRuleUpdate' :: SecurityGroupRuleUpdate -> Maybe SecurityGroupRuleRequest
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"SecurityGroupRule" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe SecurityGroupRuleRequest
securityGroupRule,
        ByteString
"SecurityGroupRuleId" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Maybe Text
securityGroupRuleId
      ]