{-# 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.SSOAdmin.Types.InstanceMetadata
-- 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.SSOAdmin.Types.InstanceMetadata where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude

-- | Provides information about the SSO instance.
--
-- /See:/ 'newInstanceMetadata' smart constructor.
data InstanceMetadata = InstanceMetadata'
  { -- | The identifier of the identity store that is connected to the SSO
    -- instance.
    InstanceMetadata -> Maybe Text
identityStoreId :: Prelude.Maybe Prelude.Text,
    -- | The ARN of the SSO instance under which the operation will be executed.
    -- For more information about ARNs, see
    -- </general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces>
    -- in the /Amazon Web Services General Reference/.
    InstanceMetadata -> Maybe Text
instanceArn :: Prelude.Maybe Prelude.Text
  }
  deriving (InstanceMetadata -> InstanceMetadata -> Bool
(InstanceMetadata -> InstanceMetadata -> Bool)
-> (InstanceMetadata -> InstanceMetadata -> Bool)
-> Eq InstanceMetadata
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: InstanceMetadata -> InstanceMetadata -> Bool
$c/= :: InstanceMetadata -> InstanceMetadata -> Bool
== :: InstanceMetadata -> InstanceMetadata -> Bool
$c== :: InstanceMetadata -> InstanceMetadata -> Bool
Prelude.Eq, ReadPrec [InstanceMetadata]
ReadPrec InstanceMetadata
Int -> ReadS InstanceMetadata
ReadS [InstanceMetadata]
(Int -> ReadS InstanceMetadata)
-> ReadS [InstanceMetadata]
-> ReadPrec InstanceMetadata
-> ReadPrec [InstanceMetadata]
-> Read InstanceMetadata
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [InstanceMetadata]
$creadListPrec :: ReadPrec [InstanceMetadata]
readPrec :: ReadPrec InstanceMetadata
$creadPrec :: ReadPrec InstanceMetadata
readList :: ReadS [InstanceMetadata]
$creadList :: ReadS [InstanceMetadata]
readsPrec :: Int -> ReadS InstanceMetadata
$creadsPrec :: Int -> ReadS InstanceMetadata
Prelude.Read, Int -> InstanceMetadata -> ShowS
[InstanceMetadata] -> ShowS
InstanceMetadata -> String
(Int -> InstanceMetadata -> ShowS)
-> (InstanceMetadata -> String)
-> ([InstanceMetadata] -> ShowS)
-> Show InstanceMetadata
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [InstanceMetadata] -> ShowS
$cshowList :: [InstanceMetadata] -> ShowS
show :: InstanceMetadata -> String
$cshow :: InstanceMetadata -> String
showsPrec :: Int -> InstanceMetadata -> ShowS
$cshowsPrec :: Int -> InstanceMetadata -> ShowS
Prelude.Show, (forall x. InstanceMetadata -> Rep InstanceMetadata x)
-> (forall x. Rep InstanceMetadata x -> InstanceMetadata)
-> Generic InstanceMetadata
forall x. Rep InstanceMetadata x -> InstanceMetadata
forall x. InstanceMetadata -> Rep InstanceMetadata x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep InstanceMetadata x -> InstanceMetadata
$cfrom :: forall x. InstanceMetadata -> Rep InstanceMetadata x
Prelude.Generic)

-- |
-- Create a value of 'InstanceMetadata' 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:
--
-- 'identityStoreId', 'instanceMetadata_identityStoreId' - The identifier of the identity store that is connected to the SSO
-- instance.
--
-- 'instanceArn', 'instanceMetadata_instanceArn' - The ARN of the SSO instance under which the operation will be executed.
-- For more information about ARNs, see
-- </general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces>
-- in the /Amazon Web Services General Reference/.
newInstanceMetadata ::
  InstanceMetadata
newInstanceMetadata :: InstanceMetadata
newInstanceMetadata =
  InstanceMetadata' :: Maybe Text -> Maybe Text -> InstanceMetadata
InstanceMetadata'
    { $sel:identityStoreId:InstanceMetadata' :: Maybe Text
identityStoreId =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:instanceArn:InstanceMetadata' :: Maybe Text
instanceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing
    }

-- | The identifier of the identity store that is connected to the SSO
-- instance.
instanceMetadata_identityStoreId :: Lens.Lens' InstanceMetadata (Prelude.Maybe Prelude.Text)
instanceMetadata_identityStoreId :: (Maybe Text -> f (Maybe Text))
-> InstanceMetadata -> f InstanceMetadata
instanceMetadata_identityStoreId = (InstanceMetadata -> Maybe Text)
-> (InstanceMetadata -> Maybe Text -> InstanceMetadata)
-> Lens InstanceMetadata InstanceMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceMetadata' {Maybe Text
identityStoreId :: Maybe Text
$sel:identityStoreId:InstanceMetadata' :: InstanceMetadata -> Maybe Text
identityStoreId} -> Maybe Text
identityStoreId) (\s :: InstanceMetadata
s@InstanceMetadata' {} Maybe Text
a -> InstanceMetadata
s {$sel:identityStoreId:InstanceMetadata' :: Maybe Text
identityStoreId = Maybe Text
a} :: InstanceMetadata)

-- | The ARN of the SSO instance under which the operation will be executed.
-- For more information about ARNs, see
-- </general/latest/gr/aws-arns-and-namespaces.html Amazon Resource Names (ARNs) and Amazon Web Services Service Namespaces>
-- in the /Amazon Web Services General Reference/.
instanceMetadata_instanceArn :: Lens.Lens' InstanceMetadata (Prelude.Maybe Prelude.Text)
instanceMetadata_instanceArn :: (Maybe Text -> f (Maybe Text))
-> InstanceMetadata -> f InstanceMetadata
instanceMetadata_instanceArn = (InstanceMetadata -> Maybe Text)
-> (InstanceMetadata -> Maybe Text -> InstanceMetadata)
-> Lens InstanceMetadata InstanceMetadata (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\InstanceMetadata' {Maybe Text
instanceArn :: Maybe Text
$sel:instanceArn:InstanceMetadata' :: InstanceMetadata -> Maybe Text
instanceArn} -> Maybe Text
instanceArn) (\s :: InstanceMetadata
s@InstanceMetadata' {} Maybe Text
a -> InstanceMetadata
s {$sel:instanceArn:InstanceMetadata' :: Maybe Text
instanceArn = Maybe Text
a} :: InstanceMetadata)

instance Core.FromJSON InstanceMetadata where
  parseJSON :: Value -> Parser InstanceMetadata
parseJSON =
    String
-> (Object -> Parser InstanceMetadata)
-> Value
-> Parser InstanceMetadata
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"InstanceMetadata"
      ( \Object
x ->
          Maybe Text -> Maybe Text -> InstanceMetadata
InstanceMetadata'
            (Maybe Text -> Maybe Text -> InstanceMetadata)
-> Parser (Maybe Text) -> Parser (Maybe Text -> InstanceMetadata)
forall (f :: * -> *) a b. Functor 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
"IdentityStoreId")
            Parser (Maybe Text -> InstanceMetadata)
-> Parser (Maybe Text) -> Parser InstanceMetadata
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
"InstanceArn")
      )

instance Prelude.Hashable InstanceMetadata

instance Prelude.NFData InstanceMetadata