{-# 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.ServiceCatalogAppRegistry.Types.ResourceGroup
-- 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.ServiceCatalogAppRegistry.Types.ResourceGroup where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import Amazonka.ServiceCatalogAppRegistry.Types.ResourceGroupState

-- | The information about the resource group integration.
--
-- /See:/ 'newResourceGroup' smart constructor.
data ResourceGroup = ResourceGroup'
  { -- | The state of the propagation process for the resource group. The states
    -- includes:
    --
    -- @CREATING @if the resource group is in the process of being created.
    --
    -- @CREATE_COMPLETE@ if the resource group was created successfully.
    --
    -- @CREATE_FAILED@ if the resource group failed to be created.
    --
    -- @UPDATING@ if the resource group is in the process of being updated.
    --
    -- @UPDATE_COMPLETE@ if the resource group updated successfully.
    --
    -- @UPDATE_FAILED@ if the resource group could not update successfully.
    ResourceGroup -> Maybe ResourceGroupState
state :: Prelude.Maybe ResourceGroupState,
    -- | The Amazon resource name (ARN) of the resource group.
    ResourceGroup -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The error message that generates when the propagation process for the
    -- resource group fails.
    ResourceGroup -> Maybe Text
errorMessage :: Prelude.Maybe Prelude.Text
  }
  deriving (ResourceGroup -> ResourceGroup -> Bool
(ResourceGroup -> ResourceGroup -> Bool)
-> (ResourceGroup -> ResourceGroup -> Bool) -> Eq ResourceGroup
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: ResourceGroup -> ResourceGroup -> Bool
$c/= :: ResourceGroup -> ResourceGroup -> Bool
== :: ResourceGroup -> ResourceGroup -> Bool
$c== :: ResourceGroup -> ResourceGroup -> Bool
Prelude.Eq, ReadPrec [ResourceGroup]
ReadPrec ResourceGroup
Int -> ReadS ResourceGroup
ReadS [ResourceGroup]
(Int -> ReadS ResourceGroup)
-> ReadS [ResourceGroup]
-> ReadPrec ResourceGroup
-> ReadPrec [ResourceGroup]
-> Read ResourceGroup
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [ResourceGroup]
$creadListPrec :: ReadPrec [ResourceGroup]
readPrec :: ReadPrec ResourceGroup
$creadPrec :: ReadPrec ResourceGroup
readList :: ReadS [ResourceGroup]
$creadList :: ReadS [ResourceGroup]
readsPrec :: Int -> ReadS ResourceGroup
$creadsPrec :: Int -> ReadS ResourceGroup
Prelude.Read, Int -> ResourceGroup -> ShowS
[ResourceGroup] -> ShowS
ResourceGroup -> String
(Int -> ResourceGroup -> ShowS)
-> (ResourceGroup -> String)
-> ([ResourceGroup] -> ShowS)
-> Show ResourceGroup
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [ResourceGroup] -> ShowS
$cshowList :: [ResourceGroup] -> ShowS
show :: ResourceGroup -> String
$cshow :: ResourceGroup -> String
showsPrec :: Int -> ResourceGroup -> ShowS
$cshowsPrec :: Int -> ResourceGroup -> ShowS
Prelude.Show, (forall x. ResourceGroup -> Rep ResourceGroup x)
-> (forall x. Rep ResourceGroup x -> ResourceGroup)
-> Generic ResourceGroup
forall x. Rep ResourceGroup x -> ResourceGroup
forall x. ResourceGroup -> Rep ResourceGroup x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep ResourceGroup x -> ResourceGroup
$cfrom :: forall x. ResourceGroup -> Rep ResourceGroup x
Prelude.Generic)

-- |
-- Create a value of 'ResourceGroup' 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:
--
-- 'state', 'resourceGroup_state' - The state of the propagation process for the resource group. The states
-- includes:
--
-- @CREATING @if the resource group is in the process of being created.
--
-- @CREATE_COMPLETE@ if the resource group was created successfully.
--
-- @CREATE_FAILED@ if the resource group failed to be created.
--
-- @UPDATING@ if the resource group is in the process of being updated.
--
-- @UPDATE_COMPLETE@ if the resource group updated successfully.
--
-- @UPDATE_FAILED@ if the resource group could not update successfully.
--
-- 'arn', 'resourceGroup_arn' - The Amazon resource name (ARN) of the resource group.
--
-- 'errorMessage', 'resourceGroup_errorMessage' - The error message that generates when the propagation process for the
-- resource group fails.
newResourceGroup ::
  ResourceGroup
newResourceGroup :: ResourceGroup
newResourceGroup =
  ResourceGroup' :: Maybe ResourceGroupState
-> Maybe Text -> Maybe Text -> ResourceGroup
ResourceGroup'
    { $sel:state:ResourceGroup' :: Maybe ResourceGroupState
state = Maybe ResourceGroupState
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:ResourceGroup' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:errorMessage:ResourceGroup' :: Maybe Text
errorMessage = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The state of the propagation process for the resource group. The states
-- includes:
--
-- @CREATING @if the resource group is in the process of being created.
--
-- @CREATE_COMPLETE@ if the resource group was created successfully.
--
-- @CREATE_FAILED@ if the resource group failed to be created.
--
-- @UPDATING@ if the resource group is in the process of being updated.
--
-- @UPDATE_COMPLETE@ if the resource group updated successfully.
--
-- @UPDATE_FAILED@ if the resource group could not update successfully.
resourceGroup_state :: Lens.Lens' ResourceGroup (Prelude.Maybe ResourceGroupState)
resourceGroup_state :: (Maybe ResourceGroupState -> f (Maybe ResourceGroupState))
-> ResourceGroup -> f ResourceGroup
resourceGroup_state = (ResourceGroup -> Maybe ResourceGroupState)
-> (ResourceGroup -> Maybe ResourceGroupState -> ResourceGroup)
-> Lens
     ResourceGroup
     ResourceGroup
     (Maybe ResourceGroupState)
     (Maybe ResourceGroupState)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceGroup' {Maybe ResourceGroupState
state :: Maybe ResourceGroupState
$sel:state:ResourceGroup' :: ResourceGroup -> Maybe ResourceGroupState
state} -> Maybe ResourceGroupState
state) (\s :: ResourceGroup
s@ResourceGroup' {} Maybe ResourceGroupState
a -> ResourceGroup
s {$sel:state:ResourceGroup' :: Maybe ResourceGroupState
state = Maybe ResourceGroupState
a} :: ResourceGroup)

-- | The Amazon resource name (ARN) of the resource group.
resourceGroup_arn :: Lens.Lens' ResourceGroup (Prelude.Maybe Prelude.Text)
resourceGroup_arn :: (Maybe Text -> f (Maybe Text)) -> ResourceGroup -> f ResourceGroup
resourceGroup_arn = (ResourceGroup -> Maybe Text)
-> (ResourceGroup -> Maybe Text -> ResourceGroup)
-> Lens ResourceGroup ResourceGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceGroup' {Maybe Text
arn :: Maybe Text
$sel:arn:ResourceGroup' :: ResourceGroup -> Maybe Text
arn} -> Maybe Text
arn) (\s :: ResourceGroup
s@ResourceGroup' {} Maybe Text
a -> ResourceGroup
s {$sel:arn:ResourceGroup' :: Maybe Text
arn = Maybe Text
a} :: ResourceGroup)

-- | The error message that generates when the propagation process for the
-- resource group fails.
resourceGroup_errorMessage :: Lens.Lens' ResourceGroup (Prelude.Maybe Prelude.Text)
resourceGroup_errorMessage :: (Maybe Text -> f (Maybe Text)) -> ResourceGroup -> f ResourceGroup
resourceGroup_errorMessage = (ResourceGroup -> Maybe Text)
-> (ResourceGroup -> Maybe Text -> ResourceGroup)
-> Lens ResourceGroup ResourceGroup (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\ResourceGroup' {Maybe Text
errorMessage :: Maybe Text
$sel:errorMessage:ResourceGroup' :: ResourceGroup -> Maybe Text
errorMessage} -> Maybe Text
errorMessage) (\s :: ResourceGroup
s@ResourceGroup' {} Maybe Text
a -> ResourceGroup
s {$sel:errorMessage:ResourceGroup' :: Maybe Text
errorMessage = Maybe Text
a} :: ResourceGroup)

instance Core.FromJSON ResourceGroup where
  parseJSON :: Value -> Parser ResourceGroup
parseJSON =
    String
-> (Object -> Parser ResourceGroup)
-> Value
-> Parser ResourceGroup
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"ResourceGroup"
      ( \Object
x ->
          Maybe ResourceGroupState
-> Maybe Text -> Maybe Text -> ResourceGroup
ResourceGroup'
            (Maybe ResourceGroupState
 -> Maybe Text -> Maybe Text -> ResourceGroup)
-> Parser (Maybe ResourceGroupState)
-> Parser (Maybe Text -> Maybe Text -> ResourceGroup)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser (Maybe ResourceGroupState)
forall a. FromJSON a => Object -> Text -> Parser (Maybe a)
Core..:? Text
"state")
            Parser (Maybe Text -> Maybe Text -> ResourceGroup)
-> Parser (Maybe Text) -> Parser (Maybe Text -> ResourceGroup)
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 Text -> ResourceGroup)
-> Parser (Maybe Text) -> Parser ResourceGroup
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
"errorMessage")
      )

instance Prelude.Hashable ResourceGroup

instance Prelude.NFData ResourceGroup