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

import Amazonka.CodeArtifact.Types.DomainStatus
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

-- | Information about a domain. A domain is a container for repositories.
-- When you create a domain, it is empty until you add one or more
-- repositories.
--
-- /See:/ 'newDomainDescription' smart constructor.
data DomainDescription = DomainDescription'
  { -- | The Amazon Resource Name (ARN) of the domain.
    DomainDescription -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The total size of all assets in the domain.
    DomainDescription -> Maybe Integer
assetSizeBytes :: Prelude.Maybe Prelude.Integer,
    -- | A timestamp that represents the date and time the domain was created.
    DomainDescription -> Maybe POSIX
createdTime :: Prelude.Maybe Data.POSIX,
    -- | The ARN of an Key Management Service (KMS) key associated with a domain.
    DomainDescription -> Maybe Text
encryptionKey :: Prelude.Maybe Prelude.Text,
    -- | The name of the domain.
    DomainDescription -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services account ID that owns the domain.
    DomainDescription -> Maybe Text
owner :: Prelude.Maybe Prelude.Text,
    -- | The number of repositories in the domain.
    DomainDescription -> Maybe Int
repositoryCount :: Prelude.Maybe Prelude.Int,
    -- | The Amazon Resource Name (ARN) of the Amazon S3 bucket that is used to
    -- store package assets in the domain.
    DomainDescription -> Maybe Text
s3BucketArn :: Prelude.Maybe Prelude.Text,
    -- | The current status of a domain.
    DomainDescription -> Maybe DomainStatus
status :: Prelude.Maybe DomainStatus
  }
  deriving (DomainDescription -> DomainDescription -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DomainDescription -> DomainDescription -> Bool
$c/= :: DomainDescription -> DomainDescription -> Bool
== :: DomainDescription -> DomainDescription -> Bool
$c== :: DomainDescription -> DomainDescription -> Bool
Prelude.Eq, ReadPrec [DomainDescription]
ReadPrec DomainDescription
Int -> ReadS DomainDescription
ReadS [DomainDescription]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DomainDescription]
$creadListPrec :: ReadPrec [DomainDescription]
readPrec :: ReadPrec DomainDescription
$creadPrec :: ReadPrec DomainDescription
readList :: ReadS [DomainDescription]
$creadList :: ReadS [DomainDescription]
readsPrec :: Int -> ReadS DomainDescription
$creadsPrec :: Int -> ReadS DomainDescription
Prelude.Read, Int -> DomainDescription -> ShowS
[DomainDescription] -> ShowS
DomainDescription -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DomainDescription] -> ShowS
$cshowList :: [DomainDescription] -> ShowS
show :: DomainDescription -> String
$cshow :: DomainDescription -> String
showsPrec :: Int -> DomainDescription -> ShowS
$cshowsPrec :: Int -> DomainDescription -> ShowS
Prelude.Show, forall x. Rep DomainDescription x -> DomainDescription
forall x. DomainDescription -> Rep DomainDescription x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DomainDescription x -> DomainDescription
$cfrom :: forall x. DomainDescription -> Rep DomainDescription x
Prelude.Generic)

-- |
-- Create a value of 'DomainDescription' 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:
--
-- 'arn', 'domainDescription_arn' - The Amazon Resource Name (ARN) of the domain.
--
-- 'assetSizeBytes', 'domainDescription_assetSizeBytes' - The total size of all assets in the domain.
--
-- 'createdTime', 'domainDescription_createdTime' - A timestamp that represents the date and time the domain was created.
--
-- 'encryptionKey', 'domainDescription_encryptionKey' - The ARN of an Key Management Service (KMS) key associated with a domain.
--
-- 'name', 'domainDescription_name' - The name of the domain.
--
-- 'owner', 'domainDescription_owner' - The Amazon Web Services account ID that owns the domain.
--
-- 'repositoryCount', 'domainDescription_repositoryCount' - The number of repositories in the domain.
--
-- 's3BucketArn', 'domainDescription_s3BucketArn' - The Amazon Resource Name (ARN) of the Amazon S3 bucket that is used to
-- store package assets in the domain.
--
-- 'status', 'domainDescription_status' - The current status of a domain.
newDomainDescription ::
  DomainDescription
newDomainDescription :: DomainDescription
newDomainDescription =
  DomainDescription'
    { $sel:arn:DomainDescription' :: Maybe Text
arn = forall a. Maybe a
Prelude.Nothing,
      $sel:assetSizeBytes:DomainDescription' :: Maybe Integer
assetSizeBytes = forall a. Maybe a
Prelude.Nothing,
      $sel:createdTime:DomainDescription' :: Maybe POSIX
createdTime = forall a. Maybe a
Prelude.Nothing,
      $sel:encryptionKey:DomainDescription' :: Maybe Text
encryptionKey = forall a. Maybe a
Prelude.Nothing,
      $sel:name:DomainDescription' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
      $sel:owner:DomainDescription' :: Maybe Text
owner = forall a. Maybe a
Prelude.Nothing,
      $sel:repositoryCount:DomainDescription' :: Maybe Int
repositoryCount = forall a. Maybe a
Prelude.Nothing,
      $sel:s3BucketArn:DomainDescription' :: Maybe Text
s3BucketArn = forall a. Maybe a
Prelude.Nothing,
      $sel:status:DomainDescription' :: Maybe DomainStatus
status = forall a. Maybe a
Prelude.Nothing
    }

-- | The Amazon Resource Name (ARN) of the domain.
domainDescription_arn :: Lens.Lens' DomainDescription (Prelude.Maybe Prelude.Text)
domainDescription_arn :: Lens' DomainDescription (Maybe Text)
domainDescription_arn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainDescription' {Maybe Text
arn :: Maybe Text
$sel:arn:DomainDescription' :: DomainDescription -> Maybe Text
arn} -> Maybe Text
arn) (\s :: DomainDescription
s@DomainDescription' {} Maybe Text
a -> DomainDescription
s {$sel:arn:DomainDescription' :: Maybe Text
arn = Maybe Text
a} :: DomainDescription)

-- | The total size of all assets in the domain.
domainDescription_assetSizeBytes :: Lens.Lens' DomainDescription (Prelude.Maybe Prelude.Integer)
domainDescription_assetSizeBytes :: Lens' DomainDescription (Maybe Integer)
domainDescription_assetSizeBytes = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainDescription' {Maybe Integer
assetSizeBytes :: Maybe Integer
$sel:assetSizeBytes:DomainDescription' :: DomainDescription -> Maybe Integer
assetSizeBytes} -> Maybe Integer
assetSizeBytes) (\s :: DomainDescription
s@DomainDescription' {} Maybe Integer
a -> DomainDescription
s {$sel:assetSizeBytes:DomainDescription' :: Maybe Integer
assetSizeBytes = Maybe Integer
a} :: DomainDescription)

-- | A timestamp that represents the date and time the domain was created.
domainDescription_createdTime :: Lens.Lens' DomainDescription (Prelude.Maybe Prelude.UTCTime)
domainDescription_createdTime :: Lens' DomainDescription (Maybe UTCTime)
domainDescription_createdTime = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainDescription' {Maybe POSIX
createdTime :: Maybe POSIX
$sel:createdTime:DomainDescription' :: DomainDescription -> Maybe POSIX
createdTime} -> Maybe POSIX
createdTime) (\s :: DomainDescription
s@DomainDescription' {} Maybe POSIX
a -> DomainDescription
s {$sel:createdTime:DomainDescription' :: Maybe POSIX
createdTime = Maybe POSIX
a} :: DomainDescription) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall (a :: Format). Iso' (Time a) UTCTime
Data._Time

-- | The ARN of an Key Management Service (KMS) key associated with a domain.
domainDescription_encryptionKey :: Lens.Lens' DomainDescription (Prelude.Maybe Prelude.Text)
domainDescription_encryptionKey :: Lens' DomainDescription (Maybe Text)
domainDescription_encryptionKey = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainDescription' {Maybe Text
encryptionKey :: Maybe Text
$sel:encryptionKey:DomainDescription' :: DomainDescription -> Maybe Text
encryptionKey} -> Maybe Text
encryptionKey) (\s :: DomainDescription
s@DomainDescription' {} Maybe Text
a -> DomainDescription
s {$sel:encryptionKey:DomainDescription' :: Maybe Text
encryptionKey = Maybe Text
a} :: DomainDescription)

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

-- | The Amazon Web Services account ID that owns the domain.
domainDescription_owner :: Lens.Lens' DomainDescription (Prelude.Maybe Prelude.Text)
domainDescription_owner :: Lens' DomainDescription (Maybe Text)
domainDescription_owner = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainDescription' {Maybe Text
owner :: Maybe Text
$sel:owner:DomainDescription' :: DomainDescription -> Maybe Text
owner} -> Maybe Text
owner) (\s :: DomainDescription
s@DomainDescription' {} Maybe Text
a -> DomainDescription
s {$sel:owner:DomainDescription' :: Maybe Text
owner = Maybe Text
a} :: DomainDescription)

-- | The number of repositories in the domain.
domainDescription_repositoryCount :: Lens.Lens' DomainDescription (Prelude.Maybe Prelude.Int)
domainDescription_repositoryCount :: Lens' DomainDescription (Maybe Int)
domainDescription_repositoryCount = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainDescription' {Maybe Int
repositoryCount :: Maybe Int
$sel:repositoryCount:DomainDescription' :: DomainDescription -> Maybe Int
repositoryCount} -> Maybe Int
repositoryCount) (\s :: DomainDescription
s@DomainDescription' {} Maybe Int
a -> DomainDescription
s {$sel:repositoryCount:DomainDescription' :: Maybe Int
repositoryCount = Maybe Int
a} :: DomainDescription)

-- | The Amazon Resource Name (ARN) of the Amazon S3 bucket that is used to
-- store package assets in the domain.
domainDescription_s3BucketArn :: Lens.Lens' DomainDescription (Prelude.Maybe Prelude.Text)
domainDescription_s3BucketArn :: Lens' DomainDescription (Maybe Text)
domainDescription_s3BucketArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainDescription' {Maybe Text
s3BucketArn :: Maybe Text
$sel:s3BucketArn:DomainDescription' :: DomainDescription -> Maybe Text
s3BucketArn} -> Maybe Text
s3BucketArn) (\s :: DomainDescription
s@DomainDescription' {} Maybe Text
a -> DomainDescription
s {$sel:s3BucketArn:DomainDescription' :: Maybe Text
s3BucketArn = Maybe Text
a} :: DomainDescription)

-- | The current status of a domain.
domainDescription_status :: Lens.Lens' DomainDescription (Prelude.Maybe DomainStatus)
domainDescription_status :: Lens' DomainDescription (Maybe DomainStatus)
domainDescription_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DomainDescription' {Maybe DomainStatus
status :: Maybe DomainStatus
$sel:status:DomainDescription' :: DomainDescription -> Maybe DomainStatus
status} -> Maybe DomainStatus
status) (\s :: DomainDescription
s@DomainDescription' {} Maybe DomainStatus
a -> DomainDescription
s {$sel:status:DomainDescription' :: Maybe DomainStatus
status = Maybe DomainStatus
a} :: DomainDescription)

instance Data.FromJSON DomainDescription where
  parseJSON :: Value -> Parser DomainDescription
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"DomainDescription"
      ( \Object
x ->
          Maybe Text
-> Maybe Integer
-> Maybe POSIX
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Int
-> Maybe Text
-> Maybe DomainStatus
-> DomainDescription
DomainDescription'
            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
"arn")
            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
"assetSizeBytes")
            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
"createdTime")
            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
"encryptionKey")
            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
"name")
            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
"owner")
            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
"repositoryCount")
            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
"s3BucketArn")
            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
"status")
      )

instance Prelude.Hashable DomainDescription where
  hashWithSalt :: Int -> DomainDescription -> Int
hashWithSalt Int
_salt DomainDescription' {Maybe Int
Maybe Integer
Maybe Text
Maybe POSIX
Maybe DomainStatus
status :: Maybe DomainStatus
s3BucketArn :: Maybe Text
repositoryCount :: Maybe Int
owner :: Maybe Text
name :: Maybe Text
encryptionKey :: Maybe Text
createdTime :: Maybe POSIX
assetSizeBytes :: Maybe Integer
arn :: Maybe Text
$sel:status:DomainDescription' :: DomainDescription -> Maybe DomainStatus
$sel:s3BucketArn:DomainDescription' :: DomainDescription -> Maybe Text
$sel:repositoryCount:DomainDescription' :: DomainDescription -> Maybe Int
$sel:owner:DomainDescription' :: DomainDescription -> Maybe Text
$sel:name:DomainDescription' :: DomainDescription -> Maybe Text
$sel:encryptionKey:DomainDescription' :: DomainDescription -> Maybe Text
$sel:createdTime:DomainDescription' :: DomainDescription -> Maybe POSIX
$sel:assetSizeBytes:DomainDescription' :: DomainDescription -> Maybe Integer
$sel:arn:DomainDescription' :: DomainDescription -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
arn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Integer
assetSizeBytes
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe POSIX
createdTime
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
encryptionKey
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
owner
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Int
repositoryCount
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
s3BucketArn
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DomainStatus
status

instance Prelude.NFData DomainDescription where
  rnf :: DomainDescription -> ()
rnf DomainDescription' {Maybe Int
Maybe Integer
Maybe Text
Maybe POSIX
Maybe DomainStatus
status :: Maybe DomainStatus
s3BucketArn :: Maybe Text
repositoryCount :: Maybe Int
owner :: Maybe Text
name :: Maybe Text
encryptionKey :: Maybe Text
createdTime :: Maybe POSIX
assetSizeBytes :: Maybe Integer
arn :: Maybe Text
$sel:status:DomainDescription' :: DomainDescription -> Maybe DomainStatus
$sel:s3BucketArn:DomainDescription' :: DomainDescription -> Maybe Text
$sel:repositoryCount:DomainDescription' :: DomainDescription -> Maybe Int
$sel:owner:DomainDescription' :: DomainDescription -> Maybe Text
$sel:name:DomainDescription' :: DomainDescription -> Maybe Text
$sel:encryptionKey:DomainDescription' :: DomainDescription -> Maybe Text
$sel:createdTime:DomainDescription' :: DomainDescription -> Maybe POSIX
$sel:assetSizeBytes:DomainDescription' :: DomainDescription -> Maybe Integer
$sel:arn:DomainDescription' :: DomainDescription -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
arn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Integer
assetSizeBytes
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe POSIX
createdTime
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
encryptionKey
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
owner
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Int
repositoryCount
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
s3BucketArn
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DomainStatus
status