{-# 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.GuardDuty.Types.Owner
-- 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.GuardDuty.Types.Owner where

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

-- | Contains information on the owner of the bucket.
--
-- /See:/ 'newOwner' smart constructor.
data Owner = Owner'
  { -- | The canonical user ID of the bucket owner. For information about
    -- locating your canonical user ID see
    -- <https://docs.aws.amazon.com/general/latest/gr/acct-identifiers.html#FindingCanonicalId Finding Your Account Canonical User ID.>
    Owner -> Maybe Text
id :: Prelude.Maybe Prelude.Text
  }
  deriving (Owner -> Owner -> Bool
(Owner -> Owner -> Bool) -> (Owner -> Owner -> Bool) -> Eq Owner
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Owner -> Owner -> Bool
$c/= :: Owner -> Owner -> Bool
== :: Owner -> Owner -> Bool
$c== :: Owner -> Owner -> Bool
Prelude.Eq, ReadPrec [Owner]
ReadPrec Owner
Int -> ReadS Owner
ReadS [Owner]
(Int -> ReadS Owner)
-> ReadS [Owner]
-> ReadPrec Owner
-> ReadPrec [Owner]
-> Read Owner
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Owner]
$creadListPrec :: ReadPrec [Owner]
readPrec :: ReadPrec Owner
$creadPrec :: ReadPrec Owner
readList :: ReadS [Owner]
$creadList :: ReadS [Owner]
readsPrec :: Int -> ReadS Owner
$creadsPrec :: Int -> ReadS Owner
Prelude.Read, Int -> Owner -> ShowS
[Owner] -> ShowS
Owner -> String
(Int -> Owner -> ShowS)
-> (Owner -> String) -> ([Owner] -> ShowS) -> Show Owner
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Owner] -> ShowS
$cshowList :: [Owner] -> ShowS
show :: Owner -> String
$cshow :: Owner -> String
showsPrec :: Int -> Owner -> ShowS
$cshowsPrec :: Int -> Owner -> ShowS
Prelude.Show, (forall x. Owner -> Rep Owner x)
-> (forall x. Rep Owner x -> Owner) -> Generic Owner
forall x. Rep Owner x -> Owner
forall x. Owner -> Rep Owner x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Owner x -> Owner
$cfrom :: forall x. Owner -> Rep Owner x
Prelude.Generic)

-- |
-- Create a value of 'Owner' 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:
--
-- 'id', 'owner_id' - The canonical user ID of the bucket owner. For information about
-- locating your canonical user ID see
-- <https://docs.aws.amazon.com/general/latest/gr/acct-identifiers.html#FindingCanonicalId Finding Your Account Canonical User ID.>
newOwner ::
  Owner
newOwner :: Owner
newOwner = Owner' :: Maybe Text -> Owner
Owner' {$sel:id:Owner' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing}

-- | The canonical user ID of the bucket owner. For information about
-- locating your canonical user ID see
-- <https://docs.aws.amazon.com/general/latest/gr/acct-identifiers.html#FindingCanonicalId Finding Your Account Canonical User ID.>
owner_id :: Lens.Lens' Owner (Prelude.Maybe Prelude.Text)
owner_id :: (Maybe Text -> f (Maybe Text)) -> Owner -> f Owner
owner_id = (Owner -> Maybe Text)
-> (Owner -> Maybe Text -> Owner)
-> Lens Owner Owner (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Owner' {Maybe Text
id :: Maybe Text
$sel:id:Owner' :: Owner -> Maybe Text
id} -> Maybe Text
id) (\s :: Owner
s@Owner' {} Maybe Text
a -> Owner
s {$sel:id:Owner' :: Maybe Text
id = Maybe Text
a} :: Owner)

instance Core.FromJSON Owner where
  parseJSON :: Value -> Parser Owner
parseJSON =
    String -> (Object -> Parser Owner) -> Value -> Parser Owner
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"Owner"
      (\Object
x -> Maybe Text -> Owner
Owner' (Maybe Text -> Owner) -> Parser (Maybe Text) -> Parser Owner
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
"id"))

instance Prelude.Hashable Owner

instance Prelude.NFData Owner