{-# 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.MacieV2.Types.IpOwner
-- Copyright   : (c) 2013-2023 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
module Amazonka.MacieV2.Types.IpOwner where

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

-- | Provides information about the registered owner of an IP address.
--
-- /See:/ 'newIpOwner' smart constructor.
data IpOwner = IpOwner'
  { -- | The autonomous system number (ASN) for the autonomous system that
    -- included the IP address.
    IpOwner -> Maybe Text
asn :: Prelude.Maybe Prelude.Text,
    -- | The organization identifier that\'s associated with the autonomous
    -- system number (ASN) for the autonomous system that included the IP
    -- address.
    IpOwner -> Maybe Text
asnOrg :: Prelude.Maybe Prelude.Text,
    -- | The name of the internet service provider (ISP) that owned the IP
    -- address.
    IpOwner -> Maybe Text
isp :: Prelude.Maybe Prelude.Text,
    -- | The name of the organization that owned the IP address.
    IpOwner -> Maybe Text
org :: Prelude.Maybe Prelude.Text
  }
  deriving (IpOwner -> IpOwner -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: IpOwner -> IpOwner -> Bool
$c/= :: IpOwner -> IpOwner -> Bool
== :: IpOwner -> IpOwner -> Bool
$c== :: IpOwner -> IpOwner -> Bool
Prelude.Eq, ReadPrec [IpOwner]
ReadPrec IpOwner
Int -> ReadS IpOwner
ReadS [IpOwner]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [IpOwner]
$creadListPrec :: ReadPrec [IpOwner]
readPrec :: ReadPrec IpOwner
$creadPrec :: ReadPrec IpOwner
readList :: ReadS [IpOwner]
$creadList :: ReadS [IpOwner]
readsPrec :: Int -> ReadS IpOwner
$creadsPrec :: Int -> ReadS IpOwner
Prelude.Read, Int -> IpOwner -> ShowS
[IpOwner] -> ShowS
IpOwner -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [IpOwner] -> ShowS
$cshowList :: [IpOwner] -> ShowS
show :: IpOwner -> String
$cshow :: IpOwner -> String
showsPrec :: Int -> IpOwner -> ShowS
$cshowsPrec :: Int -> IpOwner -> ShowS
Prelude.Show, forall x. Rep IpOwner x -> IpOwner
forall x. IpOwner -> Rep IpOwner x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep IpOwner x -> IpOwner
$cfrom :: forall x. IpOwner -> Rep IpOwner x
Prelude.Generic)

-- |
-- Create a value of 'IpOwner' 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:
--
-- 'asn', 'ipOwner_asn' - The autonomous system number (ASN) for the autonomous system that
-- included the IP address.
--
-- 'asnOrg', 'ipOwner_asnOrg' - The organization identifier that\'s associated with the autonomous
-- system number (ASN) for the autonomous system that included the IP
-- address.
--
-- 'isp', 'ipOwner_isp' - The name of the internet service provider (ISP) that owned the IP
-- address.
--
-- 'org', 'ipOwner_org' - The name of the organization that owned the IP address.
newIpOwner ::
  IpOwner
newIpOwner :: IpOwner
newIpOwner =
  IpOwner'
    { $sel:asn:IpOwner' :: Maybe Text
asn = forall a. Maybe a
Prelude.Nothing,
      $sel:asnOrg:IpOwner' :: Maybe Text
asnOrg = forall a. Maybe a
Prelude.Nothing,
      $sel:isp:IpOwner' :: Maybe Text
isp = forall a. Maybe a
Prelude.Nothing,
      $sel:org:IpOwner' :: Maybe Text
org = forall a. Maybe a
Prelude.Nothing
    }

-- | The autonomous system number (ASN) for the autonomous system that
-- included the IP address.
ipOwner_asn :: Lens.Lens' IpOwner (Prelude.Maybe Prelude.Text)
ipOwner_asn :: Lens' IpOwner (Maybe Text)
ipOwner_asn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpOwner' {Maybe Text
asn :: Maybe Text
$sel:asn:IpOwner' :: IpOwner -> Maybe Text
asn} -> Maybe Text
asn) (\s :: IpOwner
s@IpOwner' {} Maybe Text
a -> IpOwner
s {$sel:asn:IpOwner' :: Maybe Text
asn = Maybe Text
a} :: IpOwner)

-- | The organization identifier that\'s associated with the autonomous
-- system number (ASN) for the autonomous system that included the IP
-- address.
ipOwner_asnOrg :: Lens.Lens' IpOwner (Prelude.Maybe Prelude.Text)
ipOwner_asnOrg :: Lens' IpOwner (Maybe Text)
ipOwner_asnOrg = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpOwner' {Maybe Text
asnOrg :: Maybe Text
$sel:asnOrg:IpOwner' :: IpOwner -> Maybe Text
asnOrg} -> Maybe Text
asnOrg) (\s :: IpOwner
s@IpOwner' {} Maybe Text
a -> IpOwner
s {$sel:asnOrg:IpOwner' :: Maybe Text
asnOrg = Maybe Text
a} :: IpOwner)

-- | The name of the internet service provider (ISP) that owned the IP
-- address.
ipOwner_isp :: Lens.Lens' IpOwner (Prelude.Maybe Prelude.Text)
ipOwner_isp :: Lens' IpOwner (Maybe Text)
ipOwner_isp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpOwner' {Maybe Text
isp :: Maybe Text
$sel:isp:IpOwner' :: IpOwner -> Maybe Text
isp} -> Maybe Text
isp) (\s :: IpOwner
s@IpOwner' {} Maybe Text
a -> IpOwner
s {$sel:isp:IpOwner' :: Maybe Text
isp = Maybe Text
a} :: IpOwner)

-- | The name of the organization that owned the IP address.
ipOwner_org :: Lens.Lens' IpOwner (Prelude.Maybe Prelude.Text)
ipOwner_org :: Lens' IpOwner (Maybe Text)
ipOwner_org = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\IpOwner' {Maybe Text
org :: Maybe Text
$sel:org:IpOwner' :: IpOwner -> Maybe Text
org} -> Maybe Text
org) (\s :: IpOwner
s@IpOwner' {} Maybe Text
a -> IpOwner
s {$sel:org:IpOwner' :: Maybe Text
org = Maybe Text
a} :: IpOwner)

instance Data.FromJSON IpOwner where
  parseJSON :: Value -> Parser IpOwner
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"IpOwner"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> IpOwner
IpOwner'
            forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"asn")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"asnOrg")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"isp")
            forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Parser (Maybe a)
Data..:? Key
"org")
      )

instance Prelude.Hashable IpOwner where
  hashWithSalt :: Int -> IpOwner -> Int
hashWithSalt Int
_salt IpOwner' {Maybe Text
org :: Maybe Text
isp :: Maybe Text
asnOrg :: Maybe Text
asn :: Maybe Text
$sel:org:IpOwner' :: IpOwner -> Maybe Text
$sel:isp:IpOwner' :: IpOwner -> Maybe Text
$sel:asnOrg:IpOwner' :: IpOwner -> Maybe Text
$sel:asn:IpOwner' :: IpOwner -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
asn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
asnOrg
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
isp
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
org

instance Prelude.NFData IpOwner where
  rnf :: IpOwner -> ()
rnf IpOwner' {Maybe Text
org :: Maybe Text
isp :: Maybe Text
asnOrg :: Maybe Text
asn :: Maybe Text
$sel:org:IpOwner' :: IpOwner -> Maybe Text
$sel:isp:IpOwner' :: IpOwner -> Maybe Text
$sel:asnOrg:IpOwner' :: IpOwner -> Maybe Text
$sel:asn:IpOwner' :: IpOwner -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
asn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
asnOrg
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
isp
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
org