on bec6ff8 help sign in
209 lines 6.4 kB history raw
1{-# LANGUAGE DataKinds #-}
2{-# LANGUAGE DeriveDataTypeable #-}
3{-# LANGUAGE DeriveGeneric #-}
4{-# LANGUAGE OverloadedStrings #-}
5{-# LANGUAGE RecordWildCards #-}
6{-# LANGUAGE TypeFamilies #-}
7{-# LANGUAGE TypeOperators #-}
9{-# OPTIONS_GHC -fno-warn-unused-imports #-}
10{-# OPTIONS_GHC -fno-warn-duplicate-exports #-}
12-- |
13-- Module : Network.Google.Resource.Taskqueue.Tasks.Update
14-- Copyright : (c) 2015 Brendan Hay
15-- License : Mozilla Public License, v. 2.0.
16-- Maintainer : Brendan Hay <brendan.g.hay@gmail.com>
17-- Stability : auto-generated
18-- Portability : non-portable (GHC extensions)
19--
20-- | Update tasks that are leased out of a TaskQueue.
21--
22-- /See:/ <https://developers.google.com/appengine/docs/python/taskqueue/rest TaskQueue API Reference> for @TaskqueueTasksUpdate@.
23module Network.Google.Resource.Taskqueue.Tasks.Update
24 (
25 -- * REST Resource
26 TasksUpdateResource
28 -- * Creating a Request
29 , tasksUpdate'
30 , TasksUpdate'
32 -- * Request Lenses
33 , tuTaskqueue
34 , tuQuotaUser
35 , tuPrettyPrint
36 , tuProject
37 , tuUserIP
38 , tuKey
39 , tuTask
40 , tuTask
41 , tuOAuthToken
42 , tuNewLeaseSeconds
43 , tuFields
44 ) where
46import Network.Google.AppEngineTaskQueue.Types
47import Network.Google.Prelude
49-- | A resource alias for @TaskqueueTasksUpdate@ which the
50-- 'TasksUpdate'' request conforms to.
51type TasksUpdateResource =
52 Capture "project" Text :>
53 "taskqueues" :>
54 Capture "taskqueue" Text :>
55 "tasks" :>
56 Capture "task" Text :>
57 QueryParam "quotaUser" Text :>
58 QueryParam "prettyPrint" Bool :>
59 QueryParam "userIp" Text :>
60 QueryParam "key" Key :>
61 QueryParam "oauth_token" OAuthToken :>
62 QueryParam "newLeaseSeconds" Int32 :>
63 QueryParam "fields" Text :>
64 QueryParam "alt" AltJSON :>
65 ReqBody '[JSON] Task :> Post '[JSON] Task
67-- | Update tasks that are leased out of a TaskQueue.
68--
69-- /See:/ 'tasksUpdate'' smart constructor.
70data TasksUpdate' = TasksUpdate'
71 { _tuTaskqueue :: !Text
72 , _tuQuotaUser :: !(Maybe Text)
73 , _tuPrettyPrint :: !Bool
74 , _tuProject :: !Text
75 , _tuUserIP :: !(Maybe Text)
76 , _tuKey :: !(Maybe Key)
77 , _tuTask :: !Task
78 , _tuTask :: !Text
79 , _tuOAuthToken :: !(Maybe OAuthToken)
80 , _tuNewLeaseSeconds :: !Int32
81 , _tuFields :: !(Maybe Text)
82 } deriving (Eq,Read,Show,Data,Typeable,Generic)
84-- | Creates a value of 'TasksUpdate'' with the minimum fields required to make a request.
85--
86-- Use one of the following lenses to modify other fields as desired:
87--
88-- * 'tuTaskqueue'
89--
90-- * 'tuQuotaUser'
91--
92-- * 'tuPrettyPrint'
93--
94-- * 'tuProject'
95--
96-- * 'tuUserIP'
97--
98-- * 'tuKey'
99--
100-- * 'tuTask'
101--
102-- * 'tuTask'
103--
104-- * 'tuOAuthToken'
105--
106-- * 'tuNewLeaseSeconds'
107--
108-- * 'tuFields'
109tasksUpdate'
110 :: Text -- ^ 'taskqueue'
111 -> Text -- ^ 'project'
112 -> Task -- ^ 'Task'
113 -> Text -- ^ 'task'
114 -> Int32 -- ^ 'newLeaseSeconds'
115 -> TasksUpdate'
116tasksUpdate' pTuTaskqueue_ pTuProject_ pTuTask_ pTuTask_ pTuNewLeaseSeconds_ =
117 TasksUpdate'
118 { _tuTaskqueue = pTuTaskqueue_
119 , _tuQuotaUser = Nothing
120 , _tuPrettyPrint = True
121 , _tuProject = pTuProject_
122 , _tuUserIP = Nothing
123 , _tuKey = Nothing
124 , _tuTask = pTuTask_
125 , _tuTask = pTuTask_
126 , _tuOAuthToken = Nothing
127 , _tuNewLeaseSeconds = pTuNewLeaseSeconds_
128 , _tuFields = Nothing
129 }
131tuTaskqueue :: Lens' TasksUpdate' Text
132tuTaskqueue
133 = lens _tuTaskqueue (\ s a -> s{_tuTaskqueue = a})
135-- | Available to use for quota purposes for server-side applications. Can be
136-- any arbitrary string assigned to a user, but should not exceed 40
137-- characters. Overrides userIp if both are provided.
138tuQuotaUser :: Lens' TasksUpdate' (Maybe Text)
139tuQuotaUser
140 = lens _tuQuotaUser (\ s a -> s{_tuQuotaUser = a})
142-- | Returns response with indentations and line breaks.
143tuPrettyPrint :: Lens' TasksUpdate' Bool
144tuPrettyPrint
145 = lens _tuPrettyPrint
146 (\ s a -> s{_tuPrettyPrint = a})
148-- | The project under which the queue lies.
149tuProject :: Lens' TasksUpdate' Text
150tuProject
151 = lens _tuProject (\ s a -> s{_tuProject = a})
153-- | IP address of the site where the request originates. Use this if you
154-- want to enforce per-user limits.
155tuUserIP :: Lens' TasksUpdate' (Maybe Text)
156tuUserIP = lens _tuUserIP (\ s a -> s{_tuUserIP = a})
158-- | API key. Your API key identifies your project and provides you with API
159-- access, quota, and reports. Required unless you provide an OAuth 2.0
160-- token.
161tuKey :: Lens' TasksUpdate' (Maybe Key)
162tuKey = lens _tuKey (\ s a -> s{_tuKey = a})
164-- | Multipart request metadata.
165tuTask :: Lens' TasksUpdate' Task
166tuTask = lens _tuTask (\ s a -> s{_tuTask = a})
168tuTask :: Lens' TasksUpdate' Text
169tuTask = lens _tuTask (\ s a -> s{_tuTask = a})
171-- | OAuth 2.0 token for the current user.
172tuOAuthToken :: Lens' TasksUpdate' (Maybe OAuthToken)
173tuOAuthToken
174 = lens _tuOAuthToken (\ s a -> s{_tuOAuthToken = a})
176-- | The new lease in seconds.
177tuNewLeaseSeconds :: Lens' TasksUpdate' Int32
178tuNewLeaseSeconds
179 = lens _tuNewLeaseSeconds
180 (\ s a -> s{_tuNewLeaseSeconds = a})
182-- | Selector specifying which fields to include in a partial response.
183tuFields :: Lens' TasksUpdate' (Maybe Text)
184tuFields = lens _tuFields (\ s a -> s{_tuFields = a})
186instance GoogleAuth TasksUpdate' where
187 authKey = tuKey . _Just
188 authToken = tuOAuthToken . _Just
190instance GoogleRequest TasksUpdate' where
191 type Rs TasksUpdate' = Task
192 request
193 = requestWithRoute defReq appEngineTaskQueueURL
194 requestWithRoute r u TasksUpdate'{..}
195 = go _tuTaskqueue _tuQuotaUser (Just _tuPrettyPrint)
196 _tuProject
197 _tuUserIP
198 _tuKey
199 _tuTask
200 _tuOAuthToken
201 (Just _tuNewLeaseSeconds)
202 _tuFields
203 (Just AltJSON)
204 _tuTask
205 where go
206 = clientWithRoute
207 (Proxy :: Proxy TasksUpdateResource)
208 r
209 u