{-# 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.CodeArtifact.Types.DomainSummary
-- 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.CodeArtifact.Types.DomainSummary where

import Amazonka.CodeArtifact.Types.DomainStatus
import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Information about a domain, including its name, Amazon Resource Name
-- (ARN), and status. The
-- <https://docs.aws.amazon.com/codeartifact/latest/APIReference/API_ListDomains.html ListDomains>
-- operation returns a list of @DomainSummary@ objects.
--
-- /See:/ 'newDomainSummary' smart constructor.
data DomainSummary = DomainSummary'
  { -- | A string that contains the status of the domain. The valid values are:
    --
    -- -   @Active@
    --
    -- -   @Deleted@
    DomainSummary -> Maybe DomainStatus
status :: Prelude.Maybe DomainStatus,
    -- | The ARN of the domain.
    DomainSummary -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | A timestamp that contains the date and time the domain was created.
    DomainSummary -> Maybe POSIX
createdTime :: Prelude.Maybe Core.POSIX,
    -- | The 12-digit account number of the AWS account that owns the domain. It
    -- does not include dashes or spaces.
    DomainSummary -> Maybe Text
owner :: Prelude.Maybe Prelude.Text,
    -- | The name of the domain.
    DomainSummary -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The key used to encrypt the domain.
    DomainSummary -> Maybe Text
encryptionKey :: Prelude.Maybe Prelude.Text
  }
  deriving (DomainSummary -> DomainSummary -> Bool
(DomainSummary -> DomainSummary -> Bool)
-> (DomainSummary -> DomainSummary -> Bool) -> Eq DomainSummary
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DomainSummary -> DomainSummary -> Bool
$c/= :: DomainSummary -> DomainSummary -> Bool
== :: DomainSummary -> DomainSummary -> Bool
$c== :: DomainSummary -> DomainSummary -> Bool
Prelude.Eq, ReadPrec [DomainSummary]
ReadPrec DomainSummary
Int -> ReadS DomainSummary
ReadS [DomainSummary]
(Int -> ReadS DomainSummary)
-> ReadS [DomainSummary]
-> ReadPrec DomainSummary
-> ReadPrec [DomainSummary]
-> Read DomainSummary
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DomainSummary]
$creadListPrec :: ReadPrec [DomainSummary]
readPrec :: ReadPrec DomainSummary
$creadPrec :: ReadPrec DomainSummary
readList :: ReadS [DomainSummary]
$creadList :: ReadS [DomainSummary]
readsPrec :: Int -> ReadS DomainSummary
$creadsPrec :: Int -> ReadS DomainSummary
Prelude.Read, Int -> DomainSummary -> ShowS
[DomainSummary] -> ShowS
DomainSummary -> String
(Int -> DomainSummary -> ShowS)
-> (DomainSummary -> String)
-> ([DomainSummary] -> ShowS)
-> Show DomainSummary
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DomainSummary] -> ShowS
$cshowList :: [DomainSummary] -> ShowS
show :: DomainSummary -> String
$cshow :: DomainSummary -> String
showsPrec :: Int -> DomainSummary -> ShowS
$cshowsPrec :: Int -> DomainSummary -> ShowS
Prelude.Show, (forall x. DomainSummary -> Rep DomainSummary x)
-> (forall x. Rep DomainSummary x -> DomainSummary)
-> Generic DomainSummary
forall x. Rep DomainSummary x -> DomainSummary
forall x. DomainSummary -> Rep DomainSummary x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DomainSummary x -> DomainSummary
$cfrom :: forall x. DomainSummary -> Rep DomainSummary x
Prelude.Generic)

-- |
-- Create a value of 'DomainSummary' 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:
--
-- 'status', 'domainSummary_status' - A string that contains the status of the domain. The valid values are:
--
-- -   @Active@
--
-- -   @Deleted@
--
-- 'arn', 'domainSummary_arn' - The ARN of the domain.
--
-- 'createdTime', 'domainSummary_createdTime' - A timestamp that contains the date and time the domain was created.
--
-- 'owner', 'domainSummary_owner' - The 12-digit account number of the AWS account that owns the domain. It
-- does not include dashes or spaces.
--
-- 'name', 'domainSummary_name' - The name of the domain.
--
-- 'encryptionKey', 'domainSummary_encryptionKey' - The key used to encrypt the domain.
newDomainSummary ::
  DomainSummary
newDomainSummary :: DomainSummary
newDomainSummary =
  DomainSummary' :: Maybe DomainStatus
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> DomainSummary
DomainSummary'
    { $sel:status:DomainSummary' :: Maybe DomainStatus
status = Maybe DomainStatus
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:DomainSummary' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:createdTime:DomainSummary' :: Maybe POSIX
createdTime = Maybe POSIX
forall a. Maybe a
Prelude.Nothing,
      $sel:owner:DomainSummary' :: Maybe Text
owner = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:DomainSummary' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:encryptionKey:DomainSummary' :: Maybe Text
encryptionKey = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | A string that contains the status of the domain. The valid values are:
--
-- -   @Active@
--
-- -   @Deleted@
domainSummary_status :: Lens.Lens' DomainSummary (Prelude.Maybe DomainStatus)
domainSummary_status :: (Maybe DomainStatus -> f (Maybe DomainStatus))
-> DomainSummary -> f DomainSummary
domainSummary_status = (DomainSummary -> Maybe DomainStatus)
-> (DomainSummary -> Maybe DomainStatus -> DomainSummary)
-> Lens
     DomainSummary
     DomainSummary
     (Maybe DomainStatus)
     (Maybe DomainStatus)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainSummary' {Maybe DomainStatus
status :: Maybe DomainStatus
$sel:status:DomainSummary' :: DomainSummary -> Maybe DomainStatus
status} -> Maybe DomainStatus
status) (\s :: DomainSummary
s@DomainSummary' {} Maybe DomainStatus
a -> DomainSummary
s {$sel:status:DomainSummary' :: Maybe DomainStatus
status = Maybe DomainStatus
a} :: DomainSummary)

-- | The ARN of the domain.
domainSummary_arn :: Lens.Lens' DomainSummary (Prelude.Maybe Prelude.Text)
domainSummary_arn :: (Maybe Text -> f (Maybe Text)) -> DomainSummary -> f DomainSummary
domainSummary_arn = (DomainSummary -> Maybe Text)
-> (DomainSummary -> Maybe Text -> DomainSummary)
-> Lens DomainSummary DomainSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainSummary' {Maybe Text
arn :: Maybe Text
$sel:arn:DomainSummary' :: DomainSummary -> Maybe Text
arn} -> Maybe Text
arn) (\s :: DomainSummary
s@DomainSummary' {} Maybe Text
a -> DomainSummary
s {$sel:arn:DomainSummary' :: Maybe Text
arn = Maybe Text
a} :: DomainSummary)

-- | A timestamp that contains the date and time the domain was created.
domainSummary_createdTime :: Lens.Lens' DomainSummary (Prelude.Maybe Prelude.UTCTime)
domainSummary_createdTime :: (Maybe UTCTime -> f (Maybe UTCTime))
-> DomainSummary -> f DomainSummary
domainSummary_createdTime = (DomainSummary -> Maybe POSIX)
-> (DomainSummary -> Maybe POSIX -> DomainSummary)
-> Lens DomainSummary DomainSummary (Maybe POSIX) (Maybe POSIX)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainSummary' {Maybe POSIX
createdTime :: Maybe POSIX
$sel:createdTime:DomainSummary' :: DomainSummary -> Maybe POSIX
createdTime} -> Maybe POSIX
createdTime) (\s :: DomainSummary
s@DomainSummary' {} Maybe POSIX
a -> DomainSummary
s {$sel:createdTime:DomainSummary' :: Maybe POSIX
createdTime = Maybe POSIX
a} :: DomainSummary) ((Maybe POSIX -> f (Maybe POSIX))
 -> DomainSummary -> f DomainSummary)
-> ((Maybe UTCTime -> f (Maybe UTCTime))
    -> Maybe POSIX -> f (Maybe POSIX))
-> (Maybe UTCTime -> f (Maybe UTCTime))
-> DomainSummary
-> f DomainSummary
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso POSIX POSIX UTCTime UTCTime
-> Iso (Maybe POSIX) (Maybe POSIX) (Maybe UTCTime) (Maybe UTCTime)
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso POSIX POSIX UTCTime UTCTime
forall (a :: Format). Iso' (Time a) UTCTime
Core._Time

-- | The 12-digit account number of the AWS account that owns the domain. It
-- does not include dashes or spaces.
domainSummary_owner :: Lens.Lens' DomainSummary (Prelude.Maybe Prelude.Text)
domainSummary_owner :: (Maybe Text -> f (Maybe Text)) -> DomainSummary -> f DomainSummary
domainSummary_owner = (DomainSummary -> Maybe Text)
-> (DomainSummary -> Maybe Text -> DomainSummary)
-> Lens DomainSummary DomainSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainSummary' {Maybe Text
owner :: Maybe Text
$sel:owner:DomainSummary' :: DomainSummary -> Maybe Text
owner} -> Maybe Text
owner) (\s :: DomainSummary
s@DomainSummary' {} Maybe Text
a -> DomainSummary
s {$sel:owner:DomainSummary' :: Maybe Text
owner = Maybe Text
a} :: DomainSummary)

-- | The name of the domain.
domainSummary_name :: Lens.Lens' DomainSummary (Prelude.Maybe Prelude.Text)
domainSummary_name :: (Maybe Text -> f (Maybe Text)) -> DomainSummary -> f DomainSummary
domainSummary_name = (DomainSummary -> Maybe Text)
-> (DomainSummary -> Maybe Text -> DomainSummary)
-> Lens DomainSummary DomainSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainSummary' {Maybe Text
name :: Maybe Text
$sel:name:DomainSummary' :: DomainSummary -> Maybe Text
name} -> Maybe Text
name) (\s :: DomainSummary
s@DomainSummary' {} Maybe Text
a -> DomainSummary
s {$sel:name:DomainSummary' :: Maybe Text
name = Maybe Text
a} :: DomainSummary)

-- | The key used to encrypt the domain.
domainSummary_encryptionKey :: Lens.Lens' DomainSummary (Prelude.Maybe Prelude.Text)
domainSummary_encryptionKey :: (Maybe Text -> f (Maybe Text)) -> DomainSummary -> f DomainSummary
domainSummary_encryptionKey = (DomainSummary -> Maybe Text)
-> (DomainSummary -> Maybe Text -> DomainSummary)
-> Lens DomainSummary DomainSummary (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainSummary' {Maybe Text
encryptionKey :: Maybe Text
$sel:encryptionKey:DomainSummary' :: DomainSummary -> Maybe Text
encryptionKey} -> Maybe Text
encryptionKey) (\s :: DomainSummary
s@DomainSummary' {} Maybe Text
a -> DomainSummary
s {$sel:encryptionKey:DomainSummary' :: Maybe Text
encryptionKey = Maybe Text
a} :: DomainSummary)

instance Core.FromJSON DomainSummary where
  parseJSON :: Value -> Parser DomainSummary
parseJSON =
    String
-> (Object -> Parser DomainSummary)
-> Value
-> Parser DomainSummary
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"DomainSummary"
      ( \Object
x ->
          Maybe DomainStatus
-> Maybe Text
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> DomainSummary
DomainSummary'
            (Maybe DomainStatus
 -> Maybe Text
 -> Maybe POSIX
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> DomainSummary)
-> Parser (Maybe DomainStatus)
-> Parser
     (Maybe Text
      -> Maybe POSIX
      -> Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> DomainSummary)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe DomainStatus)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"status")
            Parser
  (Maybe Text
   -> Maybe POSIX
   -> Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> DomainSummary)
-> Parser (Maybe Text)
-> Parser
     (Maybe POSIX
      -> Maybe Text -> Maybe Text -> Maybe Text -> DomainSummary)
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
"arn")
            Parser
  (Maybe POSIX
   -> Maybe Text -> Maybe Text -> Maybe Text -> DomainSummary)
-> Parser (Maybe POSIX)
-> Parser (Maybe Text -> Maybe Text -> Maybe Text -> DomainSummary)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser (Maybe POSIX)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"createdTime")
            Parser (Maybe Text -> Maybe Text -> Maybe Text -> DomainSummary)
-> Parser (Maybe Text)
-> Parser (Maybe Text -> Maybe Text -> DomainSummary)
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
"owner")
            Parser (Maybe Text -> Maybe Text -> DomainSummary)
-> Parser (Maybe Text) -> Parser (Maybe Text -> DomainSummary)
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
"name")
            Parser (Maybe Text -> DomainSummary)
-> Parser (Maybe Text) -> Parser DomainSummary
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
"encryptionKey")
      )

instance Prelude.Hashable DomainSummary

instance Prelude.NFData DomainSummary