{-# 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.Route53AutoNaming.UpdateInstanceCustomHealthStatus
-- 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)
--
-- Submits a request to change the health status of a custom health check
-- to healthy or unhealthy.
--
-- You can use @UpdateInstanceCustomHealthStatus@ to change the status only
-- for custom health checks, which you define using
-- @HealthCheckCustomConfig@ when you create a service. You can\'t use it
-- to change the status for Route 53 health checks, which you define using
-- @HealthCheckConfig@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/cloud-map/latest/api/API_HealthCheckCustomConfig.html HealthCheckCustomConfig>.
module Amazonka.Route53AutoNaming.UpdateInstanceCustomHealthStatus
  ( -- * Creating a Request
    UpdateInstanceCustomHealthStatus (..),
    newUpdateInstanceCustomHealthStatus,

    -- * Request Lenses
    updateInstanceCustomHealthStatus_serviceId,
    updateInstanceCustomHealthStatus_instanceId,
    updateInstanceCustomHealthStatus_status,

    -- * Destructuring the Response
    UpdateInstanceCustomHealthStatusResponse (..),
    newUpdateInstanceCustomHealthStatusResponse,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.Route53AutoNaming.Types

-- | /See:/ 'newUpdateInstanceCustomHealthStatus' smart constructor.
data UpdateInstanceCustomHealthStatus = UpdateInstanceCustomHealthStatus'
  { -- | The ID of the service that includes the configuration for the custom
    -- health check that you want to change the status for.
    UpdateInstanceCustomHealthStatus -> Text
serviceId :: Prelude.Text,
    -- | The ID of the instance that you want to change the health status for.
    UpdateInstanceCustomHealthStatus -> Text
instanceId :: Prelude.Text,
    -- | The new status of the instance, @HEALTHY@ or @UNHEALTHY@.
    UpdateInstanceCustomHealthStatus -> CustomHealthStatus
status :: CustomHealthStatus
  }
  deriving (UpdateInstanceCustomHealthStatus
-> UpdateInstanceCustomHealthStatus -> Bool
(UpdateInstanceCustomHealthStatus
 -> UpdateInstanceCustomHealthStatus -> Bool)
-> (UpdateInstanceCustomHealthStatus
    -> UpdateInstanceCustomHealthStatus -> Bool)
-> Eq UpdateInstanceCustomHealthStatus
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateInstanceCustomHealthStatus
-> UpdateInstanceCustomHealthStatus -> Bool
$c/= :: UpdateInstanceCustomHealthStatus
-> UpdateInstanceCustomHealthStatus -> Bool
== :: UpdateInstanceCustomHealthStatus
-> UpdateInstanceCustomHealthStatus -> Bool
$c== :: UpdateInstanceCustomHealthStatus
-> UpdateInstanceCustomHealthStatus -> Bool
Prelude.Eq, ReadPrec [UpdateInstanceCustomHealthStatus]
ReadPrec UpdateInstanceCustomHealthStatus
Int -> ReadS UpdateInstanceCustomHealthStatus
ReadS [UpdateInstanceCustomHealthStatus]
(Int -> ReadS UpdateInstanceCustomHealthStatus)
-> ReadS [UpdateInstanceCustomHealthStatus]
-> ReadPrec UpdateInstanceCustomHealthStatus
-> ReadPrec [UpdateInstanceCustomHealthStatus]
-> Read UpdateInstanceCustomHealthStatus
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateInstanceCustomHealthStatus]
$creadListPrec :: ReadPrec [UpdateInstanceCustomHealthStatus]
readPrec :: ReadPrec UpdateInstanceCustomHealthStatus
$creadPrec :: ReadPrec UpdateInstanceCustomHealthStatus
readList :: ReadS [UpdateInstanceCustomHealthStatus]
$creadList :: ReadS [UpdateInstanceCustomHealthStatus]
readsPrec :: Int -> ReadS UpdateInstanceCustomHealthStatus
$creadsPrec :: Int -> ReadS UpdateInstanceCustomHealthStatus
Prelude.Read, Int -> UpdateInstanceCustomHealthStatus -> ShowS
[UpdateInstanceCustomHealthStatus] -> ShowS
UpdateInstanceCustomHealthStatus -> String
(Int -> UpdateInstanceCustomHealthStatus -> ShowS)
-> (UpdateInstanceCustomHealthStatus -> String)
-> ([UpdateInstanceCustomHealthStatus] -> ShowS)
-> Show UpdateInstanceCustomHealthStatus
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateInstanceCustomHealthStatus] -> ShowS
$cshowList :: [UpdateInstanceCustomHealthStatus] -> ShowS
show :: UpdateInstanceCustomHealthStatus -> String
$cshow :: UpdateInstanceCustomHealthStatus -> String
showsPrec :: Int -> UpdateInstanceCustomHealthStatus -> ShowS
$cshowsPrec :: Int -> UpdateInstanceCustomHealthStatus -> ShowS
Prelude.Show, (forall x.
 UpdateInstanceCustomHealthStatus
 -> Rep UpdateInstanceCustomHealthStatus x)
-> (forall x.
    Rep UpdateInstanceCustomHealthStatus x
    -> UpdateInstanceCustomHealthStatus)
-> Generic UpdateInstanceCustomHealthStatus
forall x.
Rep UpdateInstanceCustomHealthStatus x
-> UpdateInstanceCustomHealthStatus
forall x.
UpdateInstanceCustomHealthStatus
-> Rep UpdateInstanceCustomHealthStatus x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateInstanceCustomHealthStatus x
-> UpdateInstanceCustomHealthStatus
$cfrom :: forall x.
UpdateInstanceCustomHealthStatus
-> Rep UpdateInstanceCustomHealthStatus x
Prelude.Generic)

-- |
-- Create a value of 'UpdateInstanceCustomHealthStatus' 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:
--
-- 'serviceId', 'updateInstanceCustomHealthStatus_serviceId' - The ID of the service that includes the configuration for the custom
-- health check that you want to change the status for.
--
-- 'instanceId', 'updateInstanceCustomHealthStatus_instanceId' - The ID of the instance that you want to change the health status for.
--
-- 'status', 'updateInstanceCustomHealthStatus_status' - The new status of the instance, @HEALTHY@ or @UNHEALTHY@.
newUpdateInstanceCustomHealthStatus ::
  -- | 'serviceId'
  Prelude.Text ->
  -- | 'instanceId'
  Prelude.Text ->
  -- | 'status'
  CustomHealthStatus ->
  UpdateInstanceCustomHealthStatus
newUpdateInstanceCustomHealthStatus :: Text
-> Text -> CustomHealthStatus -> UpdateInstanceCustomHealthStatus
newUpdateInstanceCustomHealthStatus
  Text
pServiceId_
  Text
pInstanceId_
  CustomHealthStatus
pStatus_ =
    UpdateInstanceCustomHealthStatus' :: Text
-> Text -> CustomHealthStatus -> UpdateInstanceCustomHealthStatus
UpdateInstanceCustomHealthStatus'
      { $sel:serviceId:UpdateInstanceCustomHealthStatus' :: Text
serviceId =
          Text
pServiceId_,
        $sel:instanceId:UpdateInstanceCustomHealthStatus' :: Text
instanceId = Text
pInstanceId_,
        $sel:status:UpdateInstanceCustomHealthStatus' :: CustomHealthStatus
status = CustomHealthStatus
pStatus_
      }

-- | The ID of the service that includes the configuration for the custom
-- health check that you want to change the status for.
updateInstanceCustomHealthStatus_serviceId :: Lens.Lens' UpdateInstanceCustomHealthStatus Prelude.Text
updateInstanceCustomHealthStatus_serviceId :: (Text -> f Text)
-> UpdateInstanceCustomHealthStatus
-> f UpdateInstanceCustomHealthStatus
updateInstanceCustomHealthStatus_serviceId = (UpdateInstanceCustomHealthStatus -> Text)
-> (UpdateInstanceCustomHealthStatus
    -> Text -> UpdateInstanceCustomHealthStatus)
-> Lens
     UpdateInstanceCustomHealthStatus
     UpdateInstanceCustomHealthStatus
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInstanceCustomHealthStatus' {Text
serviceId :: Text
$sel:serviceId:UpdateInstanceCustomHealthStatus' :: UpdateInstanceCustomHealthStatus -> Text
serviceId} -> Text
serviceId) (\s :: UpdateInstanceCustomHealthStatus
s@UpdateInstanceCustomHealthStatus' {} Text
a -> UpdateInstanceCustomHealthStatus
s {$sel:serviceId:UpdateInstanceCustomHealthStatus' :: Text
serviceId = Text
a} :: UpdateInstanceCustomHealthStatus)

-- | The ID of the instance that you want to change the health status for.
updateInstanceCustomHealthStatus_instanceId :: Lens.Lens' UpdateInstanceCustomHealthStatus Prelude.Text
updateInstanceCustomHealthStatus_instanceId :: (Text -> f Text)
-> UpdateInstanceCustomHealthStatus
-> f UpdateInstanceCustomHealthStatus
updateInstanceCustomHealthStatus_instanceId = (UpdateInstanceCustomHealthStatus -> Text)
-> (UpdateInstanceCustomHealthStatus
    -> Text -> UpdateInstanceCustomHealthStatus)
-> Lens
     UpdateInstanceCustomHealthStatus
     UpdateInstanceCustomHealthStatus
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInstanceCustomHealthStatus' {Text
instanceId :: Text
$sel:instanceId:UpdateInstanceCustomHealthStatus' :: UpdateInstanceCustomHealthStatus -> Text
instanceId} -> Text
instanceId) (\s :: UpdateInstanceCustomHealthStatus
s@UpdateInstanceCustomHealthStatus' {} Text
a -> UpdateInstanceCustomHealthStatus
s {$sel:instanceId:UpdateInstanceCustomHealthStatus' :: Text
instanceId = Text
a} :: UpdateInstanceCustomHealthStatus)

-- | The new status of the instance, @HEALTHY@ or @UNHEALTHY@.
updateInstanceCustomHealthStatus_status :: Lens.Lens' UpdateInstanceCustomHealthStatus CustomHealthStatus
updateInstanceCustomHealthStatus_status :: (CustomHealthStatus -> f CustomHealthStatus)
-> UpdateInstanceCustomHealthStatus
-> f UpdateInstanceCustomHealthStatus
updateInstanceCustomHealthStatus_status = (UpdateInstanceCustomHealthStatus -> CustomHealthStatus)
-> (UpdateInstanceCustomHealthStatus
    -> CustomHealthStatus -> UpdateInstanceCustomHealthStatus)
-> Lens
     UpdateInstanceCustomHealthStatus
     UpdateInstanceCustomHealthStatus
     CustomHealthStatus
     CustomHealthStatus
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateInstanceCustomHealthStatus' {CustomHealthStatus
status :: CustomHealthStatus
$sel:status:UpdateInstanceCustomHealthStatus' :: UpdateInstanceCustomHealthStatus -> CustomHealthStatus
status} -> CustomHealthStatus
status) (\s :: UpdateInstanceCustomHealthStatus
s@UpdateInstanceCustomHealthStatus' {} CustomHealthStatus
a -> UpdateInstanceCustomHealthStatus
s {$sel:status:UpdateInstanceCustomHealthStatus' :: CustomHealthStatus
status = CustomHealthStatus
a} :: UpdateInstanceCustomHealthStatus)

instance
  Core.AWSRequest
    UpdateInstanceCustomHealthStatus
  where
  type
    AWSResponse UpdateInstanceCustomHealthStatus =
      UpdateInstanceCustomHealthStatusResponse
  request :: UpdateInstanceCustomHealthStatus
-> Request UpdateInstanceCustomHealthStatus
request = Service
-> UpdateInstanceCustomHealthStatus
-> Request UpdateInstanceCustomHealthStatus
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy UpdateInstanceCustomHealthStatus
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse UpdateInstanceCustomHealthStatus)))
response =
    AWSResponse UpdateInstanceCustomHealthStatus
-> Logger
-> Service
-> Proxy UpdateInstanceCustomHealthStatus
-> ClientResponse ClientBody
-> m (Either
        Error
        (ClientResponse (AWSResponse UpdateInstanceCustomHealthStatus)))
forall (m :: * -> *) a.
MonadResource m =>
AWSResponse a
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveNull
      AWSResponse UpdateInstanceCustomHealthStatus
UpdateInstanceCustomHealthStatusResponse
UpdateInstanceCustomHealthStatusResponse'

instance
  Prelude.Hashable
    UpdateInstanceCustomHealthStatus

instance
  Prelude.NFData
    UpdateInstanceCustomHealthStatus

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

instance Core.ToJSON UpdateInstanceCustomHealthStatus where
  toJSON :: UpdateInstanceCustomHealthStatus -> Value
toJSON UpdateInstanceCustomHealthStatus' {Text
CustomHealthStatus
status :: CustomHealthStatus
instanceId :: Text
serviceId :: Text
$sel:status:UpdateInstanceCustomHealthStatus' :: UpdateInstanceCustomHealthStatus -> CustomHealthStatus
$sel:instanceId:UpdateInstanceCustomHealthStatus' :: UpdateInstanceCustomHealthStatus -> Text
$sel:serviceId:UpdateInstanceCustomHealthStatus' :: UpdateInstanceCustomHealthStatus -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ServiceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serviceId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"InstanceId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
instanceId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Status" Text -> CustomHealthStatus -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= CustomHealthStatus
status)
          ]
      )

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

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

-- | /See:/ 'newUpdateInstanceCustomHealthStatusResponse' smart constructor.
data UpdateInstanceCustomHealthStatusResponse = UpdateInstanceCustomHealthStatusResponse'
  {
  }
  deriving (UpdateInstanceCustomHealthStatusResponse
-> UpdateInstanceCustomHealthStatusResponse -> Bool
(UpdateInstanceCustomHealthStatusResponse
 -> UpdateInstanceCustomHealthStatusResponse -> Bool)
-> (UpdateInstanceCustomHealthStatusResponse
    -> UpdateInstanceCustomHealthStatusResponse -> Bool)
-> Eq UpdateInstanceCustomHealthStatusResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateInstanceCustomHealthStatusResponse
-> UpdateInstanceCustomHealthStatusResponse -> Bool
$c/= :: UpdateInstanceCustomHealthStatusResponse
-> UpdateInstanceCustomHealthStatusResponse -> Bool
== :: UpdateInstanceCustomHealthStatusResponse
-> UpdateInstanceCustomHealthStatusResponse -> Bool
$c== :: UpdateInstanceCustomHealthStatusResponse
-> UpdateInstanceCustomHealthStatusResponse -> Bool
Prelude.Eq, ReadPrec [UpdateInstanceCustomHealthStatusResponse]
ReadPrec UpdateInstanceCustomHealthStatusResponse
Int -> ReadS UpdateInstanceCustomHealthStatusResponse
ReadS [UpdateInstanceCustomHealthStatusResponse]
(Int -> ReadS UpdateInstanceCustomHealthStatusResponse)
-> ReadS [UpdateInstanceCustomHealthStatusResponse]
-> ReadPrec UpdateInstanceCustomHealthStatusResponse
-> ReadPrec [UpdateInstanceCustomHealthStatusResponse]
-> Read UpdateInstanceCustomHealthStatusResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateInstanceCustomHealthStatusResponse]
$creadListPrec :: ReadPrec [UpdateInstanceCustomHealthStatusResponse]
readPrec :: ReadPrec UpdateInstanceCustomHealthStatusResponse
$creadPrec :: ReadPrec UpdateInstanceCustomHealthStatusResponse
readList :: ReadS [UpdateInstanceCustomHealthStatusResponse]
$creadList :: ReadS [UpdateInstanceCustomHealthStatusResponse]
readsPrec :: Int -> ReadS UpdateInstanceCustomHealthStatusResponse
$creadsPrec :: Int -> ReadS UpdateInstanceCustomHealthStatusResponse
Prelude.Read, Int -> UpdateInstanceCustomHealthStatusResponse -> ShowS
[UpdateInstanceCustomHealthStatusResponse] -> ShowS
UpdateInstanceCustomHealthStatusResponse -> String
(Int -> UpdateInstanceCustomHealthStatusResponse -> ShowS)
-> (UpdateInstanceCustomHealthStatusResponse -> String)
-> ([UpdateInstanceCustomHealthStatusResponse] -> ShowS)
-> Show UpdateInstanceCustomHealthStatusResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateInstanceCustomHealthStatusResponse] -> ShowS
$cshowList :: [UpdateInstanceCustomHealthStatusResponse] -> ShowS
show :: UpdateInstanceCustomHealthStatusResponse -> String
$cshow :: UpdateInstanceCustomHealthStatusResponse -> String
showsPrec :: Int -> UpdateInstanceCustomHealthStatusResponse -> ShowS
$cshowsPrec :: Int -> UpdateInstanceCustomHealthStatusResponse -> ShowS
Prelude.Show, (forall x.
 UpdateInstanceCustomHealthStatusResponse
 -> Rep UpdateInstanceCustomHealthStatusResponse x)
-> (forall x.
    Rep UpdateInstanceCustomHealthStatusResponse x
    -> UpdateInstanceCustomHealthStatusResponse)
-> Generic UpdateInstanceCustomHealthStatusResponse
forall x.
Rep UpdateInstanceCustomHealthStatusResponse x
-> UpdateInstanceCustomHealthStatusResponse
forall x.
UpdateInstanceCustomHealthStatusResponse
-> Rep UpdateInstanceCustomHealthStatusResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep UpdateInstanceCustomHealthStatusResponse x
-> UpdateInstanceCustomHealthStatusResponse
$cfrom :: forall x.
UpdateInstanceCustomHealthStatusResponse
-> Rep UpdateInstanceCustomHealthStatusResponse x
Prelude.Generic)

-- |
-- Create a value of 'UpdateInstanceCustomHealthStatusResponse' 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.
newUpdateInstanceCustomHealthStatusResponse ::
  UpdateInstanceCustomHealthStatusResponse
newUpdateInstanceCustomHealthStatusResponse :: UpdateInstanceCustomHealthStatusResponse
newUpdateInstanceCustomHealthStatusResponse =
  UpdateInstanceCustomHealthStatusResponse
UpdateInstanceCustomHealthStatusResponse'

instance
  Prelude.NFData
    UpdateInstanceCustomHealthStatusResponse