{-# 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-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- 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_thresholdCount,
    updateEndpointGroup_healthCheckPath,
    updateEndpointGroup_healthCheckIntervalSeconds,
    updateEndpointGroup_healthCheckProtocol,
    updateEndpointGroup_trafficDialPercentage,
    updateEndpointGroup_endpointConfigurations,
    updateEndpointGroup_healthCheckPort,
    updateEndpointGroup_portOverrides,
    updateEndpointGroup_endpointGroupArn,

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

    -- * Response Lenses
    updateEndpointGroupResponse_endpointGroup,
    updateEndpointGroupResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.GlobalAccelerator.Types
import qualified Amazonka.Lens as Lens
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 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,
    -- | 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 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,
    -- | The protocol that AWS 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,
    -- | The percentage of traffic to send to an AWS 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 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 port that AWS 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,
    -- | 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 Port overrides>
    -- in the /AWS Global Accelerator Developer Guide/.
    UpdateEndpointGroup -> Maybe [PortOverride]
portOverrides :: Prelude.Maybe [PortOverride],
    -- | The Amazon Resource Name (ARN) of the endpoint group.
    UpdateEndpointGroup -> Text
endpointGroupArn :: Prelude.Text
  }
  deriving (UpdateEndpointGroup -> UpdateEndpointGroup -> Bool
(UpdateEndpointGroup -> UpdateEndpointGroup -> Bool)
-> (UpdateEndpointGroup -> UpdateEndpointGroup -> Bool)
-> Eq UpdateEndpointGroup
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]
(Int -> ReadS UpdateEndpointGroup)
-> ReadS [UpdateEndpointGroup]
-> ReadPrec UpdateEndpointGroup
-> ReadPrec [UpdateEndpointGroup]
-> Read 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
(Int -> UpdateEndpointGroup -> ShowS)
-> (UpdateEndpointGroup -> String)
-> ([UpdateEndpointGroup] -> ShowS)
-> Show UpdateEndpointGroup
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. UpdateEndpointGroup -> Rep UpdateEndpointGroup x)
-> (forall x. Rep UpdateEndpointGroup x -> UpdateEndpointGroup)
-> Generic UpdateEndpointGroup
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:
--
-- '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.
--
-- '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 (\/).
--
-- 'healthCheckIntervalSeconds', 'updateEndpointGroup_healthCheckIntervalSeconds' - The time—10 seconds or 30 seconds—between each health check for an
-- endpoint. The default value is 30.
--
-- 'healthCheckProtocol', 'updateEndpointGroup_healthCheckProtocol' - The protocol that AWS Global Accelerator uses to check the health of
-- endpoints that are part of this endpoint group. The default value is
-- TCP.
--
-- 'trafficDialPercentage', 'updateEndpointGroup_trafficDialPercentage' - The percentage of traffic to send to an AWS 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.
--
-- 'endpointConfigurations', 'updateEndpointGroup_endpointConfigurations' - The list of endpoint objects. A resource must be valid and active when
-- you add it as an endpoint.
--
-- 'healthCheckPort', 'updateEndpointGroup_healthCheckPort' - The port that AWS 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.
--
-- '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 Port overrides>
-- in the /AWS Global Accelerator Developer Guide/.
--
-- 'endpointGroupArn', 'updateEndpointGroup_endpointGroupArn' - The Amazon Resource Name (ARN) of the endpoint group.
newUpdateEndpointGroup ::
  -- | 'endpointGroupArn'
  Prelude.Text ->
  UpdateEndpointGroup
newUpdateEndpointGroup :: Text -> UpdateEndpointGroup
newUpdateEndpointGroup Text
pEndpointGroupArn_ =
  UpdateEndpointGroup' :: Maybe Natural
-> Maybe Text
-> Maybe Natural
-> Maybe HealthCheckProtocol
-> Maybe Double
-> Maybe [EndpointConfiguration]
-> Maybe Natural
-> Maybe [PortOverride]
-> Text
-> UpdateEndpointGroup
UpdateEndpointGroup'
    { $sel:thresholdCount:UpdateEndpointGroup' :: Maybe Natural
thresholdCount =
        Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckPath:UpdateEndpointGroup' :: Maybe Text
healthCheckPath = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckIntervalSeconds:UpdateEndpointGroup' :: Maybe Natural
healthCheckIntervalSeconds = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckProtocol:UpdateEndpointGroup' :: Maybe HealthCheckProtocol
healthCheckProtocol = Maybe HealthCheckProtocol
forall a. Maybe a
Prelude.Nothing,
      $sel:trafficDialPercentage:UpdateEndpointGroup' :: Maybe Double
trafficDialPercentage = Maybe Double
forall a. Maybe a
Prelude.Nothing,
      $sel:endpointConfigurations:UpdateEndpointGroup' :: Maybe [EndpointConfiguration]
endpointConfigurations = Maybe [EndpointConfiguration]
forall a. Maybe a
Prelude.Nothing,
      $sel:healthCheckPort:UpdateEndpointGroup' :: Maybe Natural
healthCheckPort = Maybe Natural
forall a. Maybe a
Prelude.Nothing,
      $sel:portOverrides:UpdateEndpointGroup' :: Maybe [PortOverride]
portOverrides = Maybe [PortOverride]
forall a. Maybe a
Prelude.Nothing,
      $sel:endpointGroupArn:UpdateEndpointGroup' :: Text
endpointGroupArn = Text
pEndpointGroupArn_
    }

-- | 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 :: (Maybe Natural -> f (Maybe Natural))
-> UpdateEndpointGroup -> f UpdateEndpointGroup
updateEndpointGroup_thresholdCount = (UpdateEndpointGroup -> Maybe Natural)
-> (UpdateEndpointGroup -> Maybe Natural -> UpdateEndpointGroup)
-> Lens
     UpdateEndpointGroup
     UpdateEndpointGroup
     (Maybe Natural)
     (Maybe Natural)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text))
-> UpdateEndpointGroup -> f UpdateEndpointGroup
updateEndpointGroup_healthCheckPath = (UpdateEndpointGroup -> Maybe Text)
-> (UpdateEndpointGroup -> Maybe Text -> UpdateEndpointGroup)
-> Lens
     UpdateEndpointGroup UpdateEndpointGroup (Maybe Text) (Maybe Text)
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 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 :: (Maybe Natural -> f (Maybe Natural))
-> UpdateEndpointGroup -> f UpdateEndpointGroup
updateEndpointGroup_healthCheckIntervalSeconds = (UpdateEndpointGroup -> Maybe Natural)
-> (UpdateEndpointGroup -> Maybe Natural -> UpdateEndpointGroup)
-> Lens
     UpdateEndpointGroup
     UpdateEndpointGroup
     (Maybe Natural)
     (Maybe Natural)
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)

-- | The protocol that AWS 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 :: (Maybe HealthCheckProtocol -> f (Maybe HealthCheckProtocol))
-> UpdateEndpointGroup -> f UpdateEndpointGroup
updateEndpointGroup_healthCheckProtocol = (UpdateEndpointGroup -> Maybe HealthCheckProtocol)
-> (UpdateEndpointGroup
    -> Maybe HealthCheckProtocol -> UpdateEndpointGroup)
-> Lens
     UpdateEndpointGroup
     UpdateEndpointGroup
     (Maybe HealthCheckProtocol)
     (Maybe 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)

-- | The percentage of traffic to send to an AWS 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 :: (Maybe Double -> f (Maybe Double))
-> UpdateEndpointGroup -> f UpdateEndpointGroup
updateEndpointGroup_trafficDialPercentage = (UpdateEndpointGroup -> Maybe Double)
-> (UpdateEndpointGroup -> Maybe Double -> UpdateEndpointGroup)
-> Lens
     UpdateEndpointGroup
     UpdateEndpointGroup
     (Maybe Double)
     (Maybe Double)
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 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 :: (Maybe [EndpointConfiguration]
 -> f (Maybe [EndpointConfiguration]))
-> UpdateEndpointGroup -> f UpdateEndpointGroup
updateEndpointGroup_endpointConfigurations = (UpdateEndpointGroup -> Maybe [EndpointConfiguration])
-> (UpdateEndpointGroup
    -> Maybe [EndpointConfiguration] -> UpdateEndpointGroup)
-> Lens
     UpdateEndpointGroup
     UpdateEndpointGroup
     (Maybe [EndpointConfiguration])
     (Maybe [EndpointConfiguration])
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) ((Maybe [EndpointConfiguration]
  -> f (Maybe [EndpointConfiguration]))
 -> UpdateEndpointGroup -> f UpdateEndpointGroup)
-> ((Maybe [EndpointConfiguration]
     -> f (Maybe [EndpointConfiguration]))
    -> Maybe [EndpointConfiguration]
    -> f (Maybe [EndpointConfiguration]))
-> (Maybe [EndpointConfiguration]
    -> f (Maybe [EndpointConfiguration]))
-> UpdateEndpointGroup
-> f UpdateEndpointGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [EndpointConfiguration]
  [EndpointConfiguration]
  [EndpointConfiguration]
  [EndpointConfiguration]
-> Iso
     (Maybe [EndpointConfiguration])
     (Maybe [EndpointConfiguration])
     (Maybe [EndpointConfiguration])
     (Maybe [EndpointConfiguration])
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 AnIso
  [EndpointConfiguration]
  [EndpointConfiguration]
  [EndpointConfiguration]
  [EndpointConfiguration]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The port that AWS 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 :: (Maybe Natural -> f (Maybe Natural))
-> UpdateEndpointGroup -> f UpdateEndpointGroup
updateEndpointGroup_healthCheckPort = (UpdateEndpointGroup -> Maybe Natural)
-> (UpdateEndpointGroup -> Maybe Natural -> UpdateEndpointGroup)
-> Lens
     UpdateEndpointGroup
     UpdateEndpointGroup
     (Maybe Natural)
     (Maybe Natural)
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)

-- | 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 Port overrides>
-- in the /AWS Global Accelerator Developer Guide/.
updateEndpointGroup_portOverrides :: Lens.Lens' UpdateEndpointGroup (Prelude.Maybe [PortOverride])
updateEndpointGroup_portOverrides :: (Maybe [PortOverride] -> f (Maybe [PortOverride]))
-> UpdateEndpointGroup -> f UpdateEndpointGroup
updateEndpointGroup_portOverrides = (UpdateEndpointGroup -> Maybe [PortOverride])
-> (UpdateEndpointGroup
    -> Maybe [PortOverride] -> UpdateEndpointGroup)
-> Lens
     UpdateEndpointGroup
     UpdateEndpointGroup
     (Maybe [PortOverride])
     (Maybe [PortOverride])
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) ((Maybe [PortOverride] -> f (Maybe [PortOverride]))
 -> UpdateEndpointGroup -> f UpdateEndpointGroup)
-> ((Maybe [PortOverride] -> f (Maybe [PortOverride]))
    -> Maybe [PortOverride] -> f (Maybe [PortOverride]))
-> (Maybe [PortOverride] -> f (Maybe [PortOverride]))
-> UpdateEndpointGroup
-> f UpdateEndpointGroup
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [PortOverride] [PortOverride] [PortOverride] [PortOverride]
-> Iso
     (Maybe [PortOverride])
     (Maybe [PortOverride])
     (Maybe [PortOverride])
     (Maybe [PortOverride])
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 AnIso [PortOverride] [PortOverride] [PortOverride] [PortOverride]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Name (ARN) of the endpoint group.
updateEndpointGroup_endpointGroupArn :: Lens.Lens' UpdateEndpointGroup Prelude.Text
updateEndpointGroup_endpointGroupArn :: (Text -> f Text) -> UpdateEndpointGroup -> f UpdateEndpointGroup
updateEndpointGroup_endpointGroupArn = (UpdateEndpointGroup -> Text)
-> (UpdateEndpointGroup -> Text -> UpdateEndpointGroup)
-> Lens UpdateEndpointGroup UpdateEndpointGroup Text Text
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 :: UpdateEndpointGroup -> Request UpdateEndpointGroup
request = Service -> UpdateEndpointGroup -> Request UpdateEndpointGroup
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateEndpointGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateEndpointGroup)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse UpdateEndpointGroup))
-> Logger
-> Service
-> Proxy UpdateEndpointGroup
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse UpdateEndpointGroup)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe EndpointGroup -> Int -> UpdateEndpointGroupResponse
UpdateEndpointGroupResponse'
            (Maybe EndpointGroup -> Int -> UpdateEndpointGroupResponse)
-> Either String (Maybe EndpointGroup)
-> Either String (Int -> UpdateEndpointGroupResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe EndpointGroup)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"EndpointGroup")
            Either String (Int -> UpdateEndpointGroupResponse)
-> Either String Int -> Either String UpdateEndpointGroupResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable UpdateEndpointGroup

instance Prelude.NFData UpdateEndpointGroup

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

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

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

instance Core.ToQuery UpdateEndpointGroup where
  toQuery :: UpdateEndpointGroup -> QueryString
toQuery = QueryString -> UpdateEndpointGroup -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
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
(UpdateEndpointGroupResponse
 -> UpdateEndpointGroupResponse -> Bool)
-> (UpdateEndpointGroupResponse
    -> UpdateEndpointGroupResponse -> Bool)
-> Eq UpdateEndpointGroupResponse
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]
(Int -> ReadS UpdateEndpointGroupResponse)
-> ReadS [UpdateEndpointGroupResponse]
-> ReadPrec UpdateEndpointGroupResponse
-> ReadPrec [UpdateEndpointGroupResponse]
-> Read 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
(Int -> UpdateEndpointGroupResponse -> ShowS)
-> (UpdateEndpointGroupResponse -> String)
-> ([UpdateEndpointGroupResponse] -> ShowS)
-> Show UpdateEndpointGroupResponse
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.
 UpdateEndpointGroupResponse -> Rep UpdateEndpointGroupResponse x)
-> (forall x.
    Rep UpdateEndpointGroupResponse x -> UpdateEndpointGroupResponse)
-> Generic UpdateEndpointGroupResponse
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' :: Maybe EndpointGroup -> Int -> UpdateEndpointGroupResponse
UpdateEndpointGroupResponse'
    { $sel:endpointGroup:UpdateEndpointGroupResponse' :: Maybe EndpointGroup
endpointGroup =
        Maybe 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 :: (Maybe EndpointGroup -> f (Maybe EndpointGroup))
-> UpdateEndpointGroupResponse -> f UpdateEndpointGroupResponse
updateEndpointGroupResponse_endpointGroup = (UpdateEndpointGroupResponse -> Maybe EndpointGroup)
-> (UpdateEndpointGroupResponse
    -> Maybe EndpointGroup -> UpdateEndpointGroupResponse)
-> Lens
     UpdateEndpointGroupResponse
     UpdateEndpointGroupResponse
     (Maybe EndpointGroup)
     (Maybe 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 :: (Int -> f Int)
-> UpdateEndpointGroupResponse -> f UpdateEndpointGroupResponse
updateEndpointGroupResponse_httpStatus = (UpdateEndpointGroupResponse -> Int)
-> (UpdateEndpointGroupResponse
    -> Int -> UpdateEndpointGroupResponse)
-> Lens
     UpdateEndpointGroupResponse UpdateEndpointGroupResponse Int Int
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