{-# 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.Chime.UpdateAccount
(
UpdateAccount (..),
newUpdateAccount,
updateAccount_defaultLicense,
updateAccount_name,
updateAccount_accountId,
UpdateAccountResponse (..),
newUpdateAccountResponse,
updateAccountResponse_account,
updateAccountResponse_httpStatus,
)
where
import Amazonka.Chime.Types
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
data UpdateAccount = UpdateAccount'
{
UpdateAccount -> Maybe License
defaultLicense :: Prelude.Maybe License,
UpdateAccount -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
UpdateAccount -> Text
accountId :: Prelude.Text
}
deriving (UpdateAccount -> UpdateAccount -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAccount -> UpdateAccount -> Bool
$c/= :: UpdateAccount -> UpdateAccount -> Bool
== :: UpdateAccount -> UpdateAccount -> Bool
$c== :: UpdateAccount -> UpdateAccount -> Bool
Prelude.Eq, ReadPrec [UpdateAccount]
ReadPrec UpdateAccount
Int -> ReadS UpdateAccount
ReadS [UpdateAccount]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAccount]
$creadListPrec :: ReadPrec [UpdateAccount]
readPrec :: ReadPrec UpdateAccount
$creadPrec :: ReadPrec UpdateAccount
readList :: ReadS [UpdateAccount]
$creadList :: ReadS [UpdateAccount]
readsPrec :: Int -> ReadS UpdateAccount
$creadsPrec :: Int -> ReadS UpdateAccount
Prelude.Read, Int -> UpdateAccount -> ShowS
[UpdateAccount] -> ShowS
UpdateAccount -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAccount] -> ShowS
$cshowList :: [UpdateAccount] -> ShowS
show :: UpdateAccount -> String
$cshow :: UpdateAccount -> String
showsPrec :: Int -> UpdateAccount -> ShowS
$cshowsPrec :: Int -> UpdateAccount -> ShowS
Prelude.Show, forall x. Rep UpdateAccount x -> UpdateAccount
forall x. UpdateAccount -> Rep UpdateAccount x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateAccount x -> UpdateAccount
$cfrom :: forall x. UpdateAccount -> Rep UpdateAccount x
Prelude.Generic)
newUpdateAccount ::
Prelude.Text ->
UpdateAccount
newUpdateAccount :: Text -> UpdateAccount
newUpdateAccount Text
pAccountId_ =
UpdateAccount'
{ $sel:defaultLicense:UpdateAccount' :: Maybe License
defaultLicense = forall a. Maybe a
Prelude.Nothing,
$sel:name:UpdateAccount' :: Maybe Text
name = forall a. Maybe a
Prelude.Nothing,
$sel:accountId:UpdateAccount' :: Text
accountId = Text
pAccountId_
}
updateAccount_defaultLicense :: Lens.Lens' UpdateAccount (Prelude.Maybe License)
updateAccount_defaultLicense :: Lens' UpdateAccount (Maybe License)
updateAccount_defaultLicense = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAccount' {Maybe License
defaultLicense :: Maybe License
$sel:defaultLicense:UpdateAccount' :: UpdateAccount -> Maybe License
defaultLicense} -> Maybe License
defaultLicense) (\s :: UpdateAccount
s@UpdateAccount' {} Maybe License
a -> UpdateAccount
s {$sel:defaultLicense:UpdateAccount' :: Maybe License
defaultLicense = Maybe License
a} :: UpdateAccount)
updateAccount_name :: Lens.Lens' UpdateAccount (Prelude.Maybe Prelude.Text)
updateAccount_name :: Lens' UpdateAccount (Maybe Text)
updateAccount_name = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAccount' {Maybe Text
name :: Maybe Text
$sel:name:UpdateAccount' :: UpdateAccount -> Maybe Text
name} -> Maybe Text
name) (\s :: UpdateAccount
s@UpdateAccount' {} Maybe Text
a -> UpdateAccount
s {$sel:name:UpdateAccount' :: Maybe Text
name = Maybe Text
a} :: UpdateAccount)
updateAccount_accountId :: Lens.Lens' UpdateAccount Prelude.Text
updateAccount_accountId :: Lens' UpdateAccount Text
updateAccount_accountId = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAccount' {Text
accountId :: Text
$sel:accountId:UpdateAccount' :: UpdateAccount -> Text
accountId} -> Text
accountId) (\s :: UpdateAccount
s@UpdateAccount' {} Text
a -> UpdateAccount
s {$sel:accountId:UpdateAccount' :: Text
accountId = Text
a} :: UpdateAccount)
instance Core.AWSRequest UpdateAccount where
type
AWSResponse UpdateAccount =
UpdateAccountResponse
request :: (Service -> Service) -> UpdateAccount -> Request UpdateAccount
request Service -> Service
overrides =
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON (Service -> Service
overrides Service
defaultService)
response :: forall (m :: * -> *).
MonadResource m =>
(ByteStringLazy -> IO ByteStringLazy)
-> Service
-> Proxy UpdateAccount
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse UpdateAccount)))
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 ->
Maybe Account -> Int -> UpdateAccountResponse
UpdateAccountResponse'
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"Account")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
)
instance Prelude.Hashable UpdateAccount where
hashWithSalt :: Int -> UpdateAccount -> Int
hashWithSalt Int
_salt UpdateAccount' {Maybe Text
Maybe License
Text
accountId :: Text
name :: Maybe Text
defaultLicense :: Maybe License
$sel:accountId:UpdateAccount' :: UpdateAccount -> Text
$sel:name:UpdateAccount' :: UpdateAccount -> Maybe Text
$sel:defaultLicense:UpdateAccount' :: UpdateAccount -> Maybe License
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe License
defaultLicense
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Maybe Text
name
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
accountId
instance Prelude.NFData UpdateAccount where
rnf :: UpdateAccount -> ()
rnf UpdateAccount' {Maybe Text
Maybe License
Text
accountId :: Text
name :: Maybe Text
defaultLicense :: Maybe License
$sel:accountId:UpdateAccount' :: UpdateAccount -> Text
$sel:name:UpdateAccount' :: UpdateAccount -> Maybe Text
$sel:defaultLicense:UpdateAccount' :: UpdateAccount -> Maybe License
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe License
defaultLicense
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 Text
accountId
instance Data.ToHeaders UpdateAccount where
toHeaders :: UpdateAccount -> ResponseHeaders
toHeaders = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
instance Data.ToJSON UpdateAccount where
toJSON :: UpdateAccount -> Value
toJSON UpdateAccount' {Maybe Text
Maybe License
Text
accountId :: Text
name :: Maybe Text
defaultLicense :: Maybe License
$sel:accountId:UpdateAccount' :: UpdateAccount -> Text
$sel:name:UpdateAccount' :: UpdateAccount -> Maybe Text
$sel:defaultLicense:UpdateAccount' :: UpdateAccount -> Maybe License
..} =
[Pair] -> Value
Data.object
( forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Key
"DefaultLicense" 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 License
defaultLicense,
(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
]
)
instance Data.ToPath UpdateAccount where
toPath :: UpdateAccount -> ByteString
toPath UpdateAccount' {Maybe Text
Maybe License
Text
accountId :: Text
name :: Maybe Text
defaultLicense :: Maybe License
$sel:accountId:UpdateAccount' :: UpdateAccount -> Text
$sel:name:UpdateAccount' :: UpdateAccount -> Maybe Text
$sel:defaultLicense:UpdateAccount' :: UpdateAccount -> Maybe License
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat [ByteString
"/accounts/", forall a. ToByteString a => a -> ByteString
Data.toBS Text
accountId]
instance Data.ToQuery UpdateAccount where
toQuery :: UpdateAccount -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data UpdateAccountResponse = UpdateAccountResponse'
{
UpdateAccountResponse -> Maybe Account
account :: Prelude.Maybe Account,
UpdateAccountResponse -> Int
httpStatus :: Prelude.Int
}
deriving (UpdateAccountResponse -> UpdateAccountResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: UpdateAccountResponse -> UpdateAccountResponse -> Bool
$c/= :: UpdateAccountResponse -> UpdateAccountResponse -> Bool
== :: UpdateAccountResponse -> UpdateAccountResponse -> Bool
$c== :: UpdateAccountResponse -> UpdateAccountResponse -> Bool
Prelude.Eq, ReadPrec [UpdateAccountResponse]
ReadPrec UpdateAccountResponse
Int -> ReadS UpdateAccountResponse
ReadS [UpdateAccountResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [UpdateAccountResponse]
$creadListPrec :: ReadPrec [UpdateAccountResponse]
readPrec :: ReadPrec UpdateAccountResponse
$creadPrec :: ReadPrec UpdateAccountResponse
readList :: ReadS [UpdateAccountResponse]
$creadList :: ReadS [UpdateAccountResponse]
readsPrec :: Int -> ReadS UpdateAccountResponse
$creadsPrec :: Int -> ReadS UpdateAccountResponse
Prelude.Read, Int -> UpdateAccountResponse -> ShowS
[UpdateAccountResponse] -> ShowS
UpdateAccountResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [UpdateAccountResponse] -> ShowS
$cshowList :: [UpdateAccountResponse] -> ShowS
show :: UpdateAccountResponse -> String
$cshow :: UpdateAccountResponse -> String
showsPrec :: Int -> UpdateAccountResponse -> ShowS
$cshowsPrec :: Int -> UpdateAccountResponse -> ShowS
Prelude.Show, forall x. Rep UpdateAccountResponse x -> UpdateAccountResponse
forall x. UpdateAccountResponse -> Rep UpdateAccountResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep UpdateAccountResponse x -> UpdateAccountResponse
$cfrom :: forall x. UpdateAccountResponse -> Rep UpdateAccountResponse x
Prelude.Generic)
newUpdateAccountResponse ::
Prelude.Int ->
UpdateAccountResponse
newUpdateAccountResponse :: Int -> UpdateAccountResponse
newUpdateAccountResponse Int
pHttpStatus_ =
UpdateAccountResponse'
{ $sel:account:UpdateAccountResponse' :: Maybe Account
account = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:UpdateAccountResponse' :: Int
httpStatus = Int
pHttpStatus_
}
updateAccountResponse_account :: Lens.Lens' UpdateAccountResponse (Prelude.Maybe Account)
updateAccountResponse_account :: Lens' UpdateAccountResponse (Maybe Account)
updateAccountResponse_account = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAccountResponse' {Maybe Account
account :: Maybe Account
$sel:account:UpdateAccountResponse' :: UpdateAccountResponse -> Maybe Account
account} -> Maybe Account
account) (\s :: UpdateAccountResponse
s@UpdateAccountResponse' {} Maybe Account
a -> UpdateAccountResponse
s {$sel:account:UpdateAccountResponse' :: Maybe Account
account = Maybe Account
a} :: UpdateAccountResponse)
updateAccountResponse_httpStatus :: Lens.Lens' UpdateAccountResponse Prelude.Int
updateAccountResponse_httpStatus :: Lens' UpdateAccountResponse Int
updateAccountResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\UpdateAccountResponse' {Int
httpStatus :: Int
$sel:httpStatus:UpdateAccountResponse' :: UpdateAccountResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: UpdateAccountResponse
s@UpdateAccountResponse' {} Int
a -> UpdateAccountResponse
s {$sel:httpStatus:UpdateAccountResponse' :: Int
httpStatus = Int
a} :: UpdateAccountResponse)
instance Prelude.NFData UpdateAccountResponse where
rnf :: UpdateAccountResponse -> ()
rnf UpdateAccountResponse' {Int
Maybe Account
httpStatus :: Int
account :: Maybe Account
$sel:httpStatus:UpdateAccountResponse' :: UpdateAccountResponse -> Int
$sel:account:UpdateAccountResponse' :: UpdateAccountResponse -> Maybe Account
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe Account
account
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus