{-# 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.Grafana.CreateWorkspace
-- 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 /workspace/. In a workspace, you can create Grafana dashboards
-- and visualizations to analyze your metrics, logs, and traces. You don\'t
-- have to build, package, or deploy any hardware to run the Grafana
-- server.
--
-- Don\'t use @CreateWorkspace@ to modify an existing workspace. Instead,
-- use
-- <https://docs.aws.amazon.com/grafana/latest/APIReference/API_UpdateWorkspace.html UpdateWorkspace>.
module Amazonka.Grafana.CreateWorkspace
  ( -- * Creating a Request
    CreateWorkspace (..),
    newCreateWorkspace,

    -- * Request Lenses
    createWorkspace_workspaceRoleArn,
    createWorkspace_clientToken,
    createWorkspace_workspaceDataSources,
    createWorkspace_workspaceNotificationDestinations,
    createWorkspace_workspaceName,
    createWorkspace_organizationRoleName,
    createWorkspace_workspaceDescription,
    createWorkspace_stackSetName,
    createWorkspace_workspaceOrganizationalUnits,
    createWorkspace_accountAccessType,
    createWorkspace_authenticationProviders,
    createWorkspace_permissionType,

    -- * Destructuring the Response
    CreateWorkspaceResponse (..),
    newCreateWorkspaceResponse,

    -- * Response Lenses
    createWorkspaceResponse_httpStatus,
    createWorkspaceResponse_workspace,
  )
where

import qualified Amazonka.Core as Core
import Amazonka.Grafana.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:/ 'newCreateWorkspace' smart constructor.
data CreateWorkspace = CreateWorkspace'
  { -- | The workspace needs an IAM role that grants permissions to the Amazon
    -- Web Services resources that the workspace will view data from. If you
    -- already have a role that you want to use, specify it here. If you omit
    -- this field and you specify some Amazon Web Services resources in
    -- @workspaceDataSources@ or @workspaceNotificationDestinations@, a new IAM
    -- role with the necessary permissions is automatically created.
    CreateWorkspace -> Maybe (Sensitive Text)
workspaceRoleArn :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | A unique, case-sensitive, user-provided identifier to ensure the
    -- idempotency of the request.
    CreateWorkspace -> Maybe Text
clientToken :: Prelude.Maybe Prelude.Text,
    -- | Specify the Amazon Web Services data sources that you want to be queried
    -- in this workspace. Specifying these data sources here enables Amazon
    -- Managed Grafana to create IAM roles and permissions that allow Amazon
    -- Managed Grafana to read data from these sources. You must still add them
    -- as data sources in the Grafana console in the workspace.
    --
    -- If you don\'t specify a data source here, you can still add it as a data
    -- source in the workspace console later. However, you will then have to
    -- manually configure permissions for it.
    CreateWorkspace -> Maybe [DataSourceType]
workspaceDataSources :: Prelude.Maybe [DataSourceType],
    -- | Specify the Amazon Web Services notification channels that you plan to
    -- use in this workspace. Specifying these data sources here enables Amazon
    -- Managed Grafana to create IAM roles and permissions that allow Amazon
    -- Managed Grafana to use these channels.
    CreateWorkspace -> Maybe [NotificationDestinationType]
workspaceNotificationDestinations :: Prelude.Maybe [NotificationDestinationType],
    -- | The name for the workspace. It does not have to be unique.
    CreateWorkspace -> Maybe (Sensitive Text)
workspaceName :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The name of an IAM role that already exists to use with Organizations to
    -- access Amazon Web Services data sources and notification channels in
    -- other accounts in an organization.
    CreateWorkspace -> Maybe (Sensitive Text)
organizationRoleName :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | A description for the workspace. This is used only to help you identify
    -- this workspace.
    CreateWorkspace -> Maybe (Sensitive Text)
workspaceDescription :: Prelude.Maybe (Core.Sensitive Prelude.Text),
    -- | The name of the CloudFormation stack set to use to generate IAM roles to
    -- be used for this workspace.
    CreateWorkspace -> Maybe Text
stackSetName :: Prelude.Maybe Prelude.Text,
    -- | Specifies the organizational units that this workspace is allowed to use
    -- data sources from, if this workspace is in an account that is part of an
    -- organization.
    CreateWorkspace -> Maybe (Sensitive [Text])
workspaceOrganizationalUnits :: Prelude.Maybe (Core.Sensitive [Prelude.Text]),
    -- | Specifies whether the workspace can access Amazon Web Services resources
    -- in this Amazon Web Services account only, or whether it can also access
    -- Amazon Web Services resources in other accounts in the same
    -- organization. If you specify @ORGANIZATION@, you must specify which
    -- organizational units the workspace can access in the
    -- @workspaceOrganizationalUnits@ parameter.
    CreateWorkspace -> AccountAccessType
accountAccessType :: AccountAccessType,
    -- | Specifies whether this workspace uses SAML 2.0, Amazon Web Services
    -- Single Sign On, or both to authenticate users for using the Grafana
    -- console within a workspace. For more information, see
    -- <https://docs.aws.amazon.com/grafana/latest/userguide/authentication-in-AMG.html User authentication in Amazon Managed Grafana>.
    CreateWorkspace -> [AuthenticationProviderTypes]
authenticationProviders :: [AuthenticationProviderTypes],
    -- | If you specify @Service Managed@, Amazon Managed Grafana automatically
    -- creates the IAM roles and provisions the permissions that the workspace
    -- needs to use Amazon Web Services data sources and notification channels.
    --
    -- If you specify @CUSTOMER_MANAGED@, you will manage those roles and
    -- permissions yourself. If you are creating this workspace in a member
    -- account of an organization that is not a delegated administrator
    -- account, and you want the workspace to access data sources in other
    -- Amazon Web Services accounts in the organization, you must choose
    -- @CUSTOMER_MANAGED@.
    --
    -- For more information, see
    -- <https://docs.aws.amazon.com/grafana/latest/userguide/AMG-manage-permissions.html Amazon Managed Grafana permissions and policies for Amazon Web Services data sources and notification channels>
    CreateWorkspace -> PermissionType
permissionType :: PermissionType
  }
  deriving (CreateWorkspace -> CreateWorkspace -> Bool
(CreateWorkspace -> CreateWorkspace -> Bool)
-> (CreateWorkspace -> CreateWorkspace -> Bool)
-> Eq CreateWorkspace
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateWorkspace -> CreateWorkspace -> Bool
$c/= :: CreateWorkspace -> CreateWorkspace -> Bool
== :: CreateWorkspace -> CreateWorkspace -> Bool
$c== :: CreateWorkspace -> CreateWorkspace -> Bool
Prelude.Eq, Int -> CreateWorkspace -> ShowS
[CreateWorkspace] -> ShowS
CreateWorkspace -> String
(Int -> CreateWorkspace -> ShowS)
-> (CreateWorkspace -> String)
-> ([CreateWorkspace] -> ShowS)
-> Show CreateWorkspace
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateWorkspace] -> ShowS
$cshowList :: [CreateWorkspace] -> ShowS
show :: CreateWorkspace -> String
$cshow :: CreateWorkspace -> String
showsPrec :: Int -> CreateWorkspace -> ShowS
$cshowsPrec :: Int -> CreateWorkspace -> ShowS
Prelude.Show, (forall x. CreateWorkspace -> Rep CreateWorkspace x)
-> (forall x. Rep CreateWorkspace x -> CreateWorkspace)
-> Generic CreateWorkspace
forall x. Rep CreateWorkspace x -> CreateWorkspace
forall x. CreateWorkspace -> Rep CreateWorkspace x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateWorkspace x -> CreateWorkspace
$cfrom :: forall x. CreateWorkspace -> Rep CreateWorkspace x
Prelude.Generic)

-- |
-- Create a value of 'CreateWorkspace' 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:
--
-- 'workspaceRoleArn', 'createWorkspace_workspaceRoleArn' - The workspace needs an IAM role that grants permissions to the Amazon
-- Web Services resources that the workspace will view data from. If you
-- already have a role that you want to use, specify it here. If you omit
-- this field and you specify some Amazon Web Services resources in
-- @workspaceDataSources@ or @workspaceNotificationDestinations@, a new IAM
-- role with the necessary permissions is automatically created.
--
-- 'clientToken', 'createWorkspace_clientToken' - A unique, case-sensitive, user-provided identifier to ensure the
-- idempotency of the request.
--
-- 'workspaceDataSources', 'createWorkspace_workspaceDataSources' - Specify the Amazon Web Services data sources that you want to be queried
-- in this workspace. Specifying these data sources here enables Amazon
-- Managed Grafana to create IAM roles and permissions that allow Amazon
-- Managed Grafana to read data from these sources. You must still add them
-- as data sources in the Grafana console in the workspace.
--
-- If you don\'t specify a data source here, you can still add it as a data
-- source in the workspace console later. However, you will then have to
-- manually configure permissions for it.
--
-- 'workspaceNotificationDestinations', 'createWorkspace_workspaceNotificationDestinations' - Specify the Amazon Web Services notification channels that you plan to
-- use in this workspace. Specifying these data sources here enables Amazon
-- Managed Grafana to create IAM roles and permissions that allow Amazon
-- Managed Grafana to use these channels.
--
-- 'workspaceName', 'createWorkspace_workspaceName' - The name for the workspace. It does not have to be unique.
--
-- 'organizationRoleName', 'createWorkspace_organizationRoleName' - The name of an IAM role that already exists to use with Organizations to
-- access Amazon Web Services data sources and notification channels in
-- other accounts in an organization.
--
-- 'workspaceDescription', 'createWorkspace_workspaceDescription' - A description for the workspace. This is used only to help you identify
-- this workspace.
--
-- 'stackSetName', 'createWorkspace_stackSetName' - The name of the CloudFormation stack set to use to generate IAM roles to
-- be used for this workspace.
--
-- 'workspaceOrganizationalUnits', 'createWorkspace_workspaceOrganizationalUnits' - Specifies the organizational units that this workspace is allowed to use
-- data sources from, if this workspace is in an account that is part of an
-- organization.
--
-- 'accountAccessType', 'createWorkspace_accountAccessType' - Specifies whether the workspace can access Amazon Web Services resources
-- in this Amazon Web Services account only, or whether it can also access
-- Amazon Web Services resources in other accounts in the same
-- organization. If you specify @ORGANIZATION@, you must specify which
-- organizational units the workspace can access in the
-- @workspaceOrganizationalUnits@ parameter.
--
-- 'authenticationProviders', 'createWorkspace_authenticationProviders' - Specifies whether this workspace uses SAML 2.0, Amazon Web Services
-- Single Sign On, or both to authenticate users for using the Grafana
-- console within a workspace. For more information, see
-- <https://docs.aws.amazon.com/grafana/latest/userguide/authentication-in-AMG.html User authentication in Amazon Managed Grafana>.
--
-- 'permissionType', 'createWorkspace_permissionType' - If you specify @Service Managed@, Amazon Managed Grafana automatically
-- creates the IAM roles and provisions the permissions that the workspace
-- needs to use Amazon Web Services data sources and notification channels.
--
-- If you specify @CUSTOMER_MANAGED@, you will manage those roles and
-- permissions yourself. If you are creating this workspace in a member
-- account of an organization that is not a delegated administrator
-- account, and you want the workspace to access data sources in other
-- Amazon Web Services accounts in the organization, you must choose
-- @CUSTOMER_MANAGED@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/grafana/latest/userguide/AMG-manage-permissions.html Amazon Managed Grafana permissions and policies for Amazon Web Services data sources and notification channels>
newCreateWorkspace ::
  -- | 'accountAccessType'
  AccountAccessType ->
  -- | 'permissionType'
  PermissionType ->
  CreateWorkspace
newCreateWorkspace :: AccountAccessType -> PermissionType -> CreateWorkspace
newCreateWorkspace
  AccountAccessType
pAccountAccessType_
  PermissionType
pPermissionType_ =
    CreateWorkspace' :: Maybe (Sensitive Text)
-> Maybe Text
-> Maybe [DataSourceType]
-> Maybe [NotificationDestinationType]
-> Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> Maybe (Sensitive Text)
-> Maybe Text
-> Maybe (Sensitive [Text])
-> AccountAccessType
-> [AuthenticationProviderTypes]
-> PermissionType
-> CreateWorkspace
CreateWorkspace'
      { $sel:workspaceRoleArn:CreateWorkspace' :: Maybe (Sensitive Text)
workspaceRoleArn =
          Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:clientToken:CreateWorkspace' :: Maybe Text
clientToken = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:workspaceDataSources:CreateWorkspace' :: Maybe [DataSourceType]
workspaceDataSources = Maybe [DataSourceType]
forall a. Maybe a
Prelude.Nothing,
        $sel:workspaceNotificationDestinations:CreateWorkspace' :: Maybe [NotificationDestinationType]
workspaceNotificationDestinations = Maybe [NotificationDestinationType]
forall a. Maybe a
Prelude.Nothing,
        $sel:workspaceName:CreateWorkspace' :: Maybe (Sensitive Text)
workspaceName = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:organizationRoleName:CreateWorkspace' :: Maybe (Sensitive Text)
organizationRoleName = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:workspaceDescription:CreateWorkspace' :: Maybe (Sensitive Text)
workspaceDescription = Maybe (Sensitive Text)
forall a. Maybe a
Prelude.Nothing,
        $sel:stackSetName:CreateWorkspace' :: Maybe Text
stackSetName = Maybe Text
forall a. Maybe a
Prelude.Nothing,
        $sel:workspaceOrganizationalUnits:CreateWorkspace' :: Maybe (Sensitive [Text])
workspaceOrganizationalUnits = Maybe (Sensitive [Text])
forall a. Maybe a
Prelude.Nothing,
        $sel:accountAccessType:CreateWorkspace' :: AccountAccessType
accountAccessType = AccountAccessType
pAccountAccessType_,
        $sel:authenticationProviders:CreateWorkspace' :: [AuthenticationProviderTypes]
authenticationProviders = [AuthenticationProviderTypes]
forall a. Monoid a => a
Prelude.mempty,
        $sel:permissionType:CreateWorkspace' :: PermissionType
permissionType = PermissionType
pPermissionType_
      }

-- | The workspace needs an IAM role that grants permissions to the Amazon
-- Web Services resources that the workspace will view data from. If you
-- already have a role that you want to use, specify it here. If you omit
-- this field and you specify some Amazon Web Services resources in
-- @workspaceDataSources@ or @workspaceNotificationDestinations@, a new IAM
-- role with the necessary permissions is automatically created.
createWorkspace_workspaceRoleArn :: Lens.Lens' CreateWorkspace (Prelude.Maybe Prelude.Text)
createWorkspace_workspaceRoleArn :: (Maybe Text -> f (Maybe Text))
-> CreateWorkspace -> f CreateWorkspace
createWorkspace_workspaceRoleArn = (CreateWorkspace -> Maybe (Sensitive Text))
-> (CreateWorkspace -> Maybe (Sensitive Text) -> CreateWorkspace)
-> Lens
     CreateWorkspace
     CreateWorkspace
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkspace' {Maybe (Sensitive Text)
workspaceRoleArn :: Maybe (Sensitive Text)
$sel:workspaceRoleArn:CreateWorkspace' :: CreateWorkspace -> Maybe (Sensitive Text)
workspaceRoleArn} -> Maybe (Sensitive Text)
workspaceRoleArn) (\s :: CreateWorkspace
s@CreateWorkspace' {} Maybe (Sensitive Text)
a -> CreateWorkspace
s {$sel:workspaceRoleArn:CreateWorkspace' :: Maybe (Sensitive Text)
workspaceRoleArn = Maybe (Sensitive Text)
a} :: CreateWorkspace) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> CreateWorkspace -> f CreateWorkspace)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateWorkspace
-> f CreateWorkspace
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | A unique, case-sensitive, user-provided identifier to ensure the
-- idempotency of the request.
createWorkspace_clientToken :: Lens.Lens' CreateWorkspace (Prelude.Maybe Prelude.Text)
createWorkspace_clientToken :: (Maybe Text -> f (Maybe Text))
-> CreateWorkspace -> f CreateWorkspace
createWorkspace_clientToken = (CreateWorkspace -> Maybe Text)
-> (CreateWorkspace -> Maybe Text -> CreateWorkspace)
-> Lens CreateWorkspace CreateWorkspace (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkspace' {Maybe Text
clientToken :: Maybe Text
$sel:clientToken:CreateWorkspace' :: CreateWorkspace -> Maybe Text
clientToken} -> Maybe Text
clientToken) (\s :: CreateWorkspace
s@CreateWorkspace' {} Maybe Text
a -> CreateWorkspace
s {$sel:clientToken:CreateWorkspace' :: Maybe Text
clientToken = Maybe Text
a} :: CreateWorkspace)

-- | Specify the Amazon Web Services data sources that you want to be queried
-- in this workspace. Specifying these data sources here enables Amazon
-- Managed Grafana to create IAM roles and permissions that allow Amazon
-- Managed Grafana to read data from these sources. You must still add them
-- as data sources in the Grafana console in the workspace.
--
-- If you don\'t specify a data source here, you can still add it as a data
-- source in the workspace console later. However, you will then have to
-- manually configure permissions for it.
createWorkspace_workspaceDataSources :: Lens.Lens' CreateWorkspace (Prelude.Maybe [DataSourceType])
createWorkspace_workspaceDataSources :: (Maybe [DataSourceType] -> f (Maybe [DataSourceType]))
-> CreateWorkspace -> f CreateWorkspace
createWorkspace_workspaceDataSources = (CreateWorkspace -> Maybe [DataSourceType])
-> (CreateWorkspace -> Maybe [DataSourceType] -> CreateWorkspace)
-> Lens
     CreateWorkspace
     CreateWorkspace
     (Maybe [DataSourceType])
     (Maybe [DataSourceType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkspace' {Maybe [DataSourceType]
workspaceDataSources :: Maybe [DataSourceType]
$sel:workspaceDataSources:CreateWorkspace' :: CreateWorkspace -> Maybe [DataSourceType]
workspaceDataSources} -> Maybe [DataSourceType]
workspaceDataSources) (\s :: CreateWorkspace
s@CreateWorkspace' {} Maybe [DataSourceType]
a -> CreateWorkspace
s {$sel:workspaceDataSources:CreateWorkspace' :: Maybe [DataSourceType]
workspaceDataSources = Maybe [DataSourceType]
a} :: CreateWorkspace) ((Maybe [DataSourceType] -> f (Maybe [DataSourceType]))
 -> CreateWorkspace -> f CreateWorkspace)
-> ((Maybe [DataSourceType] -> f (Maybe [DataSourceType]))
    -> Maybe [DataSourceType] -> f (Maybe [DataSourceType]))
-> (Maybe [DataSourceType] -> f (Maybe [DataSourceType]))
-> CreateWorkspace
-> f CreateWorkspace
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [DataSourceType] [DataSourceType] [DataSourceType] [DataSourceType]
-> Iso
     (Maybe [DataSourceType])
     (Maybe [DataSourceType])
     (Maybe [DataSourceType])
     (Maybe [DataSourceType])
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
  [DataSourceType] [DataSourceType] [DataSourceType] [DataSourceType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | Specify the Amazon Web Services notification channels that you plan to
-- use in this workspace. Specifying these data sources here enables Amazon
-- Managed Grafana to create IAM roles and permissions that allow Amazon
-- Managed Grafana to use these channels.
createWorkspace_workspaceNotificationDestinations :: Lens.Lens' CreateWorkspace (Prelude.Maybe [NotificationDestinationType])
createWorkspace_workspaceNotificationDestinations :: (Maybe [NotificationDestinationType]
 -> f (Maybe [NotificationDestinationType]))
-> CreateWorkspace -> f CreateWorkspace
createWorkspace_workspaceNotificationDestinations = (CreateWorkspace -> Maybe [NotificationDestinationType])
-> (CreateWorkspace
    -> Maybe [NotificationDestinationType] -> CreateWorkspace)
-> Lens
     CreateWorkspace
     CreateWorkspace
     (Maybe [NotificationDestinationType])
     (Maybe [NotificationDestinationType])
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkspace' {Maybe [NotificationDestinationType]
workspaceNotificationDestinations :: Maybe [NotificationDestinationType]
$sel:workspaceNotificationDestinations:CreateWorkspace' :: CreateWorkspace -> Maybe [NotificationDestinationType]
workspaceNotificationDestinations} -> Maybe [NotificationDestinationType]
workspaceNotificationDestinations) (\s :: CreateWorkspace
s@CreateWorkspace' {} Maybe [NotificationDestinationType]
a -> CreateWorkspace
s {$sel:workspaceNotificationDestinations:CreateWorkspace' :: Maybe [NotificationDestinationType]
workspaceNotificationDestinations = Maybe [NotificationDestinationType]
a} :: CreateWorkspace) ((Maybe [NotificationDestinationType]
  -> f (Maybe [NotificationDestinationType]))
 -> CreateWorkspace -> f CreateWorkspace)
-> ((Maybe [NotificationDestinationType]
     -> f (Maybe [NotificationDestinationType]))
    -> Maybe [NotificationDestinationType]
    -> f (Maybe [NotificationDestinationType]))
-> (Maybe [NotificationDestinationType]
    -> f (Maybe [NotificationDestinationType]))
-> CreateWorkspace
-> f CreateWorkspace
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  [NotificationDestinationType]
  [NotificationDestinationType]
  [NotificationDestinationType]
  [NotificationDestinationType]
-> Iso
     (Maybe [NotificationDestinationType])
     (Maybe [NotificationDestinationType])
     (Maybe [NotificationDestinationType])
     (Maybe [NotificationDestinationType])
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
  [NotificationDestinationType]
  [NotificationDestinationType]
  [NotificationDestinationType]
  [NotificationDestinationType]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The name for the workspace. It does not have to be unique.
createWorkspace_workspaceName :: Lens.Lens' CreateWorkspace (Prelude.Maybe Prelude.Text)
createWorkspace_workspaceName :: (Maybe Text -> f (Maybe Text))
-> CreateWorkspace -> f CreateWorkspace
createWorkspace_workspaceName = (CreateWorkspace -> Maybe (Sensitive Text))
-> (CreateWorkspace -> Maybe (Sensitive Text) -> CreateWorkspace)
-> Lens
     CreateWorkspace
     CreateWorkspace
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkspace' {Maybe (Sensitive Text)
workspaceName :: Maybe (Sensitive Text)
$sel:workspaceName:CreateWorkspace' :: CreateWorkspace -> Maybe (Sensitive Text)
workspaceName} -> Maybe (Sensitive Text)
workspaceName) (\s :: CreateWorkspace
s@CreateWorkspace' {} Maybe (Sensitive Text)
a -> CreateWorkspace
s {$sel:workspaceName:CreateWorkspace' :: Maybe (Sensitive Text)
workspaceName = Maybe (Sensitive Text)
a} :: CreateWorkspace) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> CreateWorkspace -> f CreateWorkspace)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateWorkspace
-> f CreateWorkspace
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The name of an IAM role that already exists to use with Organizations to
-- access Amazon Web Services data sources and notification channels in
-- other accounts in an organization.
createWorkspace_organizationRoleName :: Lens.Lens' CreateWorkspace (Prelude.Maybe Prelude.Text)
createWorkspace_organizationRoleName :: (Maybe Text -> f (Maybe Text))
-> CreateWorkspace -> f CreateWorkspace
createWorkspace_organizationRoleName = (CreateWorkspace -> Maybe (Sensitive Text))
-> (CreateWorkspace -> Maybe (Sensitive Text) -> CreateWorkspace)
-> Lens
     CreateWorkspace
     CreateWorkspace
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkspace' {Maybe (Sensitive Text)
organizationRoleName :: Maybe (Sensitive Text)
$sel:organizationRoleName:CreateWorkspace' :: CreateWorkspace -> Maybe (Sensitive Text)
organizationRoleName} -> Maybe (Sensitive Text)
organizationRoleName) (\s :: CreateWorkspace
s@CreateWorkspace' {} Maybe (Sensitive Text)
a -> CreateWorkspace
s {$sel:organizationRoleName:CreateWorkspace' :: Maybe (Sensitive Text)
organizationRoleName = Maybe (Sensitive Text)
a} :: CreateWorkspace) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> CreateWorkspace -> f CreateWorkspace)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateWorkspace
-> f CreateWorkspace
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | A description for the workspace. This is used only to help you identify
-- this workspace.
createWorkspace_workspaceDescription :: Lens.Lens' CreateWorkspace (Prelude.Maybe Prelude.Text)
createWorkspace_workspaceDescription :: (Maybe Text -> f (Maybe Text))
-> CreateWorkspace -> f CreateWorkspace
createWorkspace_workspaceDescription = (CreateWorkspace -> Maybe (Sensitive Text))
-> (CreateWorkspace -> Maybe (Sensitive Text) -> CreateWorkspace)
-> Lens
     CreateWorkspace
     CreateWorkspace
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkspace' {Maybe (Sensitive Text)
workspaceDescription :: Maybe (Sensitive Text)
$sel:workspaceDescription:CreateWorkspace' :: CreateWorkspace -> Maybe (Sensitive Text)
workspaceDescription} -> Maybe (Sensitive Text)
workspaceDescription) (\s :: CreateWorkspace
s@CreateWorkspace' {} Maybe (Sensitive Text)
a -> CreateWorkspace
s {$sel:workspaceDescription:CreateWorkspace' :: Maybe (Sensitive Text)
workspaceDescription = Maybe (Sensitive Text)
a} :: CreateWorkspace) ((Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
 -> CreateWorkspace -> f CreateWorkspace)
-> ((Maybe Text -> f (Maybe Text))
    -> Maybe (Sensitive Text) -> f (Maybe (Sensitive Text)))
-> (Maybe Text -> f (Maybe Text))
-> CreateWorkspace
-> f CreateWorkspace
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive Text) (Sensitive Text) Text Text
-> Iso
     (Maybe (Sensitive Text))
     (Maybe (Sensitive Text))
     (Maybe Text)
     (Maybe 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 (Sensitive Text) (Sensitive Text) Text Text
forall a. Iso' (Sensitive a) a
Core._Sensitive

-- | The name of the CloudFormation stack set to use to generate IAM roles to
-- be used for this workspace.
createWorkspace_stackSetName :: Lens.Lens' CreateWorkspace (Prelude.Maybe Prelude.Text)
createWorkspace_stackSetName :: (Maybe Text -> f (Maybe Text))
-> CreateWorkspace -> f CreateWorkspace
createWorkspace_stackSetName = (CreateWorkspace -> Maybe Text)
-> (CreateWorkspace -> Maybe Text -> CreateWorkspace)
-> Lens CreateWorkspace CreateWorkspace (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkspace' {Maybe Text
stackSetName :: Maybe Text
$sel:stackSetName:CreateWorkspace' :: CreateWorkspace -> Maybe Text
stackSetName} -> Maybe Text
stackSetName) (\s :: CreateWorkspace
s@CreateWorkspace' {} Maybe Text
a -> CreateWorkspace
s {$sel:stackSetName:CreateWorkspace' :: Maybe Text
stackSetName = Maybe Text
a} :: CreateWorkspace)

-- | Specifies the organizational units that this workspace is allowed to use
-- data sources from, if this workspace is in an account that is part of an
-- organization.
createWorkspace_workspaceOrganizationalUnits :: Lens.Lens' CreateWorkspace (Prelude.Maybe [Prelude.Text])
createWorkspace_workspaceOrganizationalUnits :: (Maybe [Text] -> f (Maybe [Text]))
-> CreateWorkspace -> f CreateWorkspace
createWorkspace_workspaceOrganizationalUnits = (CreateWorkspace -> Maybe (Sensitive [Text]))
-> (CreateWorkspace -> Maybe (Sensitive [Text]) -> CreateWorkspace)
-> Lens
     CreateWorkspace
     CreateWorkspace
     (Maybe (Sensitive [Text]))
     (Maybe (Sensitive [Text]))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkspace' {Maybe (Sensitive [Text])
workspaceOrganizationalUnits :: Maybe (Sensitive [Text])
$sel:workspaceOrganizationalUnits:CreateWorkspace' :: CreateWorkspace -> Maybe (Sensitive [Text])
workspaceOrganizationalUnits} -> Maybe (Sensitive [Text])
workspaceOrganizationalUnits) (\s :: CreateWorkspace
s@CreateWorkspace' {} Maybe (Sensitive [Text])
a -> CreateWorkspace
s {$sel:workspaceOrganizationalUnits:CreateWorkspace' :: Maybe (Sensitive [Text])
workspaceOrganizationalUnits = Maybe (Sensitive [Text])
a} :: CreateWorkspace) ((Maybe (Sensitive [Text]) -> f (Maybe (Sensitive [Text])))
 -> CreateWorkspace -> f CreateWorkspace)
-> ((Maybe [Text] -> f (Maybe [Text]))
    -> Maybe (Sensitive [Text]) -> f (Maybe (Sensitive [Text])))
-> (Maybe [Text] -> f (Maybe [Text]))
-> CreateWorkspace
-> f CreateWorkspace
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (Sensitive [Text]) (Sensitive [Text]) [Text] [Text]
-> Iso
     (Maybe (Sensitive [Text]))
     (Maybe (Sensitive [Text]))
     (Maybe [Text])
     (Maybe [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 (Sensitive [Text]) (Sensitive [Text]) [Text] [Text]
forall a. Iso' (Sensitive a) a
Core._Sensitive AnIso (Sensitive [Text]) (Sensitive [Text]) [Text] [Text]
-> (Exchange [Text] [Text] [Text] (Identity [Text])
    -> Exchange [Text] [Text] [Text] (Identity [Text]))
-> AnIso (Sensitive [Text]) (Sensitive [Text]) [Text] [Text]
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. Exchange [Text] [Text] [Text] (Identity [Text])
-> Exchange [Text] [Text] [Text] (Identity [Text])
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced)

-- | Specifies whether the workspace can access Amazon Web Services resources
-- in this Amazon Web Services account only, or whether it can also access
-- Amazon Web Services resources in other accounts in the same
-- organization. If you specify @ORGANIZATION@, you must specify which
-- organizational units the workspace can access in the
-- @workspaceOrganizationalUnits@ parameter.
createWorkspace_accountAccessType :: Lens.Lens' CreateWorkspace AccountAccessType
createWorkspace_accountAccessType :: (AccountAccessType -> f AccountAccessType)
-> CreateWorkspace -> f CreateWorkspace
createWorkspace_accountAccessType = (CreateWorkspace -> AccountAccessType)
-> (CreateWorkspace -> AccountAccessType -> CreateWorkspace)
-> Lens
     CreateWorkspace CreateWorkspace AccountAccessType AccountAccessType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkspace' {AccountAccessType
accountAccessType :: AccountAccessType
$sel:accountAccessType:CreateWorkspace' :: CreateWorkspace -> AccountAccessType
accountAccessType} -> AccountAccessType
accountAccessType) (\s :: CreateWorkspace
s@CreateWorkspace' {} AccountAccessType
a -> CreateWorkspace
s {$sel:accountAccessType:CreateWorkspace' :: AccountAccessType
accountAccessType = AccountAccessType
a} :: CreateWorkspace)

-- | Specifies whether this workspace uses SAML 2.0, Amazon Web Services
-- Single Sign On, or both to authenticate users for using the Grafana
-- console within a workspace. For more information, see
-- <https://docs.aws.amazon.com/grafana/latest/userguide/authentication-in-AMG.html User authentication in Amazon Managed Grafana>.
createWorkspace_authenticationProviders :: Lens.Lens' CreateWorkspace [AuthenticationProviderTypes]
createWorkspace_authenticationProviders :: ([AuthenticationProviderTypes] -> f [AuthenticationProviderTypes])
-> CreateWorkspace -> f CreateWorkspace
createWorkspace_authenticationProviders = (CreateWorkspace -> [AuthenticationProviderTypes])
-> (CreateWorkspace
    -> [AuthenticationProviderTypes] -> CreateWorkspace)
-> Lens
     CreateWorkspace
     CreateWorkspace
     [AuthenticationProviderTypes]
     [AuthenticationProviderTypes]
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkspace' {[AuthenticationProviderTypes]
authenticationProviders :: [AuthenticationProviderTypes]
$sel:authenticationProviders:CreateWorkspace' :: CreateWorkspace -> [AuthenticationProviderTypes]
authenticationProviders} -> [AuthenticationProviderTypes]
authenticationProviders) (\s :: CreateWorkspace
s@CreateWorkspace' {} [AuthenticationProviderTypes]
a -> CreateWorkspace
s {$sel:authenticationProviders:CreateWorkspace' :: [AuthenticationProviderTypes]
authenticationProviders = [AuthenticationProviderTypes]
a} :: CreateWorkspace) (([AuthenticationProviderTypes] -> f [AuthenticationProviderTypes])
 -> CreateWorkspace -> f CreateWorkspace)
-> (([AuthenticationProviderTypes]
     -> f [AuthenticationProviderTypes])
    -> [AuthenticationProviderTypes]
    -> f [AuthenticationProviderTypes])
-> ([AuthenticationProviderTypes]
    -> f [AuthenticationProviderTypes])
-> CreateWorkspace
-> f CreateWorkspace
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. ([AuthenticationProviderTypes] -> f [AuthenticationProviderTypes])
-> [AuthenticationProviderTypes] -> f [AuthenticationProviderTypes]
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | If you specify @Service Managed@, Amazon Managed Grafana automatically
-- creates the IAM roles and provisions the permissions that the workspace
-- needs to use Amazon Web Services data sources and notification channels.
--
-- If you specify @CUSTOMER_MANAGED@, you will manage those roles and
-- permissions yourself. If you are creating this workspace in a member
-- account of an organization that is not a delegated administrator
-- account, and you want the workspace to access data sources in other
-- Amazon Web Services accounts in the organization, you must choose
-- @CUSTOMER_MANAGED@.
--
-- For more information, see
-- <https://docs.aws.amazon.com/grafana/latest/userguide/AMG-manage-permissions.html Amazon Managed Grafana permissions and policies for Amazon Web Services data sources and notification channels>
createWorkspace_permissionType :: Lens.Lens' CreateWorkspace PermissionType
createWorkspace_permissionType :: (PermissionType -> f PermissionType)
-> CreateWorkspace -> f CreateWorkspace
createWorkspace_permissionType = (CreateWorkspace -> PermissionType)
-> (CreateWorkspace -> PermissionType -> CreateWorkspace)
-> Lens
     CreateWorkspace CreateWorkspace PermissionType PermissionType
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkspace' {PermissionType
permissionType :: PermissionType
$sel:permissionType:CreateWorkspace' :: CreateWorkspace -> PermissionType
permissionType} -> PermissionType
permissionType) (\s :: CreateWorkspace
s@CreateWorkspace' {} PermissionType
a -> CreateWorkspace
s {$sel:permissionType:CreateWorkspace' :: PermissionType
permissionType = PermissionType
a} :: CreateWorkspace)

instance Core.AWSRequest CreateWorkspace where
  type
    AWSResponse CreateWorkspace =
      CreateWorkspaceResponse
  request :: CreateWorkspace -> Request CreateWorkspace
request = Service -> CreateWorkspace -> Request CreateWorkspace
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateWorkspace
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateWorkspace)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateWorkspace))
-> Logger
-> Service
-> Proxy CreateWorkspace
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateWorkspace)))
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 ->
          Int -> WorkspaceDescription -> CreateWorkspaceResponse
CreateWorkspaceResponse'
            (Int -> WorkspaceDescription -> CreateWorkspaceResponse)
-> Either String Int
-> Either String (WorkspaceDescription -> CreateWorkspaceResponse)
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> (Int -> Either String Int
forall (f :: * -> *) a. Applicative f => a -> f a
Prelude.pure (Int -> Int
forall a. Enum a => a -> Int
Prelude.fromEnum Int
s))
            Either String (WorkspaceDescription -> CreateWorkspaceResponse)
-> Either String WorkspaceDescription
-> Either String CreateWorkspaceResponse
forall (f :: * -> *) a b. Applicative f => f (a -> b) -> f a -> f b
Prelude.<*> (Object
x Object -> Text -> Either String WorkspaceDescription
forall a. FromJSON a => Object -> Text -> Either String a
Core..:> Text
"workspace")
      )

instance Prelude.Hashable CreateWorkspace

instance Prelude.NFData CreateWorkspace

instance Core.ToHeaders CreateWorkspace where
  toHeaders :: CreateWorkspace -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateWorkspace -> 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 CreateWorkspace where
  toJSON :: CreateWorkspace -> Value
toJSON CreateWorkspace' {[AuthenticationProviderTypes]
Maybe [DataSourceType]
Maybe [NotificationDestinationType]
Maybe Text
Maybe (Sensitive [Text])
Maybe (Sensitive Text)
AccountAccessType
PermissionType
permissionType :: PermissionType
authenticationProviders :: [AuthenticationProviderTypes]
accountAccessType :: AccountAccessType
workspaceOrganizationalUnits :: Maybe (Sensitive [Text])
stackSetName :: Maybe Text
workspaceDescription :: Maybe (Sensitive Text)
organizationRoleName :: Maybe (Sensitive Text)
workspaceName :: Maybe (Sensitive Text)
workspaceNotificationDestinations :: Maybe [NotificationDestinationType]
workspaceDataSources :: Maybe [DataSourceType]
clientToken :: Maybe Text
workspaceRoleArn :: Maybe (Sensitive Text)
$sel:permissionType:CreateWorkspace' :: CreateWorkspace -> PermissionType
$sel:authenticationProviders:CreateWorkspace' :: CreateWorkspace -> [AuthenticationProviderTypes]
$sel:accountAccessType:CreateWorkspace' :: CreateWorkspace -> AccountAccessType
$sel:workspaceOrganizationalUnits:CreateWorkspace' :: CreateWorkspace -> Maybe (Sensitive [Text])
$sel:stackSetName:CreateWorkspace' :: CreateWorkspace -> Maybe Text
$sel:workspaceDescription:CreateWorkspace' :: CreateWorkspace -> Maybe (Sensitive Text)
$sel:organizationRoleName:CreateWorkspace' :: CreateWorkspace -> Maybe (Sensitive Text)
$sel:workspaceName:CreateWorkspace' :: CreateWorkspace -> Maybe (Sensitive Text)
$sel:workspaceNotificationDestinations:CreateWorkspace' :: CreateWorkspace -> Maybe [NotificationDestinationType]
$sel:workspaceDataSources:CreateWorkspace' :: CreateWorkspace -> Maybe [DataSourceType]
$sel:clientToken:CreateWorkspace' :: CreateWorkspace -> Maybe Text
$sel:workspaceRoleArn:CreateWorkspace' :: CreateWorkspace -> Maybe (Sensitive Text)
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"workspaceRoleArn" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
workspaceRoleArn,
            (Text
"clientToken" 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
clientToken,
            (Text
"workspaceDataSources" Text -> [DataSourceType] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([DataSourceType] -> Pair) -> Maybe [DataSourceType] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [DataSourceType]
workspaceDataSources,
            (Text
"workspaceNotificationDestinations" Text -> [NotificationDestinationType] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              ([NotificationDestinationType] -> Pair)
-> Maybe [NotificationDestinationType] -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe [NotificationDestinationType]
workspaceNotificationDestinations,
            (Text
"workspaceName" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
workspaceName,
            (Text
"organizationRoleName" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
organizationRoleName,
            (Text
"workspaceDescription" Text -> Sensitive Text -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Sensitive Text -> Pair) -> Maybe (Sensitive Text) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive Text)
workspaceDescription,
            (Text
"stackSetName" 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
stackSetName,
            (Text
"workspaceOrganizationalUnits" Text -> Sensitive [Text] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=)
              (Sensitive [Text] -> Pair)
-> Maybe (Sensitive [Text]) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (Sensitive [Text])
workspaceOrganizationalUnits,
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"accountAccessType" Text -> AccountAccessType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= AccountAccessType
accountAccessType),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              ( Text
"authenticationProviders"
                  Text -> [AuthenticationProviderTypes] -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= [AuthenticationProviderTypes]
authenticationProviders
              ),
            Pair -> Maybe Pair
forall a. a -> Maybe a
Prelude.Just
              (Text
"permissionType" Text -> PermissionType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..= PermissionType
permissionType)
          ]
      )

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

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

-- | /See:/ 'newCreateWorkspaceResponse' smart constructor.
data CreateWorkspaceResponse = CreateWorkspaceResponse'
  { -- | The response's http status code.
    CreateWorkspaceResponse -> Int
httpStatus :: Prelude.Int,
    -- | A structure containing data about the workspace that was created.
    CreateWorkspaceResponse -> WorkspaceDescription
workspace :: WorkspaceDescription
  }
  deriving (CreateWorkspaceResponse -> CreateWorkspaceResponse -> Bool
(CreateWorkspaceResponse -> CreateWorkspaceResponse -> Bool)
-> (CreateWorkspaceResponse -> CreateWorkspaceResponse -> Bool)
-> Eq CreateWorkspaceResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateWorkspaceResponse -> CreateWorkspaceResponse -> Bool
$c/= :: CreateWorkspaceResponse -> CreateWorkspaceResponse -> Bool
== :: CreateWorkspaceResponse -> CreateWorkspaceResponse -> Bool
$c== :: CreateWorkspaceResponse -> CreateWorkspaceResponse -> Bool
Prelude.Eq, Int -> CreateWorkspaceResponse -> ShowS
[CreateWorkspaceResponse] -> ShowS
CreateWorkspaceResponse -> String
(Int -> CreateWorkspaceResponse -> ShowS)
-> (CreateWorkspaceResponse -> String)
-> ([CreateWorkspaceResponse] -> ShowS)
-> Show CreateWorkspaceResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateWorkspaceResponse] -> ShowS
$cshowList :: [CreateWorkspaceResponse] -> ShowS
show :: CreateWorkspaceResponse -> String
$cshow :: CreateWorkspaceResponse -> String
showsPrec :: Int -> CreateWorkspaceResponse -> ShowS
$cshowsPrec :: Int -> CreateWorkspaceResponse -> ShowS
Prelude.Show, (forall x.
 CreateWorkspaceResponse -> Rep CreateWorkspaceResponse x)
-> (forall x.
    Rep CreateWorkspaceResponse x -> CreateWorkspaceResponse)
-> Generic CreateWorkspaceResponse
forall x. Rep CreateWorkspaceResponse x -> CreateWorkspaceResponse
forall x. CreateWorkspaceResponse -> Rep CreateWorkspaceResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateWorkspaceResponse x -> CreateWorkspaceResponse
$cfrom :: forall x. CreateWorkspaceResponse -> Rep CreateWorkspaceResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateWorkspaceResponse' 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:
--
-- 'httpStatus', 'createWorkspaceResponse_httpStatus' - The response's http status code.
--
-- 'workspace', 'createWorkspaceResponse_workspace' - A structure containing data about the workspace that was created.
newCreateWorkspaceResponse ::
  -- | 'httpStatus'
  Prelude.Int ->
  -- | 'workspace'
  WorkspaceDescription ->
  CreateWorkspaceResponse
newCreateWorkspaceResponse :: Int -> WorkspaceDescription -> CreateWorkspaceResponse
newCreateWorkspaceResponse Int
pHttpStatus_ WorkspaceDescription
pWorkspace_ =
  CreateWorkspaceResponse' :: Int -> WorkspaceDescription -> CreateWorkspaceResponse
CreateWorkspaceResponse'
    { $sel:httpStatus:CreateWorkspaceResponse' :: Int
httpStatus = Int
pHttpStatus_,
      $sel:workspace:CreateWorkspaceResponse' :: WorkspaceDescription
workspace = WorkspaceDescription
pWorkspace_
    }

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

-- | A structure containing data about the workspace that was created.
createWorkspaceResponse_workspace :: Lens.Lens' CreateWorkspaceResponse WorkspaceDescription
createWorkspaceResponse_workspace :: (WorkspaceDescription -> f WorkspaceDescription)
-> CreateWorkspaceResponse -> f CreateWorkspaceResponse
createWorkspaceResponse_workspace = (CreateWorkspaceResponse -> WorkspaceDescription)
-> (CreateWorkspaceResponse
    -> WorkspaceDescription -> CreateWorkspaceResponse)
-> Lens
     CreateWorkspaceResponse
     CreateWorkspaceResponse
     WorkspaceDescription
     WorkspaceDescription
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateWorkspaceResponse' {WorkspaceDescription
workspace :: WorkspaceDescription
$sel:workspace:CreateWorkspaceResponse' :: CreateWorkspaceResponse -> WorkspaceDescription
workspace} -> WorkspaceDescription
workspace) (\s :: CreateWorkspaceResponse
s@CreateWorkspaceResponse' {} WorkspaceDescription
a -> CreateWorkspaceResponse
s {$sel:workspace:CreateWorkspaceResponse' :: WorkspaceDescription
workspace = WorkspaceDescription
a} :: CreateWorkspaceResponse)

instance Prelude.NFData CreateWorkspaceResponse