{-# 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.UpdateSMBLocalGroups
-- 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)
--
-- Updates the list of Active Directory users and groups that have special
-- permissions for SMB file shares on the gateway.
module Amazonka.StorageGateway.UpdateSMBLocalGroups
  ( -- * Creating a Request
    UpdateSMBLocalGroups (..),
    newUpdateSMBLocalGroups,

    -- * Request Lenses
    updateSMBLocalGroups_gatewayARN,
    updateSMBLocalGroups_sMBLocalGroups,

    -- * Destructuring the Response
    UpdateSMBLocalGroupsResponse (..),
    newUpdateSMBLocalGroupsResponse,

    -- * Response Lenses
    updateSMBLocalGroupsResponse_gatewayARN,
    updateSMBLocalGroupsResponse_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:/ 'newUpdateSMBLocalGroups' smart constructor.
data UpdateSMBLocalGroups = UpdateSMBLocalGroups'
  { UpdateSMBLocalGroups -> Text
gatewayARN :: Prelude.Text,
    -- | A list of Active Directory users and groups that you want to grant
    -- special permissions for SMB file shares on the gateway.
    UpdateSMBLocalGroups -> SMBLocalGroups
sMBLocalGroups :: SMBLocalGroups
  }
  deriving (UpdateSMBLocalGroups -> UpdateSMBLocalGroups -> Bool
(UpdateSMBLocalGroups -> UpdateSMBLocalGroups -> Bool)
-> (UpdateSMBLocalGroups -> UpdateSMBLocalGroups -> Bool)
-> Eq UpdateSMBLocalGroups
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateSMBLocalGroups -> UpdateSMBLocalGroups -> Bool
$c/= :: UpdateSMBLocalGroups -> UpdateSMBLocalGroups -> Bool
== :: UpdateSMBLocalGroups -> UpdateSMBLocalGroups -> Bool
$c== :: UpdateSMBLocalGroups -> UpdateSMBLocalGroups -> Bool
Prelude.Eq, ReadPrec [UpdateSMBLocalGroups]
ReadPrec UpdateSMBLocalGroups
Int -> ReadS UpdateSMBLocalGroups
ReadS [UpdateSMBLocalGroups]
(Int -> ReadS UpdateSMBLocalGroups)
-> ReadS [UpdateSMBLocalGroups]
-> ReadPrec UpdateSMBLocalGroups
-> ReadPrec [UpdateSMBLocalGroups]
-> Read UpdateSMBLocalGroups
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateSMBLocalGroups]
$creadListPrec :: ReadPrec [UpdateSMBLocalGroups]
readPrec :: ReadPrec UpdateSMBLocalGroups
$creadPrec :: ReadPrec UpdateSMBLocalGroups
readList :: ReadS [UpdateSMBLocalGroups]
$creadList :: ReadS [UpdateSMBLocalGroups]
readsPrec :: Int -> ReadS UpdateSMBLocalGroups
$creadsPrec :: Int -> ReadS UpdateSMBLocalGroups
Prelude.Read, Int -> UpdateSMBLocalGroups -> ShowS
[UpdateSMBLocalGroups] -> ShowS
UpdateSMBLocalGroups -> String
(Int -> UpdateSMBLocalGroups -> ShowS)
-> (UpdateSMBLocalGroups -> String)
-> ([UpdateSMBLocalGroups] -> ShowS)
-> Show UpdateSMBLocalGroups
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateSMBLocalGroups] -> ShowS
$cshowList :: [UpdateSMBLocalGroups] -> ShowS
show :: UpdateSMBLocalGroups -> String
$cshow :: UpdateSMBLocalGroups -> String
showsPrec :: Int -> UpdateSMBLocalGroups -> ShowS
$cshowsPrec :: Int -> UpdateSMBLocalGroups -> ShowS
Prelude.Show, (forall x. UpdateSMBLocalGroups -> Rep UpdateSMBLocalGroups x)
-> (forall x. Rep UpdateSMBLocalGroups x -> UpdateSMBLocalGroups)
-> Generic UpdateSMBLocalGroups
forall x. Rep UpdateSMBLocalGroups x -> UpdateSMBLocalGroups
forall x. UpdateSMBLocalGroups -> Rep UpdateSMBLocalGroups x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateSMBLocalGroups x -> UpdateSMBLocalGroups
$cfrom :: forall x. UpdateSMBLocalGroups -> Rep UpdateSMBLocalGroups x
Prelude.Generic)

-- |
-- Create a value of 'UpdateSMBLocalGroups' 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:
--
-- 'gatewayARN', 'updateSMBLocalGroups_gatewayARN' - Undocumented member.
--
-- 'sMBLocalGroups', 'updateSMBLocalGroups_sMBLocalGroups' - A list of Active Directory users and groups that you want to grant
-- special permissions for SMB file shares on the gateway.
newUpdateSMBLocalGroups ::
  -- | 'gatewayARN'
  Prelude.Text ->
  -- | 'sMBLocalGroups'
  SMBLocalGroups ->
  UpdateSMBLocalGroups
newUpdateSMBLocalGroups :: Text -> SMBLocalGroups -> UpdateSMBLocalGroups
newUpdateSMBLocalGroups Text
pGatewayARN_ SMBLocalGroups
pSMBLocalGroups_ =
  UpdateSMBLocalGroups' :: Text -> SMBLocalGroups -> UpdateSMBLocalGroups
UpdateSMBLocalGroups'
    { $sel:gatewayARN:UpdateSMBLocalGroups' :: Text
gatewayARN = Text
pGatewayARN_,
      $sel:sMBLocalGroups:UpdateSMBLocalGroups' :: SMBLocalGroups
sMBLocalGroups = SMBLocalGroups
pSMBLocalGroups_
    }

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

-- | A list of Active Directory users and groups that you want to grant
-- special permissions for SMB file shares on the gateway.
updateSMBLocalGroups_sMBLocalGroups :: Lens.Lens' UpdateSMBLocalGroups SMBLocalGroups
updateSMBLocalGroups_sMBLocalGroups :: (SMBLocalGroups -> f SMBLocalGroups)
-> UpdateSMBLocalGroups -> f UpdateSMBLocalGroups
updateSMBLocalGroups_sMBLocalGroups = (UpdateSMBLocalGroups -> SMBLocalGroups)
-> (UpdateSMBLocalGroups -> SMBLocalGroups -> UpdateSMBLocalGroups)
-> Lens
     UpdateSMBLocalGroups
     UpdateSMBLocalGroups
     SMBLocalGroups
     SMBLocalGroups
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateSMBLocalGroups' {SMBLocalGroups
sMBLocalGroups :: SMBLocalGroups
$sel:sMBLocalGroups:UpdateSMBLocalGroups' :: UpdateSMBLocalGroups -> SMBLocalGroups
sMBLocalGroups} -> SMBLocalGroups
sMBLocalGroups) (\s :: UpdateSMBLocalGroups
s@UpdateSMBLocalGroups' {} SMBLocalGroups
a -> UpdateSMBLocalGroups
s {$sel:sMBLocalGroups:UpdateSMBLocalGroups' :: SMBLocalGroups
sMBLocalGroups = SMBLocalGroups
a} :: UpdateSMBLocalGroups)

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

instance Prelude.NFData UpdateSMBLocalGroups

instance Core.ToHeaders UpdateSMBLocalGroups where
  toHeaders :: UpdateSMBLocalGroups -> ResponseHeaders
toHeaders =
    ResponseHeaders -> UpdateSMBLocalGroups -> 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.UpdateSMBLocalGroups" ::
                          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 UpdateSMBLocalGroups where
  toJSON :: UpdateSMBLocalGroups -> Value
toJSON UpdateSMBLocalGroups' {Text
SMBLocalGroups
sMBLocalGroups :: SMBLocalGroups
gatewayARN :: Text
$sel:sMBLocalGroups:UpdateSMBLocalGroups' :: UpdateSMBLocalGroups -> SMBLocalGroups
$sel:gatewayARN:UpdateSMBLocalGroups' :: UpdateSMBLocalGroups -> Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"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
"SMBLocalGroups" Text -> SMBLocalGroups -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= SMBLocalGroups
sMBLocalGroups)
          ]
      )

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

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

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

-- |
-- Create a value of 'UpdateSMBLocalGroupsResponse' 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:
--
-- 'gatewayARN', 'updateSMBLocalGroupsResponse_gatewayARN' - Undocumented member.
--
-- 'httpStatus', 'updateSMBLocalGroupsResponse_httpStatus' - The response's http status code.
newUpdateSMBLocalGroupsResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  UpdateSMBLocalGroupsResponse
newUpdateSMBLocalGroupsResponse :: Int -> UpdateSMBLocalGroupsResponse
newUpdateSMBLocalGroupsResponse Int
pHttpStatus_ =
  UpdateSMBLocalGroupsResponse' :: Maybe Text -> Int -> UpdateSMBLocalGroupsResponse
UpdateSMBLocalGroupsResponse'
    { $sel:gatewayARN:UpdateSMBLocalGroupsResponse' :: Maybe Text
gatewayARN =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:UpdateSMBLocalGroupsResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

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

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

instance Prelude.NFData UpdateSMBLocalGroupsResponse