{-# 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.AssociateResource
(
AssociateResource (..),
newAssociateResource,
associateResource_application,
associateResource_resourceType,
associateResource_resource,
AssociateResourceResponse (..),
newAssociateResourceResponse,
associateResourceResponse_applicationArn,
associateResourceResponse_resourceArn,
associateResourceResponse_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 AssociateResource = AssociateResource'
{
AssociateResource -> Text
application :: Prelude.Text,
AssociateResource -> ResourceType
resourceType :: ResourceType,
AssociateResource -> Text
resource :: Prelude.Text
}
deriving (AssociateResource -> AssociateResource -> Bool
(AssociateResource -> AssociateResource -> Bool)
-> (AssociateResource -> AssociateResource -> Bool)
-> Eq AssociateResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateResource -> AssociateResource -> Bool
$c/= :: AssociateResource -> AssociateResource -> Bool
== :: AssociateResource -> AssociateResource -> Bool
$c== :: AssociateResource -> AssociateResource -> Bool
Prelude.Eq, ReadPrec [AssociateResource]
ReadPrec AssociateResource
Int -> ReadS AssociateResource
ReadS [AssociateResource]
(Int -> ReadS AssociateResource)
-> ReadS [AssociateResource]
-> ReadPrec AssociateResource
-> ReadPrec [AssociateResource]
-> Read AssociateResource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateResource]
$creadListPrec :: ReadPrec [AssociateResource]
readPrec :: ReadPrec AssociateResource
$creadPrec :: ReadPrec AssociateResource
readList :: ReadS [AssociateResource]
$creadList :: ReadS [AssociateResource]
readsPrec :: Int -> ReadS AssociateResource
$creadsPrec :: Int -> ReadS AssociateResource
Prelude.Read, Int -> AssociateResource -> ShowS
[AssociateResource] -> ShowS
AssociateResource -> String
(Int -> AssociateResource -> ShowS)
-> (AssociateResource -> String)
-> ([AssociateResource] -> ShowS)
-> Show AssociateResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateResource] -> ShowS
$cshowList :: [AssociateResource] -> ShowS
show :: AssociateResource -> String
$cshow :: AssociateResource -> String
showsPrec :: Int -> AssociateResource -> ShowS
$cshowsPrec :: Int -> AssociateResource -> ShowS
Prelude.Show, (forall x. AssociateResource -> Rep AssociateResource x)
-> (forall x. Rep AssociateResource x -> AssociateResource)
-> Generic AssociateResource
forall x. Rep AssociateResource x -> AssociateResource
forall x. AssociateResource -> Rep AssociateResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep AssociateResource x -> AssociateResource
$cfrom :: forall x. AssociateResource -> Rep AssociateResource x
Prelude.Generic)
newAssociateResource ::
Prelude.Text ->
ResourceType ->
Prelude.Text ->
AssociateResource
newAssociateResource :: Text -> ResourceType -> Text -> AssociateResource
newAssociateResource
Text
pApplication_
ResourceType
pResourceType_
Text
pResource_ =
AssociateResource' :: Text -> ResourceType -> Text -> AssociateResource
AssociateResource'
{ $sel:application:AssociateResource' :: Text
application = Text
pApplication_,
$sel:resourceType:AssociateResource' :: ResourceType
resourceType = ResourceType
pResourceType_,
$sel:resource:AssociateResource' :: Text
resource = Text
pResource_
}
associateResource_application :: Lens.Lens' AssociateResource Prelude.Text
associateResource_application :: (Text -> f Text) -> AssociateResource -> f AssociateResource
associateResource_application = (AssociateResource -> Text)
-> (AssociateResource -> Text -> AssociateResource)
-> Lens AssociateResource AssociateResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateResource' {Text
application :: Text
$sel:application:AssociateResource' :: AssociateResource -> Text
application} -> Text
application) (\s :: AssociateResource
s@AssociateResource' {} Text
a -> AssociateResource
s {$sel:application:AssociateResource' :: Text
application = Text
a} :: AssociateResource)
associateResource_resourceType :: Lens.Lens' AssociateResource ResourceType
associateResource_resourceType :: (ResourceType -> f ResourceType)
-> AssociateResource -> f AssociateResource
associateResource_resourceType = (AssociateResource -> ResourceType)
-> (AssociateResource -> ResourceType -> AssociateResource)
-> Lens
AssociateResource AssociateResource ResourceType ResourceType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateResource' {ResourceType
resourceType :: ResourceType
$sel:resourceType:AssociateResource' :: AssociateResource -> ResourceType
resourceType} -> ResourceType
resourceType) (\s :: AssociateResource
s@AssociateResource' {} ResourceType
a -> AssociateResource
s {$sel:resourceType:AssociateResource' :: ResourceType
resourceType = ResourceType
a} :: AssociateResource)
associateResource_resource :: Lens.Lens' AssociateResource Prelude.Text
associateResource_resource :: (Text -> f Text) -> AssociateResource -> f AssociateResource
associateResource_resource = (AssociateResource -> Text)
-> (AssociateResource -> Text -> AssociateResource)
-> Lens AssociateResource AssociateResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateResource' {Text
resource :: Text
$sel:resource:AssociateResource' :: AssociateResource -> Text
resource} -> Text
resource) (\s :: AssociateResource
s@AssociateResource' {} Text
a -> AssociateResource
s {$sel:resource:AssociateResource' :: Text
resource = Text
a} :: AssociateResource)
instance Core.AWSRequest AssociateResource where
type
AWSResponse AssociateResource =
AssociateResourceResponse
request :: AssociateResource -> Request AssociateResource
request = Service -> AssociateResource -> Request AssociateResource
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.putJSON Service
defaultService
response :: Logger
-> Service
-> Proxy AssociateResource
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateResource)))
response =
(Int
-> ResponseHeaders
-> Object
-> Either String (AWSResponse AssociateResource))
-> Logger
-> Service
-> Proxy AssociateResource
-> ClientResponse ClientBody
-> m (Either
Error (ClientResponse (AWSResponse AssociateResource)))
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 Text -> Int -> AssociateResourceResponse
AssociateResourceResponse'
(Maybe Text -> Maybe Text -> Int -> AssociateResourceResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> AssociateResourceResponse)
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 Text -> Int -> AssociateResourceResponse)
-> Either String (Maybe Text)
-> Either String (Int -> AssociateResourceResponse)
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 -> AssociateResourceResponse)
-> Either String Int -> Either String AssociateResourceResponse
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 AssociateResource
instance Prelude.NFData AssociateResource
instance Core.ToHeaders AssociateResource where
toHeaders :: AssociateResource -> ResponseHeaders
toHeaders =
ResponseHeaders -> AssociateResource -> 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 AssociateResource where
toJSON :: AssociateResource -> Value
toJSON = Value -> AssociateResource -> Value
forall a b. a -> b -> a
Prelude.const (Object -> Value
Core.Object Object
forall a. Monoid a => a
Prelude.mempty)
instance Core.ToPath AssociateResource where
toPath :: AssociateResource -> ByteString
toPath AssociateResource' {Text
ResourceType
resource :: Text
resourceType :: ResourceType
application :: Text
$sel:resource:AssociateResource' :: AssociateResource -> Text
$sel:resourceType:AssociateResource' :: AssociateResource -> ResourceType
$sel:application:AssociateResource' :: AssociateResource -> Text
..} =
[ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ ByteString
"/applications/",
Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
application,
ByteString
"/resources/",
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 AssociateResource where
toQuery :: AssociateResource -> QueryString
toQuery = QueryString -> AssociateResource -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data AssociateResourceResponse = AssociateResourceResponse'
{
AssociateResourceResponse -> Maybe Text
applicationArn :: Prelude.Maybe Prelude.Text,
AssociateResourceResponse -> Maybe Text
resourceArn :: Prelude.Maybe Prelude.Text,
AssociateResourceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (AssociateResourceResponse -> AssociateResourceResponse -> Bool
(AssociateResourceResponse -> AssociateResourceResponse -> Bool)
-> (AssociateResourceResponse -> AssociateResourceResponse -> Bool)
-> Eq AssociateResourceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: AssociateResourceResponse -> AssociateResourceResponse -> Bool
$c/= :: AssociateResourceResponse -> AssociateResourceResponse -> Bool
== :: AssociateResourceResponse -> AssociateResourceResponse -> Bool
$c== :: AssociateResourceResponse -> AssociateResourceResponse -> Bool
Prelude.Eq, ReadPrec [AssociateResourceResponse]
ReadPrec AssociateResourceResponse
Int -> ReadS AssociateResourceResponse
ReadS [AssociateResourceResponse]
(Int -> ReadS AssociateResourceResponse)
-> ReadS [AssociateResourceResponse]
-> ReadPrec AssociateResourceResponse
-> ReadPrec [AssociateResourceResponse]
-> Read AssociateResourceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [AssociateResourceResponse]
$creadListPrec :: ReadPrec [AssociateResourceResponse]
readPrec :: ReadPrec AssociateResourceResponse
$creadPrec :: ReadPrec AssociateResourceResponse
readList :: ReadS [AssociateResourceResponse]
$creadList :: ReadS [AssociateResourceResponse]
readsPrec :: Int -> ReadS AssociateResourceResponse
$creadsPrec :: Int -> ReadS AssociateResourceResponse
Prelude.Read, Int -> AssociateResourceResponse -> ShowS
[AssociateResourceResponse] -> ShowS
AssociateResourceResponse -> String
(Int -> AssociateResourceResponse -> ShowS)
-> (AssociateResourceResponse -> String)
-> ([AssociateResourceResponse] -> ShowS)
-> Show AssociateResourceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [AssociateResourceResponse] -> ShowS
$cshowList :: [AssociateResourceResponse] -> ShowS
show :: AssociateResourceResponse -> String
$cshow :: AssociateResourceResponse -> String
showsPrec :: Int -> AssociateResourceResponse -> ShowS
$cshowsPrec :: Int -> AssociateResourceResponse -> ShowS
Prelude.Show, (forall x.
AssociateResourceResponse -> Rep AssociateResourceResponse x)
-> (forall x.
Rep AssociateResourceResponse x -> AssociateResourceResponse)
-> Generic AssociateResourceResponse
forall x.
Rep AssociateResourceResponse x -> AssociateResourceResponse
forall x.
AssociateResourceResponse -> Rep AssociateResourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep AssociateResourceResponse x -> AssociateResourceResponse
$cfrom :: forall x.
AssociateResourceResponse -> Rep AssociateResourceResponse x
Prelude.Generic)
newAssociateResourceResponse ::
Prelude.Int ->
AssociateResourceResponse
newAssociateResourceResponse :: Int -> AssociateResourceResponse
newAssociateResourceResponse Int
pHttpStatus_ =
AssociateResourceResponse' :: Maybe Text -> Maybe Text -> Int -> AssociateResourceResponse
AssociateResourceResponse'
{ $sel:applicationArn:AssociateResourceResponse' :: Maybe Text
applicationArn =
Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:resourceArn:AssociateResourceResponse' :: Maybe Text
resourceArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:httpStatus:AssociateResourceResponse' :: Int
httpStatus = Int
pHttpStatus_
}
associateResourceResponse_applicationArn :: Lens.Lens' AssociateResourceResponse (Prelude.Maybe Prelude.Text)
associateResourceResponse_applicationArn :: (Maybe Text -> f (Maybe Text))
-> AssociateResourceResponse -> f AssociateResourceResponse
associateResourceResponse_applicationArn = (AssociateResourceResponse -> Maybe Text)
-> (AssociateResourceResponse
-> Maybe Text -> AssociateResourceResponse)
-> Lens
AssociateResourceResponse
AssociateResourceResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateResourceResponse' {Maybe Text
applicationArn :: Maybe Text
$sel:applicationArn:AssociateResourceResponse' :: AssociateResourceResponse -> Maybe Text
applicationArn} -> Maybe Text
applicationArn) (\s :: AssociateResourceResponse
s@AssociateResourceResponse' {} Maybe Text
a -> AssociateResourceResponse
s {$sel:applicationArn:AssociateResourceResponse' :: Maybe Text
applicationArn = Maybe Text
a} :: AssociateResourceResponse)
associateResourceResponse_resourceArn :: Lens.Lens' AssociateResourceResponse (Prelude.Maybe Prelude.Text)
associateResourceResponse_resourceArn :: (Maybe Text -> f (Maybe Text))
-> AssociateResourceResponse -> f AssociateResourceResponse
associateResourceResponse_resourceArn = (AssociateResourceResponse -> Maybe Text)
-> (AssociateResourceResponse
-> Maybe Text -> AssociateResourceResponse)
-> Lens
AssociateResourceResponse
AssociateResourceResponse
(Maybe Text)
(Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateResourceResponse' {Maybe Text
resourceArn :: Maybe Text
$sel:resourceArn:AssociateResourceResponse' :: AssociateResourceResponse -> Maybe Text
resourceArn} -> Maybe Text
resourceArn) (\s :: AssociateResourceResponse
s@AssociateResourceResponse' {} Maybe Text
a -> AssociateResourceResponse
s {$sel:resourceArn:AssociateResourceResponse' :: Maybe Text
resourceArn = Maybe Text
a} :: AssociateResourceResponse)
associateResourceResponse_httpStatus :: Lens.Lens' AssociateResourceResponse Prelude.Int
associateResourceResponse_httpStatus :: (Int -> f Int)
-> AssociateResourceResponse -> f AssociateResourceResponse
associateResourceResponse_httpStatus = (AssociateResourceResponse -> Int)
-> (AssociateResourceResponse -> Int -> AssociateResourceResponse)
-> Lens AssociateResourceResponse AssociateResourceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\AssociateResourceResponse' {Int
httpStatus :: Int
$sel:httpStatus:AssociateResourceResponse' :: AssociateResourceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: AssociateResourceResponse
s@AssociateResourceResponse' {} Int
a -> AssociateResourceResponse
s {$sel:httpStatus:AssociateResourceResponse' :: Int
httpStatus = Int
a} :: AssociateResourceResponse)
instance Prelude.NFData AssociateResourceResponse