{-# 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.ELBV2.ModifyTargetGroupAttributes
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Modifies the specified attributes of the specified target group.
module Amazonka.ELBV2.ModifyTargetGroupAttributes
  ( -- * Creating a Request
    ModifyTargetGroupAttributes (..),
    newModifyTargetGroupAttributes,

    -- * Request Lenses
    modifyTargetGroupAttributes_targetGroupArn,
    modifyTargetGroupAttributes_attributes,

    -- * Destructuring the Response
    ModifyTargetGroupAttributesResponse (..),
    newModifyTargetGroupAttributesResponse,

    -- * Response Lenses
    modifyTargetGroupAttributesResponse_attributes,
    modifyTargetGroupAttributesResponse_httpStatus,
  )
where

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

-- | /See:/ 'newModifyTargetGroupAttributes' smart constructor.
data ModifyTargetGroupAttributes = ModifyTargetGroupAttributes'
  { -- | The Amazon Resource Name (ARN) of the target group.
    ModifyTargetGroupAttributes -> Text
targetGroupArn :: Prelude.Text,
    -- | The attributes.
    ModifyTargetGroupAttributes -> [TargetGroupAttribute]
attributes :: [TargetGroupAttribute]
  }
  deriving (ModifyTargetGroupAttributes -> ModifyTargetGroupAttributes -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ModifyTargetGroupAttributes -> ModifyTargetGroupAttributes -> Bool
$c/= :: ModifyTargetGroupAttributes -> ModifyTargetGroupAttributes -> Bool
== :: ModifyTargetGroupAttributes -> ModifyTargetGroupAttributes -> Bool
$c== :: ModifyTargetGroupAttributes -> ModifyTargetGroupAttributes -> Bool
Prelude.Eq, ReadPrec [ModifyTargetGroupAttributes]
ReadPrec ModifyTargetGroupAttributes
Int -> ReadS ModifyTargetGroupAttributes
ReadS [ModifyTargetGroupAttributes]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ModifyTargetGroupAttributes]
$creadListPrec :: ReadPrec [ModifyTargetGroupAttributes]
readPrec :: ReadPrec ModifyTargetGroupAttributes
$creadPrec :: ReadPrec ModifyTargetGroupAttributes
readList :: ReadS [ModifyTargetGroupAttributes]
$creadList :: ReadS [ModifyTargetGroupAttributes]
readsPrec :: Int -> ReadS ModifyTargetGroupAttributes
$creadsPrec :: Int -> ReadS ModifyTargetGroupAttributes
Prelude.Read, Int -> ModifyTargetGroupAttributes -> ShowS
[ModifyTargetGroupAttributes] -> ShowS
ModifyTargetGroupAttributes -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ModifyTargetGroupAttributes] -> ShowS
$cshowList :: [ModifyTargetGroupAttributes] -> ShowS
show :: ModifyTargetGroupAttributes -> String
$cshow :: ModifyTargetGroupAttributes -> String
showsPrec :: Int -> ModifyTargetGroupAttributes -> ShowS
$cshowsPrec :: Int -> ModifyTargetGroupAttributes -> ShowS
Prelude.Show, forall x.
Rep ModifyTargetGroupAttributes x -> ModifyTargetGroupAttributes
forall x.
ModifyTargetGroupAttributes -> Rep ModifyTargetGroupAttributes x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep ModifyTargetGroupAttributes x -> ModifyTargetGroupAttributes
$cfrom :: forall x.
ModifyTargetGroupAttributes -> Rep ModifyTargetGroupAttributes x
Prelude.Generic)

-- |
-- Create a value of 'ModifyTargetGroupAttributes' 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:
--
-- 'targetGroupArn', 'modifyTargetGroupAttributes_targetGroupArn' - The Amazon Resource Name (ARN) of the target group.
--
-- 'attributes', 'modifyTargetGroupAttributes_attributes' - The attributes.
newModifyTargetGroupAttributes ::
  -- | 'targetGroupArn'
  Prelude.Text ->
  ModifyTargetGroupAttributes
newModifyTargetGroupAttributes :: Text -> ModifyTargetGroupAttributes
newModifyTargetGroupAttributes Text
pTargetGroupArn_ =
  ModifyTargetGroupAttributes'
    { $sel:targetGroupArn:ModifyTargetGroupAttributes' :: Text
targetGroupArn =
        Text
pTargetGroupArn_,
      $sel:attributes:ModifyTargetGroupAttributes' :: [TargetGroupAttribute]
attributes = forall a. Monoid a => a
Prelude.mempty
    }

-- | The Amazon Resource Name (ARN) of the target group.
modifyTargetGroupAttributes_targetGroupArn :: Lens.Lens' ModifyTargetGroupAttributes Prelude.Text
modifyTargetGroupAttributes_targetGroupArn :: Lens' ModifyTargetGroupAttributes Text
modifyTargetGroupAttributes_targetGroupArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyTargetGroupAttributes' {Text
targetGroupArn :: Text
$sel:targetGroupArn:ModifyTargetGroupAttributes' :: ModifyTargetGroupAttributes -> Text
targetGroupArn} -> Text
targetGroupArn) (\s :: ModifyTargetGroupAttributes
s@ModifyTargetGroupAttributes' {} Text
a -> ModifyTargetGroupAttributes
s {$sel:targetGroupArn:ModifyTargetGroupAttributes' :: Text
targetGroupArn = Text
a} :: ModifyTargetGroupAttributes)

-- | The attributes.
modifyTargetGroupAttributes_attributes :: Lens.Lens' ModifyTargetGroupAttributes [TargetGroupAttribute]
modifyTargetGroupAttributes_attributes :: Lens' ModifyTargetGroupAttributes [TargetGroupAttribute]
modifyTargetGroupAttributes_attributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyTargetGroupAttributes' {[TargetGroupAttribute]
attributes :: [TargetGroupAttribute]
$sel:attributes:ModifyTargetGroupAttributes' :: ModifyTargetGroupAttributes -> [TargetGroupAttribute]
attributes} -> [TargetGroupAttribute]
attributes) (\s :: ModifyTargetGroupAttributes
s@ModifyTargetGroupAttributes' {} [TargetGroupAttribute]
a -> ModifyTargetGroupAttributes
s {$sel:attributes:ModifyTargetGroupAttributes' :: [TargetGroupAttribute]
attributes = [TargetGroupAttribute]
a} :: ModifyTargetGroupAttributes) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

instance Core.AWSRequest ModifyTargetGroupAttributes where
  type
    AWSResponse ModifyTargetGroupAttributes =
      ModifyTargetGroupAttributesResponse
  request :: (Service -> Service)
-> ModifyTargetGroupAttributes
-> Request ModifyTargetGroupAttributes
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 ModifyTargetGroupAttributes
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse ModifyTargetGroupAttributes)))
response =
    forall (m :: * -> *) a.
MonadResource m =>
Text
-> (Int
    -> ResponseHeaders -> [Node] -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveXMLWrapper
      Text
"ModifyTargetGroupAttributesResult"
      ( \Int
s ResponseHeaders
h [Node]
x ->
          Maybe [TargetGroupAttribute]
-> Int -> ModifyTargetGroupAttributesResponse
ModifyTargetGroupAttributesResponse'
            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
"Attributes"
                            forall (f :: * -> *) a. Functor f => f (Maybe a) -> a -> f a
Core..!@ forall a. Monoid a => a
Prelude.mempty
                            forall (m :: * -> *) a b. Monad m => m a -> (a -> m b) -> m b
Prelude.>>= forall (f :: * -> *) a b.
Applicative f =>
([a] -> f b) -> [a] -> f (Maybe b)
Core.may (forall a. FromXML a => Text -> [Node] -> Either String [a]
Data.parseXMLList Text
"member")
                        )
            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 ModifyTargetGroupAttributes where
  hashWithSalt :: Int -> ModifyTargetGroupAttributes -> Int
hashWithSalt Int
_salt ModifyTargetGroupAttributes' {[TargetGroupAttribute]
Text
attributes :: [TargetGroupAttribute]
targetGroupArn :: Text
$sel:attributes:ModifyTargetGroupAttributes' :: ModifyTargetGroupAttributes -> [TargetGroupAttribute]
$sel:targetGroupArn:ModifyTargetGroupAttributes' :: ModifyTargetGroupAttributes -> Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
targetGroupArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` [TargetGroupAttribute]
attributes

instance Prelude.NFData ModifyTargetGroupAttributes where
  rnf :: ModifyTargetGroupAttributes -> ()
rnf ModifyTargetGroupAttributes' {[TargetGroupAttribute]
Text
attributes :: [TargetGroupAttribute]
targetGroupArn :: Text
$sel:attributes:ModifyTargetGroupAttributes' :: ModifyTargetGroupAttributes -> [TargetGroupAttribute]
$sel:targetGroupArn:ModifyTargetGroupAttributes' :: ModifyTargetGroupAttributes -> Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Text
targetGroupArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf [TargetGroupAttribute]
attributes

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

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

instance Data.ToQuery ModifyTargetGroupAttributes where
  toQuery :: ModifyTargetGroupAttributes -> QueryString
toQuery ModifyTargetGroupAttributes' {[TargetGroupAttribute]
Text
attributes :: [TargetGroupAttribute]
targetGroupArn :: Text
$sel:attributes:ModifyTargetGroupAttributes' :: ModifyTargetGroupAttributes -> [TargetGroupAttribute]
$sel:targetGroupArn:ModifyTargetGroupAttributes' :: ModifyTargetGroupAttributes -> Text
..} =
    forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"Action"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: ( ByteString
"ModifyTargetGroupAttributes" ::
                      Prelude.ByteString
                  ),
        ByteString
"Version"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: (ByteString
"2015-12-01" :: Prelude.ByteString),
        ByteString
"TargetGroupArn" forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: Text
targetGroupArn,
        ByteString
"Attributes"
          forall a. ToQuery a => ByteString -> a -> QueryString
Data.=: forall a.
(IsList a, ToQuery (Item a)) =>
ByteString -> a -> QueryString
Data.toQueryList ByteString
"member" [TargetGroupAttribute]
attributes
      ]

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

-- |
-- Create a value of 'ModifyTargetGroupAttributesResponse' 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:
--
-- 'attributes', 'modifyTargetGroupAttributesResponse_attributes' - Information about the attributes.
--
-- 'httpStatus', 'modifyTargetGroupAttributesResponse_httpStatus' - The response's http status code.
newModifyTargetGroupAttributesResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  ModifyTargetGroupAttributesResponse
newModifyTargetGroupAttributesResponse :: Int -> ModifyTargetGroupAttributesResponse
newModifyTargetGroupAttributesResponse Int
pHttpStatus_ =
  ModifyTargetGroupAttributesResponse'
    { $sel:attributes:ModifyTargetGroupAttributesResponse' :: Maybe [TargetGroupAttribute]
attributes =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:ModifyTargetGroupAttributesResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about the attributes.
modifyTargetGroupAttributesResponse_attributes :: Lens.Lens' ModifyTargetGroupAttributesResponse (Prelude.Maybe [TargetGroupAttribute])
modifyTargetGroupAttributesResponse_attributes :: Lens'
  ModifyTargetGroupAttributesResponse (Maybe [TargetGroupAttribute])
modifyTargetGroupAttributesResponse_attributes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ModifyTargetGroupAttributesResponse' {Maybe [TargetGroupAttribute]
attributes :: Maybe [TargetGroupAttribute]
$sel:attributes:ModifyTargetGroupAttributesResponse' :: ModifyTargetGroupAttributesResponse -> Maybe [TargetGroupAttribute]
attributes} -> Maybe [TargetGroupAttribute]
attributes) (\s :: ModifyTargetGroupAttributesResponse
s@ModifyTargetGroupAttributesResponse' {} Maybe [TargetGroupAttribute]
a -> ModifyTargetGroupAttributesResponse
s {$sel:attributes:ModifyTargetGroupAttributesResponse' :: Maybe [TargetGroupAttribute]
attributes = Maybe [TargetGroupAttribute]
a} :: ModifyTargetGroupAttributesResponse) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

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

instance
  Prelude.NFData
    ModifyTargetGroupAttributesResponse
  where
  rnf :: ModifyTargetGroupAttributesResponse -> ()
rnf ModifyTargetGroupAttributesResponse' {Int
Maybe [TargetGroupAttribute]
httpStatus :: Int
attributes :: Maybe [TargetGroupAttribute]
$sel:httpStatus:ModifyTargetGroupAttributesResponse' :: ModifyTargetGroupAttributesResponse -> Int
$sel:attributes:ModifyTargetGroupAttributesResponse' :: ModifyTargetGroupAttributesResponse -> Maybe [TargetGroupAttribute]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [TargetGroupAttribute]
attributes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus