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

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
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 name of the internet provider.
    Organization -> Maybe Text
org :: Prelude.Maybe Prelude.Text,
    -- | The organization that registered this ASN.
    Organization -> Maybe Text
asnOrg :: Prelude.Maybe Prelude.Text,
    -- | The Autonomous System Number (ASN) of the internet provider of the
    -- remote IP address.
    Organization -> Maybe Text
asn :: Prelude.Maybe Prelude.Text,
    -- | The ISP information for the internet provider.
    Organization -> Maybe Text
isp :: Prelude.Maybe Prelude.Text
  }
  deriving (Organization -> Organization -> Bool
(Organization -> Organization -> Bool)
-> (Organization -> Organization -> Bool) -> Eq Organization
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]
(Int -> ReadS Organization)
-> ReadS [Organization]
-> ReadPrec Organization
-> ReadPrec [Organization]
-> Read 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
(Int -> Organization -> ShowS)
-> (Organization -> String)
-> ([Organization] -> ShowS)
-> Show Organization
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. Organization -> Rep Organization x)
-> (forall x. Rep Organization x -> Organization)
-> Generic Organization
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:
--
-- 'org', 'organization_org' - The name of the internet provider.
--
-- 'asnOrg', 'organization_asnOrg' - The organization that registered this ASN.
--
-- 'asn', 'organization_asn' - The Autonomous System Number (ASN) of the internet provider of the
-- remote IP address.
--
-- 'isp', 'organization_isp' - The ISP information for the internet provider.
newOrganization ::
  Organization
newOrganization :: Organization
newOrganization =
  Organization' :: Maybe Text
-> Maybe Text -> Maybe Text -> Maybe Text -> Organization
Organization'
    { $sel:org:Organization' :: Maybe Text
org = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:asnOrg:Organization' :: Maybe Text
asnOrg = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:asn:Organization' :: Maybe Text
asn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:isp:Organization' :: Maybe Text
isp = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the internet provider.
organization_org :: Lens.Lens' Organization (Prelude.Maybe Prelude.Text)
organization_org :: (Maybe Text -> f (Maybe Text)) -> Organization -> f Organization
organization_org = (Organization -> Maybe Text)
-> (Organization -> Maybe Text -> Organization)
-> Lens Organization Organization (Maybe Text) (Maybe Text)
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)

-- | The organization that registered this ASN.
organization_asnOrg :: Lens.Lens' Organization (Prelude.Maybe Prelude.Text)
organization_asnOrg :: (Maybe Text -> f (Maybe Text)) -> Organization -> f Organization
organization_asnOrg = (Organization -> Maybe Text)
-> (Organization -> Maybe Text -> Organization)
-> Lens Organization Organization (Maybe Text) (Maybe Text)
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 Autonomous System Number (ASN) of the internet provider of the
-- remote IP address.
organization_asn :: Lens.Lens' Organization (Prelude.Maybe Prelude.Text)
organization_asn :: (Maybe Text -> f (Maybe Text)) -> Organization -> f Organization
organization_asn = (Organization -> Maybe Text)
-> (Organization -> Maybe Text -> Organization)
-> Lens Organization Organization (Maybe Text) (Maybe Text)
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 ISP information for the internet provider.
organization_isp :: Lens.Lens' Organization (Prelude.Maybe Prelude.Text)
organization_isp :: (Maybe Text -> f (Maybe Text)) -> Organization -> f Organization
organization_isp = (Organization -> Maybe Text)
-> (Organization -> Maybe Text -> Organization)
-> Lens Organization Organization (Maybe Text) (Maybe Text)
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)

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

instance Prelude.NFData Organization