{-# 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 #-}

-- Derived from AWS service descriptions, licensed under Apache 2.0.

-- |
-- Module      : Amazonka.EMRContainers.CreateManagedEndpoint
-- Copyright   : (c) 2013-2021 Brendan Hay
-- License     : Mozilla Public License, v. 2.0.
-- Maintainer  : Brendan Hay <brendan.g.hay+amazonka@gmail.com>
-- Stability   : auto-generated
-- Portability : non-portable (GHC extensions)
--
-- Creates a managed endpoint. A managed endpoint is a gateway that
-- connects EMR Studio to Amazon EMR on EKS so that EMR Studio can
-- communicate with your virtual cluster.
module Amazonka.EMRContainers.CreateManagedEndpoint
  ( -- * Creating a Request
    CreateManagedEndpoint (..),
    newCreateManagedEndpoint,

    -- * Request Lenses
    createManagedEndpoint_configurationOverrides,
    createManagedEndpoint_tags,
    createManagedEndpoint_name,
    createManagedEndpoint_virtualClusterId,
    createManagedEndpoint_type,
    createManagedEndpoint_releaseLabel,
    createManagedEndpoint_executionRoleArn,
    createManagedEndpoint_certificateArn,
    createManagedEndpoint_clientToken,

    -- * Destructuring the Response
    CreateManagedEndpointResponse (..),
    newCreateManagedEndpointResponse,

    -- * Response Lenses
    createManagedEndpointResponse_arn,
    createManagedEndpointResponse_name,
    createManagedEndpointResponse_id,
    createManagedEndpointResponse_virtualClusterId,
    createManagedEndpointResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.EMRContainers.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

-- | /See:/ 'newCreateManagedEndpoint' smart constructor.
data CreateManagedEndpoint = CreateManagedEndpoint'
  { -- | The configuration settings that will be used to override existing
    -- configurations.
    CreateManagedEndpoint -> Maybe ConfigurationOverrides
configurationOverrides :: Prelude.Maybe ConfigurationOverrides,
    -- | The tags of the managed endpoint.
    CreateManagedEndpoint -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | The name of the managed endpoint.
    CreateManagedEndpoint -> Text
name :: Prelude.Text,
    -- | The ID of the virtual cluster for which a managed endpoint is created.
    CreateManagedEndpoint -> Text
virtualClusterId :: Prelude.Text,
    -- | The type of the managed endpoint.
    CreateManagedEndpoint -> Text
type' :: Prelude.Text,
    -- | The Amazon EMR release version.
    CreateManagedEndpoint -> Text
releaseLabel :: Prelude.Text,
    -- | The ARN of the execution role.
    CreateManagedEndpoint -> Text
executionRoleArn :: Prelude.Text,
    -- | The certificate ARN of the managed endpoint.
    CreateManagedEndpoint -> Text
certificateArn :: Prelude.Text,
    -- | The client idempotency token for this create call.
    CreateManagedEndpoint -> Text
clientToken :: Prelude.Text
  }
  deriving (CreateManagedEndpoint -> CreateManagedEndpoint -> Bool
(CreateManagedEndpoint -> CreateManagedEndpoint -> Bool)
-> (CreateManagedEndpoint -> CreateManagedEndpoint -> Bool)
-> Eq CreateManagedEndpoint
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateManagedEndpoint -> CreateManagedEndpoint -> Bool
$c/= :: CreateManagedEndpoint -> CreateManagedEndpoint -> Bool
== :: CreateManagedEndpoint -> CreateManagedEndpoint -> Bool
$c== :: CreateManagedEndpoint -> CreateManagedEndpoint -> Bool
Prelude.Eq, Int -> CreateManagedEndpoint -> ShowS
[CreateManagedEndpoint] -> ShowS
CreateManagedEndpoint -> String
(Int -> CreateManagedEndpoint -> ShowS)
-> (CreateManagedEndpoint -> String)
-> ([CreateManagedEndpoint] -> ShowS)
-> Show CreateManagedEndpoint
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateManagedEndpoint] -> ShowS
$cshowList :: [CreateManagedEndpoint] -> ShowS
show :: CreateManagedEndpoint -> String
$cshow :: CreateManagedEndpoint -> String
showsPrec :: Int -> CreateManagedEndpoint -> ShowS
$cshowsPrec :: Int -> CreateManagedEndpoint -> ShowS
Prelude.Show, (forall x. CreateManagedEndpoint -> Rep CreateManagedEndpoint x)
-> (forall x. Rep CreateManagedEndpoint x -> CreateManagedEndpoint)
-> Generic CreateManagedEndpoint
forall x. Rep CreateManagedEndpoint x -> CreateManagedEndpoint
forall x. CreateManagedEndpoint -> Rep CreateManagedEndpoint x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateManagedEndpoint x -> CreateManagedEndpoint
$cfrom :: forall x. CreateManagedEndpoint -> Rep CreateManagedEndpoint x
Prelude.Generic)

-- |
-- Create a value of 'CreateManagedEndpoint' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'configurationOverrides', 'createManagedEndpoint_configurationOverrides' - The configuration settings that will be used to override existing
-- configurations.
--
-- 'tags', 'createManagedEndpoint_tags' - The tags of the managed endpoint.
--
-- 'name', 'createManagedEndpoint_name' - The name of the managed endpoint.
--
-- 'virtualClusterId', 'createManagedEndpoint_virtualClusterId' - The ID of the virtual cluster for which a managed endpoint is created.
--
-- 'type'', 'createManagedEndpoint_type' - The type of the managed endpoint.
--
-- 'releaseLabel', 'createManagedEndpoint_releaseLabel' - The Amazon EMR release version.
--
-- 'executionRoleArn', 'createManagedEndpoint_executionRoleArn' - The ARN of the execution role.
--
-- 'certificateArn', 'createManagedEndpoint_certificateArn' - The certificate ARN of the managed endpoint.
--
-- 'clientToken', 'createManagedEndpoint_clientToken' - The client idempotency token for this create call.
newCreateManagedEndpoint ::
  -- | 'name'
  Prelude.Text ->
  -- | 'virtualClusterId'
  Prelude.Text ->
  -- | 'type''
  Prelude.Text ->
  -- | 'releaseLabel'
  Prelude.Text ->
  -- | 'executionRoleArn'
  Prelude.Text ->
  -- | 'certificateArn'
  Prelude.Text ->
  -- | 'clientToken'
  Prelude.Text ->
  CreateManagedEndpoint
newCreateManagedEndpoint :: Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> CreateManagedEndpoint
newCreateManagedEndpoint
  Text
pName_
  Text
pVirtualClusterId_
  Text
pType_
  Text
pReleaseLabel_
  Text
pExecutionRoleArn_
  Text
pCertificateArn_
  Text
pClientToken_ =
    CreateManagedEndpoint' :: Maybe ConfigurationOverrides
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> Text
-> CreateManagedEndpoint
CreateManagedEndpoint'
      { $sel:configurationOverrides:CreateManagedEndpoint' :: Maybe ConfigurationOverrides
configurationOverrides =
          Maybe ConfigurationOverrides
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateManagedEndpoint' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:name:CreateManagedEndpoint' :: Text
name = Text
pName_,
        $sel:virtualClusterId:CreateManagedEndpoint' :: Text
virtualClusterId = Text
pVirtualClusterId_,
        $sel:type':CreateManagedEndpoint' :: Text
type' = Text
pType_,
        $sel:releaseLabel:CreateManagedEndpoint' :: Text
releaseLabel = Text
pReleaseLabel_,
        $sel:executionRoleArn:CreateManagedEndpoint' :: Text
executionRoleArn = Text
pExecutionRoleArn_,
        $sel:certificateArn:CreateManagedEndpoint' :: Text
certificateArn = Text
pCertificateArn_,
        $sel:clientToken:CreateManagedEndpoint' :: Text
clientToken = Text
pClientToken_
      }

-- | The configuration settings that will be used to override existing
-- configurations.
createManagedEndpoint_configurationOverrides :: Lens.Lens' CreateManagedEndpoint (Prelude.Maybe ConfigurationOverrides)
createManagedEndpoint_configurationOverrides :: (Maybe ConfigurationOverrides -> f (Maybe ConfigurationOverrides))
-> CreateManagedEndpoint -> f CreateManagedEndpoint
createManagedEndpoint_configurationOverrides = (CreateManagedEndpoint -> Maybe ConfigurationOverrides)
-> (CreateManagedEndpoint
    -> Maybe ConfigurationOverrides -> CreateManagedEndpoint)
-> Lens
     CreateManagedEndpoint
     CreateManagedEndpoint
     (Maybe ConfigurationOverrides)
     (Maybe ConfigurationOverrides)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateManagedEndpoint' {Maybe ConfigurationOverrides
configurationOverrides :: Maybe ConfigurationOverrides
$sel:configurationOverrides:CreateManagedEndpoint' :: CreateManagedEndpoint -> Maybe ConfigurationOverrides
configurationOverrides} -> Maybe ConfigurationOverrides
configurationOverrides) (\s :: CreateManagedEndpoint
s@CreateManagedEndpoint' {} Maybe ConfigurationOverrides
a -> CreateManagedEndpoint
s {$sel:configurationOverrides:CreateManagedEndpoint' :: Maybe ConfigurationOverrides
configurationOverrides = Maybe ConfigurationOverrides
a} :: CreateManagedEndpoint)

-- | The tags of the managed endpoint.
createManagedEndpoint_tags :: Lens.Lens' CreateManagedEndpoint (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createManagedEndpoint_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateManagedEndpoint -> f CreateManagedEndpoint
createManagedEndpoint_tags = (CreateManagedEndpoint -> Maybe (HashMap Text Text))
-> (CreateManagedEndpoint
    -> Maybe (HashMap Text Text) -> CreateManagedEndpoint)
-> Lens
     CreateManagedEndpoint
     CreateManagedEndpoint
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateManagedEndpoint' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateManagedEndpoint' :: CreateManagedEndpoint -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateManagedEndpoint
s@CreateManagedEndpoint' {} Maybe (HashMap Text Text)
a -> CreateManagedEndpoint
s {$sel:tags:CreateManagedEndpoint' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateManagedEndpoint) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateManagedEndpoint -> f CreateManagedEndpoint)
-> ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
    -> Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateManagedEndpoint
-> f CreateManagedEndpoint
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
-> Iso
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
     (Maybe (HashMap Text Text))
forall (f :: * -> *) (g :: * -> *) s t a b.
(Functor f, Functor g) =>
AnIso s t a b -> Iso (f s) (g t) (f a) (g b)
Lens.mapping AnIso
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
  (HashMap Text Text)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name of the managed endpoint.
createManagedEndpoint_name :: Lens.Lens' CreateManagedEndpoint Prelude.Text
createManagedEndpoint_name :: (Text -> f Text)
-> CreateManagedEndpoint -> f CreateManagedEndpoint
createManagedEndpoint_name = (CreateManagedEndpoint -> Text)
-> (CreateManagedEndpoint -> Text -> CreateManagedEndpoint)
-> Lens CreateManagedEndpoint CreateManagedEndpoint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateManagedEndpoint' {Text
name :: Text
$sel:name:CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
name} -> Text
name) (\s :: CreateManagedEndpoint
s@CreateManagedEndpoint' {} Text
a -> CreateManagedEndpoint
s {$sel:name:CreateManagedEndpoint' :: Text
name = Text
a} :: CreateManagedEndpoint)

-- | The ID of the virtual cluster for which a managed endpoint is created.
createManagedEndpoint_virtualClusterId :: Lens.Lens' CreateManagedEndpoint Prelude.Text
createManagedEndpoint_virtualClusterId :: (Text -> f Text)
-> CreateManagedEndpoint -> f CreateManagedEndpoint
createManagedEndpoint_virtualClusterId = (CreateManagedEndpoint -> Text)
-> (CreateManagedEndpoint -> Text -> CreateManagedEndpoint)
-> Lens CreateManagedEndpoint CreateManagedEndpoint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateManagedEndpoint' {Text
virtualClusterId :: Text
$sel:virtualClusterId:CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
virtualClusterId} -> Text
virtualClusterId) (\s :: CreateManagedEndpoint
s@CreateManagedEndpoint' {} Text
a -> CreateManagedEndpoint
s {$sel:virtualClusterId:CreateManagedEndpoint' :: Text
virtualClusterId = Text
a} :: CreateManagedEndpoint)

-- | The type of the managed endpoint.
createManagedEndpoint_type :: Lens.Lens' CreateManagedEndpoint Prelude.Text
createManagedEndpoint_type :: (Text -> f Text)
-> CreateManagedEndpoint -> f CreateManagedEndpoint
createManagedEndpoint_type = (CreateManagedEndpoint -> Text)
-> (CreateManagedEndpoint -> Text -> CreateManagedEndpoint)
-> Lens CreateManagedEndpoint CreateManagedEndpoint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateManagedEndpoint' {Text
type' :: Text
$sel:type':CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
type'} -> Text
type') (\s :: CreateManagedEndpoint
s@CreateManagedEndpoint' {} Text
a -> CreateManagedEndpoint
s {$sel:type':CreateManagedEndpoint' :: Text
type' = Text
a} :: CreateManagedEndpoint)

-- | The Amazon EMR release version.
createManagedEndpoint_releaseLabel :: Lens.Lens' CreateManagedEndpoint Prelude.Text
createManagedEndpoint_releaseLabel :: (Text -> f Text)
-> CreateManagedEndpoint -> f CreateManagedEndpoint
createManagedEndpoint_releaseLabel = (CreateManagedEndpoint -> Text)
-> (CreateManagedEndpoint -> Text -> CreateManagedEndpoint)
-> Lens CreateManagedEndpoint CreateManagedEndpoint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateManagedEndpoint' {Text
releaseLabel :: Text
$sel:releaseLabel:CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
releaseLabel} -> Text
releaseLabel) (\s :: CreateManagedEndpoint
s@CreateManagedEndpoint' {} Text
a -> CreateManagedEndpoint
s {$sel:releaseLabel:CreateManagedEndpoint' :: Text
releaseLabel = Text
a} :: CreateManagedEndpoint)

-- | The ARN of the execution role.
createManagedEndpoint_executionRoleArn :: Lens.Lens' CreateManagedEndpoint Prelude.Text
createManagedEndpoint_executionRoleArn :: (Text -> f Text)
-> CreateManagedEndpoint -> f CreateManagedEndpoint
createManagedEndpoint_executionRoleArn = (CreateManagedEndpoint -> Text)
-> (CreateManagedEndpoint -> Text -> CreateManagedEndpoint)
-> Lens CreateManagedEndpoint CreateManagedEndpoint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateManagedEndpoint' {Text
executionRoleArn :: Text
$sel:executionRoleArn:CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
executionRoleArn} -> Text
executionRoleArn) (\s :: CreateManagedEndpoint
s@CreateManagedEndpoint' {} Text
a -> CreateManagedEndpoint
s {$sel:executionRoleArn:CreateManagedEndpoint' :: Text
executionRoleArn = Text
a} :: CreateManagedEndpoint)

-- | The certificate ARN of the managed endpoint.
createManagedEndpoint_certificateArn :: Lens.Lens' CreateManagedEndpoint Prelude.Text
createManagedEndpoint_certificateArn :: (Text -> f Text)
-> CreateManagedEndpoint -> f CreateManagedEndpoint
createManagedEndpoint_certificateArn = (CreateManagedEndpoint -> Text)
-> (CreateManagedEndpoint -> Text -> CreateManagedEndpoint)
-> Lens CreateManagedEndpoint CreateManagedEndpoint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateManagedEndpoint' {Text
certificateArn :: Text
$sel:certificateArn:CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
certificateArn} -> Text
certificateArn) (\s :: CreateManagedEndpoint
s@CreateManagedEndpoint' {} Text
a -> CreateManagedEndpoint
s {$sel:certificateArn:CreateManagedEndpoint' :: Text
certificateArn = Text
a} :: CreateManagedEndpoint)

-- | The client idempotency token for this create call.
createManagedEndpoint_clientToken :: Lens.Lens' CreateManagedEndpoint Prelude.Text
createManagedEndpoint_clientToken :: (Text -> f Text)
-> CreateManagedEndpoint -> f CreateManagedEndpoint
createManagedEndpoint_clientToken = (CreateManagedEndpoint -> Text)
-> (CreateManagedEndpoint -> Text -> CreateManagedEndpoint)
-> Lens CreateManagedEndpoint CreateManagedEndpoint Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateManagedEndpoint' {Text
clientToken :: Text
$sel:clientToken:CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
clientToken} -> Text
clientToken) (\s :: CreateManagedEndpoint
s@CreateManagedEndpoint' {} Text
a -> CreateManagedEndpoint
s {$sel:clientToken:CreateManagedEndpoint' :: Text
clientToken = Text
a} :: CreateManagedEndpoint)

instance Core.AWSRequest CreateManagedEndpoint where
  type
    AWSResponse CreateManagedEndpoint =
      CreateManagedEndpointResponse
  request :: CreateManagedEndpoint -> Request CreateManagedEndpoint
request = Service -> CreateManagedEndpoint -> Request CreateManagedEndpoint
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateManagedEndpoint
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateManagedEndpoint)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateManagedEndpoint))
-> Logger
-> Service
-> Proxy CreateManagedEndpoint
-> ClientResponse ClientBody
-> m (Either
        Error (ClientResponse (AWSResponse CreateManagedEndpoint)))
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
-> Maybe Text
-> Maybe Text
-> Int
-> CreateManagedEndpointResponse
CreateManagedEndpointResponse'
            (Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Maybe Text
 -> Int
 -> CreateManagedEndpointResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text
      -> Maybe Text
      -> Maybe Text
      -> Int
      -> CreateManagedEndpointResponse)
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
"arn")
            Either
  String
  (Maybe Text
   -> Maybe Text
   -> Maybe Text
   -> Int
   -> CreateManagedEndpointResponse)
-> Either String (Maybe Text)
-> Either
     String
     (Maybe Text -> Maybe Text -> Int -> CreateManagedEndpointResponse)
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
"name")
            Either
  String
  (Maybe Text -> Maybe Text -> Int -> CreateManagedEndpointResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Int -> CreateManagedEndpointResponse)
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
"id")
            Either String (Maybe Text -> Int -> CreateManagedEndpointResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateManagedEndpointResponse)
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
"virtualClusterId")
            Either String (Int -> CreateManagedEndpointResponse)
-> Either String Int -> Either String CreateManagedEndpointResponse
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 CreateManagedEndpoint

instance Prelude.NFData CreateManagedEndpoint

instance Core.ToHeaders CreateManagedEndpoint where
  toHeaders :: CreateManagedEndpoint -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateManagedEndpoint -> 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 CreateManagedEndpoint where
  toJSON :: CreateManagedEndpoint -> Value
toJSON CreateManagedEndpoint' {Maybe (HashMap Text Text)
Maybe ConfigurationOverrides
Text
clientToken :: Text
certificateArn :: Text
executionRoleArn :: Text
releaseLabel :: Text
type' :: Text
virtualClusterId :: Text
name :: Text
tags :: Maybe (HashMap Text Text)
configurationOverrides :: Maybe ConfigurationOverrides
$sel:clientToken:CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
$sel:certificateArn:CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
$sel:executionRoleArn:CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
$sel:releaseLabel:CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
$sel:type':CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
$sel:virtualClusterId:CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
$sel:name:CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
$sel:tags:CreateManagedEndpoint' :: CreateManagedEndpoint -> Maybe (HashMap Text Text)
$sel:configurationOverrides:CreateManagedEndpoint' :: CreateManagedEndpoint -> Maybe ConfigurationOverrides
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"configurationOverrides" Text -> ConfigurationOverrides -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (ConfigurationOverrides -> Pair)
-> Maybe ConfigurationOverrides -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe ConfigurationOverrides
configurationOverrides,
            (Text
"tags" Text -> HashMap Text Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (HashMap Text Text -> Pair)
-> Maybe (HashMap Text Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (HashMap Text Text)
tags,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"name" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
name),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"type" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
type'),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"releaseLabel" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
releaseLabel),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"executionRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
executionRoleArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"certificateArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
certificateArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"clientToken" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
clientToken)
          ]
      )

instance Core.ToPath CreateManagedEndpoint where
  toPath :: CreateManagedEndpoint -> ByteString
toPath CreateManagedEndpoint' {Maybe (HashMap Text Text)
Maybe ConfigurationOverrides
Text
clientToken :: Text
certificateArn :: Text
executionRoleArn :: Text
releaseLabel :: Text
type' :: Text
virtualClusterId :: Text
name :: Text
tags :: Maybe (HashMap Text Text)
configurationOverrides :: Maybe ConfigurationOverrides
$sel:clientToken:CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
$sel:certificateArn:CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
$sel:executionRoleArn:CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
$sel:releaseLabel:CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
$sel:type':CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
$sel:virtualClusterId:CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
$sel:name:CreateManagedEndpoint' :: CreateManagedEndpoint -> Text
$sel:tags:CreateManagedEndpoint' :: CreateManagedEndpoint -> Maybe (HashMap Text Text)
$sel:configurationOverrides:CreateManagedEndpoint' :: CreateManagedEndpoint -> Maybe ConfigurationOverrides
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/virtualclusters/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
virtualClusterId,
        ByteString
"/endpoints"
      ]

instance Core.ToQuery CreateManagedEndpoint where
  toQuery :: CreateManagedEndpoint -> QueryString
toQuery = QueryString -> CreateManagedEndpoint -> QueryString
forall a b. a -> b -> a
Prelude.const QueryString
forall a. Monoid a => a
Prelude.mempty

-- | /See:/ 'newCreateManagedEndpointResponse' smart constructor.
data CreateManagedEndpointResponse = CreateManagedEndpointResponse'
  { -- | The output contains the ARN of the managed endpoint.
    CreateManagedEndpointResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The output contains the name of the managed endpoint.
    CreateManagedEndpointResponse -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | The output contains the ID of the managed endpoint.
    CreateManagedEndpointResponse -> Maybe Text
id :: Prelude.Maybe Prelude.Text,
    -- | The output contains the ID of the virtual cluster.
    CreateManagedEndpointResponse -> Maybe Text
virtualClusterId :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateManagedEndpointResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateManagedEndpointResponse
-> CreateManagedEndpointResponse -> Bool
(CreateManagedEndpointResponse
 -> CreateManagedEndpointResponse -> Bool)
-> (CreateManagedEndpointResponse
    -> CreateManagedEndpointResponse -> Bool)
-> Eq CreateManagedEndpointResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateManagedEndpointResponse
-> CreateManagedEndpointResponse -> Bool
$c/= :: CreateManagedEndpointResponse
-> CreateManagedEndpointResponse -> Bool
== :: CreateManagedEndpointResponse
-> CreateManagedEndpointResponse -> Bool
$c== :: CreateManagedEndpointResponse
-> CreateManagedEndpointResponse -> Bool
Prelude.Eq, ReadPrec [CreateManagedEndpointResponse]
ReadPrec CreateManagedEndpointResponse
Int -> ReadS CreateManagedEndpointResponse
ReadS [CreateManagedEndpointResponse]
(Int -> ReadS CreateManagedEndpointResponse)
-> ReadS [CreateManagedEndpointResponse]
-> ReadPrec CreateManagedEndpointResponse
-> ReadPrec [CreateManagedEndpointResponse]
-> Read CreateManagedEndpointResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateManagedEndpointResponse]
$creadListPrec :: ReadPrec [CreateManagedEndpointResponse]
readPrec :: ReadPrec CreateManagedEndpointResponse
$creadPrec :: ReadPrec CreateManagedEndpointResponse
readList :: ReadS [CreateManagedEndpointResponse]
$creadList :: ReadS [CreateManagedEndpointResponse]
readsPrec :: Int -> ReadS CreateManagedEndpointResponse
$creadsPrec :: Int -> ReadS CreateManagedEndpointResponse
Prelude.Read, Int -> CreateManagedEndpointResponse -> ShowS
[CreateManagedEndpointResponse] -> ShowS
CreateManagedEndpointResponse -> String
(Int -> CreateManagedEndpointResponse -> ShowS)
-> (CreateManagedEndpointResponse -> String)
-> ([CreateManagedEndpointResponse] -> ShowS)
-> Show CreateManagedEndpointResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateManagedEndpointResponse] -> ShowS
$cshowList :: [CreateManagedEndpointResponse] -> ShowS
show :: CreateManagedEndpointResponse -> String
$cshow :: CreateManagedEndpointResponse -> String
showsPrec :: Int -> CreateManagedEndpointResponse -> ShowS
$cshowsPrec :: Int -> CreateManagedEndpointResponse -> ShowS
Prelude.Show, (forall x.
 CreateManagedEndpointResponse
 -> Rep CreateManagedEndpointResponse x)
-> (forall x.
    Rep CreateManagedEndpointResponse x
    -> CreateManagedEndpointResponse)
-> Generic CreateManagedEndpointResponse
forall x.
Rep CreateManagedEndpointResponse x
-> CreateManagedEndpointResponse
forall x.
CreateManagedEndpointResponse
-> Rep CreateManagedEndpointResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x.
Rep CreateManagedEndpointResponse x
-> CreateManagedEndpointResponse
$cfrom :: forall x.
CreateManagedEndpointResponse
-> Rep CreateManagedEndpointResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateManagedEndpointResponse' with all optional fields omitted.
--
-- Use <https://hackage.haskell.org/package/generic-lens generic-lens> or <https://hackage.haskell.org/package/optics optics> to modify other optional fields.
--
-- The following record fields are available, with the corresponding lenses provided
-- for backwards compatibility:
--
-- 'arn', 'createManagedEndpointResponse_arn' - The output contains the ARN of the managed endpoint.
--
-- 'name', 'createManagedEndpointResponse_name' - The output contains the name of the managed endpoint.
--
-- 'id', 'createManagedEndpointResponse_id' - The output contains the ID of the managed endpoint.
--
-- 'virtualClusterId', 'createManagedEndpointResponse_virtualClusterId' - The output contains the ID of the virtual cluster.
--
-- 'httpStatus', 'createManagedEndpointResponse_httpStatus' - The response's http status code.
newCreateManagedEndpointResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateManagedEndpointResponse
newCreateManagedEndpointResponse :: Int -> CreateManagedEndpointResponse
newCreateManagedEndpointResponse Int
pHttpStatus_ =
  CreateManagedEndpointResponse' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Int
-> CreateManagedEndpointResponse
CreateManagedEndpointResponse'
    { $sel:arn:CreateManagedEndpointResponse' :: Maybe Text
arn =
        Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateManagedEndpointResponse' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:id:CreateManagedEndpointResponse' :: Maybe Text
id = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:virtualClusterId:CreateManagedEndpointResponse' :: Maybe Text
virtualClusterId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateManagedEndpointResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The output contains the ARN of the managed endpoint.
createManagedEndpointResponse_arn :: Lens.Lens' CreateManagedEndpointResponse (Prelude.Maybe Prelude.Text)
createManagedEndpointResponse_arn :: (Maybe Text -> f (Maybe Text))
-> CreateManagedEndpointResponse -> f CreateManagedEndpointResponse
createManagedEndpointResponse_arn = (CreateManagedEndpointResponse -> Maybe Text)
-> (CreateManagedEndpointResponse
    -> Maybe Text -> CreateManagedEndpointResponse)
-> Lens
     CreateManagedEndpointResponse
     CreateManagedEndpointResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateManagedEndpointResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:CreateManagedEndpointResponse' :: CreateManagedEndpointResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CreateManagedEndpointResponse
s@CreateManagedEndpointResponse' {} Maybe Text
a -> CreateManagedEndpointResponse
s {$sel:arn:CreateManagedEndpointResponse' :: Maybe Text
arn = Maybe Text
a} :: CreateManagedEndpointResponse)

-- | The output contains the name of the managed endpoint.
createManagedEndpointResponse_name :: Lens.Lens' CreateManagedEndpointResponse (Prelude.Maybe Prelude.Text)
createManagedEndpointResponse_name :: (Maybe Text -> f (Maybe Text))
-> CreateManagedEndpointResponse -> f CreateManagedEndpointResponse
createManagedEndpointResponse_name = (CreateManagedEndpointResponse -> Maybe Text)
-> (CreateManagedEndpointResponse
    -> Maybe Text -> CreateManagedEndpointResponse)
-> Lens
     CreateManagedEndpointResponse
     CreateManagedEndpointResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateManagedEndpointResponse' {Maybe Text
name :: Maybe Text
$sel:name:CreateManagedEndpointResponse' :: CreateManagedEndpointResponse -> Maybe Text
name} -> Maybe Text
name) (\s :: CreateManagedEndpointResponse
s@CreateManagedEndpointResponse' {} Maybe Text
a -> CreateManagedEndpointResponse
s {$sel:name:CreateManagedEndpointResponse' :: Maybe Text
name = Maybe Text
a} :: CreateManagedEndpointResponse)

-- | The output contains the ID of the managed endpoint.
createManagedEndpointResponse_id :: Lens.Lens' CreateManagedEndpointResponse (Prelude.Maybe Prelude.Text)
createManagedEndpointResponse_id :: (Maybe Text -> f (Maybe Text))
-> CreateManagedEndpointResponse -> f CreateManagedEndpointResponse
createManagedEndpointResponse_id = (CreateManagedEndpointResponse -> Maybe Text)
-> (CreateManagedEndpointResponse
    -> Maybe Text -> CreateManagedEndpointResponse)
-> Lens
     CreateManagedEndpointResponse
     CreateManagedEndpointResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateManagedEndpointResponse' {Maybe Text
id :: Maybe Text
$sel:id:CreateManagedEndpointResponse' :: CreateManagedEndpointResponse -> Maybe Text
id} -> Maybe Text
id) (\s :: CreateManagedEndpointResponse
s@CreateManagedEndpointResponse' {} Maybe Text
a -> CreateManagedEndpointResponse
s {$sel:id:CreateManagedEndpointResponse' :: Maybe Text
id = Maybe Text
a} :: CreateManagedEndpointResponse)

-- | The output contains the ID of the virtual cluster.
createManagedEndpointResponse_virtualClusterId :: Lens.Lens' CreateManagedEndpointResponse (Prelude.Maybe Prelude.Text)
createManagedEndpointResponse_virtualClusterId :: (Maybe Text -> f (Maybe Text))
-> CreateManagedEndpointResponse -> f CreateManagedEndpointResponse
createManagedEndpointResponse_virtualClusterId = (CreateManagedEndpointResponse -> Maybe Text)
-> (CreateManagedEndpointResponse
    -> Maybe Text -> CreateManagedEndpointResponse)
-> Lens
     CreateManagedEndpointResponse
     CreateManagedEndpointResponse
     (Maybe Text)
     (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateManagedEndpointResponse' {Maybe Text
virtualClusterId :: Maybe Text
$sel:virtualClusterId:CreateManagedEndpointResponse' :: CreateManagedEndpointResponse -> Maybe Text
virtualClusterId} -> Maybe Text
virtualClusterId) (\s :: CreateManagedEndpointResponse
s@CreateManagedEndpointResponse' {} Maybe Text
a -> CreateManagedEndpointResponse
s {$sel:virtualClusterId:CreateManagedEndpointResponse' :: Maybe Text
virtualClusterId = Maybe Text
a} :: CreateManagedEndpointResponse)

-- | The response's http status code.
createManagedEndpointResponse_httpStatus :: Lens.Lens' CreateManagedEndpointResponse Prelude.Int
createManagedEndpointResponse_httpStatus :: (Int -> f Int)
-> CreateManagedEndpointResponse -> f CreateManagedEndpointResponse
createManagedEndpointResponse_httpStatus = (CreateManagedEndpointResponse -> Int)
-> (CreateManagedEndpointResponse
    -> Int -> CreateManagedEndpointResponse)
-> Lens
     CreateManagedEndpointResponse CreateManagedEndpointResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateManagedEndpointResponse' {Int
httpStatus :: Int
$sel:httpStatus:CreateManagedEndpointResponse' :: CreateManagedEndpointResponse -> Int
httpStatus} -> Int
httpStatus) (\s :: CreateManagedEndpointResponse
s@CreateManagedEndpointResponse' {} Int
a -> CreateManagedEndpointResponse
s {$sel:httpStatus:CreateManagedEndpointResponse' :: Int
httpStatus = Int
a} :: CreateManagedEndpointResponse)

instance Prelude.NFData CreateManagedEndpointResponse