{-# 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.OpenSearch.Types.AWSDomainInformation
-- 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.OpenSearch.Types.AWSDomainInformation where

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

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

-- |
-- Create a value of 'AWSDomainInformation' 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:
--
-- 'ownerId', 'aWSDomainInformation_ownerId' - Undocumented member.
--
-- 'region', 'aWSDomainInformation_region' - Undocumented member.
--
-- 'domainName', 'aWSDomainInformation_domainName' - Undocumented member.
newAWSDomainInformation ::
  -- | 'domainName'
  Prelude.Text ->
  AWSDomainInformation
newAWSDomainInformation :: Text -> AWSDomainInformation
newAWSDomainInformation Text
pDomainName_ =
  AWSDomainInformation' :: Maybe Text -> Maybe Text -> Text -> AWSDomainInformation
AWSDomainInformation'
    { $sel:ownerId:AWSDomainInformation' :: Maybe Text
ownerId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:region:AWSDomainInformation' :: Maybe Text
region = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:domainName:AWSDomainInformation' :: Text
domainName = Text
pDomainName_
    }

-- | Undocumented member.
aWSDomainInformation_ownerId :: Lens.Lens' AWSDomainInformation (Prelude.Maybe Prelude.Text)
aWSDomainInformation_ownerId :: (Maybe Text -> f (Maybe Text))
-> AWSDomainInformation -> f AWSDomainInformation
aWSDomainInformation_ownerId = (AWSDomainInformation -> Maybe Text)
-> (AWSDomainInformation -> Maybe Text -> AWSDomainInformation)
-> Lens
     AWSDomainInformation AWSDomainInformation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AWSDomainInformation' {Maybe Text
ownerId :: Maybe Text
$sel:ownerId:AWSDomainInformation' :: AWSDomainInformation -> Maybe Text
ownerId} -> Maybe Text
ownerId) (\s :: AWSDomainInformation
s@AWSDomainInformation' {} Maybe Text
a -> AWSDomainInformation
s {$sel:ownerId:AWSDomainInformation' :: Maybe Text
ownerId = Maybe Text
a} :: AWSDomainInformation)

-- | Undocumented member.
aWSDomainInformation_region :: Lens.Lens' AWSDomainInformation (Prelude.Maybe Prelude.Text)
aWSDomainInformation_region :: (Maybe Text -> f (Maybe Text))
-> AWSDomainInformation -> f AWSDomainInformation
aWSDomainInformation_region = (AWSDomainInformation -> Maybe Text)
-> (AWSDomainInformation -> Maybe Text -> AWSDomainInformation)
-> Lens
     AWSDomainInformation AWSDomainInformation (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AWSDomainInformation' {Maybe Text
region :: Maybe Text
$sel:region:AWSDomainInformation' :: AWSDomainInformation -> Maybe Text
region} -> Maybe Text
region) (\s :: AWSDomainInformation
s@AWSDomainInformation' {} Maybe Text
a -> AWSDomainInformation
s {$sel:region:AWSDomainInformation' :: Maybe Text
region = Maybe Text
a} :: AWSDomainInformation)

-- | Undocumented member.
aWSDomainInformation_domainName :: Lens.Lens' AWSDomainInformation Prelude.Text
aWSDomainInformation_domainName :: (Text -> f Text) -> AWSDomainInformation -> f AWSDomainInformation
aWSDomainInformation_domainName = (AWSDomainInformation -> Text)
-> (AWSDomainInformation -> Text -> AWSDomainInformation)
-> Lens AWSDomainInformation AWSDomainInformation Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AWSDomainInformation' {Text
domainName :: Text
$sel:domainName:AWSDomainInformation' :: AWSDomainInformation -> Text
domainName} -> Text
domainName) (\s :: AWSDomainInformation
s@AWSDomainInformation' {} Text
a -> AWSDomainInformation
s {$sel:domainName:AWSDomainInformation' :: Text
domainName = Text
a} :: AWSDomainInformation)

instance Core.FromJSON AWSDomainInformation where
  parseJSON :: Value -> Parser AWSDomainInformation
parseJSON =
    String
-> (Object -> Parser AWSDomainInformation)
-> Value
-> Parser AWSDomainInformation
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"AWSDomainInformation"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Text -> AWSDomainInformation
AWSDomainInformation'
            (Maybe Text -> Maybe Text -> Text -> AWSDomainInformation)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Text -> AWSDomainInformation)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"OwnerId")
            Parser (Maybe Text -> Text -> AWSDomainInformation)
-> Parser (Maybe Text) -> Parser (Text -> AWSDomainInformation)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe Text)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"Region")
            Parser (Text -> AWSDomainInformation)
-> Parser Text -> Parser AWSDomainInformation
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"DomainName")
      )

instance Prelude.Hashable AWSDomainInformation

instance Prelude.NFData AWSDomainInformation

instance Core.ToJSON AWSDomainInformation where
  toJSON :: AWSDomainInformation -> Value
toJSON AWSDomainInformation' {Maybe Text
Text
domainName :: Text
region :: Maybe Text
ownerId :: Maybe Text
$sel:domainName:AWSDomainInformation' :: AWSDomainInformation -> Text
$sel:region:AWSDomainInformation' :: AWSDomainInformation -> Maybe Text
$sel:ownerId:AWSDomainInformation' :: AWSDomainInformation -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"OwnerId" 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
ownerId,
            (Text
"Region" 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
region,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"DomainName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
domainName)
          ]
      )