{-# 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 #-}
module Amazonka.RolesAnywhere.UpdateProfile
(
UpdateProfile (..),
newUpdateProfile,
updateProfile_durationSeconds,
updateProfile_managedPolicyArns,
updateProfile_name,
updateProfile_roleArns,
updateProfile_sessionPolicy,
updateProfile_profileId,
ProfileDetailResponse (..),
newProfileDetailResponse,
profileDetailResponse_profile,
)
where
import qualified Amazonka.Core as Core
import qualified Amazonka.Core.Lens.Internal as Lens
import qualified Amazonka.Data as Data
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
import Amazonka.RolesAnywhere.Types
data UpdateProfile = UpdateProfile'
{
UpdateProfile -> Maybe Natural
durationSeconds :: Prelude.Maybe Prelude.Natural,
UpdateProfile -> Maybe [Text]
managedPolicyArns :: Prelude.Maybe [Prelude.Text],
UpdateProfile -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
UpdateProfile -> Maybe [Text]
roleArns :: Prelude.Maybe [Prelude.Text],
UpdateProfile -> Maybe Text
sessionPolicy :: Prelude.Maybe Prelude.Text,
UpdateProfile -> Text
profileId :: Prelude.Text
}
deriving (UpdateProfile -> UpdateProfile -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateProfile -> UpdateProfile -> Bool
$c/= :: UpdateProfile -> UpdateProfile -> Bool
== :: UpdateProfile -> UpdateProfile -> Bool
$c== :: UpdateProfile -> UpdateProfile -> Bool
Prelude.Eq, ReadPrec [UpdateProfile]
ReadPrec UpdateProfile
Int -> ReadS UpdateProfile
ReadS [UpdateProfile]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateProfile]
$creadListPrec :: ReadPrec [UpdateProfile]
readPrec :: ReadPrec UpdateProfile
$creadPrec :: ReadPrec UpdateProfile
readList :: ReadS [UpdateProfile]
$creadList :: ReadS [UpdateProfile]
readsPrec :: Int -> ReadS UpdateProfile
$creadsPrec :: Int -> ReadS UpdateProfile
Prelude.Read, Int -> UpdateProfile -> ShowS
[UpdateProfile] -> ShowS
UpdateProfile -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateProfile] -> ShowS
$cshowList :: [UpdateProfile] -> ShowS
show :: UpdateProfile -> String
$cshow :: UpdateProfile -> String
showsPrec :: Int -> UpdateProfile -> ShowS
$cshowsPrec :: Int -> UpdateProfile -> ShowS
Prelude.Show, forall x. Rep UpdateProfile x -> UpdateProfile
forall x. UpdateProfile -> Rep UpdateProfile x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateProfile x -> UpdateProfile
$cfrom :: forall x. UpdateProfile -> Rep UpdateProfile x
Prelude.Generic)
newUpdateProfile ::
Prelude.Text ->
UpdateProfile
newUpdateProfile :: Text -> UpdateProfile
newUpdateProfile Text
pProfileId_ =
UpdateProfile'
{ $sel:durationSeconds:UpdateProfile' :: Maybe Natural
durationSeconds = forall a. Maybe a
Prelude.Nothing,
$sel:managedPolicyArns:UpdateProfile' :: Maybe [Text]
managedPolicyArns = forall a. Maybe a
Prelude.Nothing,
$sel:name:UpdateProfile' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:roleArns:UpdateProfile' :: Maybe [Text]
roleArns = forall a. Maybe a
Prelude.Nothing,
$sel:sessionPolicy:UpdateProfile' :: Maybe Text
sessionPolicy = forall a. Maybe a
Prelude.Nothing,
$sel:profileId:UpdateProfile' :: Text
profileId = Text
pProfileId_
}
updateProfile_durationSeconds :: Lens.Lens' UpdateProfile (Prelude.Maybe Prelude.Natural)
updateProfile_durationSeconds :: Lens' UpdateProfile (Maybe Natural)
updateProfile_durationSeconds = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProfile' {Maybe Natural
durationSeconds :: Maybe Natural
$sel:durationSeconds:UpdateProfile' :: UpdateProfile -> Maybe Natural
durationSeconds} -> Maybe Natural
durationSeconds) (\s :: UpdateProfile
s@UpdateProfile' {} Maybe Natural
a -> UpdateProfile
s {$sel:durationSeconds:UpdateProfile' :: Maybe Natural
durationSeconds = Maybe Natural
a} :: UpdateProfile)
updateProfile_managedPolicyArns :: Lens.Lens' UpdateProfile (Prelude.Maybe [Prelude.Text])
updateProfile_managedPolicyArns :: Lens' UpdateProfile (Maybe [Text])
updateProfile_managedPolicyArns = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProfile' {Maybe [Text]
managedPolicyArns :: Maybe [Text]
$sel:managedPolicyArns:UpdateProfile' :: UpdateProfile -> Maybe [Text]
managedPolicyArns} -> Maybe [Text]
managedPolicyArns) (\s :: UpdateProfile
s@UpdateProfile' {} Maybe [Text]
a -> UpdateProfile
s {$sel:managedPolicyArns:UpdateProfile' :: Maybe [Text]
managedPolicyArns = Maybe [Text]
a} :: UpdateProfile) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateProfile_name :: Lens.Lens' UpdateProfile (Prelude.Maybe Prelude.Text)
updateProfile_name :: Lens' UpdateProfile (Maybe Text)
updateProfile_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProfile' {Maybe Text
name :: Maybe Text
$sel:name:UpdateProfile' :: UpdateProfile -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateProfile
s@UpdateProfile' {} Maybe Text
a -> UpdateProfile
s {$sel:name:UpdateProfile' :: Maybe Text
name = Maybe Text
a} :: UpdateProfile)
updateProfile_roleArns :: Lens.Lens' UpdateProfile (Prelude.Maybe [Prelude.Text])
updateProfile_roleArns :: Lens' UpdateProfile (Maybe [Text])
updateProfile_roleArns = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProfile' {Maybe [Text]
roleArns :: Maybe [Text]
$sel:roleArns:UpdateProfile' :: UpdateProfile -> Maybe [Text]
roleArns} -> Maybe [Text]
roleArns) (\s :: UpdateProfile
s@UpdateProfile' {} Maybe [Text]
a -> UpdateProfile
s {$sel:roleArns:UpdateProfile' :: Maybe [Text]
roleArns = Maybe [Text]
a} :: UpdateProfile) forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. 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 forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced
updateProfile_sessionPolicy :: Lens.Lens' UpdateProfile (Prelude.Maybe Prelude.Text)
updateProfile_sessionPolicy :: Lens' UpdateProfile (Maybe Text)
updateProfile_sessionPolicy = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProfile' {Maybe Text
sessionPolicy :: Maybe Text
$sel:sessionPolicy:UpdateProfile' :: UpdateProfile -> Maybe Text
sessionPolicy} -> Maybe Text
sessionPolicy) (\s :: UpdateProfile
s@UpdateProfile' {} Maybe Text
a -> UpdateProfile
s {$sel:sessionPolicy:UpdateProfile' :: Maybe Text
sessionPolicy = Maybe Text
a} :: UpdateProfile)
updateProfile_profileId :: Lens.Lens' UpdateProfile Prelude.Text
updateProfile_profileId :: Lens' UpdateProfile Text
updateProfile_profileId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateProfile' {Text
profileId :: Text
$sel:profileId:UpdateProfile' :: UpdateProfile -> Text
profileId} -> Text
profileId) (\s :: UpdateProfile
s@UpdateProfile' {} Text
a -> UpdateProfile
s {$sel:profileId:UpdateProfile' :: Text
profileId = Text
a} :: UpdateProfile)
instance Core.AWSRequest UpdateProfile where
type
AWSResponse UpdateProfile =
ProfileDetailResponse
request :: (Service -> Service) -> UpdateProfile -> Request UpdateProfile
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.patchJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateProfile
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateProfile)))
response =
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> (ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
(\Int
s ResponseHeaders
h Object
x -> forall a. FromJSON a => Object -> Either String a
Data.eitherParseJSON Object
x)
instance Prelude.Hashable UpdateProfile where
hashWithSalt :: Int -> UpdateProfile -> Int
hashWithSalt Int
_salt UpdateProfile' {Maybe Natural
Maybe [Text]
Maybe Text
Text
profileId :: Text
sessionPolicy :: Maybe Text
roleArns :: Maybe [Text]
name :: Maybe Text
managedPolicyArns :: Maybe [Text]
durationSeconds :: Maybe Natural
$sel:profileId:UpdateProfile' :: UpdateProfile -> Text
$sel:sessionPolicy:UpdateProfile' :: UpdateProfile -> Maybe Text
$sel:roleArns:UpdateProfile' :: UpdateProfile -> Maybe [Text]
$sel:name:UpdateProfile' :: UpdateProfile -> Maybe Text
$sel:managedPolicyArns:UpdateProfile' :: UpdateProfile -> Maybe [Text]
$sel:durationSeconds:UpdateProfile' :: UpdateProfile -> Maybe Natural
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Natural
durationSeconds
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
managedPolicyArns
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe [Text]
roleArns
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
sessionPolicy
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
profileId
instance Prelude.NFData UpdateProfile where
rnf :: UpdateProfile -> ()
rnf UpdateProfile' {Maybe Natural
Maybe [Text]
Maybe Text
Text
profileId :: Text
sessionPolicy :: Maybe Text
roleArns :: Maybe [Text]
name :: Maybe Text
managedPolicyArns :: Maybe [Text]
durationSeconds :: Maybe Natural
$sel:profileId:UpdateProfile' :: UpdateProfile -> Text
$sel:sessionPolicy:UpdateProfile' :: UpdateProfile -> Maybe Text
$sel:roleArns:UpdateProfile' :: UpdateProfile -> Maybe [Text]
$sel:name:UpdateProfile' :: UpdateProfile -> Maybe Text
$sel:managedPolicyArns:UpdateProfile' :: UpdateProfile -> Maybe [Text]
$sel:durationSeconds:UpdateProfile' :: UpdateProfile -> Maybe Natural
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Natural
durationSeconds
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
managedPolicyArns
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
name
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe [Text]
roleArns
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
sessionPolicy
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
profileId
instance Data.ToHeaders UpdateProfile where
toHeaders :: UpdateProfile -> ResponseHeaders
toHeaders =
forall a b. a -> b -> a
Prelude.const
( forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"Content-Type"
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Data.=# ( ByteString
"application/x-amz-json-1.1" ::
Prelude.ByteString
)
]
)
instance Data.ToJSON UpdateProfile where
toJSON :: UpdateProfile -> Value
toJSON UpdateProfile' {Maybe Natural
Maybe [Text]
Maybe Text
Text
profileId :: Text
sessionPolicy :: Maybe Text
roleArns :: Maybe [Text]
name :: Maybe Text
managedPolicyArns :: Maybe [Text]
durationSeconds :: Maybe Natural
$sel:profileId:UpdateProfile' :: UpdateProfile -> Text
$sel:sessionPolicy:UpdateProfile' :: UpdateProfile -> Maybe Text
$sel:roleArns:UpdateProfile' :: UpdateProfile -> Maybe [Text]
$sel:name:UpdateProfile' :: UpdateProfile -> Maybe Text
$sel:managedPolicyArns:UpdateProfile' :: UpdateProfile -> Maybe [Text]
$sel:durationSeconds:UpdateProfile' :: UpdateProfile -> Maybe Natural
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"durationSeconds" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Natural
durationSeconds,
(Key
"managedPolicyArns" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
managedPolicyArns,
(Key
"name" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
name,
(Key
"roleArns" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Text]
roleArns,
(Key
"sessionPolicy" forall kv v. (KeyValue kv, ToJSON v) => Key -> v -> kv
Data..=) forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
sessionPolicy
]
)
instance Data.ToPath UpdateProfile where
toPath :: UpdateProfile -> ByteString
toPath UpdateProfile' {Maybe Natural
Maybe [Text]
Maybe Text
Text
profileId :: Text
sessionPolicy :: Maybe Text
roleArns :: Maybe [Text]
name :: Maybe Text
managedPolicyArns :: Maybe [Text]
durationSeconds :: Maybe Natural
$sel:profileId:UpdateProfile' :: UpdateProfile -> Text
$sel:sessionPolicy:UpdateProfile' :: UpdateProfile -> Maybe Text
$sel:roleArns:UpdateProfile' :: UpdateProfile -> Maybe [Text]
$sel:name:UpdateProfile' :: UpdateProfile -> Maybe Text
$sel:managedPolicyArns:UpdateProfile' :: UpdateProfile -> Maybe [Text]
$sel:durationSeconds:UpdateProfile' :: UpdateProfile -> Maybe Natural
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/profile/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
profileId]
instance Data.ToQuery UpdateProfile where
toQuery :: UpdateProfile -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty