{-# 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.GlobalAccelerator.UpdateEndpointGroup
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Update an endpoint group. A resource must be valid and active when you
-- add it as an endpoint.
module Amazonka.GlobalAccelerator.UpdateEndpointGroup
  ( -- * Creating a Request
    UpdateEndpointGroup (..),
    newUpdateEndpointGroup,

    -- * Request Lenses
    updateEndpointGroup_endpointConfigurations,
    updateEndpointGroup_healthCheckIntervalSeconds,
    updateEndpointGroup_healthCheckPath,
    updateEndpointGroup_healthCheckPort,
    updateEndpointGroup_healthCheckProtocol,
    updateEndpointGroup_portOverrides,
    updateEndpointGroup_thresholdCount,
    updateEndpointGroup_trafficDialPercentage,
    updateEndpointGroup_endpointGroupArn,

    -- * Destructuring the Response
    UpdateEndpointGroupResponse (..),
    newUpdateEndpointGroupResponse,

    -- * Response Lenses
    updateEndpointGroupResponse_endpointGroup,
    updateEndpointGroupResponse_httpStatus,
  )
where

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

-- | /See:/ 'newUpdateEndpointGroup' smart constructor.
data UpdateEndpointGroup = UpdateEndpointGroup'
  { -- | The list of endpoint objects. A resource must be valid and active when
    -- you add it as an endpoint.
    UpdateEndpointGroup -> Maybe [EndpointConfiguration]
endpointConfigurations :: Prelude.Maybe [EndpointConfiguration],
    -- | The time—10 seconds or 30 seconds—between each health check for an
    -- endpoint. The default value is 30.
    UpdateEndpointGroup -> Maybe Natural
healthCheckIntervalSeconds :: Prelude.Maybe Prelude.Natural,
    -- | If the protocol is HTTP\/S, then this specifies the path that is the
    -- destination for health check targets. The default value is slash (\/).
    UpdateEndpointGroup -> Maybe Text
healthCheckPath :: Prelude.Maybe Prelude.Text,
    -- | The port that Global Accelerator uses to check the health of endpoints
    -- that are part of this endpoint group. The default port is the listener
    -- port that this endpoint group is associated with. If the listener port
    -- is a list of ports, Global Accelerator uses the first port in the list.
    UpdateEndpointGroup -> Maybe Natural
healthCheckPort :: Prelude.Maybe Prelude.Natural,
    -- | The protocol that Global Accelerator uses to check the health of
    -- endpoints that are part of this endpoint group. The default value is
    -- TCP.
    UpdateEndpointGroup -> Maybe HealthCheckProtocol
healthCheckProtocol :: Prelude.Maybe HealthCheckProtocol,
    -- | Override specific listener ports used to route traffic to endpoints that
    -- are part of this endpoint group. For example, you can create a port
    -- override in which the listener receives user traffic on ports 80 and
    -- 443, but your accelerator routes that traffic to ports 1080 and 1443,
    -- respectively, on the endpoints.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/global-accelerator/latest/dg/about-endpoint-groups-port-override.html Overriding listener ports>
    -- in the /Global Accelerator Developer Guide/.
    UpdateEndpointGroup -> Maybe [PortOverride]
portOverrides :: Prelude.Maybe [PortOverride],
    -- | The number of consecutive health checks required to set the state of a
    -- healthy endpoint to unhealthy, or to set an unhealthy endpoint to
    -- healthy. The default value is 3.
    UpdateEndpointGroup -> Maybe Natural
thresholdCount :: Prelude.Maybe Prelude.Natural,
    -- | The percentage of traffic to send to an Amazon Web Services Region.
    -- Additional traffic is distributed to other endpoint groups for this
    -- listener.
    --
    -- Use this action to increase (dial up) or decrease (dial down) traffic to
    -- a specific Region. The percentage is applied to the traffic that would
    -- otherwise have been routed to the Region based on optimal routing.
    --
    -- The default value is 100.
    UpdateEndpointGroup -> Maybe Double
trafficDialPercentage :: Prelude.Maybe Prelude.Double,
    -- | The Amazon Resource Name (ARN) of the endpoint group.
    UpdateEndpointGroup -> Text
endpointGroupArn :: Prelude.Text
  }
  deriving (UpdateEndpointGroup -> UpdateEndpointGroup -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateEndpointGroup -> UpdateEndpointGroup -> Bool
$c/= :: UpdateEndpointGroup -> UpdateEndpointGroup -> Bool
== :: UpdateEndpointGroup -> UpdateEndpointGroup -> Bool
$c== :: UpdateEndpointGroup -> UpdateEndpointGroup -> Bool
Prelude.Eq, ReadPrec [UpdateEndpointGroup]
ReadPrec UpdateEndpointGroup
Int -> ReadS UpdateEndpointGroup
ReadS [UpdateEndpointGroup]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateEndpointGroup]
$creadListPrec :: ReadPrec [UpdateEndpointGroup]
readPrec :: ReadPrec UpdateEndpointGroup
$creadPrec :: ReadPrec UpdateEndpointGroup
readList :: ReadS [UpdateEndpointGroup]
$creadList :: ReadS [UpdateEndpointGroup]
readsPrec :: Int -> ReadS UpdateEndpointGroup
$creadsPrec :: Int -> ReadS UpdateEndpointGroup
Prelude.Read, Int -> UpdateEndpointGroup -> ShowS
[UpdateEndpointGroup] -> ShowS
UpdateEndpointGroup -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateEndpointGroup] -> ShowS
$cshowList :: [UpdateEndpointGroup] -> ShowS
show :: UpdateEndpointGroup -> String
$cshow :: UpdateEndpointGroup -> String
showsPrec :: Int -> UpdateEndpointGroup -> ShowS
$cshowsPrec :: Int -> UpdateEndpointGroup -> ShowS
Prelude.Show, forall x. Rep UpdateEndpointGroup x -> UpdateEndpointGroup
forall x. UpdateEndpointGroup -> Rep UpdateEndpointGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateEndpointGroup x -> UpdateEndpointGroup
$cfrom :: forall x. UpdateEndpointGroup -> Rep UpdateEndpointGroup x
Prelude.Generic)

-- |
-- Create a value of 'UpdateEndpointGroup' 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:
--
-- 'endpointConfigurations', 'updateEndpointGroup_endpointConfigurations' - The list of endpoint objects. A resource must be valid and active when
-- you add it as an endpoint.
--
-- 'healthCheckIntervalSeconds', 'updateEndpointGroup_healthCheckIntervalSeconds' - The time—10 seconds or 30 seconds—between each health check for an
-- endpoint. The default value is 30.
--
-- 'healthCheckPath', 'updateEndpointGroup_healthCheckPath' - If the protocol is HTTP\/S, then this specifies the path that is the
-- destination for health check targets. The default value is slash (\/).
--
-- 'healthCheckPort', 'updateEndpointGroup_healthCheckPort' - The port that Global Accelerator uses to check the health of endpoints
-- that are part of this endpoint group. The default port is the listener
-- port that this endpoint group is associated with. If the listener port
-- is a list of ports, Global Accelerator uses the first port in the list.
--
-- 'healthCheckProtocol', 'updateEndpointGroup_healthCheckProtocol' - The protocol that Global Accelerator uses to check the health of
-- endpoints that are part of this endpoint group. The default value is
-- TCP.
--
-- 'portOverrides', 'updateEndpointGroup_portOverrides' - Override specific listener ports used to route traffic to endpoints that
-- are part of this endpoint group. For example, you can create a port
-- override in which the listener receives user traffic on ports 80 and
-- 443, but your accelerator routes that traffic to ports 1080 and 1443,
-- respectively, on the endpoints.
--
-- For more information, see
-- <https://docs.aws.amazon.com/global-accelerator/latest/dg/about-endpoint-groups-port-override.html Overriding listener ports>
-- in the /Global Accelerator Developer Guide/.
--
-- 'thresholdCount', 'updateEndpointGroup_thresholdCount' - The number of consecutive health checks required to set the state of a
-- healthy endpoint to unhealthy, or to set an unhealthy endpoint to
-- healthy. The default value is 3.
--
-- 'trafficDialPercentage', 'updateEndpointGroup_trafficDialPercentage' - The percentage of traffic to send to an Amazon Web Services Region.
-- Additional traffic is distributed to other endpoint groups for this
-- listener.
--
-- Use this action to increase (dial up) or decrease (dial down) traffic to
-- a specific Region. The percentage is applied to the traffic that would
-- otherwise have been routed to the Region based on optimal routing.
--
-- The default value is 100.
--
-- 'endpointGroupArn', 'updateEndpointGroup_endpointGroupArn' - The Amazon Resource Name (ARN) of the endpoint group.
newUpdateEndpointGroup ::
  -- | 'endpointGroupArn'
  Prelude.Text ->
  UpdateEndpointGroup
newUpdateEndpointGroup :: Text -> UpdateEndpointGroup
newUpdateEndpointGroup Text
pEndpointGroupArn_ =
  UpdateEndpointGroup'
    { $sel:endpointConfigurations:UpdateEndpointGroup' :: Maybe [EndpointConfiguration]
endpointConfigurations =
        forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckIntervalSeconds:UpdateEndpointGroup' :: Maybe Natural
healthCheckIntervalSeconds = forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckPath:UpdateEndpointGroup' :: Maybe Text
healthCheckPath = forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckPort:UpdateEndpointGroup' :: Maybe Natural
healthCheckPort = forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckProtocol:UpdateEndpointGroup' :: Maybe HealthCheckProtocol
healthCheckProtocol = forall a. Maybe a
Prelude.Nothing,
      $sel:portOverrides:UpdateEndpointGroup' :: Maybe [PortOverride]
portOverrides = forall a. Maybe a
Prelude.Nothing,
      $sel:thresholdCount:UpdateEndpointGroup' :: Maybe Natural
thresholdCount = forall a. Maybe a
Prelude.Nothing,
      $sel:trafficDialPercentage:UpdateEndpointGroup' :: Maybe Double
trafficDialPercentage = forall a. Maybe a
Prelude.Nothing,
      $sel:endpointGroupArn:UpdateEndpointGroup' :: Text
endpointGroupArn = Text
pEndpointGroupArn_
    }

-- | The list of endpoint objects. A resource must be valid and active when
-- you add it as an endpoint.
updateEndpointGroup_endpointConfigurations :: Lens.Lens' UpdateEndpointGroup (Prelude.Maybe [EndpointConfiguration])
updateEndpointGroup_endpointConfigurations :: Lens' UpdateEndpointGroup (Maybe [EndpointConfiguration])
updateEndpointGroup_endpointConfigurations = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEndpointGroup' {Maybe [EndpointConfiguration]
endpointConfigurations :: Maybe [EndpointConfiguration]
$sel:endpointConfigurations:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe [EndpointConfiguration]
endpointConfigurations} -> Maybe [EndpointConfiguration]
endpointConfigurations) (\s :: UpdateEndpointGroup
s@UpdateEndpointGroup' {} Maybe [EndpointConfiguration]
a -> UpdateEndpointGroup
s {$sel:endpointConfigurations:UpdateEndpointGroup' :: Maybe [EndpointConfiguration]
endpointConfigurations = Maybe [EndpointConfiguration]
a} :: UpdateEndpointGroup) 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 time—10 seconds or 30 seconds—between each health check for an
-- endpoint. The default value is 30.
updateEndpointGroup_healthCheckIntervalSeconds :: Lens.Lens' UpdateEndpointGroup (Prelude.Maybe Prelude.Natural)
updateEndpointGroup_healthCheckIntervalSeconds :: Lens' UpdateEndpointGroup (Maybe Natural)
updateEndpointGroup_healthCheckIntervalSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEndpointGroup' {Maybe Natural
healthCheckIntervalSeconds :: Maybe Natural
$sel:healthCheckIntervalSeconds:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Natural
healthCheckIntervalSeconds} -> Maybe Natural
healthCheckIntervalSeconds) (\s :: UpdateEndpointGroup
s@UpdateEndpointGroup' {} Maybe Natural
a -> UpdateEndpointGroup
s {$sel:healthCheckIntervalSeconds:UpdateEndpointGroup' :: Maybe Natural
healthCheckIntervalSeconds = Maybe Natural
a} :: UpdateEndpointGroup)

-- | If the protocol is HTTP\/S, then this specifies the path that is the
-- destination for health check targets. The default value is slash (\/).
updateEndpointGroup_healthCheckPath :: Lens.Lens' UpdateEndpointGroup (Prelude.Maybe Prelude.Text)
updateEndpointGroup_healthCheckPath :: Lens' UpdateEndpointGroup (Maybe Text)
updateEndpointGroup_healthCheckPath = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEndpointGroup' {Maybe Text
healthCheckPath :: Maybe Text
$sel:healthCheckPath:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Text
healthCheckPath} -> Maybe Text
healthCheckPath) (\s :: UpdateEndpointGroup
s@UpdateEndpointGroup' {} Maybe Text
a -> UpdateEndpointGroup
s {$sel:healthCheckPath:UpdateEndpointGroup' :: Maybe Text
healthCheckPath = Maybe Text
a} :: UpdateEndpointGroup)

-- | The port that Global Accelerator uses to check the health of endpoints
-- that are part of this endpoint group. The default port is the listener
-- port that this endpoint group is associated with. If the listener port
-- is a list of ports, Global Accelerator uses the first port in the list.
updateEndpointGroup_healthCheckPort :: Lens.Lens' UpdateEndpointGroup (Prelude.Maybe Prelude.Natural)
updateEndpointGroup_healthCheckPort :: Lens' UpdateEndpointGroup (Maybe Natural)
updateEndpointGroup_healthCheckPort = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEndpointGroup' {Maybe Natural
healthCheckPort :: Maybe Natural
$sel:healthCheckPort:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Natural
healthCheckPort} -> Maybe Natural
healthCheckPort) (\s :: UpdateEndpointGroup
s@UpdateEndpointGroup' {} Maybe Natural
a -> UpdateEndpointGroup
s {$sel:healthCheckPort:UpdateEndpointGroup' :: Maybe Natural
healthCheckPort = Maybe Natural
a} :: UpdateEndpointGroup)

-- | The protocol that Global Accelerator uses to check the health of
-- endpoints that are part of this endpoint group. The default value is
-- TCP.
updateEndpointGroup_healthCheckProtocol :: Lens.Lens' UpdateEndpointGroup (Prelude.Maybe HealthCheckProtocol)
updateEndpointGroup_healthCheckProtocol :: Lens' UpdateEndpointGroup (Maybe HealthCheckProtocol)
updateEndpointGroup_healthCheckProtocol = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEndpointGroup' {Maybe HealthCheckProtocol
healthCheckProtocol :: Maybe HealthCheckProtocol
$sel:healthCheckProtocol:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe HealthCheckProtocol
healthCheckProtocol} -> Maybe HealthCheckProtocol
healthCheckProtocol) (\s :: UpdateEndpointGroup
s@UpdateEndpointGroup' {} Maybe HealthCheckProtocol
a -> UpdateEndpointGroup
s {$sel:healthCheckProtocol:UpdateEndpointGroup' :: Maybe HealthCheckProtocol
healthCheckProtocol = Maybe HealthCheckProtocol
a} :: UpdateEndpointGroup)

-- | Override specific listener ports used to route traffic to endpoints that
-- are part of this endpoint group. For example, you can create a port
-- override in which the listener receives user traffic on ports 80 and
-- 443, but your accelerator routes that traffic to ports 1080 and 1443,
-- respectively, on the endpoints.
--
-- For more information, see
-- <https://docs.aws.amazon.com/global-accelerator/latest/dg/about-endpoint-groups-port-override.html Overriding listener ports>
-- in the /Global Accelerator Developer Guide/.
updateEndpointGroup_portOverrides :: Lens.Lens' UpdateEndpointGroup (Prelude.Maybe [PortOverride])
updateEndpointGroup_portOverrides :: Lens' UpdateEndpointGroup (Maybe [PortOverride])
updateEndpointGroup_portOverrides = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEndpointGroup' {Maybe [PortOverride]
portOverrides :: Maybe [PortOverride]
$sel:portOverrides:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe [PortOverride]
portOverrides} -> Maybe [PortOverride]
portOverrides) (\s :: UpdateEndpointGroup
s@UpdateEndpointGroup' {} Maybe [PortOverride]
a -> UpdateEndpointGroup
s {$sel:portOverrides:UpdateEndpointGroup' :: Maybe [PortOverride]
portOverrides = Maybe [PortOverride]
a} :: UpdateEndpointGroup) 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 number of consecutive health checks required to set the state of a
-- healthy endpoint to unhealthy, or to set an unhealthy endpoint to
-- healthy. The default value is 3.
updateEndpointGroup_thresholdCount :: Lens.Lens' UpdateEndpointGroup (Prelude.Maybe Prelude.Natural)
updateEndpointGroup_thresholdCount :: Lens' UpdateEndpointGroup (Maybe Natural)
updateEndpointGroup_thresholdCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEndpointGroup' {Maybe Natural
thresholdCount :: Maybe Natural
$sel:thresholdCount:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Natural
thresholdCount} -> Maybe Natural
thresholdCount) (\s :: UpdateEndpointGroup
s@UpdateEndpointGroup' {} Maybe Natural
a -> UpdateEndpointGroup
s {$sel:thresholdCount:UpdateEndpointGroup' :: Maybe Natural
thresholdCount = Maybe Natural
a} :: UpdateEndpointGroup)

-- | The percentage of traffic to send to an Amazon Web Services Region.
-- Additional traffic is distributed to other endpoint groups for this
-- listener.
--
-- Use this action to increase (dial up) or decrease (dial down) traffic to
-- a specific Region. The percentage is applied to the traffic that would
-- otherwise have been routed to the Region based on optimal routing.
--
-- The default value is 100.
updateEndpointGroup_trafficDialPercentage :: Lens.Lens' UpdateEndpointGroup (Prelude.Maybe Prelude.Double)
updateEndpointGroup_trafficDialPercentage :: Lens' UpdateEndpointGroup (Maybe Double)
updateEndpointGroup_trafficDialPercentage = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEndpointGroup' {Maybe Double
trafficDialPercentage :: Maybe Double
$sel:trafficDialPercentage:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Double
trafficDialPercentage} -> Maybe Double
trafficDialPercentage) (\s :: UpdateEndpointGroup
s@UpdateEndpointGroup' {} Maybe Double
a -> UpdateEndpointGroup
s {$sel:trafficDialPercentage:UpdateEndpointGroup' :: Maybe Double
trafficDialPercentage = Maybe Double
a} :: UpdateEndpointGroup)

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

instance Core.AWSRequest UpdateEndpointGroup where
  type
    AWSResponse UpdateEndpointGroup =
      UpdateEndpointGroupResponse
  request :: (Service -> Service)
-> UpdateEndpointGroup -> Request UpdateEndpointGroup
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 UpdateEndpointGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateEndpointGroup)))
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 EndpointGroup -> Int -> UpdateEndpointGroupResponse
UpdateEndpointGroupResponse'
            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
"EndpointGroup")
            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 UpdateEndpointGroup where
  hashWithSalt :: Int -> UpdateEndpointGroup -> Int
hashWithSalt Int
_salt UpdateEndpointGroup' {Maybe Double
Maybe Natural
Maybe [EndpointConfiguration]
Maybe [PortOverride]
Maybe Text
Maybe HealthCheckProtocol
Text
endpointGroupArn :: Text
trafficDialPercentage :: Maybe Double
thresholdCount :: Maybe Natural
portOverrides :: Maybe [PortOverride]
healthCheckProtocol :: Maybe HealthCheckProtocol
healthCheckPort :: Maybe Natural
healthCheckPath :: Maybe Text
healthCheckIntervalSeconds :: Maybe Natural
endpointConfigurations :: Maybe [EndpointConfiguration]
$sel:endpointGroupArn:UpdateEndpointGroup' :: UpdateEndpointGroup -> Text
$sel:trafficDialPercentage:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Double
$sel:thresholdCount:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Natural
$sel:portOverrides:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe [PortOverride]
$sel:healthCheckProtocol:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe HealthCheckProtocol
$sel:healthCheckPort:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Natural
$sel:healthCheckPath:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Text
$sel:healthCheckIntervalSeconds:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Natural
$sel:endpointConfigurations:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe [EndpointConfiguration]
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [EndpointConfiguration]
endpointConfigurations
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
healthCheckIntervalSeconds
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
healthCheckPath
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
healthCheckPort
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe HealthCheckProtocol
healthCheckProtocol
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [PortOverride]
portOverrides
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
thresholdCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Double
trafficDialPercentage
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
endpointGroupArn

instance Prelude.NFData UpdateEndpointGroup where
  rnf :: UpdateEndpointGroup -> ()
rnf UpdateEndpointGroup' {Maybe Double
Maybe Natural
Maybe [EndpointConfiguration]
Maybe [PortOverride]
Maybe Text
Maybe HealthCheckProtocol
Text
endpointGroupArn :: Text
trafficDialPercentage :: Maybe Double
thresholdCount :: Maybe Natural
portOverrides :: Maybe [PortOverride]
healthCheckProtocol :: Maybe HealthCheckProtocol
healthCheckPort :: Maybe Natural
healthCheckPath :: Maybe Text
healthCheckIntervalSeconds :: Maybe Natural
endpointConfigurations :: Maybe [EndpointConfiguration]
$sel:endpointGroupArn:UpdateEndpointGroup' :: UpdateEndpointGroup -> Text
$sel:trafficDialPercentage:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Double
$sel:thresholdCount:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Natural
$sel:portOverrides:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe [PortOverride]
$sel:healthCheckProtocol:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe HealthCheckProtocol
$sel:healthCheckPort:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Natural
$sel:healthCheckPath:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Text
$sel:healthCheckIntervalSeconds:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Natural
$sel:endpointConfigurations:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe [EndpointConfiguration]
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe [EndpointConfiguration]
endpointConfigurations
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
healthCheckIntervalSeconds
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
healthCheckPath
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
healthCheckPort
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe HealthCheckProtocol
healthCheckProtocol
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [PortOverride]
portOverrides
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
thresholdCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Double
trafficDialPercentage
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
endpointGroupArn

instance Data.ToHeaders UpdateEndpointGroup where
  toHeaders :: UpdateEndpointGroup -> 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
"GlobalAccelerator_V20180706.UpdateEndpointGroup" ::
                          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 UpdateEndpointGroup where
  toJSON :: UpdateEndpointGroup -> Value
toJSON UpdateEndpointGroup' {Maybe Double
Maybe Natural
Maybe [EndpointConfiguration]
Maybe [PortOverride]
Maybe Text
Maybe HealthCheckProtocol
Text
endpointGroupArn :: Text
trafficDialPercentage :: Maybe Double
thresholdCount :: Maybe Natural
portOverrides :: Maybe [PortOverride]
healthCheckProtocol :: Maybe HealthCheckProtocol
healthCheckPort :: Maybe Natural
healthCheckPath :: Maybe Text
healthCheckIntervalSeconds :: Maybe Natural
endpointConfigurations :: Maybe [EndpointConfiguration]
$sel:endpointGroupArn:UpdateEndpointGroup' :: UpdateEndpointGroup -> Text
$sel:trafficDialPercentage:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Double
$sel:thresholdCount:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Natural
$sel:portOverrides:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe [PortOverride]
$sel:healthCheckProtocol:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe HealthCheckProtocol
$sel:healthCheckPort:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Natural
$sel:healthCheckPath:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Text
$sel:healthCheckIntervalSeconds:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe Natural
$sel:endpointConfigurations:UpdateEndpointGroup' :: UpdateEndpointGroup -> Maybe [EndpointConfiguration]
..} =
    [Pair] -> Value
Data.object
      ( forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Key
"EndpointConfigurations" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [EndpointConfiguration]
endpointConfigurations,
            (Key
"HealthCheckIntervalSeconds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
healthCheckIntervalSeconds,
            (Key
"HealthCheckPath" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
healthCheckPath,
            (Key
"HealthCheckPort" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
healthCheckPort,
            (Key
"HealthCheckProtocol" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe HealthCheckProtocol
healthCheckProtocol,
            (Key
"PortOverrides" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [PortOverride]
portOverrides,
            (Key
"ThresholdCount" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
thresholdCount,
            (Key
"TrafficDialPercentage" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
              forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Double
trafficDialPercentage,
            forall a. a -> Maybe a
Prelude.Just
              (Key
"EndpointGroupArn" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..= Text
endpointGroupArn)
          ]
      )

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

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

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

-- |
-- Create a value of 'UpdateEndpointGroupResponse' 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:
--
-- 'endpointGroup', 'updateEndpointGroupResponse_endpointGroup' - The information about the endpoint group that was updated.
--
-- 'httpStatus', 'updateEndpointGroupResponse_httpStatus' - The response's http status code.
newUpdateEndpointGroupResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateEndpointGroupResponse
newUpdateEndpointGroupResponse :: Int -> UpdateEndpointGroupResponse
newUpdateEndpointGroupResponse Int
pHttpStatus_ =
  UpdateEndpointGroupResponse'
    { $sel:endpointGroup:UpdateEndpointGroupResponse' :: Maybe EndpointGroup
endpointGroup =
        forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateEndpointGroupResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The information about the endpoint group that was updated.
updateEndpointGroupResponse_endpointGroup :: Lens.Lens' UpdateEndpointGroupResponse (Prelude.Maybe EndpointGroup)
updateEndpointGroupResponse_endpointGroup :: Lens' UpdateEndpointGroupResponse (Maybe EndpointGroup)
updateEndpointGroupResponse_endpointGroup = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateEndpointGroupResponse' {Maybe EndpointGroup
endpointGroup :: Maybe EndpointGroup
$sel:endpointGroup:UpdateEndpointGroupResponse' :: UpdateEndpointGroupResponse -> Maybe EndpointGroup
endpointGroup} -> Maybe EndpointGroup
endpointGroup) (\s :: UpdateEndpointGroupResponse
s@UpdateEndpointGroupResponse' {} Maybe EndpointGroup
a -> UpdateEndpointGroupResponse
s {$sel:endpointGroup:UpdateEndpointGroupResponse' :: Maybe EndpointGroup
endpointGroup = Maybe EndpointGroup
a} :: UpdateEndpointGroupResponse)

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

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