{-# 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.StorageGateway.AssociateFileSystem
-- 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)
--
-- Associate an Amazon FSx file system with the FSx File Gateway. After the
-- association process is complete, the file shares on the Amazon FSx file
-- system are available for access through the gateway. This operation only
-- supports the FSx File Gateway type.
module Amazonka.StorageGateway.AssociateFileSystem
  ( -- * Creating a Request
    AssociateFileSystem (..),
    newAssociateFileSystem,

    -- * Request Lenses
    associateFileSystem_auditDestinationARN,
    associateFileSystem_cacheAttributes,
    associateFileSystem_endpointNetworkConfiguration,
    associateFileSystem_tags,
    associateFileSystem_userName,
    associateFileSystem_password,
    associateFileSystem_clientToken,
    associateFileSystem_gatewayARN,
    associateFileSystem_locationARN,

    -- * Destructuring the Response
    AssociateFileSystemResponse (..),
    newAssociateFileSystemResponse,

    -- * Response Lenses
    associateFileSystemResponse_fileSystemAssociationARN,
    associateFileSystemResponse_httpStatus,
  )
where

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

-- | /See:/ 'newAssociateFileSystem' smart constructor.
data AssociateFileSystem = AssociateFileSystem'
  { -- | The Amazon Resource Name (ARN) of the storage used for the audit logs.
    AssociateFileSystem -> Maybe Text
auditDestinationARN :: Prelude.Maybe Prelude.Text,
    AssociateFileSystem -> Maybe CacheAttributes
cacheAttributes :: Prelude.Maybe CacheAttributes,
    -- | Specifies the network configuration information for the gateway
    -- associated with the Amazon FSx file system.
    --
    -- If multiple file systems are associated with this gateway, this
    -- parameter\'s @IpAddresses@ field is required.
    AssociateFileSystem -> Maybe EndpointNetworkConfiguration
endpointNetworkConfiguration :: Prelude.Maybe EndpointNetworkConfiguration,
    -- | A list of up to 50 tags that can be assigned to the file system
    -- association. Each tag is a key-value pair.
    AssociateFileSystem -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | The user name of the user credential that has permission to access the
    -- root share D$ of the Amazon FSx file system. The user account must
    -- belong to the Amazon FSx delegated admin user group.
    AssociateFileSystem -> Text
userName :: Prelude.Text,
    -- | The password of the user credential.
    AssociateFileSystem -> Sensitive Text
password :: Core.Sensitive Prelude.Text,
    -- | A unique string value that you supply that is used by the FSx File
    -- Gateway to ensure idempotent file system association creation.
    AssociateFileSystem -> Text
clientToken :: Prelude.Text,
    AssociateFileSystem -> Text
gatewayARN :: Prelude.Text,
    -- | The Amazon Resource Name (ARN) of the Amazon FSx file system to
    -- associate with the FSx File Gateway.
    AssociateFileSystem -> Text
locationARN :: Prelude.Text
  }
  deriving (AssociateFileSystem -> AssociateFileSystem -> Bool
(AssociateFileSystem -> AssociateFileSystem -> Bool)
-> (AssociateFileSystem -> AssociateFileSystem -> Bool)
-> Eq AssociateFileSystem
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateFileSystem -> AssociateFileSystem -> Bool
$c/= :: AssociateFileSystem -> AssociateFileSystem -> Bool
== :: AssociateFileSystem -> AssociateFileSystem -> Bool
$c== :: AssociateFileSystem -> AssociateFileSystem -> Bool
Prelude.Eq, Int -> AssociateFileSystem -> ShowS
[AssociateFileSystem] -> ShowS
AssociateFileSystem -> String
(Int -> AssociateFileSystem -> ShowS)
-> (AssociateFileSystem -> String)
-> ([AssociateFileSystem] -> ShowS)
-> Show AssociateFileSystem
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateFileSystem] -> ShowS
$cshowList :: [AssociateFileSystem] -> ShowS
show :: AssociateFileSystem -> String
$cshow :: AssociateFileSystem -> String
showsPrec :: Int -> AssociateFileSystem -> ShowS
$cshowsPrec :: Int -> AssociateFileSystem -> ShowS
Prelude.Show, (forall x. AssociateFileSystem -> Rep AssociateFileSystem x)
-> (forall x. Rep AssociateFileSystem x -> AssociateFileSystem)
-> Generic AssociateFileSystem
forall x. Rep AssociateFileSystem x -> AssociateFileSystem
forall x. AssociateFileSystem -> Rep AssociateFileSystem x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateFileSystem x -> AssociateFileSystem
$cfrom :: forall x. AssociateFileSystem -> Rep AssociateFileSystem x
Prelude.Generic)

-- |
-- Create a value of 'AssociateFileSystem' 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:
--
-- 'auditDestinationARN', 'associateFileSystem_auditDestinationARN' - The Amazon Resource Name (ARN) of the storage used for the audit logs.
--
-- 'cacheAttributes', 'associateFileSystem_cacheAttributes' - Undocumented member.
--
-- 'endpointNetworkConfiguration', 'associateFileSystem_endpointNetworkConfiguration' - Specifies the network configuration information for the gateway
-- associated with the Amazon FSx file system.
--
-- If multiple file systems are associated with this gateway, this
-- parameter\'s @IpAddresses@ field is required.
--
-- 'tags', 'associateFileSystem_tags' - A list of up to 50 tags that can be assigned to the file system
-- association. Each tag is a key-value pair.
--
-- 'userName', 'associateFileSystem_userName' - The user name of the user credential that has permission to access the
-- root share D$ of the Amazon FSx file system. The user account must
-- belong to the Amazon FSx delegated admin user group.
--
-- 'password', 'associateFileSystem_password' - The password of the user credential.
--
-- 'clientToken', 'associateFileSystem_clientToken' - A unique string value that you supply that is used by the FSx File
-- Gateway to ensure idempotent file system association creation.
--
-- 'gatewayARN', 'associateFileSystem_gatewayARN' - Undocumented member.
--
-- 'locationARN', 'associateFileSystem_locationARN' - The Amazon Resource Name (ARN) of the Amazon FSx file system to
-- associate with the FSx File Gateway.
newAssociateFileSystem ::
  -- | 'userName'
  Prelude.Text ->
  -- | 'password'
  Prelude.Text ->
  -- | 'clientToken'
  Prelude.Text ->
  -- | 'gatewayARN'
  Prelude.Text ->
  -- | 'locationARN'
  Prelude.Text ->
  AssociateFileSystem
newAssociateFileSystem :: Text -> Text -> Text -> Text -> Text -> AssociateFileSystem
newAssociateFileSystem
  Text
pUserName_
  Text
pPassword_
  Text
pClientToken_
  Text
pGatewayARN_
  Text
pLocationARN_ =
    AssociateFileSystem' :: Maybe Text
-> Maybe CacheAttributes
-> Maybe EndpointNetworkConfiguration
-> Maybe [Tag]
-> Text
-> Sensitive Text
-> Text
-> Text
-> Text
-> AssociateFileSystem
AssociateFileSystem'
      { $sel:auditDestinationARN:AssociateFileSystem' :: Maybe Text
auditDestinationARN =
          Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:cacheAttributes:AssociateFileSystem' :: Maybe CacheAttributes
cacheAttributes = Maybe CacheAttributes
forall a. Maybe a
Prelude.Nothing,
        $sel:endpointNetworkConfiguration:AssociateFileSystem' :: Maybe EndpointNetworkConfiguration
endpointNetworkConfiguration = Maybe EndpointNetworkConfiguration
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:AssociateFileSystem' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:userName:AssociateFileSystem' :: Text
userName = Text
pUserName_,
        $sel:password:AssociateFileSystem' :: 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:clientToken:AssociateFileSystem' :: Text
clientToken = Text
pClientToken_,
        $sel:gatewayARN:AssociateFileSystem' :: Text
gatewayARN = Text
pGatewayARN_,
        $sel:locationARN:AssociateFileSystem' :: Text
locationARN = Text
pLocationARN_
      }

-- | The Amazon Resource Name (ARN) of the storage used for the audit logs.
associateFileSystem_auditDestinationARN :: Lens.Lens' AssociateFileSystem (Prelude.Maybe Prelude.Text)
associateFileSystem_auditDestinationARN :: (Maybe Text -> f (Maybe Text))
-> AssociateFileSystem -> f AssociateFileSystem
associateFileSystem_auditDestinationARN = (AssociateFileSystem -> Maybe Text)
-> (AssociateFileSystem -> Maybe Text -> AssociateFileSystem)
-> Lens
     AssociateFileSystem AssociateFileSystem (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFileSystem' {Maybe Text
auditDestinationARN :: Maybe Text
$sel:auditDestinationARN:AssociateFileSystem' :: AssociateFileSystem -> Maybe Text
auditDestinationARN} -> Maybe Text
auditDestinationARN) (\s :: AssociateFileSystem
s@AssociateFileSystem' {} Maybe Text
a -> AssociateFileSystem
s {$sel:auditDestinationARN:AssociateFileSystem' :: Maybe Text
auditDestinationARN = Maybe Text
a} :: AssociateFileSystem)

-- | Undocumented member.
associateFileSystem_cacheAttributes :: Lens.Lens' AssociateFileSystem (Prelude.Maybe CacheAttributes)
associateFileSystem_cacheAttributes :: (Maybe CacheAttributes -> f (Maybe CacheAttributes))
-> AssociateFileSystem -> f AssociateFileSystem
associateFileSystem_cacheAttributes = (AssociateFileSystem -> Maybe CacheAttributes)
-> (AssociateFileSystem
    -> Maybe CacheAttributes -> AssociateFileSystem)
-> Lens
     AssociateFileSystem
     AssociateFileSystem
     (Maybe CacheAttributes)
     (Maybe CacheAttributes)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFileSystem' {Maybe CacheAttributes
cacheAttributes :: Maybe CacheAttributes
$sel:cacheAttributes:AssociateFileSystem' :: AssociateFileSystem -> Maybe CacheAttributes
cacheAttributes} -> Maybe CacheAttributes
cacheAttributes) (\s :: AssociateFileSystem
s@AssociateFileSystem' {} Maybe CacheAttributes
a -> AssociateFileSystem
s {$sel:cacheAttributes:AssociateFileSystem' :: Maybe CacheAttributes
cacheAttributes = Maybe CacheAttributes
a} :: AssociateFileSystem)

-- | Specifies the network configuration information for the gateway
-- associated with the Amazon FSx file system.
--
-- If multiple file systems are associated with this gateway, this
-- parameter\'s @IpAddresses@ field is required.
associateFileSystem_endpointNetworkConfiguration :: Lens.Lens' AssociateFileSystem (Prelude.Maybe EndpointNetworkConfiguration)
associateFileSystem_endpointNetworkConfiguration :: (Maybe EndpointNetworkConfiguration
 -> f (Maybe EndpointNetworkConfiguration))
-> AssociateFileSystem -> f AssociateFileSystem
associateFileSystem_endpointNetworkConfiguration = (AssociateFileSystem -> Maybe EndpointNetworkConfiguration)
-> (AssociateFileSystem
    -> Maybe EndpointNetworkConfiguration -> AssociateFileSystem)
-> Lens
     AssociateFileSystem
     AssociateFileSystem
     (Maybe EndpointNetworkConfiguration)
     (Maybe EndpointNetworkConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFileSystem' {Maybe EndpointNetworkConfiguration
endpointNetworkConfiguration :: Maybe EndpointNetworkConfiguration
$sel:endpointNetworkConfiguration:AssociateFileSystem' :: AssociateFileSystem -> Maybe EndpointNetworkConfiguration
endpointNetworkConfiguration} -> Maybe EndpointNetworkConfiguration
endpointNetworkConfiguration) (\s :: AssociateFileSystem
s@AssociateFileSystem' {} Maybe EndpointNetworkConfiguration
a -> AssociateFileSystem
s {$sel:endpointNetworkConfiguration:AssociateFileSystem' :: Maybe EndpointNetworkConfiguration
endpointNetworkConfiguration = Maybe EndpointNetworkConfiguration
a} :: AssociateFileSystem)

-- | A list of up to 50 tags that can be assigned to the file system
-- association. Each tag is a key-value pair.
associateFileSystem_tags :: Lens.Lens' AssociateFileSystem (Prelude.Maybe [Tag])
associateFileSystem_tags :: (Maybe [Tag] -> f (Maybe [Tag]))
-> AssociateFileSystem -> f AssociateFileSystem
associateFileSystem_tags = (AssociateFileSystem -> Maybe [Tag])
-> (AssociateFileSystem -> Maybe [Tag] -> AssociateFileSystem)
-> Lens
     AssociateFileSystem AssociateFileSystem (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFileSystem' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:AssociateFileSystem' :: AssociateFileSystem -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: AssociateFileSystem
s@AssociateFileSystem' {} Maybe [Tag]
a -> AssociateFileSystem
s {$sel:tags:AssociateFileSystem' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: AssociateFileSystem) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> AssociateFileSystem -> f AssociateFileSystem)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> AssociateFileSystem
-> f AssociateFileSystem
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The user name of the user credential that has permission to access the
-- root share D$ of the Amazon FSx file system. The user account must
-- belong to the Amazon FSx delegated admin user group.
associateFileSystem_userName :: Lens.Lens' AssociateFileSystem Prelude.Text
associateFileSystem_userName :: (Text -> f Text) -> AssociateFileSystem -> f AssociateFileSystem
associateFileSystem_userName = (AssociateFileSystem -> Text)
-> (AssociateFileSystem -> Text -> AssociateFileSystem)
-> Lens AssociateFileSystem AssociateFileSystem Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFileSystem' {Text
userName :: Text
$sel:userName:AssociateFileSystem' :: AssociateFileSystem -> Text
userName} -> Text
userName) (\s :: AssociateFileSystem
s@AssociateFileSystem' {} Text
a -> AssociateFileSystem
s {$sel:userName:AssociateFileSystem' :: Text
userName = Text
a} :: AssociateFileSystem)

-- | The password of the user credential.
associateFileSystem_password :: Lens.Lens' AssociateFileSystem Prelude.Text
associateFileSystem_password :: (Text -> f Text) -> AssociateFileSystem -> f AssociateFileSystem
associateFileSystem_password = (AssociateFileSystem -> Sensitive Text)
-> (AssociateFileSystem -> Sensitive Text -> AssociateFileSystem)
-> Lens
     AssociateFileSystem
     AssociateFileSystem
     (Sensitive Text)
     (Sensitive Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFileSystem' {Sensitive Text
password :: Sensitive Text
$sel:password:AssociateFileSystem' :: AssociateFileSystem -> Sensitive Text
password} -> Sensitive Text
password) (\s :: AssociateFileSystem
s@AssociateFileSystem' {} Sensitive Text
a -> AssociateFileSystem
s {$sel:password:AssociateFileSystem' :: Sensitive Text
password = Sensitive Text
a} :: AssociateFileSystem) ((Sensitive Text -> f (Sensitive Text))
 -> AssociateFileSystem -> f AssociateFileSystem)
-> ((Text -> f Text) -> Sensitive Text -> f (Sensitive Text))
-> (Text -> f Text)
-> AssociateFileSystem
-> f AssociateFileSystem
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

-- | A unique string value that you supply that is used by the FSx File
-- Gateway to ensure idempotent file system association creation.
associateFileSystem_clientToken :: Lens.Lens' AssociateFileSystem Prelude.Text
associateFileSystem_clientToken :: (Text -> f Text) -> AssociateFileSystem -> f AssociateFileSystem
associateFileSystem_clientToken = (AssociateFileSystem -> Text)
-> (AssociateFileSystem -> Text -> AssociateFileSystem)
-> Lens AssociateFileSystem AssociateFileSystem Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFileSystem' {Text
clientToken :: Text
$sel:clientToken:AssociateFileSystem' :: AssociateFileSystem -> Text
clientToken} -> Text
clientToken) (\s :: AssociateFileSystem
s@AssociateFileSystem' {} Text
a -> AssociateFileSystem
s {$sel:clientToken:AssociateFileSystem' :: Text
clientToken = Text
a} :: AssociateFileSystem)

-- | Undocumented member.
associateFileSystem_gatewayARN :: Lens.Lens' AssociateFileSystem Prelude.Text
associateFileSystem_gatewayARN :: (Text -> f Text) -> AssociateFileSystem -> f AssociateFileSystem
associateFileSystem_gatewayARN = (AssociateFileSystem -> Text)
-> (AssociateFileSystem -> Text -> AssociateFileSystem)
-> Lens AssociateFileSystem AssociateFileSystem Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFileSystem' {Text
gatewayARN :: Text
$sel:gatewayARN:AssociateFileSystem' :: AssociateFileSystem -> Text
gatewayARN} -> Text
gatewayARN) (\s :: AssociateFileSystem
s@AssociateFileSystem' {} Text
a -> AssociateFileSystem
s {$sel:gatewayARN:AssociateFileSystem' :: Text
gatewayARN = Text
a} :: AssociateFileSystem)

-- | The Amazon Resource Name (ARN) of the Amazon FSx file system to
-- associate with the FSx File Gateway.
associateFileSystem_locationARN :: Lens.Lens' AssociateFileSystem Prelude.Text
associateFileSystem_locationARN :: (Text -> f Text) -> AssociateFileSystem -> f AssociateFileSystem
associateFileSystem_locationARN = (AssociateFileSystem -> Text)
-> (AssociateFileSystem -> Text -> AssociateFileSystem)
-> Lens AssociateFileSystem AssociateFileSystem Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFileSystem' {Text
locationARN :: Text
$sel:locationARN:AssociateFileSystem' :: AssociateFileSystem -> Text
locationARN} -> Text
locationARN) (\s :: AssociateFileSystem
s@AssociateFileSystem' {} Text
a -> AssociateFileSystem
s {$sel:locationARN:AssociateFileSystem' :: Text
locationARN = Text
a} :: AssociateFileSystem)

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

instance Prelude.NFData AssociateFileSystem

instance Core.ToHeaders AssociateFileSystem where
  toHeaders :: AssociateFileSystem -> ResponseHeaders
toHeaders =
    ResponseHeaders -> AssociateFileSystem -> 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
"StorageGateway_20130630.AssociateFileSystem" ::
                          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 AssociateFileSystem where
  toJSON :: AssociateFileSystem -> Value
toJSON AssociateFileSystem' {Maybe [Tag]
Maybe Text
Maybe CacheAttributes
Maybe EndpointNetworkConfiguration
Text
Sensitive Text
locationARN :: Text
gatewayARN :: Text
clientToken :: Text
password :: Sensitive Text
userName :: Text
tags :: Maybe [Tag]
endpointNetworkConfiguration :: Maybe EndpointNetworkConfiguration
cacheAttributes :: Maybe CacheAttributes
auditDestinationARN :: Maybe Text
$sel:locationARN:AssociateFileSystem' :: AssociateFileSystem -> Text
$sel:gatewayARN:AssociateFileSystem' :: AssociateFileSystem -> Text
$sel:clientToken:AssociateFileSystem' :: AssociateFileSystem -> Text
$sel:password:AssociateFileSystem' :: AssociateFileSystem -> Sensitive Text
$sel:userName:AssociateFileSystem' :: AssociateFileSystem -> Text
$sel:tags:AssociateFileSystem' :: AssociateFileSystem -> Maybe [Tag]
$sel:endpointNetworkConfiguration:AssociateFileSystem' :: AssociateFileSystem -> Maybe EndpointNetworkConfiguration
$sel:cacheAttributes:AssociateFileSystem' :: AssociateFileSystem -> Maybe CacheAttributes
$sel:auditDestinationARN:AssociateFileSystem' :: AssociateFileSystem -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"AuditDestinationARN" 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
auditDestinationARN,
            (Text
"CacheAttributes" Text -> CacheAttributes -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (CacheAttributes -> Pair) -> Maybe CacheAttributes -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe CacheAttributes
cacheAttributes,
            (Text
"EndpointNetworkConfiguration" Text -> EndpointNetworkConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (EndpointNetworkConfiguration -> Pair)
-> Maybe EndpointNetworkConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe EndpointNetworkConfiguration
endpointNetworkConfiguration,
            (Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"UserName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userName),
            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
"ClientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientToken),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"GatewayARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
gatewayARN),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"LocationARN" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
locationARN)
          ]
      )

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

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

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

-- |
-- Create a value of 'AssociateFileSystemResponse' 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:
--
-- 'fileSystemAssociationARN', 'associateFileSystemResponse_fileSystemAssociationARN' - The ARN of the newly created file system association.
--
-- 'httpStatus', 'associateFileSystemResponse_httpStatus' - The response's http status code.
newAssociateFileSystemResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  AssociateFileSystemResponse
newAssociateFileSystemResponse :: Int -> AssociateFileSystemResponse
newAssociateFileSystemResponse Int
pHttpStatus_ =
  AssociateFileSystemResponse' :: Maybe Text -> Int -> AssociateFileSystemResponse
AssociateFileSystemResponse'
    { $sel:fileSystemAssociationARN:AssociateFileSystemResponse' :: Maybe Text
fileSystemAssociationARN =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:AssociateFileSystemResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ARN of the newly created file system association.
associateFileSystemResponse_fileSystemAssociationARN :: Lens.Lens' AssociateFileSystemResponse (Prelude.Maybe Prelude.Text)
associateFileSystemResponse_fileSystemAssociationARN :: (Maybe Text -> f (Maybe Text))
-> AssociateFileSystemResponse -> f AssociateFileSystemResponse
associateFileSystemResponse_fileSystemAssociationARN = (AssociateFileSystemResponse -> Maybe Text)
-> (AssociateFileSystemResponse
    -> Maybe Text -> AssociateFileSystemResponse)
-> Lens
     AssociateFileSystemResponse
     AssociateFileSystemResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateFileSystemResponse' {Maybe Text
fileSystemAssociationARN :: Maybe Text
$sel:fileSystemAssociationARN:AssociateFileSystemResponse' :: AssociateFileSystemResponse -> Maybe Text
fileSystemAssociationARN} -> Maybe Text
fileSystemAssociationARN) (\s :: AssociateFileSystemResponse
s@AssociateFileSystemResponse' {} Maybe Text
a -> AssociateFileSystemResponse
s {$sel:fileSystemAssociationARN:AssociateFileSystemResponse' :: Maybe Text
fileSystemAssociationARN = Maybe Text
a} :: AssociateFileSystemResponse)

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

instance Prelude.NFData AssociateFileSystemResponse