{-# LANGUAGE DeriveDataTypeable #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE RecordWildCards #-} {-# LANGUAGE TypeFamilies #-} {-# OPTIONS_GHC -fno-warn-unused-imports #-} {-# OPTIONS_GHC -fno-warn-unused-binds #-} {-# OPTIONS_GHC -fno-warn-unused-matches #-} -- Derived from AWS service descriptions, licensed under Apache 2.0. -- | -- Module : Network.AWS.WorkSpaces.CreateWorkspaces -- Copyright : (c) 2013-2015 Brendan Hay -- License : Mozilla Public License, v. 2.0. -- Maintainer : Brendan Hay -- Stability : auto-generated -- Portability : non-portable (GHC extensions) -- -- Creates one or more WorkSpaces. -- -- This operation is asynchronous and returns before the WorkSpaces are -- created. -- -- /See:/ for CreateWorkspaces. module Network.AWS.WorkSpaces.CreateWorkspaces ( -- * Creating a Request createWorkspaces , CreateWorkspaces -- * Request Lenses , cwWorkspaces -- * Destructuring the Response , createWorkspacesResponse , CreateWorkspacesResponse -- * Response Lenses , cwrsFailedRequests , cwrsPendingRequests , cwrsStatus ) where import Network.AWS.Prelude import Network.AWS.Request import Network.AWS.Response import Network.AWS.WorkSpaces.Types import Network.AWS.WorkSpaces.Types.Product -- | Contains the inputs for the CreateWorkspaces operation. -- -- /See:/ 'createWorkspaces' smart constructor. newtype CreateWorkspaces = CreateWorkspaces' { _cwWorkspaces :: List1 WorkspaceRequest } deriving (Eq,Read,Show,Data,Typeable,Generic) -- | Creates a value of 'CreateWorkspaces' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'cwWorkspaces' createWorkspaces :: NonEmpty WorkspaceRequest -- ^ 'cwWorkspaces' -> CreateWorkspaces createWorkspaces pWorkspaces_ = CreateWorkspaces' { _cwWorkspaces = _List1 # pWorkspaces_ } -- | An array of structures that specify the WorkSpaces to create. cwWorkspaces :: Lens' CreateWorkspaces (NonEmpty WorkspaceRequest) cwWorkspaces = lens _cwWorkspaces (\ s a -> s{_cwWorkspaces = a}) . _List1; instance AWSRequest CreateWorkspaces where type Sv CreateWorkspaces = WorkSpaces type Rs CreateWorkspaces = CreateWorkspacesResponse request = postJSON response = receiveJSON (\ s h x -> CreateWorkspacesResponse' <$> (x .?> "FailedRequests" .!@ mempty) <*> (x .?> "PendingRequests" .!@ mempty) <*> (pure (fromEnum s))) instance ToHeaders CreateWorkspaces where toHeaders = const (mconcat ["X-Amz-Target" =# ("WorkspacesService.CreateWorkspaces" :: ByteString), "Content-Type" =# ("application/x-amz-json-1.1" :: ByteString)]) instance ToJSON CreateWorkspaces where toJSON CreateWorkspaces'{..} = object ["Workspaces" .= _cwWorkspaces] instance ToPath CreateWorkspaces where toPath = const "/" instance ToQuery CreateWorkspaces where toQuery = const mempty -- | Contains the result of the CreateWorkspaces operation. -- -- /See:/ 'createWorkspacesResponse' smart constructor. data CreateWorkspacesResponse = CreateWorkspacesResponse' { _cwrsFailedRequests :: !(Maybe [FailedCreateWorkspaceRequest]) , _cwrsPendingRequests :: !(Maybe [Workspace]) , _cwrsStatus :: !Int } deriving (Eq,Read,Show,Data,Typeable,Generic) -- | Creates a value of 'CreateWorkspacesResponse' with the minimum fields required to make a request. -- -- Use one of the following lenses to modify other fields as desired: -- -- * 'cwrsFailedRequests' -- -- * 'cwrsPendingRequests' -- -- * 'cwrsStatus' createWorkspacesResponse :: Int -- ^ 'cwrsStatus' -> CreateWorkspacesResponse createWorkspacesResponse pStatus_ = CreateWorkspacesResponse' { _cwrsFailedRequests = Nothing , _cwrsPendingRequests = Nothing , _cwrsStatus = pStatus_ } -- | An array of structures that represent the WorkSpaces that could not be -- created. cwrsFailedRequests :: Lens' CreateWorkspacesResponse [FailedCreateWorkspaceRequest] cwrsFailedRequests = lens _cwrsFailedRequests (\ s a -> s{_cwrsFailedRequests = a}) . _Default . _Coerce; -- | An array of structures that represent the WorkSpaces that were created. -- -- Because this operation is asynchronous, the identifier in 'WorkspaceId' -- is not immediately available. If you immediately call DescribeWorkspaces -- with this identifier, no information will be returned. cwrsPendingRequests :: Lens' CreateWorkspacesResponse [Workspace] cwrsPendingRequests = lens _cwrsPendingRequests (\ s a -> s{_cwrsPendingRequests = a}) . _Default . _Coerce; -- | The response status code. cwrsStatus :: Lens' CreateWorkspacesResponse Int cwrsStatus = lens _cwrsStatus (\ s a -> s{_cwrsStatus = a});