{-# 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.CreateLocationSmb
-- 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)
--
-- Defines a file system on a Server Message Block (SMB) server that can be
-- read from or written to.
module Amazonka.DataSync.CreateLocationSmb
  ( -- * Creating a Request
    CreateLocationSmb (..),
    newCreateLocationSmb,

    -- * Request Lenses
    createLocationSmb_domain,
    createLocationSmb_mountOptions,
    createLocationSmb_tags,
    createLocationSmb_subdirectory,
    createLocationSmb_serverHostname,
    createLocationSmb_user,
    createLocationSmb_password,
    createLocationSmb_agentArns,

    -- * Destructuring the Response
    CreateLocationSmbResponse (..),
    newCreateLocationSmbResponse,

    -- * Response Lenses
    createLocationSmbResponse_locationArn,
    createLocationSmbResponse_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

-- | CreateLocationSmbRequest
--
-- /See:/ 'newCreateLocationSmb' smart constructor.
data CreateLocationSmb = CreateLocationSmb'
  { -- | The name of the Windows domain that the SMB server belongs to.
    CreateLocationSmb -> Maybe Text
domain :: Prelude.Maybe Prelude.Text,
    -- | The mount options used by DataSync to access the SMB server.
    CreateLocationSmb -> Maybe SmbMountOptions
mountOptions :: Prelude.Maybe SmbMountOptions,
    -- | The key-value pair that represents the tag that you want to add to the
    -- location. The value can be an empty string. We recommend using tags to
    -- name your resources.
    CreateLocationSmb -> Maybe [TagListEntry]
tags :: Prelude.Maybe [TagListEntry],
    -- | The subdirectory in the SMB file system that is used to read data from
    -- the SMB source location or write data to the SMB destination. The SMB
    -- path should be a path that\'s exported by the SMB server, or a
    -- subdirectory of that path. The path should be such that it can be
    -- mounted by other SMB clients in your network.
    --
    -- @Subdirectory@ must be specified with forward slashes. For example,
    -- @\/path\/to\/folder@.
    --
    -- To transfer all the data in the folder you specified, DataSync needs to
    -- have permissions to mount the SMB share, as well as to access all the
    -- data in that share. To ensure this, either ensure that the
    -- user\/password specified belongs to the user who can mount the share,
    -- and who has the appropriate permissions for all of the files and
    -- directories that you want DataSync to access, or use credentials of a
    -- member of the Backup Operators group to mount the share. Doing either
    -- enables the agent to access the data. For the agent to access
    -- directories, you must additionally enable all execute access.
    CreateLocationSmb -> Text
subdirectory :: Prelude.Text,
    -- | The name of the SMB server. This value is the IP address or Domain Name
    -- Service (DNS) name of the SMB server. An agent that is installed
    -- on-premises uses this hostname to mount the SMB server in a network.
    --
    -- This name must either be DNS-compliant or must be an IP version 4 (IPv4)
    -- address.
    CreateLocationSmb -> Text
serverHostname :: Prelude.Text,
    -- | The user who can mount the share, has the permissions to access files
    -- and folders in the SMB share.
    --
    -- For information about choosing a user name that ensures sufficient
    -- permissions to files, folders, and metadata, see
    -- <create-smb-location.html#SMBuser user>.
    CreateLocationSmb -> Text
user :: Prelude.Text,
    -- | The password of the user who can mount the share, has the permissions to
    -- access files and folders in the SMB share.
    CreateLocationSmb -> Sensitive Text
password :: Core.Sensitive Prelude.Text,
    -- | The Amazon Resource Names (ARNs) of agents to use for a Simple Message
    -- Block (SMB) location.
    CreateLocationSmb -> NonEmpty Text
agentArns :: Prelude.NonEmpty Prelude.Text
  }
  deriving (CreateLocationSmb -> CreateLocationSmb -> Bool
(CreateLocationSmb -> CreateLocationSmb -> Bool)
-> (CreateLocationSmb -> CreateLocationSmb -> Bool)
-> Eq CreateLocationSmb
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateLocationSmb -> CreateLocationSmb -> Bool
$c/= :: CreateLocationSmb -> CreateLocationSmb -> Bool
== :: CreateLocationSmb -> CreateLocationSmb -> Bool
$c== :: CreateLocationSmb -> CreateLocationSmb -> Bool
Prelude.Eq, Int -> CreateLocationSmb -> ShowS
[CreateLocationSmb] -> ShowS
CreateLocationSmb -> String
(Int -> CreateLocationSmb -> ShowS)
-> (CreateLocationSmb -> String)
-> ([CreateLocationSmb] -> ShowS)
-> Show CreateLocationSmb
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateLocationSmb] -> ShowS
$cshowList :: [CreateLocationSmb] -> ShowS
show :: CreateLocationSmb -> String
$cshow :: CreateLocationSmb -> String
showsPrec :: Int -> CreateLocationSmb -> ShowS
$cshowsPrec :: Int -> CreateLocationSmb -> ShowS
Prelude.Show, (forall x. CreateLocationSmb -> Rep CreateLocationSmb x)
-> (forall x. Rep CreateLocationSmb x -> CreateLocationSmb)
-> Generic CreateLocationSmb
forall x. Rep CreateLocationSmb x -> CreateLocationSmb
forall x. CreateLocationSmb -> Rep CreateLocationSmb x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateLocationSmb x -> CreateLocationSmb
$cfrom :: forall x. CreateLocationSmb -> Rep CreateLocationSmb x
Prelude.Generic)

-- |
-- Create a value of 'CreateLocationSmb' 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', 'createLocationSmb_domain' - The name of the Windows domain that the SMB server belongs to.
--
-- 'mountOptions', 'createLocationSmb_mountOptions' - The mount options used by DataSync to access the SMB server.
--
-- 'tags', 'createLocationSmb_tags' - The key-value pair that represents the tag that you want to add to the
-- location. The value can be an empty string. We recommend using tags to
-- name your resources.
--
-- 'subdirectory', 'createLocationSmb_subdirectory' - The subdirectory in the SMB file system that is used to read data from
-- the SMB source location or write data to the SMB destination. The SMB
-- path should be a path that\'s exported by the SMB server, or a
-- subdirectory of that path. The path should be such that it can be
-- mounted by other SMB clients in your network.
--
-- @Subdirectory@ must be specified with forward slashes. For example,
-- @\/path\/to\/folder@.
--
-- To transfer all the data in the folder you specified, DataSync needs to
-- have permissions to mount the SMB share, as well as to access all the
-- data in that share. To ensure this, either ensure that the
-- user\/password specified belongs to the user who can mount the share,
-- and who has the appropriate permissions for all of the files and
-- directories that you want DataSync to access, or use credentials of a
-- member of the Backup Operators group to mount the share. Doing either
-- enables the agent to access the data. For the agent to access
-- directories, you must additionally enable all execute access.
--
-- 'serverHostname', 'createLocationSmb_serverHostname' - The name of the SMB server. This value is the IP address or Domain Name
-- Service (DNS) name of the SMB server. An agent that is installed
-- on-premises uses this hostname to mount the SMB server in a network.
--
-- This name must either be DNS-compliant or must be an IP version 4 (IPv4)
-- address.
--
-- 'user', 'createLocationSmb_user' - The user who can mount the share, has the permissions to access files
-- and folders in the SMB share.
--
-- For information about choosing a user name that ensures sufficient
-- permissions to files, folders, and metadata, see
-- <create-smb-location.html#SMBuser user>.
--
-- 'password', 'createLocationSmb_password' - The password of the user who can mount the share, has the permissions to
-- access files and folders in the SMB share.
--
-- 'agentArns', 'createLocationSmb_agentArns' - The Amazon Resource Names (ARNs) of agents to use for a Simple Message
-- Block (SMB) location.
newCreateLocationSmb ::
  -- | 'subdirectory'
  Prelude.Text ->
  -- | 'serverHostname'
  Prelude.Text ->
  -- | 'user'
  Prelude.Text ->
  -- | 'password'
  Prelude.Text ->
  -- | 'agentArns'
  Prelude.NonEmpty Prelude.Text ->
  CreateLocationSmb
newCreateLocationSmb :: Text -> Text -> Text -> Text -> NonEmpty Text -> CreateLocationSmb
newCreateLocationSmb
  Text
pSubdirectory_
  Text
pServerHostname_
  Text
pUser_
  Text
pPassword_
  NonEmpty Text
pAgentArns_ =
    CreateLocationSmb' :: Maybe Text
-> Maybe SmbMountOptions
-> Maybe [TagListEntry]
-> Text
-> Text
-> Text
-> Sensitive Text
-> NonEmpty Text
-> CreateLocationSmb
CreateLocationSmb'
      { $sel:domain:CreateLocationSmb' :: Maybe Text
domain = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:mountOptions:CreateLocationSmb' :: Maybe SmbMountOptions
mountOptions = Maybe SmbMountOptions
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateLocationSmb' :: Maybe [TagListEntry]
tags = Maybe [TagListEntry]
forall a. Maybe a
Prelude.Nothing,
        $sel:subdirectory:CreateLocationSmb' :: Text
subdirectory = Text
pSubdirectory_,
        $sel:serverHostname:CreateLocationSmb' :: Text
serverHostname = Text
pServerHostname_,
        $sel:user:CreateLocationSmb' :: Text
user = Text
pUser_,
        $sel:password:CreateLocationSmb' :: 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_,
        $sel:agentArns:CreateLocationSmb' :: NonEmpty Text
agentArns = 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
pAgentArns_
      }

-- | The name of the Windows domain that the SMB server belongs to.
createLocationSmb_domain :: Lens.Lens' CreateLocationSmb (Prelude.Maybe Prelude.Text)
createLocationSmb_domain :: (Maybe Text -> f (Maybe Text))
-> CreateLocationSmb -> f CreateLocationSmb
createLocationSmb_domain = (CreateLocationSmb -> Maybe Text)
-> (CreateLocationSmb -> Maybe Text -> CreateLocationSmb)
-> Lens
     CreateLocationSmb CreateLocationSmb (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationSmb' {Maybe Text
domain :: Maybe Text
$sel:domain:CreateLocationSmb' :: CreateLocationSmb -> Maybe Text
domain} -> Maybe Text
domain) (\s :: CreateLocationSmb
s@CreateLocationSmb' {} Maybe Text
a -> CreateLocationSmb
s {$sel:domain:CreateLocationSmb' :: Maybe Text
domain = Maybe Text
a} :: CreateLocationSmb)

-- | The mount options used by DataSync to access the SMB server.
createLocationSmb_mountOptions :: Lens.Lens' CreateLocationSmb (Prelude.Maybe SmbMountOptions)
createLocationSmb_mountOptions :: (Maybe SmbMountOptions -> f (Maybe SmbMountOptions))
-> CreateLocationSmb -> f CreateLocationSmb
createLocationSmb_mountOptions = (CreateLocationSmb -> Maybe SmbMountOptions)
-> (CreateLocationSmb
    -> Maybe SmbMountOptions -> CreateLocationSmb)
-> Lens
     CreateLocationSmb
     CreateLocationSmb
     (Maybe SmbMountOptions)
     (Maybe SmbMountOptions)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationSmb' {Maybe SmbMountOptions
mountOptions :: Maybe SmbMountOptions
$sel:mountOptions:CreateLocationSmb' :: CreateLocationSmb -> Maybe SmbMountOptions
mountOptions} -> Maybe SmbMountOptions
mountOptions) (\s :: CreateLocationSmb
s@CreateLocationSmb' {} Maybe SmbMountOptions
a -> CreateLocationSmb
s {$sel:mountOptions:CreateLocationSmb' :: Maybe SmbMountOptions
mountOptions = Maybe SmbMountOptions
a} :: CreateLocationSmb)

-- | The key-value pair that represents the tag that you want to add to the
-- location. The value can be an empty string. We recommend using tags to
-- name your resources.
createLocationSmb_tags :: Lens.Lens' CreateLocationSmb (Prelude.Maybe [TagListEntry])
createLocationSmb_tags :: (Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
-> CreateLocationSmb -> f CreateLocationSmb
createLocationSmb_tags = (CreateLocationSmb -> Maybe [TagListEntry])
-> (CreateLocationSmb -> Maybe [TagListEntry] -> CreateLocationSmb)
-> Lens
     CreateLocationSmb
     CreateLocationSmb
     (Maybe [TagListEntry])
     (Maybe [TagListEntry])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationSmb' {Maybe [TagListEntry]
tags :: Maybe [TagListEntry]
$sel:tags:CreateLocationSmb' :: CreateLocationSmb -> Maybe [TagListEntry]
tags} -> Maybe [TagListEntry]
tags) (\s :: CreateLocationSmb
s@CreateLocationSmb' {} Maybe [TagListEntry]
a -> CreateLocationSmb
s {$sel:tags:CreateLocationSmb' :: Maybe [TagListEntry]
tags = Maybe [TagListEntry]
a} :: CreateLocationSmb) ((Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
 -> CreateLocationSmb -> f CreateLocationSmb)
-> ((Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
    -> Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
-> (Maybe [TagListEntry] -> f (Maybe [TagListEntry]))
-> CreateLocationSmb
-> f CreateLocationSmb
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 subdirectory in the SMB file system that is used to read data from
-- the SMB source location or write data to the SMB destination. The SMB
-- path should be a path that\'s exported by the SMB server, or a
-- subdirectory of that path. The path should be such that it can be
-- mounted by other SMB clients in your network.
--
-- @Subdirectory@ must be specified with forward slashes. For example,
-- @\/path\/to\/folder@.
--
-- To transfer all the data in the folder you specified, DataSync needs to
-- have permissions to mount the SMB share, as well as to access all the
-- data in that share. To ensure this, either ensure that the
-- user\/password specified belongs to the user who can mount the share,
-- and who has the appropriate permissions for all of the files and
-- directories that you want DataSync to access, or use credentials of a
-- member of the Backup Operators group to mount the share. Doing either
-- enables the agent to access the data. For the agent to access
-- directories, you must additionally enable all execute access.
createLocationSmb_subdirectory :: Lens.Lens' CreateLocationSmb Prelude.Text
createLocationSmb_subdirectory :: (Text -> f Text) -> CreateLocationSmb -> f CreateLocationSmb
createLocationSmb_subdirectory = (CreateLocationSmb -> Text)
-> (CreateLocationSmb -> Text -> CreateLocationSmb)
-> Lens CreateLocationSmb CreateLocationSmb Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationSmb' {Text
subdirectory :: Text
$sel:subdirectory:CreateLocationSmb' :: CreateLocationSmb -> Text
subdirectory} -> Text
subdirectory) (\s :: CreateLocationSmb
s@CreateLocationSmb' {} Text
a -> CreateLocationSmb
s {$sel:subdirectory:CreateLocationSmb' :: Text
subdirectory = Text
a} :: CreateLocationSmb)

-- | The name of the SMB server. This value is the IP address or Domain Name
-- Service (DNS) name of the SMB server. An agent that is installed
-- on-premises uses this hostname to mount the SMB server in a network.
--
-- This name must either be DNS-compliant or must be an IP version 4 (IPv4)
-- address.
createLocationSmb_serverHostname :: Lens.Lens' CreateLocationSmb Prelude.Text
createLocationSmb_serverHostname :: (Text -> f Text) -> CreateLocationSmb -> f CreateLocationSmb
createLocationSmb_serverHostname = (CreateLocationSmb -> Text)
-> (CreateLocationSmb -> Text -> CreateLocationSmb)
-> Lens CreateLocationSmb CreateLocationSmb Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationSmb' {Text
serverHostname :: Text
$sel:serverHostname:CreateLocationSmb' :: CreateLocationSmb -> Text
serverHostname} -> Text
serverHostname) (\s :: CreateLocationSmb
s@CreateLocationSmb' {} Text
a -> CreateLocationSmb
s {$sel:serverHostname:CreateLocationSmb' :: Text
serverHostname = Text
a} :: CreateLocationSmb)

-- | The user who can mount the share, has the permissions to access files
-- and folders in the SMB share.
--
-- For information about choosing a user name that ensures sufficient
-- permissions to files, folders, and metadata, see
-- <create-smb-location.html#SMBuser user>.
createLocationSmb_user :: Lens.Lens' CreateLocationSmb Prelude.Text
createLocationSmb_user :: (Text -> f Text) -> CreateLocationSmb -> f CreateLocationSmb
createLocationSmb_user = (CreateLocationSmb -> Text)
-> (CreateLocationSmb -> Text -> CreateLocationSmb)
-> Lens CreateLocationSmb CreateLocationSmb Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationSmb' {Text
user :: Text
$sel:user:CreateLocationSmb' :: CreateLocationSmb -> Text
user} -> Text
user) (\s :: CreateLocationSmb
s@CreateLocationSmb' {} Text
a -> CreateLocationSmb
s {$sel:user:CreateLocationSmb' :: Text
user = Text
a} :: CreateLocationSmb)

-- | The password of the user who can mount the share, has the permissions to
-- access files and folders in the SMB share.
createLocationSmb_password :: Lens.Lens' CreateLocationSmb Prelude.Text
createLocationSmb_password :: (Text -> f Text) -> CreateLocationSmb -> f CreateLocationSmb
createLocationSmb_password = (CreateLocationSmb -> Sensitive Text)
-> (CreateLocationSmb -> Sensitive Text -> CreateLocationSmb)
-> Lens
     CreateLocationSmb
     CreateLocationSmb
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationSmb' {Sensitive Text
password :: Sensitive Text
$sel:password:CreateLocationSmb' :: CreateLocationSmb -> Sensitive Text
password} -> Sensitive Text
password) (\s :: CreateLocationSmb
s@CreateLocationSmb' {} Sensitive Text
a -> CreateLocationSmb
s {$sel:password:CreateLocationSmb' :: Sensitive Text
password = Sensitive Text
a} :: CreateLocationSmb) ((Sensitive Text -> f (Sensitive Text))
 -> CreateLocationSmb -> f CreateLocationSmb)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> CreateLocationSmb
-> f CreateLocationSmb
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

-- | The Amazon Resource Names (ARNs) of agents to use for a Simple Message
-- Block (SMB) location.
createLocationSmb_agentArns :: Lens.Lens' CreateLocationSmb (Prelude.NonEmpty Prelude.Text)
createLocationSmb_agentArns :: (NonEmpty Text -> f (NonEmpty Text))
-> CreateLocationSmb -> f CreateLocationSmb
createLocationSmb_agentArns = (CreateLocationSmb -> NonEmpty Text)
-> (CreateLocationSmb -> NonEmpty Text -> CreateLocationSmb)
-> Lens
     CreateLocationSmb CreateLocationSmb (NonEmpty Text) (NonEmpty Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationSmb' {NonEmpty Text
agentArns :: NonEmpty Text
$sel:agentArns:CreateLocationSmb' :: CreateLocationSmb -> NonEmpty Text
agentArns} -> NonEmpty Text
agentArns) (\s :: CreateLocationSmb
s@CreateLocationSmb' {} NonEmpty Text
a -> CreateLocationSmb
s {$sel:agentArns:CreateLocationSmb' :: NonEmpty Text
agentArns = NonEmpty Text
a} :: CreateLocationSmb) ((NonEmpty Text -> f (NonEmpty Text))
 -> CreateLocationSmb -> f CreateLocationSmb)
-> ((NonEmpty Text -> f (NonEmpty Text))
    -> NonEmpty Text -> f (NonEmpty Text))
-> (NonEmpty Text -> f (NonEmpty Text))
-> CreateLocationSmb
-> f CreateLocationSmb
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

instance Core.AWSRequest CreateLocationSmb where
  type
    AWSResponse CreateLocationSmb =
      CreateLocationSmbResponse
  request :: CreateLocationSmb -> Request CreateLocationSmb
request = Service -> CreateLocationSmb -> Request CreateLocationSmb
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateLocationSmb
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateLocationSmb)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateLocationSmb))
-> Logger
-> Service
-> Proxy CreateLocationSmb
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateLocationSmb)))
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 -> CreateLocationSmbResponse
CreateLocationSmbResponse'
            (Maybe Text -> Int -> CreateLocationSmbResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateLocationSmbResponse)
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 -> CreateLocationSmbResponse)
-> Either String Int -> Either String CreateLocationSmbResponse
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 CreateLocationSmb

instance Prelude.NFData CreateLocationSmb

instance Core.ToHeaders CreateLocationSmb where
  toHeaders :: CreateLocationSmb -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateLocationSmb -> 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.CreateLocationSmb" ::
                          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 CreateLocationSmb where
  toJSON :: CreateLocationSmb -> Value
toJSON CreateLocationSmb' {Maybe [TagListEntry]
Maybe Text
Maybe SmbMountOptions
NonEmpty Text
Text
Sensitive Text
agentArns :: NonEmpty Text
password :: Sensitive Text
user :: Text
serverHostname :: Text
subdirectory :: Text
tags :: Maybe [TagListEntry]
mountOptions :: Maybe SmbMountOptions
domain :: Maybe Text
$sel:agentArns:CreateLocationSmb' :: CreateLocationSmb -> NonEmpty Text
$sel:password:CreateLocationSmb' :: CreateLocationSmb -> Sensitive Text
$sel:user:CreateLocationSmb' :: CreateLocationSmb -> Text
$sel:serverHostname:CreateLocationSmb' :: CreateLocationSmb -> Text
$sel:subdirectory:CreateLocationSmb' :: CreateLocationSmb -> Text
$sel:tags:CreateLocationSmb' :: CreateLocationSmb -> Maybe [TagListEntry]
$sel:mountOptions:CreateLocationSmb' :: CreateLocationSmb -> Maybe SmbMountOptions
$sel:domain:CreateLocationSmb' :: CreateLocationSmb -> 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
"MountOptions" Text -> SmbMountOptions -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (SmbMountOptions -> Pair) -> Maybe SmbMountOptions -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe SmbMountOptions
mountOptions,
            (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
"Subdirectory" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
subdirectory),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"ServerHostname" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serverHostname),
            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),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"AgentArns" Text -> NonEmpty Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= NonEmpty Text
agentArns)
          ]
      )

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

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

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

-- |
-- Create a value of 'CreateLocationSmbResponse' 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', 'createLocationSmbResponse_locationArn' - The Amazon Resource Name (ARN) of the source SMB file system location
-- that is created.
--
-- 'httpStatus', 'createLocationSmbResponse_httpStatus' - The response's http status code.
newCreateLocationSmbResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateLocationSmbResponse
newCreateLocationSmbResponse :: Int -> CreateLocationSmbResponse
newCreateLocationSmbResponse Int
pHttpStatus_ =
  CreateLocationSmbResponse' :: Maybe Text -> Int -> CreateLocationSmbResponse
CreateLocationSmbResponse'
    { $sel:locationArn:CreateLocationSmbResponse' :: Maybe Text
locationArn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateLocationSmbResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The Amazon Resource Name (ARN) of the source SMB file system location
-- that is created.
createLocationSmbResponse_locationArn :: Lens.Lens' CreateLocationSmbResponse (Prelude.Maybe Prelude.Text)
createLocationSmbResponse_locationArn :: (Maybe Text -> f (Maybe Text))
-> CreateLocationSmbResponse -> f CreateLocationSmbResponse
createLocationSmbResponse_locationArn = (CreateLocationSmbResponse -> Maybe Text)
-> (CreateLocationSmbResponse
    -> Maybe Text -> CreateLocationSmbResponse)
-> Lens
     CreateLocationSmbResponse
     CreateLocationSmbResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateLocationSmbResponse' {Maybe Text
locationArn :: Maybe Text
$sel:locationArn:CreateLocationSmbResponse' :: CreateLocationSmbResponse -> Maybe Text
locationArn} -> Maybe Text
locationArn) (\s :: CreateLocationSmbResponse
s@CreateLocationSmbResponse' {} Maybe Text
a -> CreateLocationSmbResponse
s {$sel:locationArn:CreateLocationSmbResponse' :: Maybe Text
locationArn = Maybe Text
a} :: CreateLocationSmbResponse)

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

instance Prelude.NFData CreateLocationSmbResponse