{-# 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-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.MacieV2.Types.IpOwner where

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

-- | Provides information about the registered owner of an IP address.
--
-- /See:/ 'newIpOwner' smart constructor.
data IpOwner = IpOwner'
  { -- | The name of the organization that owned the IP address.
    IpOwner -> Maybe Text
org :: 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 autonomous system number (ASN) for the autonomous system that
    -- included the IP address.
    IpOwner -> Maybe Text
asn :: 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
  }
  deriving (IpOwner -> IpOwner -> Bool
(IpOwner -> IpOwner -> Bool)
-> (IpOwner -> IpOwner -> Bool) -> Eq IpOwner
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]
(Int -> ReadS IpOwner)
-> ReadS [IpOwner]
-> ReadPrec IpOwner
-> ReadPrec [IpOwner]
-> Read 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
(Int -> IpOwner -> ShowS)
-> (IpOwner -> String) -> ([IpOwner] -> ShowS) -> Show IpOwner
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. IpOwner -> Rep IpOwner x)
-> (forall x. Rep IpOwner x -> IpOwner) -> Generic IpOwner
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:
--
-- 'org', 'ipOwner_org' - The name of the organization that owned 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.
--
-- 'asn', 'ipOwner_asn' - 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.
newIpOwner ::
  IpOwner
newIpOwner :: IpOwner
newIpOwner =
  IpOwner' :: Maybe Text -> Maybe Text -> Maybe Text -> Maybe Text -> IpOwner
IpOwner'
    { $sel:org:IpOwner' :: Maybe Text
org = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:asnOrg:IpOwner' :: Maybe Text
asnOrg = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:asn:IpOwner' :: Maybe Text
asn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isp:IpOwner' :: Maybe Text
isp = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the organization that owned the IP address.
ipOwner_org :: Lens.Lens' IpOwner (Prelude.Maybe Prelude.Text)
ipOwner_org :: (Maybe Text -> f (Maybe Text)) -> IpOwner -> f IpOwner
ipOwner_org = (IpOwner -> Maybe Text)
-> (IpOwner -> Maybe Text -> IpOwner)
-> Lens IpOwner IpOwner (Maybe Text) (Maybe Text)
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)

-- | 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 :: (Maybe Text -> f (Maybe Text)) -> IpOwner -> f IpOwner
ipOwner_asnOrg = (IpOwner -> Maybe Text)
-> (IpOwner -> Maybe Text -> IpOwner)
-> Lens IpOwner IpOwner (Maybe Text) (Maybe Text)
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 autonomous system number (ASN) for the autonomous system that
-- included the IP address.
ipOwner_asn :: Lens.Lens' IpOwner (Prelude.Maybe Prelude.Text)
ipOwner_asn :: (Maybe Text -> f (Maybe Text)) -> IpOwner -> f IpOwner
ipOwner_asn = (IpOwner -> Maybe Text)
-> (IpOwner -> Maybe Text -> IpOwner)
-> Lens IpOwner IpOwner (Maybe Text) (Maybe Text)
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 name of the internet service provider (ISP) that owned the IP
-- address.
ipOwner_isp :: Lens.Lens' IpOwner (Prelude.Maybe Prelude.Text)
ipOwner_isp :: (Maybe Text -> f (Maybe Text)) -> IpOwner -> f IpOwner
ipOwner_isp = (IpOwner -> Maybe Text)
-> (IpOwner -> Maybe Text -> IpOwner)
-> Lens IpOwner IpOwner (Maybe Text) (Maybe Text)
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)

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

instance Prelude.Hashable IpOwner

instance Prelude.NFData IpOwner