{-# 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.Nimble.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)
--
-- Create a new Studio.
--
-- When creating a Studio, two IAM roles must be provided: the admin role
-- and the user Role. These roles are assumed by your users when they log
-- in to the Nimble Studio portal.
--
-- The user role must have the AmazonNimbleStudio-StudioUser managed policy
-- attached for the portal to function properly.
--
-- The Admin Role must have the AmazonNimbleStudio-StudioAdmin managed
-- policy attached for the portal to function properly.
--
-- You may optionally specify a KMS key in the
-- StudioEncryptionConfiguration.
--
-- In Nimble Studio, resource names, descriptions, initialization scripts,
-- and other data you provide are always encrypted at rest using an KMS
-- key. By default, this key is owned by Amazon Web Services and managed on
-- your behalf. You may provide your own KMS key when calling CreateStudio
-- to encrypt this data using a key you own and manage.
--
-- When providing an KMS key during studio creation, Nimble Studio creates
-- KMS grants in your account to provide your studio user and admin roles
-- access to these KMS keys.
--
-- If you delete this grant, the studio will no longer be accessible to
-- your portal users.
--
-- If you delete the studio KMS key, your studio will no longer be
-- accessible.
module Amazonka.Nimble.CreateStudio
  ( -- * Creating a Request
    CreateStudio (..),
    newCreateStudio,

    -- * Request Lenses
    createStudio_studioEncryptionConfiguration,
    createStudio_clientToken,
    createStudio_tags,
    createStudio_displayName,
    createStudio_studioName,
    createStudio_userRoleArn,
    createStudio_adminRoleArn,

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

    -- * Response Lenses
    createStudioResponse_studio,
    createStudioResponse_httpStatus,
  )
where

import qualified Amazonka.Core as Core
import qualified Amazonka.Lens as Lens
import Amazonka.Nimble.Types
import qualified Amazonka.Prelude as Prelude
import qualified Amazonka.Request as Request
import qualified Amazonka.Response as Response

-- | A collection of studio resources.
--
-- /See:/ 'newCreateStudio' smart constructor.
data CreateStudio = CreateStudio'
  { -- | The studio encryption configuration.
    CreateStudio -> Maybe StudioEncryptionConfiguration
studioEncryptionConfiguration :: Prelude.Maybe StudioEncryptionConfiguration,
    -- | To make an idempotent API request using one of these actions, specify a
    -- client token in the request. You should not reuse the same client token
    -- for other API requests. If you retry a request that completed
    -- successfully using the same client token and the same parameters, the
    -- retry succeeds without performing any further actions. If you retry a
    -- successful request using the same client token, but one or more of the
    -- parameters are different, the retry fails with a ValidationException
    -- error.
    CreateStudio -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | A collection of labels, in the form of key:value pairs, that apply to
    -- this resource.
    CreateStudio -> Maybe (HashMap Text Text)
tags :: Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text),
    -- | A friendly name for the studio.
    CreateStudio -> Text
displayName :: Prelude.Text,
    -- | The studio name that is used in the URL of the Nimble Studio portal when
    -- accessed by Nimble Studio users.
    CreateStudio -> Text
studioName :: Prelude.Text,
    -- | The IAM role that Studio Users will assume when logging in to the Nimble
    -- Studio portal.
    CreateStudio -> Text
userRoleArn :: Prelude.Text,
    -- | The IAM role that Studio Admins will assume when logging in to the
    -- Nimble Studio portal.
    CreateStudio -> Text
adminRoleArn :: 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:
--
-- 'studioEncryptionConfiguration', 'createStudio_studioEncryptionConfiguration' - The studio encryption configuration.
--
-- 'clientToken', 'createStudio_clientToken' - To make an idempotent API request using one of these actions, specify a
-- client token in the request. You should not reuse the same client token
-- for other API requests. If you retry a request that completed
-- successfully using the same client token and the same parameters, the
-- retry succeeds without performing any further actions. If you retry a
-- successful request using the same client token, but one or more of the
-- parameters are different, the retry fails with a ValidationException
-- error.
--
-- 'tags', 'createStudio_tags' - A collection of labels, in the form of key:value pairs, that apply to
-- this resource.
--
-- 'displayName', 'createStudio_displayName' - A friendly name for the studio.
--
-- 'studioName', 'createStudio_studioName' - The studio name that is used in the URL of the Nimble Studio portal when
-- accessed by Nimble Studio users.
--
-- 'userRoleArn', 'createStudio_userRoleArn' - The IAM role that Studio Users will assume when logging in to the Nimble
-- Studio portal.
--
-- 'adminRoleArn', 'createStudio_adminRoleArn' - The IAM role that Studio Admins will assume when logging in to the
-- Nimble Studio portal.
newCreateStudio ::
  -- | 'displayName'
  Prelude.Text ->
  -- | 'studioName'
  Prelude.Text ->
  -- | 'userRoleArn'
  Prelude.Text ->
  -- | 'adminRoleArn'
  Prelude.Text ->
  CreateStudio
newCreateStudio :: Text -> Text -> Text -> Text -> CreateStudio
newCreateStudio
  Text
pDisplayName_
  Text
pStudioName_
  Text
pUserRoleArn_
  Text
pAdminRoleArn_ =
    CreateStudio' :: Maybe StudioEncryptionConfiguration
-> Maybe Text
-> Maybe (HashMap Text Text)
-> Text
-> Text
-> Text
-> Text
-> CreateStudio
CreateStudio'
      { $sel:studioEncryptionConfiguration:CreateStudio' :: Maybe StudioEncryptionConfiguration
studioEncryptionConfiguration =
          Maybe StudioEncryptionConfiguration
forall a. Maybe a
Prelude.Nothing,
        $sel:clientToken:CreateStudio' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:tags:CreateStudio' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:displayName:CreateStudio' :: Text
displayName = Text
pDisplayName_,
        $sel:studioName:CreateStudio' :: Text
studioName = Text
pStudioName_,
        $sel:userRoleArn:CreateStudio' :: Text
userRoleArn = Text
pUserRoleArn_,
        $sel:adminRoleArn:CreateStudio' :: Text
adminRoleArn = Text
pAdminRoleArn_
      }

-- | The studio encryption configuration.
createStudio_studioEncryptionConfiguration :: Lens.Lens' CreateStudio (Prelude.Maybe StudioEncryptionConfiguration)
createStudio_studioEncryptionConfiguration :: (Maybe StudioEncryptionConfiguration
 -> f (Maybe StudioEncryptionConfiguration))
-> CreateStudio -> f CreateStudio
createStudio_studioEncryptionConfiguration = (CreateStudio -> Maybe StudioEncryptionConfiguration)
-> (CreateStudio
    -> Maybe StudioEncryptionConfiguration -> CreateStudio)
-> Lens
     CreateStudio
     CreateStudio
     (Maybe StudioEncryptionConfiguration)
     (Maybe StudioEncryptionConfiguration)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStudio' {Maybe StudioEncryptionConfiguration
studioEncryptionConfiguration :: Maybe StudioEncryptionConfiguration
$sel:studioEncryptionConfiguration:CreateStudio' :: CreateStudio -> Maybe StudioEncryptionConfiguration
studioEncryptionConfiguration} -> Maybe StudioEncryptionConfiguration
studioEncryptionConfiguration) (\s :: CreateStudio
s@CreateStudio' {} Maybe StudioEncryptionConfiguration
a -> CreateStudio
s {$sel:studioEncryptionConfiguration:CreateStudio' :: Maybe StudioEncryptionConfiguration
studioEncryptionConfiguration = Maybe StudioEncryptionConfiguration
a} :: CreateStudio)

-- | To make an idempotent API request using one of these actions, specify a
-- client token in the request. You should not reuse the same client token
-- for other API requests. If you retry a request that completed
-- successfully using the same client token and the same parameters, the
-- retry succeeds without performing any further actions. If you retry a
-- successful request using the same client token, but one or more of the
-- parameters are different, the retry fails with a ValidationException
-- error.
createStudio_clientToken :: Lens.Lens' CreateStudio (Prelude.Maybe Prelude.Text)
createStudio_clientToken :: (Maybe Text -> f (Maybe Text)) -> CreateStudio -> f CreateStudio
createStudio_clientToken = (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
clientToken :: Maybe Text
$sel:clientToken:CreateStudio' :: CreateStudio -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateStudio
s@CreateStudio' {} Maybe Text
a -> CreateStudio
s {$sel:clientToken:CreateStudio' :: Maybe Text
clientToken = Maybe Text
a} :: CreateStudio)

-- | A collection of labels, in the form of key:value pairs, that apply to
-- this resource.
createStudio_tags :: Lens.Lens' CreateStudio (Prelude.Maybe (Prelude.HashMap Prelude.Text Prelude.Text))
createStudio_tags :: (Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
-> CreateStudio -> f CreateStudio
createStudio_tags = (CreateStudio -> Maybe (HashMap Text Text))
-> (CreateStudio -> Maybe (HashMap Text Text) -> CreateStudio)
-> Lens
     CreateStudio
     CreateStudio
     (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 (\CreateStudio' {Maybe (HashMap Text Text)
tags :: Maybe (HashMap Text Text)
$sel:tags:CreateStudio' :: CreateStudio -> Maybe (HashMap Text Text)
tags} -> Maybe (HashMap Text Text)
tags) (\s :: CreateStudio
s@CreateStudio' {} Maybe (HashMap Text Text)
a -> CreateStudio
s {$sel:tags:CreateStudio' :: Maybe (HashMap Text Text)
tags = Maybe (HashMap Text Text)
a} :: CreateStudio) ((Maybe (HashMap Text Text) -> f (Maybe (HashMap Text Text)))
 -> CreateStudio -> f CreateStudio)
-> ((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)))
-> CreateStudio
-> f CreateStudio
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

-- | A friendly name for the studio.
createStudio_displayName :: Lens.Lens' CreateStudio Prelude.Text
createStudio_displayName :: (Text -> f Text) -> CreateStudio -> f CreateStudio
createStudio_displayName = (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
displayName :: Text
$sel:displayName:CreateStudio' :: CreateStudio -> Text
displayName} -> Text
displayName) (\s :: CreateStudio
s@CreateStudio' {} Text
a -> CreateStudio
s {$sel:displayName:CreateStudio' :: Text
displayName = Text
a} :: CreateStudio)

-- | The studio name that is used in the URL of the Nimble Studio portal when
-- accessed by Nimble Studio users.
createStudio_studioName :: Lens.Lens' CreateStudio Prelude.Text
createStudio_studioName :: (Text -> f Text) -> CreateStudio -> f CreateStudio
createStudio_studioName = (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
studioName :: Text
$sel:studioName:CreateStudio' :: CreateStudio -> Text
studioName} -> Text
studioName) (\s :: CreateStudio
s@CreateStudio' {} Text
a -> CreateStudio
s {$sel:studioName:CreateStudio' :: Text
studioName = Text
a} :: CreateStudio)

-- | The IAM role that Studio Users will assume when logging in to the Nimble
-- Studio portal.
createStudio_userRoleArn :: Lens.Lens' CreateStudio Prelude.Text
createStudio_userRoleArn :: (Text -> f Text) -> CreateStudio -> f CreateStudio
createStudio_userRoleArn = (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
userRoleArn :: Text
$sel:userRoleArn:CreateStudio' :: CreateStudio -> Text
userRoleArn} -> Text
userRoleArn) (\s :: CreateStudio
s@CreateStudio' {} Text
a -> CreateStudio
s {$sel:userRoleArn:CreateStudio' :: Text
userRoleArn = Text
a} :: CreateStudio)

-- | The IAM role that Studio Admins will assume when logging in to the
-- Nimble Studio portal.
createStudio_adminRoleArn :: Lens.Lens' CreateStudio Prelude.Text
createStudio_adminRoleArn :: (Text -> f Text) -> CreateStudio -> f CreateStudio
createStudio_adminRoleArn = (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
adminRoleArn :: Text
$sel:adminRoleArn:CreateStudio' :: CreateStudio -> Text
adminRoleArn} -> Text
adminRoleArn) (\s :: CreateStudio
s@CreateStudio' {} Text
a -> CreateStudio
s {$sel:adminRoleArn:CreateStudio' :: Text
adminRoleArn = 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 Studio -> Int -> CreateStudioResponse
CreateStudioResponse'
            (Maybe Studio -> Int -> CreateStudioResponse)
-> Either String (Maybe Studio)
-> Either String (Int -> CreateStudioResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Object
x Object -> Text -> Either String (Maybe Studio)
forall a. FromJSON a => Object -> Text -> Either String (Maybe a)
Core..?> Text
"studio")
            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 CreateStudio' {Maybe Text
Maybe (HashMap Text Text)
Maybe StudioEncryptionConfiguration
Text
adminRoleArn :: Text
userRoleArn :: Text
studioName :: Text
displayName :: Text
tags :: Maybe (HashMap Text Text)
clientToken :: Maybe Text
studioEncryptionConfiguration :: Maybe StudioEncryptionConfiguration
$sel:adminRoleArn:CreateStudio' :: CreateStudio -> Text
$sel:userRoleArn:CreateStudio' :: CreateStudio -> Text
$sel:studioName:CreateStudio' :: CreateStudio -> Text
$sel:displayName:CreateStudio' :: CreateStudio -> Text
$sel:tags:CreateStudio' :: CreateStudio -> Maybe (HashMap Text Text)
$sel:clientToken:CreateStudio' :: CreateStudio -> Maybe Text
$sel:studioEncryptionConfiguration:CreateStudio' :: CreateStudio -> Maybe StudioEncryptionConfiguration
..} =
    [ResponseHeaders] -> ResponseHeaders
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ HeaderName
"X-Amz-Client-Token" HeaderName -> Maybe Text -> ResponseHeaders
forall a. ToHeader a => HeaderName -> a -> ResponseHeaders
Core.=# Maybe Text
clientToken,
        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' {Maybe Text
Maybe (HashMap Text Text)
Maybe StudioEncryptionConfiguration
Text
adminRoleArn :: Text
userRoleArn :: Text
studioName :: Text
displayName :: Text
tags :: Maybe (HashMap Text Text)
clientToken :: Maybe Text
studioEncryptionConfiguration :: Maybe StudioEncryptionConfiguration
$sel:adminRoleArn:CreateStudio' :: CreateStudio -> Text
$sel:userRoleArn:CreateStudio' :: CreateStudio -> Text
$sel:studioName:CreateStudio' :: CreateStudio -> Text
$sel:displayName:CreateStudio' :: CreateStudio -> Text
$sel:tags:CreateStudio' :: CreateStudio -> Maybe (HashMap Text Text)
$sel:clientToken:CreateStudio' :: CreateStudio -> Maybe Text
$sel:studioEncryptionConfiguration:CreateStudio' :: CreateStudio -> Maybe StudioEncryptionConfiguration
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"studioEncryptionConfiguration" Text -> StudioEncryptionConfiguration -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (StudioEncryptionConfiguration -> Pair)
-> Maybe StudioEncryptionConfiguration -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe StudioEncryptionConfiguration
studioEncryptionConfiguration,
            (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
"displayName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
displayName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"studioName" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
studioName),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"userRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
userRoleArn),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just (Text
"adminRoleArn" Text -> Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= Text
adminRoleArn)
          ]
      )

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

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'
  { -- | Information about a studio.
    CreateStudioResponse -> Maybe Studio
studio :: Prelude.Maybe Studio,
    -- | 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:
--
-- 'studio', 'createStudioResponse_studio' - Information about a studio.
--
-- 'httpStatus', 'createStudioResponse_httpStatus' - The response's http status code.
newCreateStudioResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  CreateStudioResponse
newCreateStudioResponse :: Int -> CreateStudioResponse
newCreateStudioResponse Int
pHttpStatus_ =
  CreateStudioResponse' :: Maybe Studio -> Int -> CreateStudioResponse
CreateStudioResponse'
    { $sel:studio:CreateStudioResponse' :: Maybe Studio
studio = Maybe Studio
forall a. Maybe a
Prelude.Nothing,
      $sel:httpStatus:CreateStudioResponse' :: Int
httpStatus = Int
pHttpStatus_
    }

-- | Information about a studio.
createStudioResponse_studio :: Lens.Lens' CreateStudioResponse (Prelude.Maybe Studio)
createStudioResponse_studio :: (Maybe Studio -> f (Maybe Studio))
-> CreateStudioResponse -> f CreateStudioResponse
createStudioResponse_studio = (CreateStudioResponse -> Maybe Studio)
-> (CreateStudioResponse -> Maybe Studio -> CreateStudioResponse)
-> Lens
     CreateStudioResponse
     CreateStudioResponse
     (Maybe Studio)
     (Maybe Studio)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateStudioResponse' {Maybe Studio
studio :: Maybe Studio
$sel:studio:CreateStudioResponse' :: CreateStudioResponse -> Maybe Studio
studio} -> Maybe Studio
studio) (\s :: CreateStudioResponse
s@CreateStudioResponse' {} Maybe Studio
a -> CreateStudioResponse
s {$sel:studio:CreateStudioResponse' :: Maybe Studio
studio = Maybe Studio
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