{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE DuplicateRecordFields #-}
{-# LANGUAGE NamedFieldPuns #-}
{-# LANGUAGE OverloadedStrings #-}
{-# LANGUAGE RecordWildCards #-}
{-# LANGUAGE StrictData #-}
{-# LANGUAGE TypeFamilies #-}
{-# LANGUAGE NoImplicitPrelude #-}
{-# OPTIONS_GHC -fno-warn-unused-binds #-}
{-# OPTIONS_GHC -fno-warn-unused-imports #-}
{-# OPTIONS_GHC -fno-warn-unused-matches #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.DataSync.CreateLocationFsxWindows
-- 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)
--
-- Creates an endpoint for an Amazon FSx for Windows File Server file
-- system.
module Amazonka.DataSync.CreateLocationFsxWindows
  ( -- * Creating a Request
    CreateLocationFsxWindows (..),
    newCreateLocationFsxWindows,

    -- * Request Lenses
    createLocationFsxWindows_domain,
    createLocationFsxWindows_subdirectory,
    createLocationFsxWindows_tags,
    createLocationFsxWindows_fsxFilesystemArn,
    createLocationFsxWindows_securityGroupArns,
    createLocationFsxWindows_user,
    createLocationFsxWindows_password,

    -- * Destructuring the Response
    CreateLocationFsxWindowsResponse (..),
    newCreateLocationFsxWindowsResponse,

    -- * Response Lenses
    createLocationFsxWindowsResponse_locationArn,
    createLocationFsxWindowsResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.DataSync.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | /See:/ 'newCreateLocationFsxWindows' smart constructor.
data CreateLocationFsxWindows = CreateLocationFsxWindows'
  { -- | The name of the Windows domain that the FSx for Windows File Server
    -- belongs to.
    CreateLocationFsxWindows -> Maybe Text
domain :: Prelude.Maybe Prelude.Text,
    -- | A subdirectory in the location’s path. This subdirectory in the Amazon
    -- FSx for Windows File Server file system is used to read data from the
    -- Amazon FSx for Windows File Server source location or write data to the
    -- FSx for Windows File Server destination.
    CreateLocationFsxWindows -> Maybe Text
subdirectory :: Prelude.Maybe Prelude.Text,
    -- | The key-value pair that represents a tag that you want to add to the
    -- resource. The value can be an empty string. This value helps you manage,
    -- filter, and search for your resources. We recommend that you create a
    -- name tag for your location.
    CreateLocationFsxWindows -> Maybe [TagListEntry]
tags :: Prelude.Maybe [TagListEntry],
    -- | The Amazon Resource Name (ARN) for the FSx for Windows File Server file
    -- system.
    CreateLocationFsxWindows -> Text
fsxFilesystemArn :: Prelude.Text,
    -- | The Amazon Resource Names (ARNs) of the security groups that are to use
    -- to configure the FSx for Windows File Server file system.
    CreateLocationFsxWindows -> NonEmpty Text
securityGroupArns :: Prelude.NonEmpty Prelude.Text,
    -- | The user who has the permissions to access files and folders in the FSx
    -- for Windows File Server file system.
    --
    -- For information about choosing a user name that ensures sufficient
    -- permissions to files, folders, and metadata, see
    -- <create-fsx-location.html#FSxWuser user>.
    CreateLocationFsxWindows -> Text
user :: Prelude.Text,
    -- | The password of the user who has the permissions to access files and
    -- folders in the FSx for Windows File Server file system.
    CreateLocationFsxWindows -> Sensitive Text
password :: Core.Sensitive Prelude.Text
  }
  deriving (CreateLocationFsxWindows -> CreateLocationFsxWindows -> Bool
(CreateLocationFsxWindows -> CreateLocationFsxWindows -> Bool)
-> (CreateLocationFsxWindows -> CreateLocationFsxWindows -> Bool)
-> Eq CreateLocationFsxWindows
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLocationFsxWindows -> CreateLocationFsxWindows -> Bool
$c/= :: CreateLocationFsxWindows -> CreateLocationFsxWindows -> Bool
== :: CreateLocationFsxWindows -> CreateLocationFsxWindows -> Bool
$c== :: CreateLocationFsxWindows -> CreateLocationFsxWindows -> Bool
Prelude.Eq, Int -> CreateLocationFsxWindows -> ShowS
[CreateLocationFsxWindows] -> ShowS
CreateLocationFsxWindows -> String
(Int -> CreateLocationFsxWindows -> ShowS)
-> (CreateLocationFsxWindows -> String)
-> ([CreateLocationFsxWindows] -> ShowS)
-> Show CreateLocationFsxWindows
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLocationFsxWindows] -> ShowS
$cshowList :: [CreateLocationFsxWindows] -> ShowS
show :: CreateLocationFsxWindows -> String
$cshow :: CreateLocationFsxWindows -> String
showsPrec :: Int -> CreateLocationFsxWindows -> ShowS
$cshowsPrec :: Int -> CreateLocationFsxWindows -> ShowS
Prelude.Show, (forall x.
 CreateLocationFsxWindows -> Rep CreateLocationFsxWindows x)
-> (forall x.
    Rep CreateLocationFsxWindows x -> CreateLocationFsxWindows)
-> Generic CreateLocationFsxWindows
forall x.
Rep CreateLocationFsxWindows x -> CreateLocationFsxWindows
forall x.
CreateLocationFsxWindows -> Rep CreateLocationFsxWindows x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateLocationFsxWindows x -> CreateLocationFsxWindows
$cfrom :: forall x.
CreateLocationFsxWindows -> Rep CreateLocationFsxWindows x
Prelude.Generic)

-- |
-- Create a value of 'CreateLocationFsxWindows' 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:
--
-- 'domain', 'createLocationFsxWindows_domain' - The name of the Windows domain that the FSx for Windows File Server
-- belongs to.
--
-- 'subdirectory', 'createLocationFsxWindows_subdirectory' - A subdirectory in the location’s path. This subdirectory in the Amazon
-- FSx for Windows File Server file system is used to read data from the
-- Amazon FSx for Windows File Server source location or write data to the
-- FSx for Windows File Server destination.
--
-- 'tags', 'createLocationFsxWindows_tags' - The key-value pair that represents a tag that you want to add to the
-- resource. The value can be an empty string. This value helps you manage,
-- filter, and search for your resources. We recommend that you create a
-- name tag for your location.
--
-- 'fsxFilesystemArn', 'createLocationFsxWindows_fsxFilesystemArn' - The Amazon Resource Name (ARN) for the FSx for Windows File Server file
-- system.
--
-- 'securityGroupArns', 'createLocationFsxWindows_securityGroupArns' - The Amazon Resource Names (ARNs) of the security groups that are to use
-- to configure the FSx for Windows File Server file system.
--
-- 'user', 'createLocationFsxWindows_user' - The user who has the permissions to access files and folders in the FSx
-- for Windows File Server file system.
--
-- For information about choosing a user name that ensures sufficient
-- permissions to files, folders, and metadata, see
-- <create-fsx-location.html#FSxWuser user>.
--
-- 'password', 'createLocationFsxWindows_password' - The password of the user who has the permissions to access files and
-- folders in the FSx for Windows File Server file system.
newCreateLocationFsxWindows ::
  -- | 'fsxFilesystemArn'
  Prelude.Text ->
  -- | 'securityGroupArns'
  Prelude.NonEmpty Prelude.Text ->
  -- | 'user'
  Prelude.Text ->
  -- | 'password'
  Prelude.Text ->
  CreateLocationFsxWindows
newCreateLocationFsxWindows :: Text -> NonEmpty Text -> Text -> Text -> CreateLocationFsxWindows
newCreateLocationFsxWindows
  Text
pFsxFilesystemArn_
  NonEmpty Text
pSecurityGroupArns_
  Text
pUser_
  Text
pPassword_ =
    CreateLocationFsxWindows' :: Maybe Text
-> Maybe Text
-> Maybe [TagListEntry]
-> Text
-> NonEmpty Text
-> Text
-> Sensitive Text
-> CreateLocationFsxWindows
CreateLocationFsxWindows'
      { $sel:domain:CreateLocationFsxWindows' :: Maybe Text
domain = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:subdirectory:CreateLocationFsxWindows' :: Maybe Text
subdirectory = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateLocationFsxWindows' :: Maybe [TagListEntry]
tags = Maybe [TagListEntry]
forall a. Maybe a
Prelude.Nothing,
        $sel:fsxFilesystemArn:CreateLocationFsxWindows' :: Text
fsxFilesystemArn = Text
pFsxFilesystemArn_,
        $sel:securityGroupArns:CreateLocationFsxWindows' :: NonEmpty Text
securityGroupArns =
          Tagged (NonEmpty Text) (Identity (NonEmpty Text))
-> Tagged (NonEmpty Text) (Identity (NonEmpty Text))
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced (Tagged (NonEmpty Text) (Identity (NonEmpty Text))
 -> Tagged (NonEmpty Text) (Identity (NonEmpty Text)))
-> NonEmpty Text -> NonEmpty Text
forall t b. AReview t b -> b -> t
Lens.# NonEmpty Text
pSecurityGroupArns_,
        $sel:user:CreateLocationFsxWindows' :: Text
user = Text
pUser_,
        $sel:password:CreateLocationFsxWindows' :: Sensitive Text
password = Tagged Text (Identity Text)
-> Tagged (Sensitive Text) (Identity (Sensitive Text))
forall a. Iso' (Sensitive a) a
Core._Sensitive (Tagged Text (Identity Text)
 -> Tagged (Sensitive Text) (Identity (Sensitive Text)))
-> Text -> Sensitive Text
forall t b. AReview t b -> b -> t
Lens.# Text
pPassword_
      }

-- | The name of the Windows domain that the FSx for Windows File Server
-- belongs to.
createLocationFsxWindows_domain :: Lens.Lens' CreateLocationFsxWindows (Prelude.Maybe Prelude.Text)
createLocationFsxWindows_domain :: (Maybe Text -> f (Maybe Text))
-> CreateLocationFsxWindows -> f CreateLocationFsxWindows
createLocationFsxWindows_domain = (CreateLocationFsxWindows -> Maybe Text)
-> (CreateLocationFsxWindows
    -> Maybe Text -> CreateLocationFsxWindows)
-> Lens
     CreateLocationFsxWindows
     CreateLocationFsxWindows
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationFsxWindows' {Maybe Text
domain :: Maybe Text
$sel:domain:CreateLocationFsxWindows' :: CreateLocationFsxWindows -> Maybe Text
domain} -> Maybe Text
domain) (\s :: CreateLocationFsxWindows
s@CreateLocationFsxWindows' {} Maybe Text
a -> CreateLocationFsxWindows
s {$sel:domain:CreateLocationFsxWindows' :: Maybe Text
domain = Maybe Text
a} :: CreateLocationFsxWindows)

-- | A subdirectory in the location’s path. This subdirectory in the Amazon
-- FSx for Windows File Server file system is used to read data from the
-- Amazon FSx for Windows File Server source location or write data to the
-- FSx for Windows File Server destination.
createLocationFsxWindows_subdirectory :: Lens.Lens' CreateLocationFsxWindows (Prelude.Maybe Prelude.Text)
createLocationFsxWindows_subdirectory :: (Maybe Text -> f (Maybe Text))
-> CreateLocationFsxWindows -> f CreateLocationFsxWindows
createLocationFsxWindows_subdirectory = (CreateLocationFsxWindows -> Maybe Text)
-> (CreateLocationFsxWindows
    -> Maybe Text -> CreateLocationFsxWindows)
-> Lens
     CreateLocationFsxWindows
     CreateLocationFsxWindows
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationFsxWindows' {Maybe Text
subdirectory :: Maybe Text
$sel:subdirectory:CreateLocationFsxWindows' :: CreateLocationFsxWindows -> Maybe Text
subdirectory} -> Maybe Text
subdirectory) (\s :: CreateLocationFsxWindows
s@CreateLocationFsxWindows' {} Maybe Text
a -> CreateLocationFsxWindows
s {$sel:subdirectory:CreateLocationFsxWindows' :: Maybe Text
subdirectory = Maybe Text
a} :: CreateLocationFsxWindows)

-- | The key-value pair that represents a tag that you want to add to the
-- resource. The value can be an empty string. This value helps you manage,
-- filter, and search for your resources. We recommend that you create a
-- name tag for your location.
createLocationFsxWindows_tags :: Lens.Lens' CreateLocationFsxWindows (Prelude.Maybe [TagListEntry])
createLocationFsxWindows_tags :: (Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
-> CreateLocationFsxWindows -> f CreateLocationFsxWindows
createLocationFsxWindows_tags = (CreateLocationFsxWindows -> Maybe [TagListEntry])
-> (CreateLocationFsxWindows
    -> Maybe [TagListEntry] -> CreateLocationFsxWindows)
-> Lens
     CreateLocationFsxWindows
     CreateLocationFsxWindows
     (Maybe [TagListEntry])
     (Maybe [TagListEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationFsxWindows' {Maybe [TagListEntry]
tags :: Maybe [TagListEntry]
$sel:tags:CreateLocationFsxWindows' :: CreateLocationFsxWindows -> Maybe [TagListEntry]
tags} -> Maybe [TagListEntry]
tags) (\s :: CreateLocationFsxWindows
s@CreateLocationFsxWindows' {} Maybe [TagListEntry]
a -> CreateLocationFsxWindows
s {$sel:tags:CreateLocationFsxWindows' :: Maybe [TagListEntry]
tags = Maybe [TagListEntry]
a} :: CreateLocationFsxWindows) ((Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
 -> CreateLocationFsxWindows -> f CreateLocationFsxWindows)
-> ((Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
    -> Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
-> (Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
-> CreateLocationFsxWindows
-> f CreateLocationFsxWindows
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [TagListEntry] [TagListEntry] [TagListEntry] [TagListEntry]
-> Iso
     (Maybe [TagListEntry])
     (Maybe [TagListEntry])
     (Maybe [TagListEntry])
     (Maybe [TagListEntry])
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 AnIso [TagListEntry] [TagListEntry] [TagListEntry] [TagListEntry]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The Amazon Resource Name (ARN) for the FSx for Windows File Server file
-- system.
createLocationFsxWindows_fsxFilesystemArn :: Lens.Lens' CreateLocationFsxWindows Prelude.Text
createLocationFsxWindows_fsxFilesystemArn :: (Text -> f Text)
-> CreateLocationFsxWindows -> f CreateLocationFsxWindows
createLocationFsxWindows_fsxFilesystemArn = (CreateLocationFsxWindows -> Text)
-> (CreateLocationFsxWindows -> Text -> CreateLocationFsxWindows)
-> Lens CreateLocationFsxWindows CreateLocationFsxWindows Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationFsxWindows' {Text
fsxFilesystemArn :: Text
$sel:fsxFilesystemArn:CreateLocationFsxWindows' :: CreateLocationFsxWindows -> Text
fsxFilesystemArn} -> Text
fsxFilesystemArn) (\s :: CreateLocationFsxWindows
s@CreateLocationFsxWindows' {} Text
a -> CreateLocationFsxWindows
s {$sel:fsxFilesystemArn:CreateLocationFsxWindows' :: Text
fsxFilesystemArn = Text
a} :: CreateLocationFsxWindows)

-- | The Amazon Resource Names (ARNs) of the security groups that are to use
-- to configure the FSx for Windows File Server file system.
createLocationFsxWindows_securityGroupArns :: Lens.Lens' CreateLocationFsxWindows (Prelude.NonEmpty Prelude.Text)
createLocationFsxWindows_securityGroupArns :: (NonEmpty Text -> f (NonEmpty Text))
-> CreateLocationFsxWindows -> f CreateLocationFsxWindows
createLocationFsxWindows_securityGroupArns = (CreateLocationFsxWindows -> NonEmpty Text)
-> (CreateLocationFsxWindows
    -> NonEmpty Text -> CreateLocationFsxWindows)
-> Lens
     CreateLocationFsxWindows
     CreateLocationFsxWindows
     (NonEmpty Text)
     (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationFsxWindows' {NonEmpty Text
securityGroupArns :: NonEmpty Text
$sel:securityGroupArns:CreateLocationFsxWindows' :: CreateLocationFsxWindows -> NonEmpty Text
securityGroupArns} -> NonEmpty Text
securityGroupArns) (\s :: CreateLocationFsxWindows
s@CreateLocationFsxWindows' {} NonEmpty Text
a -> CreateLocationFsxWindows
s {$sel:securityGroupArns:CreateLocationFsxWindows' :: NonEmpty Text
securityGroupArns = NonEmpty Text
a} :: CreateLocationFsxWindows) ((NonEmpty Text -> f (NonEmpty Text))
 -> CreateLocationFsxWindows -> f CreateLocationFsxWindows)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> CreateLocationFsxWindows
-> f CreateLocationFsxWindows
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (NonEmpty Text -> f (NonEmpty Text))
-> NonEmpty Text -> f (NonEmpty Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The user who has the permissions to access files and folders in the FSx
-- for Windows File Server file system.
--
-- For information about choosing a user name that ensures sufficient
-- permissions to files, folders, and metadata, see
-- <create-fsx-location.html#FSxWuser user>.
createLocationFsxWindows_user :: Lens.Lens' CreateLocationFsxWindows Prelude.Text
createLocationFsxWindows_user :: (Text -> f Text)
-> CreateLocationFsxWindows -> f CreateLocationFsxWindows
createLocationFsxWindows_user = (CreateLocationFsxWindows -> Text)
-> (CreateLocationFsxWindows -> Text -> CreateLocationFsxWindows)
-> Lens CreateLocationFsxWindows CreateLocationFsxWindows Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationFsxWindows' {Text
user :: Text
$sel:user:CreateLocationFsxWindows' :: CreateLocationFsxWindows -> Text
user} -> Text
user) (\s :: CreateLocationFsxWindows
s@CreateLocationFsxWindows' {} Text
a -> CreateLocationFsxWindows
s {$sel:user:CreateLocationFsxWindows' :: Text
user = Text
a} :: CreateLocationFsxWindows)

-- | The password of the user who has the permissions to access files and
-- folders in the FSx for Windows File Server file system.
createLocationFsxWindows_password :: Lens.Lens' CreateLocationFsxWindows Prelude.Text
createLocationFsxWindows_password :: (Text -> f Text)
-> CreateLocationFsxWindows -> f CreateLocationFsxWindows
createLocationFsxWindows_password = (CreateLocationFsxWindows -> Sensitive Text)
-> (CreateLocationFsxWindows
    -> Sensitive Text -> CreateLocationFsxWindows)
-> Lens
     CreateLocationFsxWindows
     CreateLocationFsxWindows
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationFsxWindows' {Sensitive Text
password :: Sensitive Text
$sel:password:CreateLocationFsxWindows' :: CreateLocationFsxWindows -> Sensitive Text
password} -> Sensitive Text
password) (\s :: CreateLocationFsxWindows
s@CreateLocationFsxWindows' {} Sensitive Text
a -> CreateLocationFsxWindows
s {$sel:password:CreateLocationFsxWindows' :: Sensitive Text
password = Sensitive Text
a} :: CreateLocationFsxWindows) ((Sensitive Text -> f (Sensitive Text))
 -> CreateLocationFsxWindows -> f CreateLocationFsxWindows)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> CreateLocationFsxWindows
-> f CreateLocationFsxWindows
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. (Text -> f Text) -> Sensitive Text -> f (Sensitive Text)
forall a. Iso' (Sensitive a) a
Core._Sensitive

instance Core.AWSRequest CreateLocationFsxWindows where
  type
    AWSResponse CreateLocationFsxWindows =
      CreateLocationFsxWindowsResponse
  request :: CreateLocationFsxWindows -> Request CreateLocationFsxWindows
request = Service
-> CreateLocationFsxWindows -> Request CreateLocationFsxWindows
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateLocationFsxWindows
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateLocationFsxWindows)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateLocationFsxWindows))
-> Logger
-> Service
-> Proxy CreateLocationFsxWindows
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateLocationFsxWindows)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text -> Int -> CreateLocationFsxWindowsResponse
CreateLocationFsxWindowsResponse'
            (Maybe Text -> Int -> CreateLocationFsxWindowsResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateLocationFsxWindowsResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Text)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"LocationArn")
            Either String (Int -> CreateLocationFsxWindowsResponse)
-> Either String Int
-> Either String CreateLocationFsxWindowsResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
      )

instance Prelude.Hashable CreateLocationFsxWindows

instance Prelude.NFData CreateLocationFsxWindows

instance Core.ToHeaders CreateLocationFsxWindows where
  toHeaders :: CreateLocationFsxWindows -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateLocationFsxWindows -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
      ( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
          [ HeaderName
"X-Amz-Target"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"FmrsService.CreateLocationFsxWindows" ::
                          Prelude.ByteString
                      ),
            HeaderName
"Content-Type"
              HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"application/x-amz-json-1.1" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateLocationFsxWindows where
  toJSON :: CreateLocationFsxWindows -> Value
toJSON CreateLocationFsxWindows' {Maybe [TagListEntry]
Maybe Text
NonEmpty Text
Text
Sensitive Text
password :: Sensitive Text
user :: Text
securityGroupArns :: NonEmpty Text
fsxFilesystemArn :: Text
tags :: Maybe [TagListEntry]
subdirectory :: Maybe Text
domain :: Maybe Text
$sel:password:CreateLocationFsxWindows' :: CreateLocationFsxWindows -> Sensitive Text
$sel:user:CreateLocationFsxWindows' :: CreateLocationFsxWindows -> Text
$sel:securityGroupArns:CreateLocationFsxWindows' :: CreateLocationFsxWindows -> NonEmpty Text
$sel:fsxFilesystemArn:CreateLocationFsxWindows' :: CreateLocationFsxWindows -> Text
$sel:tags:CreateLocationFsxWindows' :: CreateLocationFsxWindows -> Maybe [TagListEntry]
$sel:subdirectory:CreateLocationFsxWindows' :: CreateLocationFsxWindows -> Maybe Text
$sel:domain:CreateLocationFsxWindows' :: CreateLocationFsxWindows -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"Domain" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
domain,
            (Text
"Subdirectory" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
subdirectory,
            (Text
"Tags" Text -> [TagListEntry] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([TagListEntry] -> Pair) -> Maybe [TagListEntry] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [TagListEntry]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"FsxFilesystemArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
fsxFilesystemArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"SecurityGroupArns" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
securityGroupArns),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"User" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
user),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"Password" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Sensitive Text
password)
          ]
      )

instance Core.ToPath CreateLocationFsxWindows where
  toPath :: CreateLocationFsxWindows -> ByteString
toPath = ByteString -> CreateLocationFsxWindows -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

instance Core.ToQuery CreateLocationFsxWindows where
  toQuery :: CreateLocationFsxWindows -> QueryString
toQuery = QueryString -> CreateLocationFsxWindows -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateLocationFsxWindowsResponse' smart constructor.
data CreateLocationFsxWindowsResponse = CreateLocationFsxWindowsResponse'
  { -- | The Amazon Resource Name (ARN) of the FSx for Windows File Server file
    -- system location that is created.
    CreateLocationFsxWindowsResponse -> Maybe Text
locationArn :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateLocationFsxWindowsResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateLocationFsxWindowsResponse
-> CreateLocationFsxWindowsResponse -> Bool
(CreateLocationFsxWindowsResponse
 -> CreateLocationFsxWindowsResponse -> Bool)
-> (CreateLocationFsxWindowsResponse
    -> CreateLocationFsxWindowsResponse -> Bool)
-> Eq CreateLocationFsxWindowsResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLocationFsxWindowsResponse
-> CreateLocationFsxWindowsResponse -> Bool
$c/= :: CreateLocationFsxWindowsResponse
-> CreateLocationFsxWindowsResponse -> Bool
== :: CreateLocationFsxWindowsResponse
-> CreateLocationFsxWindowsResponse -> Bool
$c== :: CreateLocationFsxWindowsResponse
-> CreateLocationFsxWindowsResponse -> Bool
Prelude.Eq, ReadPrec [CreateLocationFsxWindowsResponse]
ReadPrec CreateLocationFsxWindowsResponse
Int -> ReadS CreateLocationFsxWindowsResponse
ReadS [CreateLocationFsxWindowsResponse]
(Int -> ReadS CreateLocationFsxWindowsResponse)
-> ReadS [CreateLocationFsxWindowsResponse]
-> ReadPrec CreateLocationFsxWindowsResponse
-> ReadPrec [CreateLocationFsxWindowsResponse]
-> Read CreateLocationFsxWindowsResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateLocationFsxWindowsResponse]
$creadListPrec :: ReadPrec [CreateLocationFsxWindowsResponse]
readPrec :: ReadPrec CreateLocationFsxWindowsResponse
$creadPrec :: ReadPrec CreateLocationFsxWindowsResponse
readList :: ReadS [CreateLocationFsxWindowsResponse]
$creadList :: ReadS [CreateLocationFsxWindowsResponse]
readsPrec :: Int -> ReadS CreateLocationFsxWindowsResponse
$creadsPrec :: Int -> ReadS CreateLocationFsxWindowsResponse
Prelude.Read, Int -> CreateLocationFsxWindowsResponse -> ShowS
[CreateLocationFsxWindowsResponse] -> ShowS
CreateLocationFsxWindowsResponse -> String
(Int -> CreateLocationFsxWindowsResponse -> ShowS)
-> (CreateLocationFsxWindowsResponse -> String)
-> ([CreateLocationFsxWindowsResponse] -> ShowS)
-> Show CreateLocationFsxWindowsResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLocationFsxWindowsResponse] -> ShowS
$cshowList :: [CreateLocationFsxWindowsResponse] -> ShowS
show :: CreateLocationFsxWindowsResponse -> String
$cshow :: CreateLocationFsxWindowsResponse -> String
showsPrec :: Int -> CreateLocationFsxWindowsResponse -> ShowS
$cshowsPrec :: Int -> CreateLocationFsxWindowsResponse -> ShowS
Prelude.Show, (forall x.
 CreateLocationFsxWindowsResponse
 -> Rep CreateLocationFsxWindowsResponse x)
-> (forall x.
    Rep CreateLocationFsxWindowsResponse x
    -> CreateLocationFsxWindowsResponse)
-> Generic CreateLocationFsxWindowsResponse
forall x.
Rep CreateLocationFsxWindowsResponse x
-> CreateLocationFsxWindowsResponse
forall x.
CreateLocationFsxWindowsResponse
-> Rep CreateLocationFsxWindowsResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateLocationFsxWindowsResponse x
-> CreateLocationFsxWindowsResponse
$cfrom :: forall x.
CreateLocationFsxWindowsResponse
-> Rep CreateLocationFsxWindowsResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateLocationFsxWindowsResponse' 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:
--
-- 'locationArn', 'createLocationFsxWindowsResponse_locationArn' - The Amazon Resource Name (ARN) of the FSx for Windows File Server file
-- system location that is created.
--
-- 'httpStatus', 'createLocationFsxWindowsResponse_httpStatus' - The response's http status code.
newCreateLocationFsxWindowsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateLocationFsxWindowsResponse
newCreateLocationFsxWindowsResponse :: Int -> CreateLocationFsxWindowsResponse
newCreateLocationFsxWindowsResponse Int
pHttpStatus_ =
  CreateLocationFsxWindowsResponse' :: Maybe Text -> Int -> CreateLocationFsxWindowsResponse
CreateLocationFsxWindowsResponse'
    { $sel:locationArn:CreateLocationFsxWindowsResponse' :: Maybe Text
locationArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateLocationFsxWindowsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the FSx for Windows File Server file
-- system location that is created.
createLocationFsxWindowsResponse_locationArn :: Lens.Lens' CreateLocationFsxWindowsResponse (Prelude.Maybe Prelude.Text)
createLocationFsxWindowsResponse_locationArn :: (Maybe Text -> f (Maybe Text))
-> CreateLocationFsxWindowsResponse
-> f CreateLocationFsxWindowsResponse
createLocationFsxWindowsResponse_locationArn = (CreateLocationFsxWindowsResponse -> Maybe Text)
-> (CreateLocationFsxWindowsResponse
    -> Maybe Text -> CreateLocationFsxWindowsResponse)
-> Lens
     CreateLocationFsxWindowsResponse
     CreateLocationFsxWindowsResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationFsxWindowsResponse' {Maybe Text
locationArn :: Maybe Text
$sel:locationArn:CreateLocationFsxWindowsResponse' :: CreateLocationFsxWindowsResponse -> Maybe Text
locationArn} -> Maybe Text
locationArn) (\s :: CreateLocationFsxWindowsResponse
s@CreateLocationFsxWindowsResponse' {} Maybe Text
a -> CreateLocationFsxWindowsResponse
s {$sel:locationArn:CreateLocationFsxWindowsResponse' :: Maybe Text
locationArn = Maybe Text
a} :: CreateLocationFsxWindowsResponse)

-- | The response's http status code.
createLocationFsxWindowsResponse_httpStatus :: Lens.Lens' CreateLocationFsxWindowsResponse Prelude.Int
createLocationFsxWindowsResponse_httpStatus :: (Int -> f Int)
-> CreateLocationFsxWindowsResponse
-> f CreateLocationFsxWindowsResponse
createLocationFsxWindowsResponse_httpStatus = (CreateLocationFsxWindowsResponse -> Int)
-> (CreateLocationFsxWindowsResponse
    -> Int -> CreateLocationFsxWindowsResponse)
-> Lens
     CreateLocationFsxWindowsResponse
     CreateLocationFsxWindowsResponse
     Int
     Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationFsxWindowsResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateLocationFsxWindowsResponse' :: CreateLocationFsxWindowsResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateLocationFsxWindowsResponse
s@CreateLocationFsxWindowsResponse' {} Int
a -> CreateLocationFsxWindowsResponse
s {$sel:httpStatus:CreateLocationFsxWindowsResponse' :: Int
httpStatus = Int
a} :: CreateLocationFsxWindowsResponse)

instance
  Prelude.NFData
    CreateLocationFsxWindowsResponse