{-# 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.ServiceCatalogAppRegistry.SyncResource
(
SyncResource (..),
newSyncResource,
syncResource_resourceType,
syncResource_resource,
SyncResourceResponse (..),
newSyncResourceResponse,
syncResourceResponse_actionTaken,
syncResourceResponse_applicationArn,
syncResourceResponse_resourceArn,
syncResourceResponse_httpStatus,
)
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.ServiceCatalogAppRegistry.Types
data SyncResource = SyncResource'
{
SyncResource -> ResourceType
resourceType :: ResourceType,
SyncResource -> Text
resource :: Prelude.Text
}
deriving (SyncResource -> SyncResource -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SyncResource -> SyncResource -> Bool
$c/= :: SyncResource -> SyncResource -> Bool
== :: SyncResource -> SyncResource -> Bool
$c== :: SyncResource -> SyncResource -> Bool
Prelude.Eq, ReadPrec [SyncResource]
ReadPrec SyncResource
Int -> ReadS SyncResource
ReadS [SyncResource]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SyncResource]
$creadListPrec :: ReadPrec [SyncResource]
readPrec :: ReadPrec SyncResource
$creadPrec :: ReadPrec SyncResource
readList :: ReadS [SyncResource]
$creadList :: ReadS [SyncResource]
readsPrec :: Int -> ReadS SyncResource
$creadsPrec :: Int -> ReadS SyncResource
Prelude.Read, Int -> SyncResource -> ShowS
[SyncResource] -> ShowS
SyncResource -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SyncResource] -> ShowS
$cshowList :: [SyncResource] -> ShowS
show :: SyncResource -> String
$cshow :: SyncResource -> String
showsPrec :: Int -> SyncResource -> ShowS
$cshowsPrec :: Int -> SyncResource -> ShowS
Prelude.Show, forall x. Rep SyncResource x -> SyncResource
forall x. SyncResource -> Rep SyncResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SyncResource x -> SyncResource
$cfrom :: forall x. SyncResource -> Rep SyncResource x
Prelude.Generic)
newSyncResource ::
ResourceType ->
Prelude.Text ->
SyncResource
newSyncResource :: ResourceType -> Text -> SyncResource
newSyncResource ResourceType
pResourceType_ Text
pResource_ =
SyncResource'
{ $sel:resourceType:SyncResource' :: ResourceType
resourceType = ResourceType
pResourceType_,
$sel:resource:SyncResource' :: Text
resource = Text
pResource_
}
syncResource_resourceType :: Lens.Lens' SyncResource ResourceType
syncResource_resourceType :: Lens' SyncResource ResourceType
syncResource_resourceType = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SyncResource' {ResourceType
resourceType :: ResourceType
$sel:resourceType:SyncResource' :: SyncResource -> ResourceType
resourceType} -> ResourceType
resourceType) (\s :: SyncResource
s@SyncResource' {} ResourceType
a -> SyncResource
s {$sel:resourceType:SyncResource' :: ResourceType
resourceType = ResourceType
a} :: SyncResource)
syncResource_resource :: Lens.Lens' SyncResource Prelude.Text
syncResource_resource :: Lens' SyncResource Text
syncResource_resource = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SyncResource' {Text
resource :: Text
$sel:resource:SyncResource' :: SyncResource -> Text
resource} -> Text
resource) (\s :: SyncResource
s@SyncResource' {} Text
a -> SyncResource
s {$sel:resource:SyncResource' :: Text
resource = Text
a} :: SyncResource)
instance Core.AWSRequest SyncResource where
type AWSResponse SyncResource = SyncResourceResponse
request :: (Service -> Service) -> SyncResource -> Request SyncResource
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 SyncResource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SyncResource)))
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 SyncAction
-> Maybe Text -> Maybe Text -> Int -> SyncResourceResponse
SyncResourceResponse'
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
"actionTaken")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"applicationArn")
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x forall a. FromJSON a => Object -> Key -> Either String (Maybe a)
Data..?> Key
"resourceArn")
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 SyncResource where
hashWithSalt :: Int -> SyncResource -> Int
hashWithSalt Int
_salt SyncResource' {Text
ResourceType
resource :: Text
resourceType :: ResourceType
$sel:resource:SyncResource' :: SyncResource -> Text
$sel:resourceType:SyncResource' :: SyncResource -> ResourceType
..} =
Int
_salt
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` ResourceType
resourceType
forall a. Hashable a => Int -> a -> Int
`Prelude.hashWithSalt` Text
resource
instance Prelude.NFData SyncResource where
rnf :: SyncResource -> ()
rnf SyncResource' {Text
ResourceType
resource :: Text
resourceType :: ResourceType
$sel:resource:SyncResource' :: SyncResource -> Text
$sel:resourceType:SyncResource' :: SyncResource -> ResourceType
..} =
forall a. NFData a => a -> ()
Prelude.rnf ResourceType
resourceType
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Text
resource
instance Data.ToHeaders SyncResource where
toHeaders :: SyncResource -> 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 SyncResource where
toJSON :: SyncResource -> Value
toJSON = forall a b. a -> b -> a
Prelude.const (Object -> Value
Data.Object forall a. Monoid a => a
Prelude.mempty)
instance Data.ToPath SyncResource where
toPath :: SyncResource -> ByteString
toPath SyncResource' {Text
ResourceType
resource :: Text
resourceType :: ResourceType
$sel:resource:SyncResource' :: SyncResource -> Text
$sel:resourceType:SyncResource' :: SyncResource -> ResourceType
..} =
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/sync/",
forall a. ToByteString a => a -> ByteString
Data.toBS ResourceType
resourceType,
ByteString
"/",
forall a. ToByteString a => a -> ByteString
Data.toBS Text
resource
]
instance Data.ToQuery SyncResource where
toQuery :: SyncResource -> QueryString
toQuery = forall a b. a -> b -> a
Prelude.const forall a. Monoid a => a
Prelude.mempty
data SyncResourceResponse = SyncResourceResponse'
{
SyncResourceResponse -> Maybe SyncAction
actionTaken :: Prelude.Maybe SyncAction,
SyncResourceResponse -> Maybe Text
applicationArn :: Prelude.Maybe Prelude.Text,
SyncResourceResponse -> Maybe Text
resourceArn :: Prelude.Maybe Prelude.Text,
SyncResourceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (SyncResourceResponse -> SyncResourceResponse -> Bool
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: SyncResourceResponse -> SyncResourceResponse -> Bool
$c/= :: SyncResourceResponse -> SyncResourceResponse -> Bool
== :: SyncResourceResponse -> SyncResourceResponse -> Bool
$c== :: SyncResourceResponse -> SyncResourceResponse -> Bool
Prelude.Eq, ReadPrec [SyncResourceResponse]
ReadPrec SyncResourceResponse
Int -> ReadS SyncResourceResponse
ReadS [SyncResourceResponse]
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [SyncResourceResponse]
$creadListPrec :: ReadPrec [SyncResourceResponse]
readPrec :: ReadPrec SyncResourceResponse
$creadPrec :: ReadPrec SyncResourceResponse
readList :: ReadS [SyncResourceResponse]
$creadList :: ReadS [SyncResourceResponse]
readsPrec :: Int -> ReadS SyncResourceResponse
$creadsPrec :: Int -> ReadS SyncResourceResponse
Prelude.Read, Int -> SyncResourceResponse -> ShowS
[SyncResourceResponse] -> ShowS
SyncResourceResponse -> String
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [SyncResourceResponse] -> ShowS
$cshowList :: [SyncResourceResponse] -> ShowS
show :: SyncResourceResponse -> String
$cshow :: SyncResourceResponse -> String
showsPrec :: Int -> SyncResourceResponse -> ShowS
$cshowsPrec :: Int -> SyncResourceResponse -> ShowS
Prelude.Show, forall x. Rep SyncResourceResponse x -> SyncResourceResponse
forall x. SyncResourceResponse -> Rep SyncResourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep SyncResourceResponse x -> SyncResourceResponse
$cfrom :: forall x. SyncResourceResponse -> Rep SyncResourceResponse x
Prelude.Generic)
newSyncResourceResponse ::
Prelude.Int ->
SyncResourceResponse
newSyncResourceResponse :: Int -> SyncResourceResponse
newSyncResourceResponse Int
pHttpStatus_ =
SyncResourceResponse'
{ $sel:actionTaken:SyncResourceResponse' :: Maybe SyncAction
actionTaken =
forall a. Maybe a
Prelude.Nothing,
$sel:applicationArn:SyncResourceResponse' :: Maybe Text
applicationArn = forall a. Maybe a
Prelude.Nothing,
$sel:resourceArn:SyncResourceResponse' :: Maybe Text
resourceArn = forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:SyncResourceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
syncResourceResponse_actionTaken :: Lens.Lens' SyncResourceResponse (Prelude.Maybe SyncAction)
syncResourceResponse_actionTaken :: Lens' SyncResourceResponse (Maybe SyncAction)
syncResourceResponse_actionTaken = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SyncResourceResponse' {Maybe SyncAction
actionTaken :: Maybe SyncAction
$sel:actionTaken:SyncResourceResponse' :: SyncResourceResponse -> Maybe SyncAction
actionTaken} -> Maybe SyncAction
actionTaken) (\s :: SyncResourceResponse
s@SyncResourceResponse' {} Maybe SyncAction
a -> SyncResourceResponse
s {$sel:actionTaken:SyncResourceResponse' :: Maybe SyncAction
actionTaken = Maybe SyncAction
a} :: SyncResourceResponse)
syncResourceResponse_applicationArn :: Lens.Lens' SyncResourceResponse (Prelude.Maybe Prelude.Text)
syncResourceResponse_applicationArn :: Lens' SyncResourceResponse (Maybe Text)
syncResourceResponse_applicationArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SyncResourceResponse' {Maybe Text
applicationArn :: Maybe Text
$sel:applicationArn:SyncResourceResponse' :: SyncResourceResponse -> Maybe Text
applicationArn} -> Maybe Text
applicationArn) (\s :: SyncResourceResponse
s@SyncResourceResponse' {} Maybe Text
a -> SyncResourceResponse
s {$sel:applicationArn:SyncResourceResponse' :: Maybe Text
applicationArn = Maybe Text
a} :: SyncResourceResponse)
syncResourceResponse_resourceArn :: Lens.Lens' SyncResourceResponse (Prelude.Maybe Prelude.Text)
syncResourceResponse_resourceArn :: Lens' SyncResourceResponse (Maybe Text)
syncResourceResponse_resourceArn = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SyncResourceResponse' {Maybe Text
resourceArn :: Maybe Text
$sel:resourceArn:SyncResourceResponse' :: SyncResourceResponse -> Maybe Text
resourceArn} -> Maybe Text
resourceArn) (\s :: SyncResourceResponse
s@SyncResourceResponse' {} Maybe Text
a -> SyncResourceResponse
s {$sel:resourceArn:SyncResourceResponse' :: Maybe Text
resourceArn = Maybe Text
a} :: SyncResourceResponse)
syncResourceResponse_httpStatus :: Lens.Lens' SyncResourceResponse Prelude.Int
syncResourceResponse_httpStatus :: Lens' SyncResourceResponse Int
syncResourceResponse_httpStatus = forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\SyncResourceResponse' {Int
httpStatus :: Int
$sel:httpStatus:SyncResourceResponse' :: SyncResourceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: SyncResourceResponse
s@SyncResourceResponse' {} Int
a -> SyncResourceResponse
s {$sel:httpStatus:SyncResourceResponse' :: Int
httpStatus = Int
a} :: SyncResourceResponse)
instance Prelude.NFData SyncResourceResponse where
rnf :: SyncResourceResponse -> ()
rnf SyncResourceResponse' {Int
Maybe Text
Maybe SyncAction
httpStatus :: Int
resourceArn :: Maybe Text
applicationArn :: Maybe Text
actionTaken :: Maybe SyncAction
$sel:httpStatus:SyncResourceResponse' :: SyncResourceResponse -> Int
$sel:resourceArn:SyncResourceResponse' :: SyncResourceResponse -> Maybe Text
$sel:applicationArn:SyncResourceResponse' :: SyncResourceResponse -> Maybe Text
$sel:actionTaken:SyncResourceResponse' :: SyncResourceResponse -> Maybe SyncAction
..} =
forall a. NFData a => a -> ()
Prelude.rnf Maybe SyncAction
actionTaken
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
applicationArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Maybe Text
resourceArn
seq :: forall a b. a -> b -> b
`Prelude.seq` forall a. NFData a => a -> ()
Prelude.rnf Int
httpStatus