{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.Route53.Types.LinkedService
-- 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)
module Amazonka.Route53.Types.LinkedService where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.Route53.Internal

-- | If a health check or hosted zone was created by another service,
-- @LinkedService@ is a complex type that describes the service that
-- created the resource. When a resource is created by another service, you
-- can\'t edit or delete it using Amazon Route 53.
--
-- /See:/ 'newLinkedService' smart constructor.
data LinkedService = LinkedService'
  { -- | If the health check or hosted zone was created by another service, the
    -- service that created the resource. When a resource is created by another
    -- service, you can\'t edit or delete it using Amazon Route 53.
    LinkedService -> Maybe Text
servicePrincipal :: Prelude.Maybe Prelude.Text,
    -- | If the health check or hosted zone was created by another service, an
    -- optional description that can be provided by the other service. When a
    -- resource is created by another service, you can\'t edit or delete it
    -- using Amazon Route 53.
    LinkedService -> Maybe Text
description :: Prelude.Maybe Prelude.Text
  }
  deriving (LinkedService -> LinkedService -> Bool
(LinkedService -> LinkedService -> Bool)
-> (LinkedService -> LinkedService -> Bool) -> Eq LinkedService
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: LinkedService -> LinkedService -> Bool
$c/= :: LinkedService -> LinkedService -> Bool
== :: LinkedService -> LinkedService -> Bool
$c== :: LinkedService -> LinkedService -> Bool
Prelude.Eq, ReadPrec [LinkedService]
ReadPrec LinkedService
Int -> ReadS LinkedService
ReadS [LinkedService]
(Int -> ReadS LinkedService)
-> ReadS [LinkedService]
-> ReadPrec LinkedService
-> ReadPrec [LinkedService]
-> Read LinkedService
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [LinkedService]
$creadListPrec :: ReadPrec [LinkedService]
readPrec :: ReadPrec LinkedService
$creadPrec :: ReadPrec LinkedService
readList :: ReadS [LinkedService]
$creadList :: ReadS [LinkedService]
readsPrec :: Int -> ReadS LinkedService
$creadsPrec :: Int -> ReadS LinkedService
Prelude.Read, Int -> LinkedService -> ShowS
[LinkedService] -> ShowS
LinkedService -> String
(Int -> LinkedService -> ShowS)
-> (LinkedService -> String)
-> ([LinkedService] -> ShowS)
-> Show LinkedService
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [LinkedService] -> ShowS
$cshowList :: [LinkedService] -> ShowS
show :: LinkedService -> String
$cshow :: LinkedService -> String
showsPrec :: Int -> LinkedService -> ShowS
$cshowsPrec :: Int -> LinkedService -> ShowS
Prelude.Show, (forall x. LinkedService -> Rep LinkedService x)
-> (forall x. Rep LinkedService x -> LinkedService)
-> Generic LinkedService
forall x. Rep LinkedService x -> LinkedService
forall x. LinkedService -> Rep LinkedService x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep LinkedService x -> LinkedService
$cfrom :: forall x. LinkedService -> Rep LinkedService x
Prelude.Generic)

-- |
-- Create a value of 'LinkedService' 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:
--
-- 'servicePrincipal', 'linkedService_servicePrincipal' - If the health check or hosted zone was created by another service, the
-- service that created the resource. When a resource is created by another
-- service, you can\'t edit or delete it using Amazon Route 53.
--
-- 'description', 'linkedService_description' - If the health check or hosted zone was created by another service, an
-- optional description that can be provided by the other service. When a
-- resource is created by another service, you can\'t edit or delete it
-- using Amazon Route 53.
newLinkedService ::
  LinkedService
newLinkedService :: LinkedService
newLinkedService =
  LinkedService' :: Maybe Text -> Maybe Text -> LinkedService
LinkedService'
    { $sel:servicePrincipal:LinkedService' :: Maybe Text
servicePrincipal = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:description:LinkedService' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | If the health check or hosted zone was created by another service, the
-- service that created the resource. When a resource is created by another
-- service, you can\'t edit or delete it using Amazon Route 53.
linkedService_servicePrincipal :: Lens.Lens' LinkedService (Prelude.Maybe Prelude.Text)
linkedService_servicePrincipal :: (Maybe Text -> f (Maybe Text)) -> LinkedService -> f LinkedService
linkedService_servicePrincipal = (LinkedService -> Maybe Text)
-> (LinkedService -> Maybe Text -> LinkedService)
-> Lens LinkedService LinkedService (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LinkedService' {Maybe Text
servicePrincipal :: Maybe Text
$sel:servicePrincipal:LinkedService' :: LinkedService -> Maybe Text
servicePrincipal} -> Maybe Text
servicePrincipal) (\s :: LinkedService
s@LinkedService' {} Maybe Text
a -> LinkedService
s {$sel:servicePrincipal:LinkedService' :: Maybe Text
servicePrincipal = Maybe Text
a} :: LinkedService)

-- | If the health check or hosted zone was created by another service, an
-- optional description that can be provided by the other service. When a
-- resource is created by another service, you can\'t edit or delete it
-- using Amazon Route 53.
linkedService_description :: Lens.Lens' LinkedService (Prelude.Maybe Prelude.Text)
linkedService_description :: (Maybe Text -> f (Maybe Text)) -> LinkedService -> f LinkedService
linkedService_description = (LinkedService -> Maybe Text)
-> (LinkedService -> Maybe Text -> LinkedService)
-> Lens LinkedService LinkedService (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\LinkedService' {Maybe Text
description :: Maybe Text
$sel:description:LinkedService' :: LinkedService -> Maybe Text
description} -> Maybe Text
description) (\s :: LinkedService
s@LinkedService' {} Maybe Text
a -> LinkedService
s {$sel:description:LinkedService' :: Maybe Text
description = Maybe Text
a} :: LinkedService)

instance Core.FromXML LinkedService where
  parseXML :: [Node] -> Either String LinkedService
parseXML [Node]
x =
    Maybe Text -> Maybe Text -> LinkedService
LinkedService'
      (Maybe Text -> Maybe Text -> LinkedService)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> LinkedService)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"ServicePrincipal")
      Either String (Maybe Text -> LinkedService)
-> Either String (Maybe Text) -> Either String LinkedService
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x [Node] -> Text -> Either String (Maybe Text)
forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Core..@? Text
"Description")

instance Prelude.Hashable LinkedService

instance Prelude.NFData LinkedService