{-# 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.ECS.Types.FSxWindowsFileServerAuthorizationConfig
-- 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.ECS.Types.FSxWindowsFileServerAuthorizationConfig where

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

-- | The authorization configuration details for Amazon FSx for Windows File
-- Server file system. See
-- <https://docs.aws.amazon.com/AmazonECS/latest/APIReference/API_FSxWindowsFileServerVolumeConfiguration.html FSxWindowsFileServerVolumeConfiguration>
-- in the /Amazon Elastic Container Service API Reference/.
--
-- For more information and the input format, see
-- <https://docs.aws.amazon.com/AmazonECS/latest/developerguide/wfsx-volumes.html Amazon FSx for Windows File Server Volumes>
-- in the /Amazon Elastic Container Service Developer Guide/.
--
-- /See:/ 'newFSxWindowsFileServerAuthorizationConfig' smart constructor.
data FSxWindowsFileServerAuthorizationConfig = FSxWindowsFileServerAuthorizationConfig'
  { -- | The authorization credential option to use. The authorization credential
    -- options can be provided using either the Amazon Resource Name (ARN) of
    -- an Secrets Manager secret or SSM Parameter Store parameter. The ARNs
    -- refer to the stored credentials.
    FSxWindowsFileServerAuthorizationConfig -> Text
credentialsParameter :: Prelude.Text,
    -- | A fully qualified domain name hosted by an
    -- <https://docs.aws.amazon.com/directoryservice/latest/admin-guide/directory_microsoft_ad.html Directory Service>
    -- Managed Microsoft AD (Active Directory) or self-hosted AD on Amazon EC2.
    FSxWindowsFileServerAuthorizationConfig -> Text
domain :: Prelude.Text
  }
  deriving (FSxWindowsFileServerAuthorizationConfig
-> FSxWindowsFileServerAuthorizationConfig -> Bool
(FSxWindowsFileServerAuthorizationConfig
 -> FSxWindowsFileServerAuthorizationConfig -> Bool)
-> (FSxWindowsFileServerAuthorizationConfig
    -> FSxWindowsFileServerAuthorizationConfig -> Bool)
-> Eq FSxWindowsFileServerAuthorizationConfig
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: FSxWindowsFileServerAuthorizationConfig
-> FSxWindowsFileServerAuthorizationConfig -> Bool
$c/= :: FSxWindowsFileServerAuthorizationConfig
-> FSxWindowsFileServerAuthorizationConfig -> Bool
== :: FSxWindowsFileServerAuthorizationConfig
-> FSxWindowsFileServerAuthorizationConfig -> Bool
$c== :: FSxWindowsFileServerAuthorizationConfig
-> FSxWindowsFileServerAuthorizationConfig -> Bool
Prelude.Eq, ReadPrec [FSxWindowsFileServerAuthorizationConfig]
ReadPrec FSxWindowsFileServerAuthorizationConfig
Int -> ReadS FSxWindowsFileServerAuthorizationConfig
ReadS [FSxWindowsFileServerAuthorizationConfig]
(Int -> ReadS FSxWindowsFileServerAuthorizationConfig)
-> ReadS [FSxWindowsFileServerAuthorizationConfig]
-> ReadPrec FSxWindowsFileServerAuthorizationConfig
-> ReadPrec [FSxWindowsFileServerAuthorizationConfig]
-> Read FSxWindowsFileServerAuthorizationConfig
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [FSxWindowsFileServerAuthorizationConfig]
$creadListPrec :: ReadPrec [FSxWindowsFileServerAuthorizationConfig]
readPrec :: ReadPrec FSxWindowsFileServerAuthorizationConfig
$creadPrec :: ReadPrec FSxWindowsFileServerAuthorizationConfig
readList :: ReadS [FSxWindowsFileServerAuthorizationConfig]
$creadList :: ReadS [FSxWindowsFileServerAuthorizationConfig]
readsPrec :: Int -> ReadS FSxWindowsFileServerAuthorizationConfig
$creadsPrec :: Int -> ReadS FSxWindowsFileServerAuthorizationConfig
Prelude.Read, Int -> FSxWindowsFileServerAuthorizationConfig -> ShowS
[FSxWindowsFileServerAuthorizationConfig] -> ShowS
FSxWindowsFileServerAuthorizationConfig -> String
(Int -> FSxWindowsFileServerAuthorizationConfig -> ShowS)
-> (FSxWindowsFileServerAuthorizationConfig -> String)
-> ([FSxWindowsFileServerAuthorizationConfig] -> ShowS)
-> Show FSxWindowsFileServerAuthorizationConfig
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [FSxWindowsFileServerAuthorizationConfig] -> ShowS
$cshowList :: [FSxWindowsFileServerAuthorizationConfig] -> ShowS
show :: FSxWindowsFileServerAuthorizationConfig -> String
$cshow :: FSxWindowsFileServerAuthorizationConfig -> String
showsPrec :: Int -> FSxWindowsFileServerAuthorizationConfig -> ShowS
$cshowsPrec :: Int -> FSxWindowsFileServerAuthorizationConfig -> ShowS
Prelude.Show, (forall x.
 FSxWindowsFileServerAuthorizationConfig
 -> Rep FSxWindowsFileServerAuthorizationConfig x)
-> (forall x.
    Rep FSxWindowsFileServerAuthorizationConfig x
    -> FSxWindowsFileServerAuthorizationConfig)
-> Generic FSxWindowsFileServerAuthorizationConfig
forall x.
Rep FSxWindowsFileServerAuthorizationConfig x
-> FSxWindowsFileServerAuthorizationConfig
forall x.
FSxWindowsFileServerAuthorizationConfig
-> Rep FSxWindowsFileServerAuthorizationConfig x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep FSxWindowsFileServerAuthorizationConfig x
-> FSxWindowsFileServerAuthorizationConfig
$cfrom :: forall x.
FSxWindowsFileServerAuthorizationConfig
-> Rep FSxWindowsFileServerAuthorizationConfig x
Prelude.Generic)

-- |
-- Create a value of 'FSxWindowsFileServerAuthorizationConfig' 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:
--
-- 'credentialsParameter', 'fSxWindowsFileServerAuthorizationConfig_credentialsParameter' - The authorization credential option to use. The authorization credential
-- options can be provided using either the Amazon Resource Name (ARN) of
-- an Secrets Manager secret or SSM Parameter Store parameter. The ARNs
-- refer to the stored credentials.
--
-- 'domain', 'fSxWindowsFileServerAuthorizationConfig_domain' - A fully qualified domain name hosted by an
-- <https://docs.aws.amazon.com/directoryservice/latest/admin-guide/directory_microsoft_ad.html Directory Service>
-- Managed Microsoft AD (Active Directory) or self-hosted AD on Amazon EC2.
newFSxWindowsFileServerAuthorizationConfig ::
  -- | 'credentialsParameter'
  Prelude.Text ->
  -- | 'domain'
  Prelude.Text ->
  FSxWindowsFileServerAuthorizationConfig
newFSxWindowsFileServerAuthorizationConfig :: Text -> Text -> FSxWindowsFileServerAuthorizationConfig
newFSxWindowsFileServerAuthorizationConfig
  Text
pCredentialsParameter_
  Text
pDomain_ =
    FSxWindowsFileServerAuthorizationConfig' :: Text -> Text -> FSxWindowsFileServerAuthorizationConfig
FSxWindowsFileServerAuthorizationConfig'
      { $sel:credentialsParameter:FSxWindowsFileServerAuthorizationConfig' :: Text
credentialsParameter =
          Text
pCredentialsParameter_,
        $sel:domain:FSxWindowsFileServerAuthorizationConfig' :: Text
domain = Text
pDomain_
      }

-- | The authorization credential option to use. The authorization credential
-- options can be provided using either the Amazon Resource Name (ARN) of
-- an Secrets Manager secret or SSM Parameter Store parameter. The ARNs
-- refer to the stored credentials.
fSxWindowsFileServerAuthorizationConfig_credentialsParameter :: Lens.Lens' FSxWindowsFileServerAuthorizationConfig Prelude.Text
fSxWindowsFileServerAuthorizationConfig_credentialsParameter :: (Text -> f Text)
-> FSxWindowsFileServerAuthorizationConfig
-> f FSxWindowsFileServerAuthorizationConfig
fSxWindowsFileServerAuthorizationConfig_credentialsParameter = (FSxWindowsFileServerAuthorizationConfig -> Text)
-> (FSxWindowsFileServerAuthorizationConfig
    -> Text -> FSxWindowsFileServerAuthorizationConfig)
-> Lens
     FSxWindowsFileServerAuthorizationConfig
     FSxWindowsFileServerAuthorizationConfig
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FSxWindowsFileServerAuthorizationConfig' {Text
credentialsParameter :: Text
$sel:credentialsParameter:FSxWindowsFileServerAuthorizationConfig' :: FSxWindowsFileServerAuthorizationConfig -> Text
credentialsParameter} -> Text
credentialsParameter) (\s :: FSxWindowsFileServerAuthorizationConfig
s@FSxWindowsFileServerAuthorizationConfig' {} Text
a -> FSxWindowsFileServerAuthorizationConfig
s {$sel:credentialsParameter:FSxWindowsFileServerAuthorizationConfig' :: Text
credentialsParameter = Text
a} :: FSxWindowsFileServerAuthorizationConfig)

-- | A fully qualified domain name hosted by an
-- <https://docs.aws.amazon.com/directoryservice/latest/admin-guide/directory_microsoft_ad.html Directory Service>
-- Managed Microsoft AD (Active Directory) or self-hosted AD on Amazon EC2.
fSxWindowsFileServerAuthorizationConfig_domain :: Lens.Lens' FSxWindowsFileServerAuthorizationConfig Prelude.Text
fSxWindowsFileServerAuthorizationConfig_domain :: (Text -> f Text)
-> FSxWindowsFileServerAuthorizationConfig
-> f FSxWindowsFileServerAuthorizationConfig
fSxWindowsFileServerAuthorizationConfig_domain = (FSxWindowsFileServerAuthorizationConfig -> Text)
-> (FSxWindowsFileServerAuthorizationConfig
    -> Text -> FSxWindowsFileServerAuthorizationConfig)
-> Lens
     FSxWindowsFileServerAuthorizationConfig
     FSxWindowsFileServerAuthorizationConfig
     Text
     Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\FSxWindowsFileServerAuthorizationConfig' {Text
domain :: Text
$sel:domain:FSxWindowsFileServerAuthorizationConfig' :: FSxWindowsFileServerAuthorizationConfig -> Text
domain} -> Text
domain) (\s :: FSxWindowsFileServerAuthorizationConfig
s@FSxWindowsFileServerAuthorizationConfig' {} Text
a -> FSxWindowsFileServerAuthorizationConfig
s {$sel:domain:FSxWindowsFileServerAuthorizationConfig' :: Text
domain = Text
a} :: FSxWindowsFileServerAuthorizationConfig)

instance
  Core.FromJSON
    FSxWindowsFileServerAuthorizationConfig
  where
  parseJSON :: Value -> Parser FSxWindowsFileServerAuthorizationConfig
parseJSON =
    String
-> (Object -> Parser FSxWindowsFileServerAuthorizationConfig)
-> Value
-> Parser FSxWindowsFileServerAuthorizationConfig
forall a. String -> (Object -> Parser a) -> Value -> Parser a
Core.withObject
      String
"FSxWindowsFileServerAuthorizationConfig"
      ( \Object
x ->
          Text -> Text -> FSxWindowsFileServerAuthorizationConfig
FSxWindowsFileServerAuthorizationConfig'
            (Text -> Text -> FSxWindowsFileServerAuthorizationConfig)
-> Parser Text
-> Parser (Text -> FSxWindowsFileServerAuthorizationConfig)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"credentialsParameter")
            Parser (Text -> FSxWindowsFileServerAuthorizationConfig)
-> Parser Text -> Parser FSxWindowsFileServerAuthorizationConfig
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Parser Text
forall a. FromJSON a => Object -> Text -> Parser a
Core..: Text
"domain")
      )

instance
  Prelude.Hashable
    FSxWindowsFileServerAuthorizationConfig

instance
  Prelude.NFData
    FSxWindowsFileServerAuthorizationConfig

instance
  Core.ToJSON
    FSxWindowsFileServerAuthorizationConfig
  where
  toJSON :: FSxWindowsFileServerAuthorizationConfig -> Value
toJSON FSxWindowsFileServerAuthorizationConfig' {Text
domain :: Text
credentialsParameter :: Text
$sel:domain:FSxWindowsFileServerAuthorizationConfig' :: FSxWindowsFileServerAuthorizationConfig -> Text
$sel:credentialsParameter:FSxWindowsFileServerAuthorizationConfig' :: FSxWindowsFileServerAuthorizationConfig -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"credentialsParameter"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
credentialsParameter
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"domain" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
domain)
          ]
      )