{-# 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_applicationArn,
syncResourceResponse_actionTaken,
syncResourceResponse_resourceArn,
syncResourceResponse_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.ServiceCatalogAppRegistry.Types
data SyncResource = SyncResource'
{
SyncResource -> ResourceType
resourceType :: ResourceType,
SyncResource -> Text
resource :: Prelude.Text
}
deriving (SyncResource -> SyncResource -> Bool
(SyncResource -> SyncResource -> Bool)
-> (SyncResource -> SyncResource -> Bool) -> Eq SyncResource
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]
(Int -> ReadS SyncResource)
-> ReadS [SyncResource]
-> ReadPrec SyncResource
-> ReadPrec [SyncResource]
-> Read 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
(Int -> SyncResource -> ShowS)
-> (SyncResource -> String)
-> ([SyncResource] -> ShowS)
-> Show SyncResource
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. SyncResource -> Rep SyncResource x)
-> (forall x. Rep SyncResource x -> SyncResource)
-> Generic SyncResource
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' :: ResourceType -> Text -> SyncResource
SyncResource'
{ $sel:resourceType:SyncResource' :: ResourceType
resourceType = ResourceType
pResourceType_,
$sel:resource:SyncResource' :: Text
resource = Text
pResource_
}
syncResource_resourceType :: Lens.Lens' SyncResource ResourceType
syncResource_resourceType :: (ResourceType -> f ResourceType) -> SyncResource -> f SyncResource
syncResource_resourceType = (SyncResource -> ResourceType)
-> (SyncResource -> ResourceType -> SyncResource)
-> Lens SyncResource SyncResource ResourceType 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 :: (Text -> f Text) -> SyncResource -> f SyncResource
syncResource_resource = (SyncResource -> Text)
-> (SyncResource -> Text -> SyncResource)
-> Lens SyncResource SyncResource Text Text
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 :: SyncResource -> Request SyncResource
request = Service -> SyncResource -> Request SyncResource
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy SyncResource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SyncResource)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse SyncResource))
-> Logger
-> Service
-> Proxy SyncResource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse SyncResource)))
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
-> Maybe SyncAction -> Maybe Text -> Int -> SyncResourceResponse
SyncResourceResponse'
(Maybe Text
-> Maybe SyncAction -> Maybe Text -> Int -> SyncResourceResponse)
-> Either String (Maybe Text)
-> Either
String
(Maybe SyncAction -> Maybe Text -> Int -> SyncResourceResponse)
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
"applicationArn")
Either
String
(Maybe SyncAction -> Maybe Text -> Int -> SyncResourceResponse)
-> Either String (Maybe SyncAction)
-> Either String (Maybe Text -> Int -> SyncResourceResponse)
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String (Maybe SyncAction)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"actionTaken")
Either String (Maybe Text -> Int -> SyncResourceResponse)
-> Either String (Maybe Text)
-> Either String (Int -> SyncResourceResponse)
forall (f :: * -> *) a b. Applicative f => 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
"resourceArn")
Either String (Int -> SyncResourceResponse)
-> Either String Int -> Either String SyncResourceResponse
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 SyncResource
instance Prelude.NFData SyncResource
instance Core.ToHeaders SyncResource where
toHeaders :: SyncResource -> ResponseHeaders
toHeaders =
ResponseHeaders -> SyncResource -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ 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 SyncResource where
toJSON :: SyncResource -> Value
toJSON = Value -> SyncResource -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath SyncResource where
toPath :: SyncResource -> ByteString
toPath SyncResource' {Text
ResourceType
resource :: Text
resourceType :: ResourceType
$sel:resource:SyncResource' :: SyncResource -> Text
$sel:resourceType:SyncResource' :: SyncResource -> ResourceType
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/sync/",
ResourceType -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS ResourceType
resourceType,
ByteString
"/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
resource
]
instance Core.ToQuery SyncResource where
toQuery :: SyncResource -> QueryString
toQuery = QueryString -> SyncResource -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data SyncResourceResponse = SyncResourceResponse'
{
SyncResourceResponse -> Maybe Text
applicationArn :: Prelude.Maybe Prelude.Text,
SyncResourceResponse -> Maybe SyncAction
actionTaken :: Prelude.Maybe SyncAction,
SyncResourceResponse -> Maybe Text
resourceArn :: Prelude.Maybe Prelude.Text,
SyncResourceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (SyncResourceResponse -> SyncResourceResponse -> Bool
(SyncResourceResponse -> SyncResourceResponse -> Bool)
-> (SyncResourceResponse -> SyncResourceResponse -> Bool)
-> Eq SyncResourceResponse
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]
(Int -> ReadS SyncResourceResponse)
-> ReadS [SyncResourceResponse]
-> ReadPrec SyncResourceResponse
-> ReadPrec [SyncResourceResponse]
-> Read 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
(Int -> SyncResourceResponse -> ShowS)
-> (SyncResourceResponse -> String)
-> ([SyncResourceResponse] -> ShowS)
-> Show SyncResourceResponse
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. SyncResourceResponse -> Rep SyncResourceResponse x)
-> (forall x. Rep SyncResourceResponse x -> SyncResourceResponse)
-> Generic SyncResourceResponse
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' :: Maybe Text
-> Maybe SyncAction -> Maybe Text -> Int -> SyncResourceResponse
SyncResourceResponse'
{ $sel:applicationArn:SyncResourceResponse' :: Maybe Text
applicationArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:actionTaken:SyncResourceResponse' :: Maybe SyncAction
actionTaken = Maybe SyncAction
forall a. Maybe a
Prelude.Nothing,
$sel:resourceArn:SyncResourceResponse' :: Maybe Text
resourceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:SyncResourceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
syncResourceResponse_applicationArn :: Lens.Lens' SyncResourceResponse (Prelude.Maybe Prelude.Text)
syncResourceResponse_applicationArn :: (Maybe Text -> f (Maybe Text))
-> SyncResourceResponse -> f SyncResourceResponse
syncResourceResponse_applicationArn = (SyncResourceResponse -> Maybe Text)
-> (SyncResourceResponse -> Maybe Text -> SyncResourceResponse)
-> Lens
SyncResourceResponse SyncResourceResponse (Maybe Text) (Maybe Text)
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_actionTaken :: Lens.Lens' SyncResourceResponse (Prelude.Maybe SyncAction)
syncResourceResponse_actionTaken :: (Maybe SyncAction -> f (Maybe SyncAction))
-> SyncResourceResponse -> f SyncResourceResponse
syncResourceResponse_actionTaken = (SyncResourceResponse -> Maybe SyncAction)
-> (SyncResourceResponse
-> Maybe SyncAction -> SyncResourceResponse)
-> Lens
SyncResourceResponse
SyncResourceResponse
(Maybe SyncAction)
(Maybe SyncAction)
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_resourceArn :: Lens.Lens' SyncResourceResponse (Prelude.Maybe Prelude.Text)
syncResourceResponse_resourceArn :: (Maybe Text -> f (Maybe Text))
-> SyncResourceResponse -> f SyncResourceResponse
syncResourceResponse_resourceArn = (SyncResourceResponse -> Maybe Text)
-> (SyncResourceResponse -> Maybe Text -> SyncResourceResponse)
-> Lens
SyncResourceResponse SyncResourceResponse (Maybe Text) (Maybe Text)
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 :: (Int -> f Int) -> SyncResourceResponse -> f SyncResourceResponse
syncResourceResponse_httpStatus = (SyncResourceResponse -> Int)
-> (SyncResourceResponse -> Int -> SyncResourceResponse)
-> Lens SyncResourceResponse SyncResourceResponse Int Int
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