{-# 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.EMR.CreateStudio
-- 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 new Amazon EMR Studio.
module Amazonka.EMR.CreateStudio
  ( -- * Creating a Request
    CreateStudio (..),
    newCreateStudio,

    -- * Request Lenses
    createStudio_idpAuthUrl,
    createStudio_idpRelayStateParameterName,
    createStudio_userRole,
    createStudio_description,
    createStudio_tags,
    createStudio_name,
    createStudio_authMode,
    createStudio_vpcId,
    createStudio_subnetIds,
    createStudio_serviceRole,
    createStudio_workspaceSecurityGroupId,
    createStudio_engineSecurityGroupId,
    createStudio_defaultS3Location,

    -- * Destructuring the Response
    CreateStudioResponse (..),
    newCreateStudioResponse,

    -- * Response Lenses
    createStudioResponse_studioId,
    createStudioResponse_url,
    createStudioResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.EMR.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:/ 'newCreateStudio' smart constructor.
data CreateStudio = CreateStudio'
  { -- | The authentication endpoint of your identity provider (IdP). Specify
    -- this value when you use IAM authentication and want to let federated
    -- users log in to a Studio with the Studio URL and credentials from your
    -- IdP. Amazon EMR Studio redirects users to this endpoint to enter
    -- credentials.
    CreateStudio -> Maybe Text
idpAuthUrl :: Prelude.Maybe Prelude.Text,
    -- | The name that your identity provider (IdP) uses for its @RelayState@
    -- parameter. For example, @RelayState@ or @TargetSource@. Specify this
    -- value when you use IAM authentication and want to let federated users
    -- log in to a Studio using the Studio URL. The @RelayState@ parameter
    -- differs by IdP.
    CreateStudio -> Maybe Text
idpRelayStateParameterName :: Prelude.Maybe Prelude.Text,
    -- | The IAM user role that users and groups assume when logged in to an
    -- Amazon EMR Studio. Only specify a @UserRole@ when you use Amazon Web
    -- Services SSO authentication. The permissions attached to the @UserRole@
    -- can be scoped down for each user or group using session policies.
    CreateStudio -> Maybe Text
userRole :: Prelude.Maybe Prelude.Text,
    -- | A detailed description of the Amazon EMR Studio.
    CreateStudio -> Maybe Text
description :: Prelude.Maybe Prelude.Text,
    -- | A list of tags to associate with the Amazon EMR Studio. Tags are
    -- user-defined key-value pairs that consist of a required key string with
    -- a maximum of 128 characters, and an optional value string with a maximum
    -- of 256 characters.
    CreateStudio -> Maybe [Tag]
tags :: Prelude.Maybe [Tag],
    -- | A descriptive name for the Amazon EMR Studio.
    CreateStudio -> Text
name :: Prelude.Text,
    -- | Specifies whether the Studio authenticates users using IAM or Amazon Web
    -- Services SSO.
    CreateStudio -> AuthMode
authMode :: AuthMode,
    -- | The ID of the Amazon Virtual Private Cloud (Amazon VPC) to associate
    -- with the Studio.
    CreateStudio -> Text
vpcId :: Prelude.Text,
    -- | A list of subnet IDs to associate with the Amazon EMR Studio. A Studio
    -- can have a maximum of 5 subnets. The subnets must belong to the VPC
    -- specified by @VpcId@. Studio users can create a Workspace in any of the
    -- specified subnets.
    CreateStudio -> [Text]
subnetIds :: [Prelude.Text],
    -- | The IAM role that the Amazon EMR Studio assumes. The service role
    -- provides a way for Amazon EMR Studio to interoperate with other Amazon
    -- Web Services services.
    CreateStudio -> Text
serviceRole :: Prelude.Text,
    -- | The ID of the Amazon EMR Studio Workspace security group. The Workspace
    -- security group allows outbound network traffic to resources in the
    -- Engine security group, and it must be in the same VPC specified by
    -- @VpcId@.
    CreateStudio -> Text
workspaceSecurityGroupId :: Prelude.Text,
    -- | The ID of the Amazon EMR Studio Engine security group. The Engine
    -- security group allows inbound network traffic from the Workspace
    -- security group, and it must be in the same VPC specified by @VpcId@.
    CreateStudio -> Text
engineSecurityGroupId :: Prelude.Text,
    -- | The Amazon S3 location to back up Amazon EMR Studio Workspaces and
    -- notebook files.
    CreateStudio -> Text
defaultS3Location :: Prelude.Text
  }
  deriving (CreateStudio -> CreateStudio -> Bool
(CreateStudio -> CreateStudio -> Bool)
-> (CreateStudio -> CreateStudio -> Bool) -> Eq CreateStudio
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStudio -> CreateStudio -> Bool
$c/= :: CreateStudio -> CreateStudio -> Bool
== :: CreateStudio -> CreateStudio -> Bool
$c== :: CreateStudio -> CreateStudio -> Bool
Prelude.Eq, ReadPrec [CreateStudio]
ReadPrec CreateStudio
Int -> ReadS CreateStudio
ReadS [CreateStudio]
(Int -> ReadS CreateStudio)
-> ReadS [CreateStudio]
-> ReadPrec CreateStudio
-> ReadPrec [CreateStudio]
-> Read CreateStudio
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateStudio]
$creadListPrec :: ReadPrec [CreateStudio]
readPrec :: ReadPrec CreateStudio
$creadPrec :: ReadPrec CreateStudio
readList :: ReadS [CreateStudio]
$creadList :: ReadS [CreateStudio]
readsPrec :: Int -> ReadS CreateStudio
$creadsPrec :: Int -> ReadS CreateStudio
Prelude.Read, Int -> CreateStudio -> ShowS
[CreateStudio] -> ShowS
CreateStudio -> String
(Int -> CreateStudio -> ShowS)
-> (CreateStudio -> String)
-> ([CreateStudio] -> ShowS)
-> Show CreateStudio
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStudio] -> ShowS
$cshowList :: [CreateStudio] -> ShowS
show :: CreateStudio -> String
$cshow :: CreateStudio -> String
showsPrec :: Int -> CreateStudio -> ShowS
$cshowsPrec :: Int -> CreateStudio -> ShowS
Prelude.Show, (forall x. CreateStudio -> Rep CreateStudio x)
-> (forall x. Rep CreateStudio x -> CreateStudio)
-> Generic CreateStudio
forall x. Rep CreateStudio x -> CreateStudio
forall x. CreateStudio -> Rep CreateStudio x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateStudio x -> CreateStudio
$cfrom :: forall x. CreateStudio -> Rep CreateStudio x
Prelude.Generic)

-- |
-- Create a value of 'CreateStudio' 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:
--
-- 'idpAuthUrl', 'createStudio_idpAuthUrl' - The authentication endpoint of your identity provider (IdP). Specify
-- this value when you use IAM authentication and want to let federated
-- users log in to a Studio with the Studio URL and credentials from your
-- IdP. Amazon EMR Studio redirects users to this endpoint to enter
-- credentials.
--
-- 'idpRelayStateParameterName', 'createStudio_idpRelayStateParameterName' - The name that your identity provider (IdP) uses for its @RelayState@
-- parameter. For example, @RelayState@ or @TargetSource@. Specify this
-- value when you use IAM authentication and want to let federated users
-- log in to a Studio using the Studio URL. The @RelayState@ parameter
-- differs by IdP.
--
-- 'userRole', 'createStudio_userRole' - The IAM user role that users and groups assume when logged in to an
-- Amazon EMR Studio. Only specify a @UserRole@ when you use Amazon Web
-- Services SSO authentication. The permissions attached to the @UserRole@
-- can be scoped down for each user or group using session policies.
--
-- 'description', 'createStudio_description' - A detailed description of the Amazon EMR Studio.
--
-- 'tags', 'createStudio_tags' - A list of tags to associate with the Amazon EMR Studio. Tags are
-- user-defined key-value pairs that consist of a required key string with
-- a maximum of 128 characters, and an optional value string with a maximum
-- of 256 characters.
--
-- 'name', 'createStudio_name' - A descriptive name for the Amazon EMR Studio.
--
-- 'authMode', 'createStudio_authMode' - Specifies whether the Studio authenticates users using IAM or Amazon Web
-- Services SSO.
--
-- 'vpcId', 'createStudio_vpcId' - The ID of the Amazon Virtual Private Cloud (Amazon VPC) to associate
-- with the Studio.
--
-- 'subnetIds', 'createStudio_subnetIds' - A list of subnet IDs to associate with the Amazon EMR Studio. A Studio
-- can have a maximum of 5 subnets. The subnets must belong to the VPC
-- specified by @VpcId@. Studio users can create a Workspace in any of the
-- specified subnets.
--
-- 'serviceRole', 'createStudio_serviceRole' - The IAM role that the Amazon EMR Studio assumes. The service role
-- provides a way for Amazon EMR Studio to interoperate with other Amazon
-- Web Services services.
--
-- 'workspaceSecurityGroupId', 'createStudio_workspaceSecurityGroupId' - The ID of the Amazon EMR Studio Workspace security group. The Workspace
-- security group allows outbound network traffic to resources in the
-- Engine security group, and it must be in the same VPC specified by
-- @VpcId@.
--
-- 'engineSecurityGroupId', 'createStudio_engineSecurityGroupId' - The ID of the Amazon EMR Studio Engine security group. The Engine
-- security group allows inbound network traffic from the Workspace
-- security group, and it must be in the same VPC specified by @VpcId@.
--
-- 'defaultS3Location', 'createStudio_defaultS3Location' - The Amazon S3 location to back up Amazon EMR Studio Workspaces and
-- notebook files.
newCreateStudio ::
  -- | 'name'
  Prelude.Text ->
  -- | 'authMode'
  AuthMode ->
  -- | 'vpcId'
  Prelude.Text ->
  -- | 'serviceRole'
  Prelude.Text ->
  -- | 'workspaceSecurityGroupId'
  Prelude.Text ->
  -- | 'engineSecurityGroupId'
  Prelude.Text ->
  -- | 'defaultS3Location'
  Prelude.Text ->
  CreateStudio
newCreateStudio :: Text
-> AuthMode -> Text -> Text -> Text -> Text -> Text -> CreateStudio
newCreateStudio
  Text
pName_
  AuthMode
pAuthMode_
  Text
pVpcId_
  Text
pServiceRole_
  Text
pWorkspaceSecurityGroupId_
  Text
pEngineSecurityGroupId_
  Text
pDefaultS3Location_ =
    CreateStudio' :: Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe Text
-> Maybe [Tag]
-> Text
-> AuthMode
-> Text
-> [Text]
-> Text
-> Text
-> Text
-> Text
-> CreateStudio
CreateStudio'
      { $sel:idpAuthUrl:CreateStudio' :: Maybe Text
idpAuthUrl = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:idpRelayStateParameterName:CreateStudio' :: Maybe Text
idpRelayStateParameterName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:userRole:CreateStudio' :: Maybe Text
userRole = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:description:CreateStudio' :: Maybe Text
description = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateStudio' :: Maybe [Tag]
tags = Maybe [Tag]
forall a. Maybe a
Prelude.Nothing,
        $sel:name:CreateStudio' :: Text
name = Text
pName_,
        $sel:authMode:CreateStudio' :: AuthMode
authMode = AuthMode
pAuthMode_,
        $sel:vpcId:CreateStudio' :: Text
vpcId = Text
pVpcId_,
        $sel:subnetIds:CreateStudio' :: [Text]
subnetIds = [Text]
forall a. Monoid a => a
Prelude.mempty,
        $sel:serviceRole:CreateStudio' :: Text
serviceRole = Text
pServiceRole_,
        $sel:workspaceSecurityGroupId:CreateStudio' :: Text
workspaceSecurityGroupId =
          Text
pWorkspaceSecurityGroupId_,
        $sel:engineSecurityGroupId:CreateStudio' :: Text
engineSecurityGroupId = Text
pEngineSecurityGroupId_,
        $sel:defaultS3Location:CreateStudio' :: Text
defaultS3Location = Text
pDefaultS3Location_
      }

-- | The authentication endpoint of your identity provider (IdP). Specify
-- this value when you use IAM authentication and want to let federated
-- users log in to a Studio with the Studio URL and credentials from your
-- IdP. Amazon EMR Studio redirects users to this endpoint to enter
-- credentials.
createStudio_idpAuthUrl :: Lens.Lens' CreateStudio (Prelude.Maybe Prelude.Text)
createStudio_idpAuthUrl :: (Maybe Text -> f (Maybe Text)) -> CreateStudio -> f CreateStudio
createStudio_idpAuthUrl = (CreateStudio -> Maybe Text)
-> (CreateStudio -> Maybe Text -> CreateStudio)
-> Lens CreateStudio CreateStudio (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStudio' {Maybe Text
idpAuthUrl :: Maybe Text
$sel:idpAuthUrl:CreateStudio' :: CreateStudio -> Maybe Text
idpAuthUrl} -> Maybe Text
idpAuthUrl) (\s :: CreateStudio
s@CreateStudio' {} Maybe Text
a -> CreateStudio
s {$sel:idpAuthUrl:CreateStudio' :: Maybe Text
idpAuthUrl = Maybe Text
a} :: CreateStudio)

-- | The name that your identity provider (IdP) uses for its @RelayState@
-- parameter. For example, @RelayState@ or @TargetSource@. Specify this
-- value when you use IAM authentication and want to let federated users
-- log in to a Studio using the Studio URL. The @RelayState@ parameter
-- differs by IdP.
createStudio_idpRelayStateParameterName :: Lens.Lens' CreateStudio (Prelude.Maybe Prelude.Text)
createStudio_idpRelayStateParameterName :: (Maybe Text -> f (Maybe Text)) -> CreateStudio -> f CreateStudio
createStudio_idpRelayStateParameterName = (CreateStudio -> Maybe Text)
-> (CreateStudio -> Maybe Text -> CreateStudio)
-> Lens CreateStudio CreateStudio (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStudio' {Maybe Text
idpRelayStateParameterName :: Maybe Text
$sel:idpRelayStateParameterName:CreateStudio' :: CreateStudio -> Maybe Text
idpRelayStateParameterName} -> Maybe Text
idpRelayStateParameterName) (\s :: CreateStudio
s@CreateStudio' {} Maybe Text
a -> CreateStudio
s {$sel:idpRelayStateParameterName:CreateStudio' :: Maybe Text
idpRelayStateParameterName = Maybe Text
a} :: CreateStudio)

-- | The IAM user role that users and groups assume when logged in to an
-- Amazon EMR Studio. Only specify a @UserRole@ when you use Amazon Web
-- Services SSO authentication. The permissions attached to the @UserRole@
-- can be scoped down for each user or group using session policies.
createStudio_userRole :: Lens.Lens' CreateStudio (Prelude.Maybe Prelude.Text)
createStudio_userRole :: (Maybe Text -> f (Maybe Text)) -> CreateStudio -> f CreateStudio
createStudio_userRole = (CreateStudio -> Maybe Text)
-> (CreateStudio -> Maybe Text -> CreateStudio)
-> Lens CreateStudio CreateStudio (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStudio' {Maybe Text
userRole :: Maybe Text
$sel:userRole:CreateStudio' :: CreateStudio -> Maybe Text
userRole} -> Maybe Text
userRole) (\s :: CreateStudio
s@CreateStudio' {} Maybe Text
a -> CreateStudio
s {$sel:userRole:CreateStudio' :: Maybe Text
userRole = Maybe Text
a} :: CreateStudio)

-- | A detailed description of the Amazon EMR Studio.
createStudio_description :: Lens.Lens' CreateStudio (Prelude.Maybe Prelude.Text)
createStudio_description :: (Maybe Text -> f (Maybe Text)) -> CreateStudio -> f CreateStudio
createStudio_description = (CreateStudio -> Maybe Text)
-> (CreateStudio -> Maybe Text -> CreateStudio)
-> Lens CreateStudio CreateStudio (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStudio' {Maybe Text
description :: Maybe Text
$sel:description:CreateStudio' :: CreateStudio -> Maybe Text
description} -> Maybe Text
description) (\s :: CreateStudio
s@CreateStudio' {} Maybe Text
a -> CreateStudio
s {$sel:description:CreateStudio' :: Maybe Text
description = Maybe Text
a} :: CreateStudio)

-- | A list of tags to associate with the Amazon EMR Studio. Tags are
-- user-defined key-value pairs that consist of a required key string with
-- a maximum of 128 characters, and an optional value string with a maximum
-- of 256 characters.
createStudio_tags :: Lens.Lens' CreateStudio (Prelude.Maybe [Tag])
createStudio_tags :: (Maybe [Tag] -> f (Maybe [Tag])) -> CreateStudio -> f CreateStudio
createStudio_tags = (CreateStudio -> Maybe [Tag])
-> (CreateStudio -> Maybe [Tag] -> CreateStudio)
-> Lens CreateStudio CreateStudio (Maybe [Tag]) (Maybe [Tag])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStudio' {Maybe [Tag]
tags :: Maybe [Tag]
$sel:tags:CreateStudio' :: CreateStudio -> Maybe [Tag]
tags} -> Maybe [Tag]
tags) (\s :: CreateStudio
s@CreateStudio' {} Maybe [Tag]
a -> CreateStudio
s {$sel:tags:CreateStudio' :: Maybe [Tag]
tags = Maybe [Tag]
a} :: CreateStudio) ((Maybe [Tag] -> f (Maybe [Tag]))
 -> CreateStudio -> f CreateStudio)
-> ((Maybe [Tag] -> f (Maybe [Tag]))
    -> Maybe [Tag] -> f (Maybe [Tag]))
-> (Maybe [Tag] -> f (Maybe [Tag]))
-> CreateStudio
-> f CreateStudio
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso [Tag] [Tag] [Tag] [Tag]
-> Iso (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag]) (Maybe [Tag])
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 [Tag] [Tag] [Tag] [Tag]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | A descriptive name for the Amazon EMR Studio.
createStudio_name :: Lens.Lens' CreateStudio Prelude.Text
createStudio_name :: (Text -> f Text) -> CreateStudio -> f CreateStudio
createStudio_name = (CreateStudio -> Text)
-> (CreateStudio -> Text -> CreateStudio)
-> Lens CreateStudio CreateStudio Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStudio' {Text
name :: Text
$sel:name:CreateStudio' :: CreateStudio -> Text
name} -> Text
name) (\s :: CreateStudio
s@CreateStudio' {} Text
a -> CreateStudio
s {$sel:name:CreateStudio' :: Text
name = Text
a} :: CreateStudio)

-- | Specifies whether the Studio authenticates users using IAM or Amazon Web
-- Services SSO.
createStudio_authMode :: Lens.Lens' CreateStudio AuthMode
createStudio_authMode :: (AuthMode -> f AuthMode) -> CreateStudio -> f CreateStudio
createStudio_authMode = (CreateStudio -> AuthMode)
-> (CreateStudio -> AuthMode -> CreateStudio)
-> Lens CreateStudio CreateStudio AuthMode AuthMode
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStudio' {AuthMode
authMode :: AuthMode
$sel:authMode:CreateStudio' :: CreateStudio -> AuthMode
authMode} -> AuthMode
authMode) (\s :: CreateStudio
s@CreateStudio' {} AuthMode
a -> CreateStudio
s {$sel:authMode:CreateStudio' :: AuthMode
authMode = AuthMode
a} :: CreateStudio)

-- | The ID of the Amazon Virtual Private Cloud (Amazon VPC) to associate
-- with the Studio.
createStudio_vpcId :: Lens.Lens' CreateStudio Prelude.Text
createStudio_vpcId :: (Text -> f Text) -> CreateStudio -> f CreateStudio
createStudio_vpcId = (CreateStudio -> Text)
-> (CreateStudio -> Text -> CreateStudio)
-> Lens CreateStudio CreateStudio Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStudio' {Text
vpcId :: Text
$sel:vpcId:CreateStudio' :: CreateStudio -> Text
vpcId} -> Text
vpcId) (\s :: CreateStudio
s@CreateStudio' {} Text
a -> CreateStudio
s {$sel:vpcId:CreateStudio' :: Text
vpcId = Text
a} :: CreateStudio)

-- | A list of subnet IDs to associate with the Amazon EMR Studio. A Studio
-- can have a maximum of 5 subnets. The subnets must belong to the VPC
-- specified by @VpcId@. Studio users can create a Workspace in any of the
-- specified subnets.
createStudio_subnetIds :: Lens.Lens' CreateStudio [Prelude.Text]
createStudio_subnetIds :: ([Text] -> f [Text]) -> CreateStudio -> f CreateStudio
createStudio_subnetIds = (CreateStudio -> [Text])
-> (CreateStudio -> [Text] -> CreateStudio)
-> Lens CreateStudio CreateStudio [Text] [Text]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStudio' {[Text]
subnetIds :: [Text]
$sel:subnetIds:CreateStudio' :: CreateStudio -> [Text]
subnetIds} -> [Text]
subnetIds) (\s :: CreateStudio
s@CreateStudio' {} [Text]
a -> CreateStudio
s {$sel:subnetIds:CreateStudio' :: [Text]
subnetIds = [Text]
a} :: CreateStudio) (([Text] -> f [Text]) -> CreateStudio -> f CreateStudio)
-> (([Text] -> f [Text]) -> [Text] -> f [Text])
-> ([Text] -> f [Text])
-> CreateStudio
-> f CreateStudio
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([Text] -> f [Text]) -> [Text] -> f [Text]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The IAM role that the Amazon EMR Studio assumes. The service role
-- provides a way for Amazon EMR Studio to interoperate with other Amazon
-- Web Services services.
createStudio_serviceRole :: Lens.Lens' CreateStudio Prelude.Text
createStudio_serviceRole :: (Text -> f Text) -> CreateStudio -> f CreateStudio
createStudio_serviceRole = (CreateStudio -> Text)
-> (CreateStudio -> Text -> CreateStudio)
-> Lens CreateStudio CreateStudio Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStudio' {Text
serviceRole :: Text
$sel:serviceRole:CreateStudio' :: CreateStudio -> Text
serviceRole} -> Text
serviceRole) (\s :: CreateStudio
s@CreateStudio' {} Text
a -> CreateStudio
s {$sel:serviceRole:CreateStudio' :: Text
serviceRole = Text
a} :: CreateStudio)

-- | The ID of the Amazon EMR Studio Workspace security group. The Workspace
-- security group allows outbound network traffic to resources in the
-- Engine security group, and it must be in the same VPC specified by
-- @VpcId@.
createStudio_workspaceSecurityGroupId :: Lens.Lens' CreateStudio Prelude.Text
createStudio_workspaceSecurityGroupId :: (Text -> f Text) -> CreateStudio -> f CreateStudio
createStudio_workspaceSecurityGroupId = (CreateStudio -> Text)
-> (CreateStudio -> Text -> CreateStudio)
-> Lens CreateStudio CreateStudio Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStudio' {Text
workspaceSecurityGroupId :: Text
$sel:workspaceSecurityGroupId:CreateStudio' :: CreateStudio -> Text
workspaceSecurityGroupId} -> Text
workspaceSecurityGroupId) (\s :: CreateStudio
s@CreateStudio' {} Text
a -> CreateStudio
s {$sel:workspaceSecurityGroupId:CreateStudio' :: Text
workspaceSecurityGroupId = Text
a} :: CreateStudio)

-- | The ID of the Amazon EMR Studio Engine security group. The Engine
-- security group allows inbound network traffic from the Workspace
-- security group, and it must be in the same VPC specified by @VpcId@.
createStudio_engineSecurityGroupId :: Lens.Lens' CreateStudio Prelude.Text
createStudio_engineSecurityGroupId :: (Text -> f Text) -> CreateStudio -> f CreateStudio
createStudio_engineSecurityGroupId = (CreateStudio -> Text)
-> (CreateStudio -> Text -> CreateStudio)
-> Lens CreateStudio CreateStudio Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStudio' {Text
engineSecurityGroupId :: Text
$sel:engineSecurityGroupId:CreateStudio' :: CreateStudio -> Text
engineSecurityGroupId} -> Text
engineSecurityGroupId) (\s :: CreateStudio
s@CreateStudio' {} Text
a -> CreateStudio
s {$sel:engineSecurityGroupId:CreateStudio' :: Text
engineSecurityGroupId = Text
a} :: CreateStudio)

-- | The Amazon S3 location to back up Amazon EMR Studio Workspaces and
-- notebook files.
createStudio_defaultS3Location :: Lens.Lens' CreateStudio Prelude.Text
createStudio_defaultS3Location :: (Text -> f Text) -> CreateStudio -> f CreateStudio
createStudio_defaultS3Location = (CreateStudio -> Text)
-> (CreateStudio -> Text -> CreateStudio)
-> Lens CreateStudio CreateStudio Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStudio' {Text
defaultS3Location :: Text
$sel:defaultS3Location:CreateStudio' :: CreateStudio -> Text
defaultS3Location} -> Text
defaultS3Location) (\s :: CreateStudio
s@CreateStudio' {} Text
a -> CreateStudio
s {$sel:defaultS3Location:CreateStudio' :: Text
defaultS3Location = Text
a} :: CreateStudio)

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

instance Prelude.NFData CreateStudio

instance Core.ToHeaders CreateStudio where
  toHeaders :: CreateStudio -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateStudio -> 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
"ElasticMapReduce.CreateStudio" ::
                          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 CreateStudio where
  toJSON :: CreateStudio -> Value
toJSON CreateStudio' {[Text]
Maybe [Tag]
Maybe Text
Text
AuthMode
defaultS3Location :: Text
engineSecurityGroupId :: Text
workspaceSecurityGroupId :: Text
serviceRole :: Text
subnetIds :: [Text]
vpcId :: Text
authMode :: AuthMode
name :: Text
tags :: Maybe [Tag]
description :: Maybe Text
userRole :: Maybe Text
idpRelayStateParameterName :: Maybe Text
idpAuthUrl :: Maybe Text
$sel:defaultS3Location:CreateStudio' :: CreateStudio -> Text
$sel:engineSecurityGroupId:CreateStudio' :: CreateStudio -> Text
$sel:workspaceSecurityGroupId:CreateStudio' :: CreateStudio -> Text
$sel:serviceRole:CreateStudio' :: CreateStudio -> Text
$sel:subnetIds:CreateStudio' :: CreateStudio -> [Text]
$sel:vpcId:CreateStudio' :: CreateStudio -> Text
$sel:authMode:CreateStudio' :: CreateStudio -> AuthMode
$sel:name:CreateStudio' :: CreateStudio -> Text
$sel:tags:CreateStudio' :: CreateStudio -> Maybe [Tag]
$sel:description:CreateStudio' :: CreateStudio -> Maybe Text
$sel:userRole:CreateStudio' :: CreateStudio -> Maybe Text
$sel:idpRelayStateParameterName:CreateStudio' :: CreateStudio -> Maybe Text
$sel:idpAuthUrl:CreateStudio' :: CreateStudio -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"IdpAuthUrl" 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
idpAuthUrl,
            (Text
"IdpRelayStateParameterName" 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
idpRelayStateParameterName,
            (Text
"UserRole" 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
userRole,
            (Text
"Description" 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
description,
            (Text
"Tags" Text -> [Tag] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) ([Tag] -> Pair) -> Maybe [Tag] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [Tag]
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
"AuthMode" Text -> AuthMode -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AuthMode
authMode),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"VpcId" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
vpcId),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"SubnetIds" Text -> [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [Text]
subnetIds),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"ServiceRole" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
serviceRole),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"WorkspaceSecurityGroupId"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
workspaceSecurityGroupId
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"EngineSecurityGroupId"
                  Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
engineSecurityGroupId
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"DefaultS3Location" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
defaultS3Location)
          ]
      )

instance Core.ToPath CreateStudio where
  toPath :: CreateStudio -> ByteString
toPath = ByteString -> CreateStudio -> ByteString
forall a b. a -> b -> a
Prelude.const ByteString
"/"

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

-- | /See:/ 'newCreateStudioResponse' smart constructor.
data CreateStudioResponse = CreateStudioResponse'
  { -- | The ID of the Amazon EMR Studio.
    CreateStudioResponse -> Maybe Text
studioId :: Prelude.Maybe Prelude.Text,
    -- | The unique Studio access URL.
    CreateStudioResponse -> Maybe Text
url :: Prelude.Maybe Prelude.Text,
    -- | The response's http status code.
    CreateStudioResponse -> Int
httpStatus :: Prelude.Int
  }
  deriving (CreateStudioResponse -> CreateStudioResponse -> Bool
(CreateStudioResponse -> CreateStudioResponse -> Bool)
-> (CreateStudioResponse -> CreateStudioResponse -> Bool)
-> Eq CreateStudioResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateStudioResponse -> CreateStudioResponse -> Bool
$c/= :: CreateStudioResponse -> CreateStudioResponse -> Bool
== :: CreateStudioResponse -> CreateStudioResponse -> Bool
$c== :: CreateStudioResponse -> CreateStudioResponse -> Bool
Prelude.Eq, ReadPrec [CreateStudioResponse]
ReadPrec CreateStudioResponse
Int -> ReadS CreateStudioResponse
ReadS [CreateStudioResponse]
(Int -> ReadS CreateStudioResponse)
-> ReadS [CreateStudioResponse]
-> ReadPrec CreateStudioResponse
-> ReadPrec [CreateStudioResponse]
-> Read CreateStudioResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateStudioResponse]
$creadListPrec :: ReadPrec [CreateStudioResponse]
readPrec :: ReadPrec CreateStudioResponse
$creadPrec :: ReadPrec CreateStudioResponse
readList :: ReadS [CreateStudioResponse]
$creadList :: ReadS [CreateStudioResponse]
readsPrec :: Int -> ReadS CreateStudioResponse
$creadsPrec :: Int -> ReadS CreateStudioResponse
Prelude.Read, Int -> CreateStudioResponse -> ShowS
[CreateStudioResponse] -> ShowS
CreateStudioResponse -> String
(Int -> CreateStudioResponse -> ShowS)
-> (CreateStudioResponse -> String)
-> ([CreateStudioResponse] -> ShowS)
-> Show CreateStudioResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateStudioResponse] -> ShowS
$cshowList :: [CreateStudioResponse] -> ShowS
show :: CreateStudioResponse -> String
$cshow :: CreateStudioResponse -> String
showsPrec :: Int -> CreateStudioResponse -> ShowS
$cshowsPrec :: Int -> CreateStudioResponse -> ShowS
Prelude.Show, (forall x. CreateStudioResponse -> Rep CreateStudioResponse x)
-> (forall x. Rep CreateStudioResponse x -> CreateStudioResponse)
-> Generic CreateStudioResponse
forall x. Rep CreateStudioResponse x -> CreateStudioResponse
forall x. CreateStudioResponse -> Rep CreateStudioResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateStudioResponse x -> CreateStudioResponse
$cfrom :: forall x. CreateStudioResponse -> Rep CreateStudioResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateStudioResponse' 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:
--
-- 'studioId', 'createStudioResponse_studioId' - The ID of the Amazon EMR Studio.
--
-- 'url', 'createStudioResponse_url' - The unique Studio access URL.
--
-- 'httpStatus', 'createStudioResponse_httpStatus' - The response's http status code.
newCreateStudioResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateStudioResponse
newCreateStudioResponse :: Int -> CreateStudioResponse
newCreateStudioResponse Int
pHttpStatus_ =
  CreateStudioResponse' :: Maybe Text -> Maybe Text -> Int -> CreateStudioResponse
CreateStudioResponse'
    { $sel:studioId:CreateStudioResponse' :: Maybe Text
studioId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:url:CreateStudioResponse' :: Maybe Text
url = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateStudioResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | The ID of the Amazon EMR Studio.
createStudioResponse_studioId :: Lens.Lens' CreateStudioResponse (Prelude.Maybe Prelude.Text)
createStudioResponse_studioId :: (Maybe Text -> f (Maybe Text))
-> CreateStudioResponse -> f CreateStudioResponse
createStudioResponse_studioId = (CreateStudioResponse -> Maybe Text)
-> (CreateStudioResponse -> Maybe Text -> CreateStudioResponse)
-> Lens
     CreateStudioResponse CreateStudioResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStudioResponse' {Maybe Text
studioId :: Maybe Text
$sel:studioId:CreateStudioResponse' :: CreateStudioResponse -> Maybe Text
studioId} -> Maybe Text
studioId) (\s :: CreateStudioResponse
s@CreateStudioResponse' {} Maybe Text
a -> CreateStudioResponse
s {$sel:studioId:CreateStudioResponse' :: Maybe Text
studioId = Maybe Text
a} :: CreateStudioResponse)

-- | The unique Studio access URL.
createStudioResponse_url :: Lens.Lens' CreateStudioResponse (Prelude.Maybe Prelude.Text)
createStudioResponse_url :: (Maybe Text -> f (Maybe Text))
-> CreateStudioResponse -> f CreateStudioResponse
createStudioResponse_url = (CreateStudioResponse -> Maybe Text)
-> (CreateStudioResponse -> Maybe Text -> CreateStudioResponse)
-> Lens
     CreateStudioResponse CreateStudioResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStudioResponse' {Maybe Text
url :: Maybe Text
$sel:url:CreateStudioResponse' :: CreateStudioResponse -> Maybe Text
url} -> Maybe Text
url) (\s :: CreateStudioResponse
s@CreateStudioResponse' {} Maybe Text
a -> CreateStudioResponse
s {$sel:url:CreateStudioResponse' :: Maybe Text
url = Maybe Text
a} :: CreateStudioResponse)

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

instance Prelude.NFData CreateStudioResponse