{-# 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.LakeFormation.RegisterResource
(
RegisterResource (..),
newRegisterResource,
registerResource_useServiceLinkedRole,
registerResource_roleArn,
registerResource_resourceArn,
RegisterResourceResponse (..),
newRegisterResourceResponse,
registerResourceResponse_httpStatus,
)
where
import qualified Amazonka.Core as Core
import Amazonka.LakeFormation.Types
import qualified Amazonka.Lens as Lens
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response
data RegisterResource = RegisterResource'
{
RegisterResource -> Maybe Bool
useServiceLinkedRole :: Prelude.Maybe Prelude.Bool,
RegisterResource -> Maybe Text
roleArn :: Prelude.Maybe Prelude.Text,
RegisterResource -> Text
resourceArn :: Prelude.Text
}
deriving (RegisterResource -> RegisterResource -> Bool
(RegisterResource -> RegisterResource -> Bool)
-> (RegisterResource -> RegisterResource -> Bool)
-> Eq RegisterResource
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterResource -> RegisterResource -> Bool
$c/= :: RegisterResource -> RegisterResource -> Bool
== :: RegisterResource -> RegisterResource -> Bool
$c== :: RegisterResource -> RegisterResource -> Bool
Prelude.Eq, ReadPrec [RegisterResource]
ReadPrec RegisterResource
Int -> ReadS RegisterResource
ReadS [RegisterResource]
(Int -> ReadS RegisterResource)
-> ReadS [RegisterResource]
-> ReadPrec RegisterResource
-> ReadPrec [RegisterResource]
-> Read RegisterResource
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterResource]
$creadListPrec :: ReadPrec [RegisterResource]
readPrec :: ReadPrec RegisterResource
$creadPrec :: ReadPrec RegisterResource
readList :: ReadS [RegisterResource]
$creadList :: ReadS [RegisterResource]
readsPrec :: Int -> ReadS RegisterResource
$creadsPrec :: Int -> ReadS RegisterResource
Prelude.Read, Int -> RegisterResource -> ShowS
[RegisterResource] -> ShowS
RegisterResource -> String
(Int -> RegisterResource -> ShowS)
-> (RegisterResource -> String)
-> ([RegisterResource] -> ShowS)
-> Show RegisterResource
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterResource] -> ShowS
$cshowList :: [RegisterResource] -> ShowS
show :: RegisterResource -> String
$cshow :: RegisterResource -> String
showsPrec :: Int -> RegisterResource -> ShowS
$cshowsPrec :: Int -> RegisterResource -> ShowS
Prelude.Show, (forall x. RegisterResource -> Rep RegisterResource x)
-> (forall x. Rep RegisterResource x -> RegisterResource)
-> Generic RegisterResource
forall x. Rep RegisterResource x -> RegisterResource
forall x. RegisterResource -> Rep RegisterResource x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep RegisterResource x -> RegisterResource
$cfrom :: forall x. RegisterResource -> Rep RegisterResource x
Prelude.Generic)
newRegisterResource ::
Prelude.Text ->
RegisterResource
newRegisterResource :: Text -> RegisterResource
newRegisterResource Text
pResourceArn_ =
RegisterResource' :: Maybe Bool -> Maybe Text -> Text -> RegisterResource
RegisterResource'
{ $sel:useServiceLinkedRole:RegisterResource' :: Maybe Bool
useServiceLinkedRole =
Maybe Bool
forall a. Maybe a
Prelude.Nothing,
$sel:roleArn:RegisterResource' :: Maybe Text
roleArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
$sel:resourceArn:RegisterResource' :: Text
resourceArn = Text
pResourceArn_
}
registerResource_useServiceLinkedRole :: Lens.Lens' RegisterResource (Prelude.Maybe Prelude.Bool)
registerResource_useServiceLinkedRole :: (Maybe Bool -> f (Maybe Bool))
-> RegisterResource -> f RegisterResource
registerResource_useServiceLinkedRole = (RegisterResource -> Maybe Bool)
-> (RegisterResource -> Maybe Bool -> RegisterResource)
-> Lens RegisterResource RegisterResource (Maybe Bool) (Maybe Bool)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterResource' {Maybe Bool
useServiceLinkedRole :: Maybe Bool
$sel:useServiceLinkedRole:RegisterResource' :: RegisterResource -> Maybe Bool
useServiceLinkedRole} -> Maybe Bool
useServiceLinkedRole) (\s :: RegisterResource
s@RegisterResource' {} Maybe Bool
a -> RegisterResource
s {$sel:useServiceLinkedRole:RegisterResource' :: Maybe Bool
useServiceLinkedRole = Maybe Bool
a} :: RegisterResource)
registerResource_roleArn :: Lens.Lens' RegisterResource (Prelude.Maybe Prelude.Text)
registerResource_roleArn :: (Maybe Text -> f (Maybe Text))
-> RegisterResource -> f RegisterResource
registerResource_roleArn = (RegisterResource -> Maybe Text)
-> (RegisterResource -> Maybe Text -> RegisterResource)
-> Lens RegisterResource RegisterResource (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterResource' {Maybe Text
roleArn :: Maybe Text
$sel:roleArn:RegisterResource' :: RegisterResource -> Maybe Text
roleArn} -> Maybe Text
roleArn) (\s :: RegisterResource
s@RegisterResource' {} Maybe Text
a -> RegisterResource
s {$sel:roleArn:RegisterResource' :: Maybe Text
roleArn = Maybe Text
a} :: RegisterResource)
registerResource_resourceArn :: Lens.Lens' RegisterResource Prelude.Text
registerResource_resourceArn :: (Text -> f Text) -> RegisterResource -> f RegisterResource
registerResource_resourceArn = (RegisterResource -> Text)
-> (RegisterResource -> Text -> RegisterResource)
-> Lens RegisterResource RegisterResource Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterResource' {Text
resourceArn :: Text
$sel:resourceArn:RegisterResource' :: RegisterResource -> Text
resourceArn} -> Text
resourceArn) (\s :: RegisterResource
s@RegisterResource' {} Text
a -> RegisterResource
s {$sel:resourceArn:RegisterResource' :: Text
resourceArn = Text
a} :: RegisterResource)
instance Core.AWSRequest RegisterResource where
type
AWSResponse RegisterResource =
RegisterResourceResponse
request :: RegisterResource -> Request RegisterResource
request = Service -> RegisterResource -> Request RegisterResource
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
response :: Logger
-> Service
-> Proxy RegisterResource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RegisterResource)))
response =
(Int
-> ResponseHeaders
-> ()
-> Either String (AWSResponse RegisterResource))
-> Logger
-> Service
-> Proxy RegisterResource
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse RegisterResource)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> () -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveEmpty
( \Int
s ResponseHeaders
h ()
x ->
Int -> RegisterResourceResponse
RegisterResourceResponse'
(Int -> RegisterResourceResponse)
-> Either String Int -> Either String RegisterResourceResponse
forall (f :: * -> *) a b. Functor 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 RegisterResource
instance Prelude.NFData RegisterResource
instance Core.ToHeaders RegisterResource where
toHeaders :: RegisterResource -> ResponseHeaders
toHeaders =
ResponseHeaders -> RegisterResource -> ResponseHeaders
forall a b. a -> b -> a
Prelude.const
( [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
[ HeaderName
"X-Amz-Target"
HeaderName -> ByteString -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# ( ByteString
"AWSLakeFormation.RegisterResource" ::
Prelude.ByteString
),
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 RegisterResource where
toJSON :: RegisterResource -> Value
toJSON RegisterResource' {Maybe Bool
Maybe Text
Text
resourceArn :: Text
roleArn :: Maybe Text
useServiceLinkedRole :: Maybe Bool
$sel:resourceArn:RegisterResource' :: RegisterResource -> Text
$sel:roleArn:RegisterResource' :: RegisterResource -> Maybe Text
$sel:useServiceLinkedRole:RegisterResource' :: RegisterResource -> Maybe Bool
..} =
[Pair] -> Value
Core.object
( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
[ (Text
"UseServiceLinkedRole" Text -> Bool -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
(Bool -> Pair) -> Maybe Bool -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Bool
useServiceLinkedRole,
(Text
"RoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Text -> Pair) -> Maybe Text -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe Text
roleArn,
Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ResourceArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
resourceArn)
]
)
instance Core.ToPath RegisterResource where
toPath :: RegisterResource -> ByteString
toPath = ByteString -> RegisterResource -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"
instance Core.ToQuery RegisterResource where
toQuery :: RegisterResource -> QueryString
toQuery = QueryString -> RegisterResource -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty
data RegisterResourceResponse = RegisterResourceResponse'
{
RegisterResourceResponse -> Int
httpStatus :: Prelude.Int
}
deriving (RegisterResourceResponse -> RegisterResourceResponse -> Bool
(RegisterResourceResponse -> RegisterResourceResponse -> Bool)
-> (RegisterResourceResponse -> RegisterResourceResponse -> Bool)
-> Eq RegisterResourceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: RegisterResourceResponse -> RegisterResourceResponse -> Bool
$c/= :: RegisterResourceResponse -> RegisterResourceResponse -> Bool
== :: RegisterResourceResponse -> RegisterResourceResponse -> Bool
$c== :: RegisterResourceResponse -> RegisterResourceResponse -> Bool
Prelude.Eq, ReadPrec [RegisterResourceResponse]
ReadPrec RegisterResourceResponse
Int -> ReadS RegisterResourceResponse
ReadS [RegisterResourceResponse]
(Int -> ReadS RegisterResourceResponse)
-> ReadS [RegisterResourceResponse]
-> ReadPrec RegisterResourceResponse
-> ReadPrec [RegisterResourceResponse]
-> Read RegisterResourceResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [RegisterResourceResponse]
$creadListPrec :: ReadPrec [RegisterResourceResponse]
readPrec :: ReadPrec RegisterResourceResponse
$creadPrec :: ReadPrec RegisterResourceResponse
readList :: ReadS [RegisterResourceResponse]
$creadList :: ReadS [RegisterResourceResponse]
readsPrec :: Int -> ReadS RegisterResourceResponse
$creadsPrec :: Int -> ReadS RegisterResourceResponse
Prelude.Read, Int -> RegisterResourceResponse -> ShowS
[RegisterResourceResponse] -> ShowS
RegisterResourceResponse -> String
(Int -> RegisterResourceResponse -> ShowS)
-> (RegisterResourceResponse -> String)
-> ([RegisterResourceResponse] -> ShowS)
-> Show RegisterResourceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [RegisterResourceResponse] -> ShowS
$cshowList :: [RegisterResourceResponse] -> ShowS
show :: RegisterResourceResponse -> String
$cshow :: RegisterResourceResponse -> String
showsPrec :: Int -> RegisterResourceResponse -> ShowS
$cshowsPrec :: Int -> RegisterResourceResponse -> ShowS
Prelude.Show, (forall x.
RegisterResourceResponse -> Rep RegisterResourceResponse x)
-> (forall x.
Rep RegisterResourceResponse x -> RegisterResourceResponse)
-> Generic RegisterResourceResponse
forall x.
Rep RegisterResourceResponse x -> RegisterResourceResponse
forall x.
RegisterResourceResponse -> Rep RegisterResourceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep RegisterResourceResponse x -> RegisterResourceResponse
$cfrom :: forall x.
RegisterResourceResponse -> Rep RegisterResourceResponse x
Prelude.Generic)
newRegisterResourceResponse ::
Prelude.Int ->
RegisterResourceResponse
newRegisterResourceResponse :: Int -> RegisterResourceResponse
newRegisterResourceResponse Int
pHttpStatus_ =
RegisterResourceResponse' :: Int -> RegisterResourceResponse
RegisterResourceResponse'
{ $sel:httpStatus:RegisterResourceResponse' :: Int
httpStatus =
Int
pHttpStatus_
}
registerResourceResponse_httpStatus :: Lens.Lens' RegisterResourceResponse Prelude.Int
registerResourceResponse_httpStatus :: (Int -> f Int)
-> RegisterResourceResponse -> f RegisterResourceResponse
registerResourceResponse_httpStatus = (RegisterResourceResponse -> Int)
-> (RegisterResourceResponse -> Int -> RegisterResourceResponse)
-> Lens RegisterResourceResponse RegisterResourceResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\RegisterResourceResponse' {Int
httpStatus :: Int
$sel:httpStatus:RegisterResourceResponse' :: RegisterResourceResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: RegisterResourceResponse
s@RegisterResourceResponse' {} Int
a -> RegisterResourceResponse
s {$sel:httpStatus:RegisterResourceResponse' :: Int
httpStatus = Int
a} :: RegisterResourceResponse)
instance Prelude.NFData RegisterResourceResponse