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

-- | Contains information about the ISP organization of the remote IP
-- address.
--
-- /See:/ 'newOrganization' smart constructor.
data Organization = Organization'
  { -- | The Autonomous System Number (ASN) of the internet provider of the
    -- remote IP address.
    Organization -> Maybe Text
asn :: Prelude.Maybe Prelude.Text,
    -- | The organization that registered this ASN.
    Organization -> Maybe Text
asnOrg :: Prelude.Maybe Prelude.Text,
    -- | The ISP information for the internet provider.
    Organization -> Maybe Text
isp :: Prelude.Maybe Prelude.Text,
    -- | The name of the internet provider.
    Organization -> Maybe Text
org :: Prelude.Maybe Prelude.Text
  }
  deriving (Organization -> Organization -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: Organization -> Organization -> Bool
$c/= :: Organization -> Organization -> Bool
== :: Organization -> Organization -> Bool
$c== :: Organization -> Organization -> Bool
Prelude.Eq, ReadPrec [Organization]
ReadPrec Organization
Int -> ReadS Organization
ReadS [Organization]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [Organization]
$creadListPrec :: ReadPrec [Organization]
readPrec :: ReadPrec Organization
$creadPrec :: ReadPrec Organization
readList :: ReadS [Organization]
$creadList :: ReadS [Organization]
readsPrec :: Int -> ReadS Organization
$creadsPrec :: Int -> ReadS Organization
Prelude.Read, Int -> Organization -> ShowS
[Organization] -> ShowS
Organization -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [Organization] -> ShowS
$cshowList :: [Organization] -> ShowS
show :: Organization -> String
$cshow :: Organization -> String
showsPrec :: Int -> Organization -> ShowS
$cshowsPrec :: Int -> Organization -> ShowS
Prelude.Show, forall x. Rep Organization x -> Organization
forall x. Organization -> Rep Organization x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep Organization x -> Organization
$cfrom :: forall x. Organization -> Rep Organization x
Prelude.Generic)

-- |
-- Create a value of 'Organization' 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', 'organization_asn' - The Autonomous System Number (ASN) of the internet provider of the
-- remote IP address.
--
-- 'asnOrg', 'organization_asnOrg' - The organization that registered this ASN.
--
-- 'isp', 'organization_isp' - The ISP information for the internet provider.
--
-- 'org', 'organization_org' - The name of the internet provider.
newOrganization ::
  Organization
newOrganization :: Organization
newOrganization =
  Organization'
    { $sel:asn:Organization' :: Maybe Text
asn = forall a. Maybe a
Prelude.Nothing,
      $sel:asnOrg:Organization' :: Maybe Text
asnOrg = forall a. Maybe a
Prelude.Nothing,
      $sel:isp:Organization' :: Maybe Text
isp = forall a. Maybe a
Prelude.Nothing,
      $sel:org:Organization' :: Maybe Text
org = forall a. Maybe a
Prelude.Nothing
    }

-- | The Autonomous System Number (ASN) of the internet provider of the
-- remote IP address.
organization_asn :: Lens.Lens' Organization (Prelude.Maybe Prelude.Text)
organization_asn :: Lens' Organization (Maybe Text)
organization_asn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Organization' {Maybe Text
asn :: Maybe Text
$sel:asn:Organization' :: Organization -> Maybe Text
asn} -> Maybe Text
asn) (\s :: Organization
s@Organization' {} Maybe Text
a -> Organization
s {$sel:asn:Organization' :: Maybe Text
asn = Maybe Text
a} :: Organization)

-- | The organization that registered this ASN.
organization_asnOrg :: Lens.Lens' Organization (Prelude.Maybe Prelude.Text)
organization_asnOrg :: Lens' Organization (Maybe Text)
organization_asnOrg = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Organization' {Maybe Text
asnOrg :: Maybe Text
$sel:asnOrg:Organization' :: Organization -> Maybe Text
asnOrg} -> Maybe Text
asnOrg) (\s :: Organization
s@Organization' {} Maybe Text
a -> Organization
s {$sel:asnOrg:Organization' :: Maybe Text
asnOrg = Maybe Text
a} :: Organization)

-- | The ISP information for the internet provider.
organization_isp :: Lens.Lens' Organization (Prelude.Maybe Prelude.Text)
organization_isp :: Lens' Organization (Maybe Text)
organization_isp = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Organization' {Maybe Text
isp :: Maybe Text
$sel:isp:Organization' :: Organization -> Maybe Text
isp} -> Maybe Text
isp) (\s :: Organization
s@Organization' {} Maybe Text
a -> Organization
s {$sel:isp:Organization' :: Maybe Text
isp = Maybe Text
a} :: Organization)

-- | The name of the internet provider.
organization_org :: Lens.Lens' Organization (Prelude.Maybe Prelude.Text)
organization_org :: Lens' Organization (Maybe Text)
organization_org = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\Organization' {Maybe Text
org :: Maybe Text
$sel:org:Organization' :: Organization -> Maybe Text
org} -> Maybe Text
org) (\s :: Organization
s@Organization' {} Maybe Text
a -> Organization
s {$sel:org:Organization' :: Maybe Text
org = Maybe Text
a} :: Organization)

instance Data.FromJSON Organization where
  parseJSON :: Value -> Parser Organization
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"Organization"
      ( \Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> Organization
Organization'
            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 Organization where
  hashWithSalt :: Int -> Organization -> Int
hashWithSalt Int
_salt Organization' {Maybe Text
org :: Maybe Text
isp :: Maybe Text
asnOrg :: Maybe Text
asn :: Maybe Text
$sel:org:Organization' :: Organization -> Maybe Text
$sel:isp:Organization' :: Organization -> Maybe Text
$sel:asnOrg:Organization' :: Organization -> Maybe Text
$sel:asn:Organization' :: Organization -> 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 Organization where
  rnf :: Organization -> ()
rnf Organization' {Maybe Text
org :: Maybe Text
isp :: Maybe Text
asnOrg :: Maybe Text
asn :: Maybe Text
$sel:org:Organization' :: Organization -> Maybe Text
$sel:isp:Organization' :: Organization -> Maybe Text
$sel:asnOrg:Organization' :: Organization -> Maybe Text
$sel:asn:Organization' :: Organization -> 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