{-# 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.Redshift.Types.DataShareAssociation
-- 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.Redshift.Types.DataShareAssociation 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
import Amazonka.Redshift.Internal
import Amazonka.Redshift.Types.DataShareStatus

-- | The association of a datashare from a producer account with a data
-- consumer.
--
-- /See:/ 'newDataShareAssociation' smart constructor.
data DataShareAssociation = DataShareAssociation'
  { -- | The name of the consumer accounts that have an association with a
    -- producer datashare.
    DataShareAssociation -> Maybe Text
consumerIdentifier :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Web Services Region of the consumer accounts that have an
    -- association with a producer datashare.
    DataShareAssociation -> Maybe Text
consumerRegion :: Prelude.Maybe Prelude.Text,
    -- | The creation date of the datashare that is associated.
    DataShareAssociation -> Maybe ISO8601
createdDate :: Prelude.Maybe Data.ISO8601,
    -- | The status of the datashare that is associated.
    DataShareAssociation -> Maybe DataShareStatus
status :: Prelude.Maybe DataShareStatus,
    -- | The status change data of the datashare that is associated.
    DataShareAssociation -> Maybe ISO8601
statusChangeDate :: Prelude.Maybe Data.ISO8601
  }
  deriving (DataShareAssociation -> DataShareAssociation -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: DataShareAssociation -> DataShareAssociation -> Bool
$c/= :: DataShareAssociation -> DataShareAssociation -> Bool
== :: DataShareAssociation -> DataShareAssociation -> Bool
$c== :: DataShareAssociation -> DataShareAssociation -> Bool
Prelude.Eq, ReadPrec [DataShareAssociation]
ReadPrec DataShareAssociation
Int -> ReadS DataShareAssociation
ReadS [DataShareAssociation]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [DataShareAssociation]
$creadListPrec :: ReadPrec [DataShareAssociation]
readPrec :: ReadPrec DataShareAssociation
$creadPrec :: ReadPrec DataShareAssociation
readList :: ReadS [DataShareAssociation]
$creadList :: ReadS [DataShareAssociation]
readsPrec :: Int -> ReadS DataShareAssociation
$creadsPrec :: Int -> ReadS DataShareAssociation
Prelude.Read, Int -> DataShareAssociation -> ShowS
[DataShareAssociation] -> ShowS
DataShareAssociation -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [DataShareAssociation] -> ShowS
$cshowList :: [DataShareAssociation] -> ShowS
show :: DataShareAssociation -> String
$cshow :: DataShareAssociation -> String
showsPrec :: Int -> DataShareAssociation -> ShowS
$cshowsPrec :: Int -> DataShareAssociation -> ShowS
Prelude.Show, forall x. Rep DataShareAssociation x -> DataShareAssociation
forall x. DataShareAssociation -> Rep DataShareAssociation x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep DataShareAssociation x -> DataShareAssociation
$cfrom :: forall x. DataShareAssociation -> Rep DataShareAssociation x
Prelude.Generic)

-- |
-- Create a value of 'DataShareAssociation' 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:
--
-- 'consumerIdentifier', 'dataShareAssociation_consumerIdentifier' - The name of the consumer accounts that have an association with a
-- producer datashare.
--
-- 'consumerRegion', 'dataShareAssociation_consumerRegion' - The Amazon Web Services Region of the consumer accounts that have an
-- association with a producer datashare.
--
-- 'createdDate', 'dataShareAssociation_createdDate' - The creation date of the datashare that is associated.
--
-- 'status', 'dataShareAssociation_status' - The status of the datashare that is associated.
--
-- 'statusChangeDate', 'dataShareAssociation_statusChangeDate' - The status change data of the datashare that is associated.
newDataShareAssociation ::
  DataShareAssociation
newDataShareAssociation :: DataShareAssociation
newDataShareAssociation =
  DataShareAssociation'
    { $sel:consumerIdentifier:DataShareAssociation' :: Maybe Text
consumerIdentifier =
        forall a. Maybe a
Prelude.Nothing,
      $sel:consumerRegion:DataShareAssociation' :: Maybe Text
consumerRegion = forall a. Maybe a
Prelude.Nothing,
      $sel:createdDate:DataShareAssociation' :: Maybe ISO8601
createdDate = forall a. Maybe a
Prelude.Nothing,
      $sel:status:DataShareAssociation' :: Maybe DataShareStatus
status = forall a. Maybe a
Prelude.Nothing,
      $sel:statusChangeDate:DataShareAssociation' :: Maybe ISO8601
statusChangeDate = forall a. Maybe a
Prelude.Nothing
    }

-- | The name of the consumer accounts that have an association with a
-- producer datashare.
dataShareAssociation_consumerIdentifier :: Lens.Lens' DataShareAssociation (Prelude.Maybe Prelude.Text)
dataShareAssociation_consumerIdentifier :: Lens' DataShareAssociation (Maybe Text)
dataShareAssociation_consumerIdentifier = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataShareAssociation' {Maybe Text
consumerIdentifier :: Maybe Text
$sel:consumerIdentifier:DataShareAssociation' :: DataShareAssociation -> Maybe Text
consumerIdentifier} -> Maybe Text
consumerIdentifier) (\s :: DataShareAssociation
s@DataShareAssociation' {} Maybe Text
a -> DataShareAssociation
s {$sel:consumerIdentifier:DataShareAssociation' :: Maybe Text
consumerIdentifier = Maybe Text
a} :: DataShareAssociation)

-- | The Amazon Web Services Region of the consumer accounts that have an
-- association with a producer datashare.
dataShareAssociation_consumerRegion :: Lens.Lens' DataShareAssociation (Prelude.Maybe Prelude.Text)
dataShareAssociation_consumerRegion :: Lens' DataShareAssociation (Maybe Text)
dataShareAssociation_consumerRegion = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataShareAssociation' {Maybe Text
consumerRegion :: Maybe Text
$sel:consumerRegion:DataShareAssociation' :: DataShareAssociation -> Maybe Text
consumerRegion} -> Maybe Text
consumerRegion) (\s :: DataShareAssociation
s@DataShareAssociation' {} Maybe Text
a -> DataShareAssociation
s {$sel:consumerRegion:DataShareAssociation' :: Maybe Text
consumerRegion = Maybe Text
a} :: DataShareAssociation)

-- | The creation date of the datashare that is associated.
dataShareAssociation_createdDate :: Lens.Lens' DataShareAssociation (Prelude.Maybe Prelude.UTCTime)
dataShareAssociation_createdDate :: Lens' DataShareAssociation (Maybe UTCTime)
dataShareAssociation_createdDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataShareAssociation' {Maybe ISO8601
createdDate :: Maybe ISO8601
$sel:createdDate:DataShareAssociation' :: DataShareAssociation -> Maybe ISO8601
createdDate} -> Maybe ISO8601
createdDate) (\s :: DataShareAssociation
s@DataShareAssociation' {} Maybe ISO8601
a -> DataShareAssociation
s {$sel:createdDate:DataShareAssociation' :: Maybe ISO8601
createdDate = Maybe ISO8601
a} :: DataShareAssociation) 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 status of the datashare that is associated.
dataShareAssociation_status :: Lens.Lens' DataShareAssociation (Prelude.Maybe DataShareStatus)
dataShareAssociation_status :: Lens' DataShareAssociation (Maybe DataShareStatus)
dataShareAssociation_status = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataShareAssociation' {Maybe DataShareStatus
status :: Maybe DataShareStatus
$sel:status:DataShareAssociation' :: DataShareAssociation -> Maybe DataShareStatus
status} -> Maybe DataShareStatus
status) (\s :: DataShareAssociation
s@DataShareAssociation' {} Maybe DataShareStatus
a -> DataShareAssociation
s {$sel:status:DataShareAssociation' :: Maybe DataShareStatus
status = Maybe DataShareStatus
a} :: DataShareAssociation)

-- | The status change data of the datashare that is associated.
dataShareAssociation_statusChangeDate :: Lens.Lens' DataShareAssociation (Prelude.Maybe Prelude.UTCTime)
dataShareAssociation_statusChangeDate :: Lens' DataShareAssociation (Maybe UTCTime)
dataShareAssociation_statusChangeDate = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\DataShareAssociation' {Maybe ISO8601
statusChangeDate :: Maybe ISO8601
$sel:statusChangeDate:DataShareAssociation' :: DataShareAssociation -> Maybe ISO8601
statusChangeDate} -> Maybe ISO8601
statusChangeDate) (\s :: DataShareAssociation
s@DataShareAssociation' {} Maybe ISO8601
a -> DataShareAssociation
s {$sel:statusChangeDate:DataShareAssociation' :: Maybe ISO8601
statusChangeDate = Maybe ISO8601
a} :: DataShareAssociation) 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

instance Data.FromXML DataShareAssociation where
  parseXML :: [Node] -> Either String DataShareAssociation
parseXML [Node]
x =
    Maybe Text
-> Maybe Text
-> Maybe ISO8601
-> Maybe DataShareStatus
-> Maybe ISO8601
-> DataShareAssociation
DataShareAssociation'
      forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ConsumerIdentifier")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"ConsumerRegion")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"CreatedDate")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"Status")
      forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> ([Node]
x forall a. FromXML a => [Node] -> Text -> Either String (Maybe a)
Data..@? Text
"StatusChangeDate")

instance Prelude.Hashable DataShareAssociation where
  hashWithSalt :: Int -> DataShareAssociation -> Int
hashWithSalt Int
_salt DataShareAssociation' {Maybe Text
Maybe ISO8601
Maybe DataShareStatus
statusChangeDate :: Maybe ISO8601
status :: Maybe DataShareStatus
createdDate :: Maybe ISO8601
consumerRegion :: Maybe Text
consumerIdentifier :: Maybe Text
$sel:statusChangeDate:DataShareAssociation' :: DataShareAssociation -> Maybe ISO8601
$sel:status:DataShareAssociation' :: DataShareAssociation -> Maybe DataShareStatus
$sel:createdDate:DataShareAssociation' :: DataShareAssociation -> Maybe ISO8601
$sel:consumerRegion:DataShareAssociation' :: DataShareAssociation -> Maybe Text
$sel:consumerIdentifier:DataShareAssociation' :: DataShareAssociation -> Maybe Text
..} =
    Int
_salt
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
consumerIdentifier
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
consumerRegion
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
createdDate
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe DataShareStatus
status
      forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe ISO8601
statusChangeDate

instance Prelude.NFData DataShareAssociation where
  rnf :: DataShareAssociation -> ()
rnf DataShareAssociation' {Maybe Text
Maybe ISO8601
Maybe DataShareStatus
statusChangeDate :: Maybe ISO8601
status :: Maybe DataShareStatus
createdDate :: Maybe ISO8601
consumerRegion :: Maybe Text
consumerIdentifier :: Maybe Text
$sel:statusChangeDate:DataShareAssociation' :: DataShareAssociation -> Maybe ISO8601
$sel:status:DataShareAssociation' :: DataShareAssociation -> Maybe DataShareStatus
$sel:createdDate:DataShareAssociation' :: DataShareAssociation -> Maybe ISO8601
$sel:consumerRegion:DataShareAssociation' :: DataShareAssociation -> Maybe Text
$sel:consumerIdentifier:DataShareAssociation' :: DataShareAssociation -> Maybe Text
..} =
    forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
consumerIdentifier
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
consumerRegion
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
createdDate
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe DataShareStatus
status
      seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe ISO8601
statusChangeDate