Skip to content

Commit 1c504f6

Browse files
authored
Fine-tuning names in service models. (#11)
1 parent 2c0ec8d commit 1c504f6

File tree

4 files changed

+154
-154
lines changed

4 files changed

+154
-154
lines changed

awsiot/iotjobs.py

Lines changed: 47 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@
2121

2222
class IotJobsClient(awsiot.MqttServiceClient):
2323

24-
def publish_describe(self, request):
24+
def publish_describe_job_execution(self, request):
2525
# type: (DescribeJobExecutionRequest) -> concurrent.futures.Future
2626
"""
2727
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-describejobexecution
@@ -42,7 +42,7 @@ def publish_describe(self, request):
4242
topic='$aws/things/{0.thing_name}/jobs/{0.job_id}/get'.format(request),
4343
payload=request.to_payload())
4444

45-
def publish_get_pending(self, request):
45+
def publish_get_pending_job_executions(self, request):
4646
# type: (GetPendingJobExecutionsRequest) -> concurrent.futures.Future
4747
"""
4848
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-getpendingjobexecutions
@@ -61,7 +61,7 @@ def publish_get_pending(self, request):
6161
topic='$aws/things/{0.thing_name}/jobs/get'.format(request),
6262
payload=request.to_payload())
6363

64-
def publish_start_next_pending(self, request):
64+
def publish_start_next_pending_job_execution(self, request):
6565
# type: (StartNextPendingJobExecutionRequest) -> concurrent.futures.Future
6666
"""
6767
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-startnextpendingjobexecution
@@ -80,7 +80,7 @@ def publish_start_next_pending(self, request):
8080
topic='$aws/things/{0.thing_name}/jobs/start-next'.format(request),
8181
payload=request.to_payload())
8282

83-
def publish_update(self, request):
83+
def publish_update_job_execution(self, request):
8484
# type: (UpdateJobExecutionRequest) -> concurrent.futures.Future
8585
"""
8686
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-updatejobexecution
@@ -101,7 +101,7 @@ def publish_update(self, request):
101101
topic='$aws/things/{0.thing_name}/jobs/{0.job_id}/update'.format(request),
102102
payload=request.to_payload())
103103

104-
def subscribe_to_describe_accepted(self, request, on_accepted):
104+
def subscribe_to_describe_job_execution_accepted(self, request, on_accepted):
105105
# type: (DescribeJobExecutionSubscriptionRequest, typing.Callable[[DescribeJobExecutionResponse], None]) -> concurrent.futures.Future
106106
"""
107107
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-describejobexecution
@@ -129,7 +129,7 @@ def subscribe_to_describe_accepted(self, request, on_accepted):
129129
callback=on_accepted,
130130
payload_to_class_fn=DescribeJobExecutionResponse.from_payload)
131131

132-
def subscribe_to_describe_rejected(self, request, on_rejected):
132+
def subscribe_to_describe_job_execution_rejected(self, request, on_rejected):
133133
# type: (DescribeJobExecutionSubscriptionRequest, typing.Callable[[RejectedError], None]) -> concurrent.futures.Future
134134
"""
135135
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-describejobexecution
@@ -157,33 +157,7 @@ def subscribe_to_describe_rejected(self, request, on_rejected):
157157
callback=on_rejected,
158158
payload_to_class_fn=RejectedError.from_payload)
159159

160-
def subscribe_to_executions_changed_events(self, request, on_job_executions_changed):
161-
# type: (JobExecutionsChangedEventsSubscriptionRequest, typing.Callable[[JobExecutionsChangedEvent], None]) -> concurrent.futures.Future
162-
"""
163-
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-jobexecutionschanged
164-
165-
Parameters:
166-
request - `JobExecutionsChangedEventsSubscriptionRequest` instance.
167-
on_job_executions_changed - Callback to invoke each time the on_job_executions_changed event is received.
168-
The callback should take 1 argument of type `JobExecutionsChangedEvent`.
169-
The callback is not expected to return anything.
170-
171-
Returns a concurrent.futures.Future, whose result will be None if the
172-
subscription is successful. The Future's result will be an exception
173-
if the subscription is unsuccessful.
174-
"""
175-
if not request.thing_name:
176-
raise ValueError("request.thing_name is required")
177-
178-
if not on_job_executions_changed:
179-
raise ValueError("on_job_executions_changed is required")
180-
181-
return self._subscribe_operation(
182-
topic='$aws/things/{0.thing_name}/jobs/notify'.format(request),
183-
callback=on_job_executions_changed,
184-
payload_to_class_fn=JobExecutionsChangedEvent.from_payload)
185-
186-
def subscribe_to_get_pending_accepted(self, request, on_accepted):
160+
def subscribe_to_get_pending_job_executions_accepted(self, request, on_accepted):
187161
# type: (GetPendingJobExecutionsSubscriptionRequest, typing.Callable[[GetPendingJobExecutionsResponse], None]) -> concurrent.futures.Future
188162
"""
189163
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-getpendingjobexecutions
@@ -209,7 +183,7 @@ def subscribe_to_get_pending_accepted(self, request, on_accepted):
209183
callback=on_accepted,
210184
payload_to_class_fn=GetPendingJobExecutionsResponse.from_payload)
211185

212-
def subscribe_to_get_pending_rejected(self, request, on_rejected):
186+
def subscribe_to_get_pending_job_executions_rejected(self, request, on_rejected):
213187
# type: (GetPendingJobExecutionsSubscriptionRequest, typing.Callable[[RejectedError], None]) -> concurrent.futures.Future
214188
"""
215189
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-getpendingjobexecutions
@@ -235,14 +209,40 @@ def subscribe_to_get_pending_rejected(self, request, on_rejected):
235209
callback=on_rejected,
236210
payload_to_class_fn=RejectedError.from_payload)
237211

238-
def subscribe_to_next_changed_events(self, request, on_next_job_execution_changed):
239-
# type: (NextJobExecutionChangedEventsSubscriptionRequest, typing.Callable[[NextJobExecutionChangedEvent], None]) -> concurrent.futures.Future
212+
def subscribe_to_job_executions_changed_events(self, request, on_event):
213+
# type: (JobExecutionsChangedSubscriptionRequest, typing.Callable[[JobExecutionsChangedEvent], None]) -> concurrent.futures.Future
214+
"""
215+
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-jobexecutionschanged
216+
217+
Parameters:
218+
request - `JobExecutionsChangedSubscriptionRequest` instance.
219+
on_event - Callback to invoke each time the on_event event is received.
220+
The callback should take 1 argument of type `JobExecutionsChangedEvent`.
221+
The callback is not expected to return anything.
222+
223+
Returns a concurrent.futures.Future, whose result will be None if the
224+
subscription is successful. The Future's result will be an exception
225+
if the subscription is unsuccessful.
226+
"""
227+
if not request.thing_name:
228+
raise ValueError("request.thing_name is required")
229+
230+
if not on_event:
231+
raise ValueError("on_event is required")
232+
233+
return self._subscribe_operation(
234+
topic='$aws/things/{0.thing_name}/jobs/notify'.format(request),
235+
callback=on_event,
236+
payload_to_class_fn=JobExecutionsChangedEvent.from_payload)
237+
238+
def subscribe_to_next_job_execution_changed_events(self, request, on_event):
239+
# type: (NextJobExecutionChangedSubscriptionRequest, typing.Callable[[NextJobExecutionChangedEvent], None]) -> concurrent.futures.Future
240240
"""
241241
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-nextjobexecutionchanged
242242
243243
Parameters:
244-
request - `NextJobExecutionChangedEventsSubscriptionRequest` instance.
245-
on_next_job_execution_changed - Callback to invoke each time the on_next_job_execution_changed event is received.
244+
request - `NextJobExecutionChangedSubscriptionRequest` instance.
245+
on_event - Callback to invoke each time the on_event event is received.
246246
The callback should take 1 argument of type `NextJobExecutionChangedEvent`.
247247
The callback is not expected to return anything.
248248
@@ -253,15 +253,15 @@ def subscribe_to_next_changed_events(self, request, on_next_job_execution_change
253253
if not request.thing_name:
254254
raise ValueError("request.thing_name is required")
255255

256-
if not on_next_job_execution_changed:
257-
raise ValueError("on_next_job_execution_changed is required")
256+
if not on_event:
257+
raise ValueError("on_event is required")
258258

259259
return self._subscribe_operation(
260260
topic='$aws/things/{0.thing_name}/jobs/notify-next'.format(request),
261-
callback=on_next_job_execution_changed,
261+
callback=on_event,
262262
payload_to_class_fn=NextJobExecutionChangedEvent.from_payload)
263263

264-
def subscribe_to_start_next_pending_accepted(self, request, on_accepted):
264+
def subscribe_to_start_next_pending_job_execution_accepted(self, request, on_accepted):
265265
# type: (StartNextPendingJobExecutionSubscriptionRequest, typing.Callable[[StartNextJobExecutionResponse], None]) -> concurrent.futures.Future
266266
"""
267267
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-startnextpendingjobexecution
@@ -287,7 +287,7 @@ def subscribe_to_start_next_pending_accepted(self, request, on_accepted):
287287
callback=on_accepted,
288288
payload_to_class_fn=StartNextJobExecutionResponse.from_payload)
289289

290-
def subscribe_to_start_next_pending_rejected(self, request, on_rejected):
290+
def subscribe_to_start_next_pending_job_execution_rejected(self, request, on_rejected):
291291
# type: (StartNextPendingJobExecutionSubscriptionRequest, typing.Callable[[RejectedError], None]) -> concurrent.futures.Future
292292
"""
293293
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-startnextpendingjobexecution
@@ -313,7 +313,7 @@ def subscribe_to_start_next_pending_rejected(self, request, on_rejected):
313313
callback=on_rejected,
314314
payload_to_class_fn=RejectedError.from_payload)
315315

316-
def subscribe_to_update_accepted(self, request, on_accepted):
316+
def subscribe_to_update_job_execution_accepted(self, request, on_accepted):
317317
# type: (UpdateJobExecutionSubscriptionRequest, typing.Callable[[UpdateJobExecutionResponse], None]) -> concurrent.futures.Future
318318
"""
319319
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-updatejobexecution
@@ -341,7 +341,7 @@ def subscribe_to_update_accepted(self, request, on_accepted):
341341
callback=on_accepted,
342342
payload_to_class_fn=UpdateJobExecutionResponse.from_payload)
343343

344-
def subscribe_to_update_rejected(self, request, on_rejected):
344+
def subscribe_to_update_job_execution_rejected(self, request, on_rejected):
345345
# type: (UpdateJobExecutionSubscriptionRequest, typing.Callable[[RejectedError], None]) -> concurrent.futures.Future
346346
"""
347347
API Docs: https://docs.aws.amazon.com/iot/latest/developerguide/jobs-api.html#mqtt-updatejobexecution
@@ -605,7 +605,7 @@ def from_payload(cls, payload):
605605
new.timestamp = datetime.datetime.fromtimestamp(val)
606606
return new
607607

608-
class JobExecutionsChangedEventsSubscriptionRequest(awsiot.ModeledClass):
608+
class JobExecutionsChangedSubscriptionRequest(awsiot.ModeledClass):
609609
__slots__ = ['thing_name']
610610

611611
def __init__(self, thing_name=None):
@@ -642,7 +642,7 @@ def from_payload(cls, payload):
642642
new.timestamp = datetime.datetime.fromtimestamp(val)
643643
return new
644644

645-
class NextJobExecutionChangedEventsSubscriptionRequest(awsiot.ModeledClass):
645+
class NextJobExecutionChangedSubscriptionRequest(awsiot.ModeledClass):
646646
__slots__ = ['thing_name']
647647

648648
def __init__(self, thing_name=None):

0 commit comments

Comments
 (0)