{-# 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.QuickSight.CreateFolder
-- 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 an empty shared folder.
module Amazonka.QuickSight.CreateFolder
  ( -- * Creating a Request
    CreateFolder (..),
    newCreateFolder,

    -- * Request Lenses
    createFolder_parentFolderArn,
    createFolder_name,
    createFolder_permissions,
    createFolder_folderType,
    createFolder_tags,
    createFolder_awsAccountId,
    createFolder_folderId,

    -- * Destructuring the Response
    CreateFolderResponse (..),
    newCreateFolderResponse,

    -- * Response Lenses
    createFolderResponse_requestId,
    createFolderResponse_arn,
    createFolderResponse_folderId,
    createFolderResponse_status,
  )
where

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

-- | /See:/ 'newCreateFolder' smart constructor.
data CreateFolder = CreateFolder'
  { -- | The Amazon Resource Name (ARN) for the parent folder.
    --
    -- @ParentFolderArn@ can be null. An empty @parentFolderArn@ creates a
    -- root-level folder.
    CreateFolder -> Maybe Text
parentFolderArn :: Prelude.Maybe Prelude.Text,
    -- | The name of the folder.
    CreateFolder -> Maybe Text
name :: Prelude.Maybe Prelude.Text,
    -- | A structure that describes the principals and the resource-level
    -- permissions of a folder.
    --
    -- To specify no permissions, omit @Permissions@.
    CreateFolder -> Maybe (NonEmpty ResourcePermission)
permissions :: Prelude.Maybe (Prelude.NonEmpty ResourcePermission),
    -- | The type of folder. By default, @folderType@ is @SHARED@.
    CreateFolder -> Maybe FolderType
folderType :: Prelude.Maybe FolderType,
    -- | Tags for the folder.
    CreateFolder -> Maybe (NonEmpty Tag)
tags :: Prelude.Maybe (Prelude.NonEmpty Tag),
    -- | The AWS Account ID.
    CreateFolder -> Text
awsAccountId :: Prelude.Text,
    -- | The folder ID.
    CreateFolder -> Text
folderId :: Prelude.Text
  }
  deriving (CreateFolder -> CreateFolder -> Bool
(CreateFolder -> CreateFolder -> Bool)
-> (CreateFolder -> CreateFolder -> Bool) -> Eq CreateFolder
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateFolder -> CreateFolder -> Bool
$c/= :: CreateFolder -> CreateFolder -> Bool
== :: CreateFolder -> CreateFolder -> Bool
$c== :: CreateFolder -> CreateFolder -> Bool
Prelude.Eq, ReadPrec [CreateFolder]
ReadPrec CreateFolder
Int -> ReadS CreateFolder
ReadS [CreateFolder]
(Int -> ReadS CreateFolder)
-> ReadS [CreateFolder]
-> ReadPrec CreateFolder
-> ReadPrec [CreateFolder]
-> Read CreateFolder
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateFolder]
$creadListPrec :: ReadPrec [CreateFolder]
readPrec :: ReadPrec CreateFolder
$creadPrec :: ReadPrec CreateFolder
readList :: ReadS [CreateFolder]
$creadList :: ReadS [CreateFolder]
readsPrec :: Int -> ReadS CreateFolder
$creadsPrec :: Int -> ReadS CreateFolder
Prelude.Read, Int -> CreateFolder -> ShowS
[CreateFolder] -> ShowS
CreateFolder -> String
(Int -> CreateFolder -> ShowS)
-> (CreateFolder -> String)
-> ([CreateFolder] -> ShowS)
-> Show CreateFolder
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateFolder] -> ShowS
$cshowList :: [CreateFolder] -> ShowS
show :: CreateFolder -> String
$cshow :: CreateFolder -> String
showsPrec :: Int -> CreateFolder -> ShowS
$cshowsPrec :: Int -> CreateFolder -> ShowS
Prelude.Show, (forall x. CreateFolder -> Rep CreateFolder x)
-> (forall x. Rep CreateFolder x -> CreateFolder)
-> Generic CreateFolder
forall x. Rep CreateFolder x -> CreateFolder
forall x. CreateFolder -> Rep CreateFolder x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateFolder x -> CreateFolder
$cfrom :: forall x. CreateFolder -> Rep CreateFolder x
Prelude.Generic)

-- |
-- Create a value of 'CreateFolder' 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:
--
-- 'parentFolderArn', 'createFolder_parentFolderArn' - The Amazon Resource Name (ARN) for the parent folder.
--
-- @ParentFolderArn@ can be null. An empty @parentFolderArn@ creates a
-- root-level folder.
--
-- 'name', 'createFolder_name' - The name of the folder.
--
-- 'permissions', 'createFolder_permissions' - A structure that describes the principals and the resource-level
-- permissions of a folder.
--
-- To specify no permissions, omit @Permissions@.
--
-- 'folderType', 'createFolder_folderType' - The type of folder. By default, @folderType@ is @SHARED@.
--
-- 'tags', 'createFolder_tags' - Tags for the folder.
--
-- 'awsAccountId', 'createFolder_awsAccountId' - The AWS Account ID.
--
-- 'folderId', 'createFolder_folderId' - The folder ID.
newCreateFolder ::
  -- | 'awsAccountId'
  Prelude.Text ->
  -- | 'folderId'
  Prelude.Text ->
  CreateFolder
newCreateFolder :: Text -> Text -> CreateFolder
newCreateFolder Text
pAwsAccountId_ Text
pFolderId_ =
  CreateFolder' :: Maybe Text
-> Maybe Text
-> Maybe (NonEmpty ResourcePermission)
-> Maybe FolderType
-> Maybe (NonEmpty Tag)
-> Text
-> Text
-> CreateFolder
CreateFolder'
    { $sel:parentFolderArn:CreateFolder' :: Maybe Text
parentFolderArn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:name:CreateFolder' :: Maybe Text
name = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:permissions:CreateFolder' :: Maybe (NonEmpty ResourcePermission)
permissions = Maybe (NonEmpty ResourcePermission)
forall a. Maybe a
Prelude.Nothing,
      $sel:folderType:CreateFolder' :: Maybe FolderType
folderType = Maybe FolderType
forall a. Maybe a
Prelude.Nothing,
      $sel:tags:CreateFolder' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
forall a. Maybe a
Prelude.Nothing,
      $sel:awsAccountId:CreateFolder' :: Text
awsAccountId = Text
pAwsAccountId_,
      $sel:folderId:CreateFolder' :: Text
folderId = Text
pFolderId_
    }

-- | The Amazon Resource Name (ARN) for the parent folder.
--
-- @ParentFolderArn@ can be null. An empty @parentFolderArn@ creates a
-- root-level folder.
createFolder_parentFolderArn :: Lens.Lens' CreateFolder (Prelude.Maybe Prelude.Text)
createFolder_parentFolderArn :: (Maybe Text -> f (Maybe Text)) -> CreateFolder -> f CreateFolder
createFolder_parentFolderArn = (CreateFolder -> Maybe Text)
-> (CreateFolder -> Maybe Text -> CreateFolder)
-> Lens CreateFolder CreateFolder (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFolder' {Maybe Text
parentFolderArn :: Maybe Text
$sel:parentFolderArn:CreateFolder' :: CreateFolder -> Maybe Text
parentFolderArn} -> Maybe Text
parentFolderArn) (\s :: CreateFolder
s@CreateFolder' {} Maybe Text
a -> CreateFolder
s {$sel:parentFolderArn:CreateFolder' :: Maybe Text
parentFolderArn = Maybe Text
a} :: CreateFolder)

-- | The name of the folder.
createFolder_name :: Lens.Lens' CreateFolder (Prelude.Maybe Prelude.Text)
createFolder_name :: (Maybe Text -> f (Maybe Text)) -> CreateFolder -> f CreateFolder
createFolder_name = (CreateFolder -> Maybe Text)
-> (CreateFolder -> Maybe Text -> CreateFolder)
-> Lens CreateFolder CreateFolder (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFolder' {Maybe Text
name :: Maybe Text
$sel:name:CreateFolder' :: CreateFolder -> Maybe Text
name} -> Maybe Text
name) (\s :: CreateFolder
s@CreateFolder' {} Maybe Text
a -> CreateFolder
s {$sel:name:CreateFolder' :: Maybe Text
name = Maybe Text
a} :: CreateFolder)

-- | A structure that describes the principals and the resource-level
-- permissions of a folder.
--
-- To specify no permissions, omit @Permissions@.
createFolder_permissions :: Lens.Lens' CreateFolder (Prelude.Maybe (Prelude.NonEmpty ResourcePermission))
createFolder_permissions :: (Maybe (NonEmpty ResourcePermission)
 -> f (Maybe (NonEmpty ResourcePermission)))
-> CreateFolder -> f CreateFolder
createFolder_permissions = (CreateFolder -> Maybe (NonEmpty ResourcePermission))
-> (CreateFolder
    -> Maybe (NonEmpty ResourcePermission) -> CreateFolder)
-> Lens
     CreateFolder
     CreateFolder
     (Maybe (NonEmpty ResourcePermission))
     (Maybe (NonEmpty ResourcePermission))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFolder' {Maybe (NonEmpty ResourcePermission)
permissions :: Maybe (NonEmpty ResourcePermission)
$sel:permissions:CreateFolder' :: CreateFolder -> Maybe (NonEmpty ResourcePermission)
permissions} -> Maybe (NonEmpty ResourcePermission)
permissions) (\s :: CreateFolder
s@CreateFolder' {} Maybe (NonEmpty ResourcePermission)
a -> CreateFolder
s {$sel:permissions:CreateFolder' :: Maybe (NonEmpty ResourcePermission)
permissions = Maybe (NonEmpty ResourcePermission)
a} :: CreateFolder) ((Maybe (NonEmpty ResourcePermission)
  -> f (Maybe (NonEmpty ResourcePermission)))
 -> CreateFolder -> f CreateFolder)
-> ((Maybe (NonEmpty ResourcePermission)
     -> f (Maybe (NonEmpty ResourcePermission)))
    -> Maybe (NonEmpty ResourcePermission)
    -> f (Maybe (NonEmpty ResourcePermission)))
-> (Maybe (NonEmpty ResourcePermission)
    -> f (Maybe (NonEmpty ResourcePermission)))
-> CreateFolder
-> f CreateFolder
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso
  (NonEmpty ResourcePermission)
  (NonEmpty ResourcePermission)
  (NonEmpty ResourcePermission)
  (NonEmpty ResourcePermission)
-> Iso
     (Maybe (NonEmpty ResourcePermission))
     (Maybe (NonEmpty ResourcePermission))
     (Maybe (NonEmpty ResourcePermission))
     (Maybe (NonEmpty ResourcePermission))
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
  (NonEmpty ResourcePermission)
  (NonEmpty ResourcePermission)
  (NonEmpty ResourcePermission)
  (NonEmpty ResourcePermission)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The type of folder. By default, @folderType@ is @SHARED@.
createFolder_folderType :: Lens.Lens' CreateFolder (Prelude.Maybe FolderType)
createFolder_folderType :: (Maybe FolderType -> f (Maybe FolderType))
-> CreateFolder -> f CreateFolder
createFolder_folderType = (CreateFolder -> Maybe FolderType)
-> (CreateFolder -> Maybe FolderType -> CreateFolder)
-> Lens
     CreateFolder CreateFolder (Maybe FolderType) (Maybe FolderType)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFolder' {Maybe FolderType
folderType :: Maybe FolderType
$sel:folderType:CreateFolder' :: CreateFolder -> Maybe FolderType
folderType} -> Maybe FolderType
folderType) (\s :: CreateFolder
s@CreateFolder' {} Maybe FolderType
a -> CreateFolder
s {$sel:folderType:CreateFolder' :: Maybe FolderType
folderType = Maybe FolderType
a} :: CreateFolder)

-- | Tags for the folder.
createFolder_tags :: Lens.Lens' CreateFolder (Prelude.Maybe (Prelude.NonEmpty Tag))
createFolder_tags :: (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateFolder -> f CreateFolder
createFolder_tags = (CreateFolder -> Maybe (NonEmpty Tag))
-> (CreateFolder -> Maybe (NonEmpty Tag) -> CreateFolder)
-> Lens
     CreateFolder
     CreateFolder
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFolder' {Maybe (NonEmpty Tag)
tags :: Maybe (NonEmpty Tag)
$sel:tags:CreateFolder' :: CreateFolder -> Maybe (NonEmpty Tag)
tags} -> Maybe (NonEmpty Tag)
tags) (\s :: CreateFolder
s@CreateFolder' {} Maybe (NonEmpty Tag)
a -> CreateFolder
s {$sel:tags:CreateFolder' :: Maybe (NonEmpty Tag)
tags = Maybe (NonEmpty Tag)
a} :: CreateFolder) ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
 -> CreateFolder -> f CreateFolder)
-> ((Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
    -> Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> (Maybe (NonEmpty Tag) -> f (Maybe (NonEmpty Tag)))
-> CreateFolder
-> f CreateFolder
forall b c a. (b -> c) -> (a -> b) -> a -> c
Prelude.. AnIso (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
-> Iso
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty Tag))
     (Maybe (NonEmpty 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 (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag) (NonEmpty Tag)
forall s t a b. (Coercible s a, Coercible t b) => Iso s t a b
Lens.coerced

-- | The AWS Account ID.
createFolder_awsAccountId :: Lens.Lens' CreateFolder Prelude.Text
createFolder_awsAccountId :: (Text -> f Text) -> CreateFolder -> f CreateFolder
createFolder_awsAccountId = (CreateFolder -> Text)
-> (CreateFolder -> Text -> CreateFolder)
-> Lens CreateFolder CreateFolder Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFolder' {Text
awsAccountId :: Text
$sel:awsAccountId:CreateFolder' :: CreateFolder -> Text
awsAccountId} -> Text
awsAccountId) (\s :: CreateFolder
s@CreateFolder' {} Text
a -> CreateFolder
s {$sel:awsAccountId:CreateFolder' :: Text
awsAccountId = Text
a} :: CreateFolder)

-- | The folder ID.
createFolder_folderId :: Lens.Lens' CreateFolder Prelude.Text
createFolder_folderId :: (Text -> f Text) -> CreateFolder -> f CreateFolder
createFolder_folderId = (CreateFolder -> Text)
-> (CreateFolder -> Text -> CreateFolder)
-> Lens CreateFolder CreateFolder Text Text
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFolder' {Text
folderId :: Text
$sel:folderId:CreateFolder' :: CreateFolder -> Text
folderId} -> Text
folderId) (\s :: CreateFolder
s@CreateFolder' {} Text
a -> CreateFolder
s {$sel:folderId:CreateFolder' :: Text
folderId = Text
a} :: CreateFolder)

instance Core.AWSRequest CreateFolder where
  type AWSResponse CreateFolder = CreateFolderResponse
  request :: CreateFolder -> Request CreateFolder
request = Service -> CreateFolder -> Request CreateFolder
forall a. (ToRequest a, ToJSON a) => Service -> a -> Request a
Request.postJSON Service
defaultService
  response :: Logger
-> Service
-> Proxy CreateFolder
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateFolder)))
response =
    (Int
 -> ResponseHeaders
 -> Object
 -> Either String (AWSResponse CreateFolder))
-> Logger
-> Service
-> Proxy CreateFolder
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse CreateFolder)))
forall (m :: * -> *) a.
MonadResource m =>
(Int -> ResponseHeaders -> Object -> Either String (AWSResponse a))
-> Logger
-> Service
-> Proxy a
-> ClientResponse ClientBody
-> m (Either Error (ClientResponse (AWSResponse a)))
Response.receiveJSON
      ( \Int
s ResponseHeaders
h Object
x ->
          Maybe Text
-> Maybe Text -> Maybe Text -> Int -> CreateFolderResponse
CreateFolderResponse'
            (Maybe Text
 -> Maybe Text -> Maybe Text -> Int -> CreateFolderResponse)
-> Either String (Maybe Text)
-> Either
     String (Maybe Text -> Maybe Text -> Int -> CreateFolderResponse)
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
"RequestId")
            Either
  String (Maybe Text -> Maybe Text -> Int -> CreateFolderResponse)
-> Either String (Maybe Text)
-> Either String (Maybe Text -> Int -> CreateFolderResponse)
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
"Arn")
            Either String (Maybe Text -> Int -> CreateFolderResponse)
-> Either String (Maybe Text)
-> Either String (Int -> CreateFolderResponse)
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
"FolderId")
            Either String (Int -> CreateFolderResponse)
-> Either String Int -> Either String CreateFolderResponse
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 CreateFolder

instance Prelude.NFData CreateFolder

instance Core.ToHeaders CreateFolder where
  toHeaders :: CreateFolder -> ResponseHeaders
toHeaders =
    ResponseHeaders -> CreateFolder -> 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.0" ::
                          Prelude.ByteString
                      )
          ]
      )

instance Core.ToJSON CreateFolder where
  toJSON :: CreateFolder -> Value
toJSON CreateFolder' {Maybe (NonEmpty ResourcePermission)
Maybe (NonEmpty Tag)
Maybe Text
Maybe FolderType
Text
folderId :: Text
awsAccountId :: Text
tags :: Maybe (NonEmpty Tag)
folderType :: Maybe FolderType
permissions :: Maybe (NonEmpty ResourcePermission)
name :: Maybe Text
parentFolderArn :: Maybe Text
$sel:folderId:CreateFolder' :: CreateFolder -> Text
$sel:awsAccountId:CreateFolder' :: CreateFolder -> Text
$sel:tags:CreateFolder' :: CreateFolder -> Maybe (NonEmpty Tag)
$sel:folderType:CreateFolder' :: CreateFolder -> Maybe FolderType
$sel:permissions:CreateFolder' :: CreateFolder -> Maybe (NonEmpty ResourcePermission)
$sel:name:CreateFolder' :: CreateFolder -> Maybe Text
$sel:parentFolderArn:CreateFolder' :: CreateFolder -> Maybe Text
..} =
    [Pair] -> Value
Core.object
      ( [Maybe Pair] -> [Pair]
forall a. [Maybe a] -> [a]
Prelude.catMaybes
          [ (Text
"ParentFolderArn" 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
parentFolderArn,
            (Text
"Name" 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
name,
            (Text
"Permissions" Text -> NonEmpty ResourcePermission -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty ResourcePermission -> Pair)
-> Maybe (NonEmpty ResourcePermission) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty ResourcePermission)
permissions,
            (Text
"FolderType" Text -> FolderType -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (FolderType -> Pair) -> Maybe FolderType -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe FolderType
folderType,
            (Text
"Tags" Text -> NonEmpty Tag -> Pair
forall kv v. (KeyValue kv, ToJSON v) => Text -> v -> kv
Core..=) (NonEmpty Tag -> Pair) -> Maybe (NonEmpty Tag) -> Maybe Pair
forall (f :: * -> *) a b. Functor f => (a -> b) -> f a -> f b
Prelude.<$> Maybe (NonEmpty Tag)
tags
          ]
      )

instance Core.ToPath CreateFolder where
  toPath :: CreateFolder -> ByteString
toPath CreateFolder' {Maybe (NonEmpty ResourcePermission)
Maybe (NonEmpty Tag)
Maybe Text
Maybe FolderType
Text
folderId :: Text
awsAccountId :: Text
tags :: Maybe (NonEmpty Tag)
folderType :: Maybe FolderType
permissions :: Maybe (NonEmpty ResourcePermission)
name :: Maybe Text
parentFolderArn :: Maybe Text
$sel:folderId:CreateFolder' :: CreateFolder -> Text
$sel:awsAccountId:CreateFolder' :: CreateFolder -> Text
$sel:tags:CreateFolder' :: CreateFolder -> Maybe (NonEmpty Tag)
$sel:folderType:CreateFolder' :: CreateFolder -> Maybe FolderType
$sel:permissions:CreateFolder' :: CreateFolder -> Maybe (NonEmpty ResourcePermission)
$sel:name:CreateFolder' :: CreateFolder -> Maybe Text
$sel:parentFolderArn:CreateFolder' :: CreateFolder -> Maybe Text
..} =
    [ByteString] -> ByteString
forall a. Monoid a => [a] -> a
Prelude.mconcat
      [ ByteString
"/accounts/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
awsAccountId,
        ByteString
"/folders/",
        Text -> ByteString
forall a. ToByteString a => a -> ByteString
Core.toBS Text
folderId
      ]

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

-- | /See:/ 'newCreateFolderResponse' smart constructor.
data CreateFolderResponse = CreateFolderResponse'
  { -- | The request ID for the newly created folder.
    CreateFolderResponse -> Maybe Text
requestId :: Prelude.Maybe Prelude.Text,
    -- | The Amazon Resource Name (ARN) for the newly created folder.
    CreateFolderResponse -> Maybe Text
arn :: Prelude.Maybe Prelude.Text,
    -- | The folder ID for the newly created folder.
    CreateFolderResponse -> Maybe Text
folderId :: Prelude.Maybe Prelude.Text,
    -- | The status of the newly created folder. If succeeded, the status is
    -- @SC_OK (200)@.
    CreateFolderResponse -> Int
status :: Prelude.Int
  }
  deriving (CreateFolderResponse -> CreateFolderResponse -> Bool
(CreateFolderResponse -> CreateFolderResponse -> Bool)
-> (CreateFolderResponse -> CreateFolderResponse -> Bool)
-> Eq CreateFolderResponse
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
/= :: CreateFolderResponse -> CreateFolderResponse -> Bool
$c/= :: CreateFolderResponse -> CreateFolderResponse -> Bool
== :: CreateFolderResponse -> CreateFolderResponse -> Bool
$c== :: CreateFolderResponse -> CreateFolderResponse -> Bool
Prelude.Eq, ReadPrec [CreateFolderResponse]
ReadPrec CreateFolderResponse
Int -> ReadS CreateFolderResponse
ReadS [CreateFolderResponse]
(Int -> ReadS CreateFolderResponse)
-> ReadS [CreateFolderResponse]
-> ReadPrec CreateFolderResponse
-> ReadPrec [CreateFolderResponse]
-> Read CreateFolderResponse
forall a.
(Int -> ReadS a)
-> ReadS [a] -> ReadPrec a -> ReadPrec [a] -> Read a
readListPrec :: ReadPrec [CreateFolderResponse]
$creadListPrec :: ReadPrec [CreateFolderResponse]
readPrec :: ReadPrec CreateFolderResponse
$creadPrec :: ReadPrec CreateFolderResponse
readList :: ReadS [CreateFolderResponse]
$creadList :: ReadS [CreateFolderResponse]
readsPrec :: Int -> ReadS CreateFolderResponse
$creadsPrec :: Int -> ReadS CreateFolderResponse
Prelude.Read, Int -> CreateFolderResponse -> ShowS
[CreateFolderResponse] -> ShowS
CreateFolderResponse -> String
(Int -> CreateFolderResponse -> ShowS)
-> (CreateFolderResponse -> String)
-> ([CreateFolderResponse] -> ShowS)
-> Show CreateFolderResponse
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
showList :: [CreateFolderResponse] -> ShowS
$cshowList :: [CreateFolderResponse] -> ShowS
show :: CreateFolderResponse -> String
$cshow :: CreateFolderResponse -> String
showsPrec :: Int -> CreateFolderResponse -> ShowS
$cshowsPrec :: Int -> CreateFolderResponse -> ShowS
Prelude.Show, (forall x. CreateFolderResponse -> Rep CreateFolderResponse x)
-> (forall x. Rep CreateFolderResponse x -> CreateFolderResponse)
-> Generic CreateFolderResponse
forall x. Rep CreateFolderResponse x -> CreateFolderResponse
forall x. CreateFolderResponse -> Rep CreateFolderResponse x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cto :: forall x. Rep CreateFolderResponse x -> CreateFolderResponse
$cfrom :: forall x. CreateFolderResponse -> Rep CreateFolderResponse x
Prelude.Generic)

-- |
-- Create a value of 'CreateFolderResponse' 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:
--
-- 'requestId', 'createFolderResponse_requestId' - The request ID for the newly created folder.
--
-- 'arn', 'createFolderResponse_arn' - The Amazon Resource Name (ARN) for the newly created folder.
--
-- 'folderId', 'createFolderResponse_folderId' - The folder ID for the newly created folder.
--
-- 'status', 'createFolderResponse_status' - The status of the newly created folder. If succeeded, the status is
-- @SC_OK (200)@.
newCreateFolderResponse ::
  -- | 'status'
  Prelude.Int ->
  CreateFolderResponse
newCreateFolderResponse :: Int -> CreateFolderResponse
newCreateFolderResponse Int
pStatus_ =
  CreateFolderResponse' :: Maybe Text
-> Maybe Text -> Maybe Text -> Int -> CreateFolderResponse
CreateFolderResponse'
    { $sel:requestId:CreateFolderResponse' :: Maybe Text
requestId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:arn:CreateFolderResponse' :: Maybe Text
arn = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:folderId:CreateFolderResponse' :: Maybe Text
folderId = Maybe Text
forall a. Maybe a
Prelude.Nothing,
      $sel:status:CreateFolderResponse' :: Int
status = Int
pStatus_
    }

-- | The request ID for the newly created folder.
createFolderResponse_requestId :: Lens.Lens' CreateFolderResponse (Prelude.Maybe Prelude.Text)
createFolderResponse_requestId :: (Maybe Text -> f (Maybe Text))
-> CreateFolderResponse -> f CreateFolderResponse
createFolderResponse_requestId = (CreateFolderResponse -> Maybe Text)
-> (CreateFolderResponse -> Maybe Text -> CreateFolderResponse)
-> Lens
     CreateFolderResponse CreateFolderResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFolderResponse' {Maybe Text
requestId :: Maybe Text
$sel:requestId:CreateFolderResponse' :: CreateFolderResponse -> Maybe Text
requestId} -> Maybe Text
requestId) (\s :: CreateFolderResponse
s@CreateFolderResponse' {} Maybe Text
a -> CreateFolderResponse
s {$sel:requestId:CreateFolderResponse' :: Maybe Text
requestId = Maybe Text
a} :: CreateFolderResponse)

-- | The Amazon Resource Name (ARN) for the newly created folder.
createFolderResponse_arn :: Lens.Lens' CreateFolderResponse (Prelude.Maybe Prelude.Text)
createFolderResponse_arn :: (Maybe Text -> f (Maybe Text))
-> CreateFolderResponse -> f CreateFolderResponse
createFolderResponse_arn = (CreateFolderResponse -> Maybe Text)
-> (CreateFolderResponse -> Maybe Text -> CreateFolderResponse)
-> Lens
     CreateFolderResponse CreateFolderResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFolderResponse' {Maybe Text
arn :: Maybe Text
$sel:arn:CreateFolderResponse' :: CreateFolderResponse -> Maybe Text
arn} -> Maybe Text
arn) (\s :: CreateFolderResponse
s@CreateFolderResponse' {} Maybe Text
a -> CreateFolderResponse
s {$sel:arn:CreateFolderResponse' :: Maybe Text
arn = Maybe Text
a} :: CreateFolderResponse)

-- | The folder ID for the newly created folder.
createFolderResponse_folderId :: Lens.Lens' CreateFolderResponse (Prelude.Maybe Prelude.Text)
createFolderResponse_folderId :: (Maybe Text -> f (Maybe Text))
-> CreateFolderResponse -> f CreateFolderResponse
createFolderResponse_folderId = (CreateFolderResponse -> Maybe Text)
-> (CreateFolderResponse -> Maybe Text -> CreateFolderResponse)
-> Lens
     CreateFolderResponse CreateFolderResponse (Maybe Text) (Maybe Text)
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFolderResponse' {Maybe Text
folderId :: Maybe Text
$sel:folderId:CreateFolderResponse' :: CreateFolderResponse -> Maybe Text
folderId} -> Maybe Text
folderId) (\s :: CreateFolderResponse
s@CreateFolderResponse' {} Maybe Text
a -> CreateFolderResponse
s {$sel:folderId:CreateFolderResponse' :: Maybe Text
folderId = Maybe Text
a} :: CreateFolderResponse)

-- | The status of the newly created folder. If succeeded, the status is
-- @SC_OK (200)@.
createFolderResponse_status :: Lens.Lens' CreateFolderResponse Prelude.Int
createFolderResponse_status :: (Int -> f Int) -> CreateFolderResponse -> f CreateFolderResponse
createFolderResponse_status = (CreateFolderResponse -> Int)
-> (CreateFolderResponse -> Int -> CreateFolderResponse)
-> Lens CreateFolderResponse CreateFolderResponse Int Int
forall s a b t. (s -> a) -> (s -> b -> t) -> Lens s t a b
Lens.lens (\CreateFolderResponse' {Int
status :: Int
$sel:status:CreateFolderResponse' :: CreateFolderResponse -> Int
status} -> Int
status) (\s :: CreateFolderResponse
s@CreateFolderResponse' {} Int
a -> CreateFolderResponse
s {$sel:status:CreateFolderResponse' :: Int
status = Int
a} :: CreateFolderResponse)

instance Prelude.NFData CreateFolderResponse