{-# 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.AppSync.Types.ApiAssociation
-- 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.AppSync.Types.ApiAssociation where

import Amazonka.AppSync.Types.AssociationStatus
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

-- | Describes an @ApiAssociation@ object.
--
-- /See:/ 'newApiAssociation' smart constructor.
data ApiAssociation = ApiAssociation'
  { -- | The API ID.
    ApiAssociation -> Maybe Text
apiId :: Prelude.Maybe Prelude.Text,
    -- | Identifies the status of an association.
    --
    -- -   __PROCESSING__: The API association is being created. You cannot
    --     modify association requests during processing.
    --
    -- -   __SUCCESS__: The API association was successful. You can modify
    --     associations after success.
    --
    -- -   __FAILED__: The API association has failed. You can modify
    --     associations after failure.
    ApiAssociation -> Maybe AssociationStatus
associationStatus :: Prelude.Maybe AssociationStatus,
    -- | Details about the last deployment status.
    ApiAssociation -> Maybe Text
deploymentDetail :: Prelude.Maybe Prelude.Text,
    -- | The domain name.
    ApiAssociation -> Maybe Text
domainName :: Prelude.Maybe Prelude.Text
  }
  deriving (ApiAssociation -> ApiAssociation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ApiAssociation -> ApiAssociation -> Bool
$c/= :: ApiAssociation -> ApiAssociation -> Bool
== :: ApiAssociation -> ApiAssociation -> Bool
$c== :: ApiAssociation -> ApiAssociation -> Bool
Prelude.Eq, ReadPrec [ApiAssociation]
ReadPrec ApiAssociation
Int -> ReadS ApiAssociation
ReadS [ApiAssociation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ApiAssociation]
$creadListPrec :: ReadPrec [ApiAssociation]
readPrec :: ReadPrec ApiAssociation
$creadPrec :: ReadPrec ApiAssociation
readList :: ReadS [ApiAssociation]
$creadList :: ReadS [ApiAssociation]
readsPrec :: Int -> ReadS ApiAssociation
$creadsPrec :: Int -> ReadS ApiAssociation
Prelude.Read, Int -> ApiAssociation -> ShowS
[ApiAssociation] -> ShowS
ApiAssociation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ApiAssociation] -> ShowS
$cshowList :: [ApiAssociation] -> ShowS
show :: ApiAssociation -> String
$cshow :: ApiAssociation -> String
showsPrec :: Int -> ApiAssociation -> ShowS
$cshowsPrec :: Int -> ApiAssociation -> ShowS
Prelude.Show, forall x. Rep ApiAssociation x -> ApiAssociation
forall x. ApiAssociation -> Rep ApiAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ApiAssociation x -> ApiAssociation
$cfrom :: forall x. ApiAssociation -> Rep ApiAssociation x
Prelude.Generic)

-- |
-- Create a value of 'ApiAssociation' 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:
--
-- 'apiId', 'apiAssociation_apiId' - The API ID.
--
-- 'associationStatus', 'apiAssociation_associationStatus' - Identifies the status of an association.
--
-- -   __PROCESSING__: The API association is being created. You cannot
--     modify association requests during processing.
--
-- -   __SUCCESS__: The API association was successful. You can modify
--     associations after success.
--
-- -   __FAILED__: The API association has failed. You can modify
--     associations after failure.
--
-- 'deploymentDetail', 'apiAssociation_deploymentDetail' - Details about the last deployment status.
--
-- 'domainName', 'apiAssociation_domainName' - The domain name.
newApiAssociation ::
  ApiAssociation
newApiAssociation :: ApiAssociation
newApiAssociation =
  ApiAssociation'
    { $sel:apiId:ApiAssociation' :: Maybe Text
apiId = forall a. Maybe a
Prelude.Nothing,
      $sel:associationStatus:ApiAssociation' :: Maybe AssociationStatus
associationStatus = forall a. Maybe a
Prelude.Nothing,
      $sel:deploymentDetail:ApiAssociation' :: Maybe Text
deploymentDetail = forall a. Maybe a
Prelude.Nothing,
      $sel:domainName:ApiAssociation' :: Maybe Text
domainName = forall a. Maybe a
Prelude.Nothing
    }

-- | The API ID.
apiAssociation_apiId :: Lens.Lens' ApiAssociation (Prelude.Maybe Prelude.Text)
apiAssociation_apiId :: Lens' ApiAssociation (Maybe Text)
apiAssociation_apiId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApiAssociation' {Maybe Text
apiId :: Maybe Text
$sel:apiId:ApiAssociation' :: ApiAssociation -> Maybe Text
apiId} -> Maybe Text
apiId) (\s :: ApiAssociation
s@ApiAssociation' {} Maybe Text
a -> ApiAssociation
s {$sel:apiId:ApiAssociation' :: Maybe Text
apiId = Maybe Text
a} :: ApiAssociation)

-- | Identifies the status of an association.
--
-- -   __PROCESSING__: The API association is being created. You cannot
--     modify association requests during processing.
--
-- -   __SUCCESS__: The API association was successful. You can modify
--     associations after success.
--
-- -   __FAILED__: The API association has failed. You can modify
--     associations after failure.
apiAssociation_associationStatus :: Lens.Lens' ApiAssociation (Prelude.Maybe AssociationStatus)
apiAssociation_associationStatus :: Lens' ApiAssociation (Maybe AssociationStatus)
apiAssociation_associationStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApiAssociation' {Maybe AssociationStatus
associationStatus :: Maybe AssociationStatus
$sel:associationStatus:ApiAssociation' :: ApiAssociation -> Maybe AssociationStatus
associationStatus} -> Maybe AssociationStatus
associationStatus) (\s :: ApiAssociation
s@ApiAssociation' {} Maybe AssociationStatus
a -> ApiAssociation
s {$sel:associationStatus:ApiAssociation' :: Maybe AssociationStatus
associationStatus = Maybe AssociationStatus
a} :: ApiAssociation)

-- | Details about the last deployment status.
apiAssociation_deploymentDetail :: Lens.Lens' ApiAssociation (Prelude.Maybe Prelude.Text)
apiAssociation_deploymentDetail :: Lens' ApiAssociation (Maybe Text)
apiAssociation_deploymentDetail = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ApiAssociation' {Maybe Text
deploymentDetail :: Maybe Text
$sel:deploymentDetail:ApiAssociation' :: ApiAssociation -> Maybe Text
deploymentDetail} -> Maybe Text
deploymentDetail) (\s :: ApiAssociation
s@ApiAssociation' {} Maybe Text
a -> ApiAssociation
s {$sel:deploymentDetail:ApiAssociation' :: Maybe Text
deploymentDetail = Maybe Text
a} :: ApiAssociation)

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

instance Data.FromJSON ApiAssociation where
  parseJSON :: Value -> Parser ApiAssociation
parseJSON =
    forall a. String -> (Object -> Parser a) -> Value -> Parser a
Data.withObject
      String
"ApiAssociation"
      ( \Object
x ->
          Maybe Text
-> Maybe AssociationStatus
-> Maybe Text
-> Maybe Text
-> ApiAssociation
ApiAssociation'
            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
"apiId")
            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
"associationStatus")
            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
"deploymentDetail")
            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
"domainName")
      )

instance Prelude.Hashable ApiAssociation where
  hashWithSalt :: Int -> ApiAssociation -> Int
hashWithSalt Int
_salt ApiAssociation' {Maybe Text
Maybe AssociationStatus
domainName :: Maybe Text
deploymentDetail :: Maybe Text
associationStatus :: Maybe AssociationStatus
apiId :: Maybe Text
$sel:domainName:ApiAssociation' :: ApiAssociation -> Maybe Text
$sel:deploymentDetail:ApiAssociation' :: ApiAssociation -> Maybe Text
$sel:associationStatus:ApiAssociation' :: ApiAssociation -> Maybe AssociationStatus
$sel:apiId:ApiAssociation' :: ApiAssociation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
apiId
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe AssociationStatus
associationStatus
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
deploymentDetail
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
domainName

instance Prelude.NFData ApiAssociation where
  rnf :: ApiAssociation -> ()
rnf ApiAssociation' {Maybe Text
Maybe AssociationStatus
domainName :: Maybe Text
deploymentDetail :: Maybe Text
associationStatus :: Maybe AssociationStatus
apiId :: Maybe Text
$sel:domainName:ApiAssociation' :: ApiAssociation -> Maybe Text
$sel:deploymentDetail:ApiAssociation' :: ApiAssociation -> Maybe Text
$sel:associationStatus:ApiAssociation' :: ApiAssociation -> Maybe AssociationStatus
$sel:apiId:ApiAssociation' :: ApiAssociation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
apiId
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe AssociationStatus
associationStatus
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
deploymentDetail
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
domainName