Mercurial > repos > shellac > guppy_basecaller
comparison env/lib/python3.7/site-packages/boto/elastictranscoder/layer1.py @ 0:26e78fe6e8c4 draft
"planemo upload commit c699937486c35866861690329de38ec1a5d9f783"
| author | shellac |
|---|---|
| date | Sat, 02 May 2020 07:14:21 -0400 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| -1:000000000000 | 0:26e78fe6e8c4 |
|---|---|
| 1 # Copyright (c) 2013 Amazon.com, Inc. or its affiliates. All Rights Reserved | |
| 2 # | |
| 3 # Permission is hereby granted, free of charge, to any person obtaining a | |
| 4 # copy of this software and associated documentation files (the | |
| 5 # "Software"), to deal in the Software without restriction, including | |
| 6 # without limitation the rights to use, copy, modify, merge, publish, dis- | |
| 7 # tribute, sublicense, and/or sell copies of the Software, and to permit | |
| 8 # persons to whom the Software is furnished to do so, subject to the fol- | |
| 9 # lowing conditions: | |
| 10 # | |
| 11 # The above copyright notice and this permission notice shall be included | |
| 12 # in all copies or substantial portions of the Software. | |
| 13 # | |
| 14 # THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | |
| 15 # OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABIL- | |
| 16 # ITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT | |
| 17 # SHALL THE AUTHOR BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, | |
| 18 # WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | |
| 19 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS | |
| 20 # IN THE SOFTWARE. | |
| 21 # | |
| 22 from boto.compat import json | |
| 23 from boto.exception import JSONResponseError | |
| 24 from boto.connection import AWSAuthConnection | |
| 25 from boto.regioninfo import RegionInfo | |
| 26 from boto.elastictranscoder import exceptions | |
| 27 | |
| 28 | |
| 29 class ElasticTranscoderConnection(AWSAuthConnection): | |
| 30 """ | |
| 31 AWS Elastic Transcoder Service | |
| 32 The AWS Elastic Transcoder Service. | |
| 33 """ | |
| 34 APIVersion = "2012-09-25" | |
| 35 DefaultRegionName = "us-east-1" | |
| 36 DefaultRegionEndpoint = "elastictranscoder.us-east-1.amazonaws.com" | |
| 37 ResponseError = JSONResponseError | |
| 38 | |
| 39 _faults = { | |
| 40 "IncompatibleVersionException": exceptions.IncompatibleVersionException, | |
| 41 "LimitExceededException": exceptions.LimitExceededException, | |
| 42 "ResourceInUseException": exceptions.ResourceInUseException, | |
| 43 "AccessDeniedException": exceptions.AccessDeniedException, | |
| 44 "ResourceNotFoundException": exceptions.ResourceNotFoundException, | |
| 45 "InternalServiceException": exceptions.InternalServiceException, | |
| 46 "ValidationException": exceptions.ValidationException, | |
| 47 } | |
| 48 | |
| 49 | |
| 50 def __init__(self, **kwargs): | |
| 51 region = kwargs.get('region') | |
| 52 if not region: | |
| 53 region = RegionInfo(self, self.DefaultRegionName, | |
| 54 self.DefaultRegionEndpoint) | |
| 55 else: | |
| 56 del kwargs['region'] | |
| 57 kwargs['host'] = region.endpoint | |
| 58 super(ElasticTranscoderConnection, self).__init__(**kwargs) | |
| 59 self.region = region | |
| 60 | |
| 61 def _required_auth_capability(self): | |
| 62 return ['hmac-v4'] | |
| 63 | |
| 64 def cancel_job(self, id=None): | |
| 65 """ | |
| 66 The CancelJob operation cancels an unfinished job. | |
| 67 You can only cancel a job that has a status of `Submitted`. To | |
| 68 prevent a pipeline from starting to process a job while you're | |
| 69 getting the job identifier, use UpdatePipelineStatus to | |
| 70 temporarily pause the pipeline. | |
| 71 | |
| 72 :type id: string | |
| 73 :param id: The identifier of the job that you want to cancel. | |
| 74 To get a list of the jobs (including their `jobId`) that have a status | |
| 75 of `Submitted`, use the ListJobsByStatus API action. | |
| 76 | |
| 77 """ | |
| 78 uri = '/2012-09-25/jobs/{0}'.format(id) | |
| 79 return self.make_request('DELETE', uri, expected_status=202) | |
| 80 | |
| 81 def create_job(self, pipeline_id=None, input_name=None, output=None, | |
| 82 outputs=None, output_key_prefix=None, playlists=None): | |
| 83 """ | |
| 84 When you create a job, Elastic Transcoder returns JSON data | |
| 85 that includes the values that you specified plus information | |
| 86 about the job that is created. | |
| 87 | |
| 88 If you have specified more than one output for your jobs (for | |
| 89 example, one output for the Kindle Fire and another output for | |
| 90 the Apple iPhone 4s), you currently must use the Elastic | |
| 91 Transcoder API to list the jobs (as opposed to the AWS | |
| 92 Console). | |
| 93 | |
| 94 :type pipeline_id: string | |
| 95 :param pipeline_id: The `Id` of the pipeline that you want Elastic | |
| 96 Transcoder to use for transcoding. The pipeline determines several | |
| 97 settings, including the Amazon S3 bucket from which Elastic | |
| 98 Transcoder gets the files to transcode and the bucket into which | |
| 99 Elastic Transcoder puts the transcoded files. | |
| 100 | |
| 101 :type input_name: dict | |
| 102 :param input_name: A section of the request body that provides | |
| 103 information about the file that is being transcoded. | |
| 104 | |
| 105 :type output: dict | |
| 106 :param output: The `CreateJobOutput` structure. | |
| 107 | |
| 108 :type outputs: list | |
| 109 :param outputs: A section of the request body that provides information | |
| 110 about the transcoded (target) files. We recommend that you use the | |
| 111 `Outputs` syntax instead of the `Output` syntax. | |
| 112 | |
| 113 :type output_key_prefix: string | |
| 114 :param output_key_prefix: The value, if any, that you want Elastic | |
| 115 Transcoder to prepend to the names of all files that this job | |
| 116 creates, including output files, thumbnails, and playlists. | |
| 117 | |
| 118 :type playlists: list | |
| 119 :param playlists: If you specify a preset in `PresetId` for which the | |
| 120 value of `Container` is ts (MPEG-TS), Playlists contains | |
| 121 information about the master playlists that you want Elastic | |
| 122 Transcoder to create. | |
| 123 We recommend that you create only one master playlist. The maximum | |
| 124 number of master playlists in a job is 30. | |
| 125 | |
| 126 """ | |
| 127 uri = '/2012-09-25/jobs' | |
| 128 params = {} | |
| 129 if pipeline_id is not None: | |
| 130 params['PipelineId'] = pipeline_id | |
| 131 if input_name is not None: | |
| 132 params['Input'] = input_name | |
| 133 if output is not None: | |
| 134 params['Output'] = output | |
| 135 if outputs is not None: | |
| 136 params['Outputs'] = outputs | |
| 137 if output_key_prefix is not None: | |
| 138 params['OutputKeyPrefix'] = output_key_prefix | |
| 139 if playlists is not None: | |
| 140 params['Playlists'] = playlists | |
| 141 return self.make_request('POST', uri, expected_status=201, | |
| 142 data=json.dumps(params)) | |
| 143 | |
| 144 def create_pipeline(self, name=None, input_bucket=None, | |
| 145 output_bucket=None, role=None, notifications=None, | |
| 146 content_config=None, thumbnail_config=None): | |
| 147 """ | |
| 148 The CreatePipeline operation creates a pipeline with settings | |
| 149 that you specify. | |
| 150 | |
| 151 :type name: string | |
| 152 :param name: The name of the pipeline. We recommend that the name be | |
| 153 unique within the AWS account, but uniqueness is not enforced. | |
| 154 Constraints: Maximum 40 characters. | |
| 155 | |
| 156 :type input_bucket: string | |
| 157 :param input_bucket: The Amazon S3 bucket in which you saved the media | |
| 158 files that you want to transcode. | |
| 159 | |
| 160 :type output_bucket: string | |
| 161 :param output_bucket: The Amazon S3 bucket in which you want Elastic | |
| 162 Transcoder to save the transcoded files. (Use this, or use | |
| 163 ContentConfig:Bucket plus ThumbnailConfig:Bucket.) | |
| 164 Specify this value when all of the following are true: | |
| 165 | |
| 166 + You want to save transcoded files, thumbnails (if any), and playlists | |
| 167 (if any) together in one bucket. | |
| 168 + You do not want to specify the users or groups who have access to the | |
| 169 transcoded files, thumbnails, and playlists. | |
| 170 + You do not want to specify the permissions that Elastic Transcoder | |
| 171 grants to the files. When Elastic Transcoder saves files in | |
| 172 `OutputBucket`, it grants full control over the files only to the | |
| 173 AWS account that owns the role that is specified by `Role`. | |
| 174 + You want to associate the transcoded files and thumbnails with the | |
| 175 Amazon S3 Standard storage class. | |
| 176 | |
| 177 | |
| 178 | |
| 179 If you want to save transcoded files and playlists in one bucket and | |
| 180 thumbnails in another bucket, specify which users can access the | |
| 181 transcoded files or the permissions the users have, or change the | |
| 182 Amazon S3 storage class, omit `OutputBucket` and specify values for | |
| 183 `ContentConfig` and `ThumbnailConfig` instead. | |
| 184 | |
| 185 :type role: string | |
| 186 :param role: The IAM Amazon Resource Name (ARN) for the role that you | |
| 187 want Elastic Transcoder to use to create the pipeline. | |
| 188 | |
| 189 :type notifications: dict | |
| 190 :param notifications: | |
| 191 The Amazon Simple Notification Service (Amazon SNS) topic that you want | |
| 192 to notify to report job status. | |
| 193 To receive notifications, you must also subscribe to the new topic in | |
| 194 the Amazon SNS console. | |
| 195 | |
| 196 + **Progressing**: The topic ARN for the Amazon Simple Notification | |
| 197 Service (Amazon SNS) topic that you want to notify when Elastic | |
| 198 Transcoder has started to process a job in this pipeline. This is | |
| 199 the ARN that Amazon SNS returned when you created the topic. For | |
| 200 more information, see Create a Topic in the Amazon Simple | |
| 201 Notification Service Developer Guide. | |
| 202 + **Completed**: The topic ARN for the Amazon SNS topic that you want | |
| 203 to notify when Elastic Transcoder has finished processing a job in | |
| 204 this pipeline. This is the ARN that Amazon SNS returned when you | |
| 205 created the topic. | |
| 206 + **Warning**: The topic ARN for the Amazon SNS topic that you want to | |
| 207 notify when Elastic Transcoder encounters a warning condition while | |
| 208 processing a job in this pipeline. This is the ARN that Amazon SNS | |
| 209 returned when you created the topic. | |
| 210 + **Error**: The topic ARN for the Amazon SNS topic that you want to | |
| 211 notify when Elastic Transcoder encounters an error condition while | |
| 212 processing a job in this pipeline. This is the ARN that Amazon SNS | |
| 213 returned when you created the topic. | |
| 214 | |
| 215 :type content_config: dict | |
| 216 :param content_config: | |
| 217 The optional `ContentConfig` object specifies information about the | |
| 218 Amazon S3 bucket in which you want Elastic Transcoder to save | |
| 219 transcoded files and playlists: which bucket to use, which users | |
| 220 you want to have access to the files, the type of access you want | |
| 221 users to have, and the storage class that you want to assign to the | |
| 222 files. | |
| 223 | |
| 224 If you specify values for `ContentConfig`, you must also specify values | |
| 225 for `ThumbnailConfig`. | |
| 226 | |
| 227 If you specify values for `ContentConfig` and `ThumbnailConfig`, omit | |
| 228 the `OutputBucket` object. | |
| 229 | |
| 230 | |
| 231 + **Bucket**: The Amazon S3 bucket in which you want Elastic Transcoder | |
| 232 to save transcoded files and playlists. | |
| 233 + **Permissions** (Optional): The Permissions object specifies which | |
| 234 users you want to have access to transcoded files and the type of | |
| 235 access you want them to have. You can grant permissions to a | |
| 236 maximum of 30 users and/or predefined Amazon S3 groups. | |
| 237 + **Grantee Type**: Specify the type of value that appears in the | |
| 238 `Grantee` object: | |
| 239 | |
| 240 + **Canonical**: The value in the `Grantee` object is either the | |
| 241 canonical user ID for an AWS account or an origin access identity | |
| 242 for an Amazon CloudFront distribution. For more information about | |
| 243 canonical user IDs, see Access Control List (ACL) Overview in the | |
| 244 Amazon Simple Storage Service Developer Guide. For more information | |
| 245 about using CloudFront origin access identities to require that | |
| 246 users use CloudFront URLs instead of Amazon S3 URLs, see Using an | |
| 247 Origin Access Identity to Restrict Access to Your Amazon S3 | |
| 248 Content. A canonical user ID is not the same as an AWS account | |
| 249 number. | |
| 250 + **Email**: The value in the `Grantee` object is the registered email | |
| 251 address of an AWS account. | |
| 252 + **Group**: The value in the `Grantee` object is one of the following | |
| 253 predefined Amazon S3 groups: `AllUsers`, `AuthenticatedUsers`, or | |
| 254 `LogDelivery`. | |
| 255 | |
| 256 + **Grantee**: The AWS user or group that you want to have access to | |
| 257 transcoded files and playlists. To identify the user or group, you | |
| 258 can specify the canonical user ID for an AWS account, an origin | |
| 259 access identity for a CloudFront distribution, the registered email | |
| 260 address of an AWS account, or a predefined Amazon S3 group | |
| 261 + **Access**: The permission that you want to give to the AWS user that | |
| 262 you specified in `Grantee`. Permissions are granted on the files | |
| 263 that Elastic Transcoder adds to the bucket, including playlists and | |
| 264 video files. Valid values include: | |
| 265 | |
| 266 + `READ`: The grantee can read the objects and metadata for objects | |
| 267 that Elastic Transcoder adds to the Amazon S3 bucket. | |
| 268 + `READ_ACP`: The grantee can read the object ACL for objects that | |
| 269 Elastic Transcoder adds to the Amazon S3 bucket. | |
| 270 + `WRITE_ACP`: The grantee can write the ACL for the objects that | |
| 271 Elastic Transcoder adds to the Amazon S3 bucket. | |
| 272 + `FULL_CONTROL`: The grantee has `READ`, `READ_ACP`, and `WRITE_ACP` | |
| 273 permissions for the objects that Elastic Transcoder adds to the | |
| 274 Amazon S3 bucket. | |
| 275 | |
| 276 + **StorageClass**: The Amazon S3 storage class, `Standard` or | |
| 277 `ReducedRedundancy`, that you want Elastic Transcoder to assign to | |
| 278 the video files and playlists that it stores in your Amazon S3 | |
| 279 bucket. | |
| 280 | |
| 281 :type thumbnail_config: dict | |
| 282 :param thumbnail_config: | |
| 283 The `ThumbnailConfig` object specifies several values, including the | |
| 284 Amazon S3 bucket in which you want Elastic Transcoder to save | |
| 285 thumbnail files, which users you want to have access to the files, | |
| 286 the type of access you want users to have, and the storage class | |
| 287 that you want to assign to the files. | |
| 288 | |
| 289 If you specify values for `ContentConfig`, you must also specify values | |
| 290 for `ThumbnailConfig` even if you don't want to create thumbnails. | |
| 291 | |
| 292 If you specify values for `ContentConfig` and `ThumbnailConfig`, omit | |
| 293 the `OutputBucket` object. | |
| 294 | |
| 295 | |
| 296 + **Bucket**: The Amazon S3 bucket in which you want Elastic Transcoder | |
| 297 to save thumbnail files. | |
| 298 + **Permissions** (Optional): The `Permissions` object specifies which | |
| 299 users and/or predefined Amazon S3 groups you want to have access to | |
| 300 thumbnail files, and the type of access you want them to have. You | |
| 301 can grant permissions to a maximum of 30 users and/or predefined | |
| 302 Amazon S3 groups. | |
| 303 + **GranteeType**: Specify the type of value that appears in the | |
| 304 Grantee object: | |
| 305 | |
| 306 + **Canonical**: The value in the `Grantee` object is either the | |
| 307 canonical user ID for an AWS account or an origin access identity | |
| 308 for an Amazon CloudFront distribution. A canonical user ID is not | |
| 309 the same as an AWS account number. | |
| 310 + **Email**: The value in the `Grantee` object is the registered email | |
| 311 address of an AWS account. | |
| 312 + **Group**: The value in the `Grantee` object is one of the following | |
| 313 predefined Amazon S3 groups: `AllUsers`, `AuthenticatedUsers`, or | |
| 314 `LogDelivery`. | |
| 315 | |
| 316 + **Grantee**: The AWS user or group that you want to have access to | |
| 317 thumbnail files. To identify the user or group, you can specify the | |
| 318 canonical user ID for an AWS account, an origin access identity for | |
| 319 a CloudFront distribution, the registered email address of an AWS | |
| 320 account, or a predefined Amazon S3 group. | |
| 321 + **Access**: The permission that you want to give to the AWS user that | |
| 322 you specified in `Grantee`. Permissions are granted on the | |
| 323 thumbnail files that Elastic Transcoder adds to the bucket. Valid | |
| 324 values include: | |
| 325 | |
| 326 + `READ`: The grantee can read the thumbnails and metadata for objects | |
| 327 that Elastic Transcoder adds to the Amazon S3 bucket. | |
| 328 + `READ_ACP`: The grantee can read the object ACL for thumbnails that | |
| 329 Elastic Transcoder adds to the Amazon S3 bucket. | |
| 330 + `WRITE_ACP`: The grantee can write the ACL for the thumbnails that | |
| 331 Elastic Transcoder adds to the Amazon S3 bucket. | |
| 332 + `FULL_CONTROL`: The grantee has `READ`, `READ_ACP`, and `WRITE_ACP` | |
| 333 permissions for the thumbnails that Elastic Transcoder adds to the | |
| 334 Amazon S3 bucket. | |
| 335 | |
| 336 + **StorageClass**: The Amazon S3 storage class, `Standard` or | |
| 337 `ReducedRedundancy`, that you want Elastic Transcoder to assign to | |
| 338 the thumbnails that it stores in your Amazon S3 bucket. | |
| 339 | |
| 340 """ | |
| 341 uri = '/2012-09-25/pipelines' | |
| 342 params = {} | |
| 343 if name is not None: | |
| 344 params['Name'] = name | |
| 345 if input_bucket is not None: | |
| 346 params['InputBucket'] = input_bucket | |
| 347 if output_bucket is not None: | |
| 348 params['OutputBucket'] = output_bucket | |
| 349 if role is not None: | |
| 350 params['Role'] = role | |
| 351 if notifications is not None: | |
| 352 params['Notifications'] = notifications | |
| 353 if content_config is not None: | |
| 354 params['ContentConfig'] = content_config | |
| 355 if thumbnail_config is not None: | |
| 356 params['ThumbnailConfig'] = thumbnail_config | |
| 357 return self.make_request('POST', uri, expected_status=201, | |
| 358 data=json.dumps(params)) | |
| 359 | |
| 360 def create_preset(self, name=None, description=None, container=None, | |
| 361 video=None, audio=None, thumbnails=None): | |
| 362 """ | |
| 363 The CreatePreset operation creates a preset with settings that | |
| 364 you specify. | |
| 365 Elastic Transcoder checks the CreatePreset settings to ensure | |
| 366 that they meet Elastic Transcoder requirements and to | |
| 367 determine whether they comply with H.264 standards. If your | |
| 368 settings are not valid for Elastic Transcoder, Elastic | |
| 369 Transcoder returns an HTTP 400 response ( | |
| 370 `ValidationException`) and does not create the preset. If the | |
| 371 settings are valid for Elastic Transcoder but aren't strictly | |
| 372 compliant with the H.264 standard, Elastic Transcoder creates | |
| 373 the preset and returns a warning message in the response. This | |
| 374 helps you determine whether your settings comply with the | |
| 375 H.264 standard while giving you greater flexibility with | |
| 376 respect to the video that Elastic Transcoder produces. | |
| 377 Elastic Transcoder uses the H.264 video-compression format. | |
| 378 For more information, see the International Telecommunication | |
| 379 Union publication Recommendation ITU-T H.264: Advanced video | |
| 380 coding for generic audiovisual services . | |
| 381 | |
| 382 :type name: string | |
| 383 :param name: The name of the preset. We recommend that the name be | |
| 384 unique within the AWS account, but uniqueness is not enforced. | |
| 385 | |
| 386 :type description: string | |
| 387 :param description: A description of the preset. | |
| 388 | |
| 389 :type container: string | |
| 390 :param container: The container type for the output file. Valid values | |
| 391 include `mp3`, `mp4`, `ogg`, `ts`, and `webm`. | |
| 392 | |
| 393 :type video: dict | |
| 394 :param video: A section of the request body that specifies the video | |
| 395 parameters. | |
| 396 | |
| 397 :type audio: dict | |
| 398 :param audio: A section of the request body that specifies the audio | |
| 399 parameters. | |
| 400 | |
| 401 :type thumbnails: dict | |
| 402 :param thumbnails: A section of the request body that specifies the | |
| 403 thumbnail parameters, if any. | |
| 404 | |
| 405 """ | |
| 406 uri = '/2012-09-25/presets' | |
| 407 params = {} | |
| 408 if name is not None: | |
| 409 params['Name'] = name | |
| 410 if description is not None: | |
| 411 params['Description'] = description | |
| 412 if container is not None: | |
| 413 params['Container'] = container | |
| 414 if video is not None: | |
| 415 params['Video'] = video | |
| 416 if audio is not None: | |
| 417 params['Audio'] = audio | |
| 418 if thumbnails is not None: | |
| 419 params['Thumbnails'] = thumbnails | |
| 420 return self.make_request('POST', uri, expected_status=201, | |
| 421 data=json.dumps(params)) | |
| 422 | |
| 423 def delete_pipeline(self, id=None): | |
| 424 """ | |
| 425 The DeletePipeline operation removes a pipeline. | |
| 426 | |
| 427 You can only delete a pipeline that has never been used or | |
| 428 that is not currently in use (doesn't contain any active | |
| 429 jobs). If the pipeline is currently in use, `DeletePipeline` | |
| 430 returns an error. | |
| 431 | |
| 432 :type id: string | |
| 433 :param id: The identifier of the pipeline that you want to delete. | |
| 434 | |
| 435 """ | |
| 436 uri = '/2012-09-25/pipelines/{0}'.format(id) | |
| 437 return self.make_request('DELETE', uri, expected_status=202) | |
| 438 | |
| 439 def delete_preset(self, id=None): | |
| 440 """ | |
| 441 The DeletePreset operation removes a preset that you've added | |
| 442 in an AWS region. | |
| 443 | |
| 444 You can't delete the default presets that are included with | |
| 445 Elastic Transcoder. | |
| 446 | |
| 447 :type id: string | |
| 448 :param id: The identifier of the preset for which you want to get | |
| 449 detailed information. | |
| 450 | |
| 451 """ | |
| 452 uri = '/2012-09-25/presets/{0}'.format(id) | |
| 453 return self.make_request('DELETE', uri, expected_status=202) | |
| 454 | |
| 455 def list_jobs_by_pipeline(self, pipeline_id=None, ascending=None, | |
| 456 page_token=None): | |
| 457 """ | |
| 458 The ListJobsByPipeline operation gets a list of the jobs | |
| 459 currently in a pipeline. | |
| 460 | |
| 461 Elastic Transcoder returns all of the jobs currently in the | |
| 462 specified pipeline. The response body contains one element for | |
| 463 each job that satisfies the search criteria. | |
| 464 | |
| 465 :type pipeline_id: string | |
| 466 :param pipeline_id: The ID of the pipeline for which you want to get | |
| 467 job information. | |
| 468 | |
| 469 :type ascending: string | |
| 470 :param ascending: To list jobs in chronological order by the date and | |
| 471 time that they were submitted, enter `True`. To list jobs in | |
| 472 reverse chronological order, enter `False`. | |
| 473 | |
| 474 :type page_token: string | |
| 475 :param page_token: When Elastic Transcoder returns more than one page | |
| 476 of results, use `pageToken` in subsequent `GET` requests to get | |
| 477 each successive page of results. | |
| 478 | |
| 479 """ | |
| 480 uri = '/2012-09-25/jobsByPipeline/{0}'.format(pipeline_id) | |
| 481 params = {} | |
| 482 if pipeline_id is not None: | |
| 483 params['PipelineId'] = pipeline_id | |
| 484 if ascending is not None: | |
| 485 params['Ascending'] = ascending | |
| 486 if page_token is not None: | |
| 487 params['PageToken'] = page_token | |
| 488 return self.make_request('GET', uri, expected_status=200, | |
| 489 params=params) | |
| 490 | |
| 491 def list_jobs_by_status(self, status=None, ascending=None, | |
| 492 page_token=None): | |
| 493 """ | |
| 494 The ListJobsByStatus operation gets a list of jobs that have a | |
| 495 specified status. The response body contains one element for | |
| 496 each job that satisfies the search criteria. | |
| 497 | |
| 498 :type status: string | |
| 499 :param status: To get information about all of the jobs associated with | |
| 500 the current AWS account that have a given status, specify the | |
| 501 following status: `Submitted`, `Progressing`, `Complete`, | |
| 502 `Canceled`, or `Error`. | |
| 503 | |
| 504 :type ascending: string | |
| 505 :param ascending: To list jobs in chronological order by the date and | |
| 506 time that they were submitted, enter `True`. To list jobs in | |
| 507 reverse chronological order, enter `False`. | |
| 508 | |
| 509 :type page_token: string | |
| 510 :param page_token: When Elastic Transcoder returns more than one page | |
| 511 of results, use `pageToken` in subsequent `GET` requests to get | |
| 512 each successive page of results. | |
| 513 | |
| 514 """ | |
| 515 uri = '/2012-09-25/jobsByStatus/{0}'.format(status) | |
| 516 params = {} | |
| 517 if status is not None: | |
| 518 params['Status'] = status | |
| 519 if ascending is not None: | |
| 520 params['Ascending'] = ascending | |
| 521 if page_token is not None: | |
| 522 params['PageToken'] = page_token | |
| 523 return self.make_request('GET', uri, expected_status=200, | |
| 524 params=params) | |
| 525 | |
| 526 def list_pipelines(self, ascending=None, page_token=None): | |
| 527 """ | |
| 528 The ListPipelines operation gets a list of the pipelines | |
| 529 associated with the current AWS account. | |
| 530 | |
| 531 :type ascending: string | |
| 532 :param ascending: To list pipelines in chronological order by the date | |
| 533 and time that they were created, enter `True`. To list pipelines in | |
| 534 reverse chronological order, enter `False`. | |
| 535 | |
| 536 :type page_token: string | |
| 537 :param page_token: When Elastic Transcoder returns more than one page | |
| 538 of results, use `pageToken` in subsequent `GET` requests to get | |
| 539 each successive page of results. | |
| 540 | |
| 541 """ | |
| 542 uri = '/2012-09-25/pipelines'.format() | |
| 543 params = {} | |
| 544 if ascending is not None: | |
| 545 params['Ascending'] = ascending | |
| 546 if page_token is not None: | |
| 547 params['PageToken'] = page_token | |
| 548 return self.make_request('GET', uri, expected_status=200, | |
| 549 params=params) | |
| 550 | |
| 551 def list_presets(self, ascending=None, page_token=None): | |
| 552 """ | |
| 553 The ListPresets operation gets a list of the default presets | |
| 554 included with Elastic Transcoder and the presets that you've | |
| 555 added in an AWS region. | |
| 556 | |
| 557 :type ascending: string | |
| 558 :param ascending: To list presets in chronological order by the date | |
| 559 and time that they were created, enter `True`. To list presets in | |
| 560 reverse chronological order, enter `False`. | |
| 561 | |
| 562 :type page_token: string | |
| 563 :param page_token: When Elastic Transcoder returns more than one page | |
| 564 of results, use `pageToken` in subsequent `GET` requests to get | |
| 565 each successive page of results. | |
| 566 | |
| 567 """ | |
| 568 uri = '/2012-09-25/presets'.format() | |
| 569 params = {} | |
| 570 if ascending is not None: | |
| 571 params['Ascending'] = ascending | |
| 572 if page_token is not None: | |
| 573 params['PageToken'] = page_token | |
| 574 return self.make_request('GET', uri, expected_status=200, | |
| 575 params=params) | |
| 576 | |
| 577 def read_job(self, id=None): | |
| 578 """ | |
| 579 The ReadJob operation returns detailed information about a | |
| 580 job. | |
| 581 | |
| 582 :type id: string | |
| 583 :param id: The identifier of the job for which you want to get detailed | |
| 584 information. | |
| 585 | |
| 586 """ | |
| 587 uri = '/2012-09-25/jobs/{0}'.format(id) | |
| 588 return self.make_request('GET', uri, expected_status=200) | |
| 589 | |
| 590 def read_pipeline(self, id=None): | |
| 591 """ | |
| 592 The ReadPipeline operation gets detailed information about a | |
| 593 pipeline. | |
| 594 | |
| 595 :type id: string | |
| 596 :param id: The identifier of the pipeline to read. | |
| 597 | |
| 598 """ | |
| 599 uri = '/2012-09-25/pipelines/{0}'.format(id) | |
| 600 return self.make_request('GET', uri, expected_status=200) | |
| 601 | |
| 602 def read_preset(self, id=None): | |
| 603 """ | |
| 604 The ReadPreset operation gets detailed information about a | |
| 605 preset. | |
| 606 | |
| 607 :type id: string | |
| 608 :param id: The identifier of the preset for which you want to get | |
| 609 detailed information. | |
| 610 | |
| 611 """ | |
| 612 uri = '/2012-09-25/presets/{0}'.format(id) | |
| 613 return self.make_request('GET', uri, expected_status=200) | |
| 614 | |
| 615 def test_role(self, role=None, input_bucket=None, output_bucket=None, | |
| 616 topics=None): | |
| 617 """ | |
| 618 The TestRole operation tests the IAM role used to create the | |
| 619 pipeline. | |
| 620 | |
| 621 The `TestRole` action lets you determine whether the IAM role | |
| 622 you are using has sufficient permissions to let Elastic | |
| 623 Transcoder perform tasks associated with the transcoding | |
| 624 process. The action attempts to assume the specified IAM role, | |
| 625 checks read access to the input and output buckets, and tries | |
| 626 to send a test notification to Amazon SNS topics that you | |
| 627 specify. | |
| 628 | |
| 629 :type role: string | |
| 630 :param role: The IAM Amazon Resource Name (ARN) for the role that you | |
| 631 want Elastic Transcoder to test. | |
| 632 | |
| 633 :type input_bucket: string | |
| 634 :param input_bucket: The Amazon S3 bucket that contains media files to | |
| 635 be transcoded. The action attempts to read from this bucket. | |
| 636 | |
| 637 :type output_bucket: string | |
| 638 :param output_bucket: The Amazon S3 bucket that Elastic Transcoder will | |
| 639 write transcoded media files to. The action attempts to read from | |
| 640 this bucket. | |
| 641 | |
| 642 :type topics: list | |
| 643 :param topics: The ARNs of one or more Amazon Simple Notification | |
| 644 Service (Amazon SNS) topics that you want the action to send a test | |
| 645 notification to. | |
| 646 | |
| 647 """ | |
| 648 uri = '/2012-09-25/roleTests' | |
| 649 params = {} | |
| 650 if role is not None: | |
| 651 params['Role'] = role | |
| 652 if input_bucket is not None: | |
| 653 params['InputBucket'] = input_bucket | |
| 654 if output_bucket is not None: | |
| 655 params['OutputBucket'] = output_bucket | |
| 656 if topics is not None: | |
| 657 params['Topics'] = topics | |
| 658 return self.make_request('POST', uri, expected_status=200, | |
| 659 data=json.dumps(params)) | |
| 660 | |
| 661 def update_pipeline(self, id, name=None, input_bucket=None, role=None, | |
| 662 notifications=None, content_config=None, | |
| 663 thumbnail_config=None): | |
| 664 """ | |
| 665 Use the `UpdatePipeline` operation to update settings for a | |
| 666 pipeline. When you change pipeline settings, your changes take | |
| 667 effect immediately. Jobs that you have already submitted and | |
| 668 that Elastic Transcoder has not started to process are | |
| 669 affected in addition to jobs that you submit after you change | |
| 670 settings. | |
| 671 | |
| 672 :type id: string | |
| 673 :param id: The ID of the pipeline that you want to update. | |
| 674 | |
| 675 :type name: string | |
| 676 :param name: The name of the pipeline. We recommend that the name be | |
| 677 unique within the AWS account, but uniqueness is not enforced. | |
| 678 Constraints: Maximum 40 characters | |
| 679 | |
| 680 :type input_bucket: string | |
| 681 :param input_bucket: The Amazon S3 bucket in which you saved the media | |
| 682 files that you want to transcode and the graphics that you want to | |
| 683 use as watermarks. | |
| 684 | |
| 685 :type role: string | |
| 686 :param role: The IAM Amazon Resource Name (ARN) for the role that you | |
| 687 want Elastic Transcoder to use to transcode jobs for this pipeline. | |
| 688 | |
| 689 :type notifications: dict | |
| 690 :param notifications: | |
| 691 The Amazon Simple Notification Service (Amazon SNS) topic or topics to | |
| 692 notify in order to report job status. | |
| 693 To receive notifications, you must also subscribe to the new topic in | |
| 694 the Amazon SNS console. | |
| 695 | |
| 696 :type content_config: dict | |
| 697 :param content_config: | |
| 698 The optional `ContentConfig` object specifies information about the | |
| 699 Amazon S3 bucket in which you want Elastic Transcoder to save | |
| 700 transcoded files and playlists: which bucket to use, which users | |
| 701 you want to have access to the files, the type of access you want | |
| 702 users to have, and the storage class that you want to assign to the | |
| 703 files. | |
| 704 | |
| 705 If you specify values for `ContentConfig`, you must also specify values | |
| 706 for `ThumbnailConfig`. | |
| 707 | |
| 708 If you specify values for `ContentConfig` and `ThumbnailConfig`, omit | |
| 709 the `OutputBucket` object. | |
| 710 | |
| 711 | |
| 712 + **Bucket**: The Amazon S3 bucket in which you want Elastic Transcoder | |
| 713 to save transcoded files and playlists. | |
| 714 + **Permissions** (Optional): The Permissions object specifies which | |
| 715 users you want to have access to transcoded files and the type of | |
| 716 access you want them to have. You can grant permissions to a | |
| 717 maximum of 30 users and/or predefined Amazon S3 groups. | |
| 718 + **Grantee Type**: Specify the type of value that appears in the | |
| 719 `Grantee` object: | |
| 720 | |
| 721 + **Canonical**: The value in the `Grantee` object is either the | |
| 722 canonical user ID for an AWS account or an origin access identity | |
| 723 for an Amazon CloudFront distribution. For more information about | |
| 724 canonical user IDs, see Access Control List (ACL) Overview in the | |
| 725 Amazon Simple Storage Service Developer Guide. For more information | |
| 726 about using CloudFront origin access identities to require that | |
| 727 users use CloudFront URLs instead of Amazon S3 URLs, see Using an | |
| 728 Origin Access Identity to Restrict Access to Your Amazon S3 | |
| 729 Content. A canonical user ID is not the same as an AWS account | |
| 730 number. | |
| 731 + **Email**: The value in the `Grantee` object is the registered email | |
| 732 address of an AWS account. | |
| 733 + **Group**: The value in the `Grantee` object is one of the following | |
| 734 predefined Amazon S3 groups: `AllUsers`, `AuthenticatedUsers`, or | |
| 735 `LogDelivery`. | |
| 736 | |
| 737 + **Grantee**: The AWS user or group that you want to have access to | |
| 738 transcoded files and playlists. To identify the user or group, you | |
| 739 can specify the canonical user ID for an AWS account, an origin | |
| 740 access identity for a CloudFront distribution, the registered email | |
| 741 address of an AWS account, or a predefined Amazon S3 group | |
| 742 + **Access**: The permission that you want to give to the AWS user that | |
| 743 you specified in `Grantee`. Permissions are granted on the files | |
| 744 that Elastic Transcoder adds to the bucket, including playlists and | |
| 745 video files. Valid values include: | |
| 746 | |
| 747 + `READ`: The grantee can read the objects and metadata for objects | |
| 748 that Elastic Transcoder adds to the Amazon S3 bucket. | |
| 749 + `READ_ACP`: The grantee can read the object ACL for objects that | |
| 750 Elastic Transcoder adds to the Amazon S3 bucket. | |
| 751 + `WRITE_ACP`: The grantee can write the ACL for the objects that | |
| 752 Elastic Transcoder adds to the Amazon S3 bucket. | |
| 753 + `FULL_CONTROL`: The grantee has `READ`, `READ_ACP`, and `WRITE_ACP` | |
| 754 permissions for the objects that Elastic Transcoder adds to the | |
| 755 Amazon S3 bucket. | |
| 756 | |
| 757 + **StorageClass**: The Amazon S3 storage class, `Standard` or | |
| 758 `ReducedRedundancy`, that you want Elastic Transcoder to assign to | |
| 759 the video files and playlists that it stores in your Amazon S3 | |
| 760 bucket. | |
| 761 | |
| 762 :type thumbnail_config: dict | |
| 763 :param thumbnail_config: | |
| 764 The `ThumbnailConfig` object specifies several values, including the | |
| 765 Amazon S3 bucket in which you want Elastic Transcoder to save | |
| 766 thumbnail files, which users you want to have access to the files, | |
| 767 the type of access you want users to have, and the storage class | |
| 768 that you want to assign to the files. | |
| 769 | |
| 770 If you specify values for `ContentConfig`, you must also specify values | |
| 771 for `ThumbnailConfig` even if you don't want to create thumbnails. | |
| 772 | |
| 773 If you specify values for `ContentConfig` and `ThumbnailConfig`, omit | |
| 774 the `OutputBucket` object. | |
| 775 | |
| 776 | |
| 777 + **Bucket**: The Amazon S3 bucket in which you want Elastic Transcoder | |
| 778 to save thumbnail files. | |
| 779 + **Permissions** (Optional): The `Permissions` object specifies which | |
| 780 users and/or predefined Amazon S3 groups you want to have access to | |
| 781 thumbnail files, and the type of access you want them to have. You | |
| 782 can grant permissions to a maximum of 30 users and/or predefined | |
| 783 Amazon S3 groups. | |
| 784 + **GranteeType**: Specify the type of value that appears in the | |
| 785 Grantee object: | |
| 786 | |
| 787 + **Canonical**: The value in the `Grantee` object is either the | |
| 788 canonical user ID for an AWS account or an origin access identity | |
| 789 for an Amazon CloudFront distribution. A canonical user ID is not | |
| 790 the same as an AWS account number. | |
| 791 + **Email**: The value in the `Grantee` object is the registered email | |
| 792 address of an AWS account. | |
| 793 + **Group**: The value in the `Grantee` object is one of the following | |
| 794 predefined Amazon S3 groups: `AllUsers`, `AuthenticatedUsers`, or | |
| 795 `LogDelivery`. | |
| 796 | |
| 797 + **Grantee**: The AWS user or group that you want to have access to | |
| 798 thumbnail files. To identify the user or group, you can specify the | |
| 799 canonical user ID for an AWS account, an origin access identity for | |
| 800 a CloudFront distribution, the registered email address of an AWS | |
| 801 account, or a predefined Amazon S3 group. | |
| 802 + **Access**: The permission that you want to give to the AWS user that | |
| 803 you specified in `Grantee`. Permissions are granted on the | |
| 804 thumbnail files that Elastic Transcoder adds to the bucket. Valid | |
| 805 values include: | |
| 806 | |
| 807 + `READ`: The grantee can read the thumbnails and metadata for objects | |
| 808 that Elastic Transcoder adds to the Amazon S3 bucket. | |
| 809 + `READ_ACP`: The grantee can read the object ACL for thumbnails that | |
| 810 Elastic Transcoder adds to the Amazon S3 bucket. | |
| 811 + `WRITE_ACP`: The grantee can write the ACL for the thumbnails that | |
| 812 Elastic Transcoder adds to the Amazon S3 bucket. | |
| 813 + `FULL_CONTROL`: The grantee has `READ`, `READ_ACP`, and `WRITE_ACP` | |
| 814 permissions for the thumbnails that Elastic Transcoder adds to the | |
| 815 Amazon S3 bucket. | |
| 816 | |
| 817 + **StorageClass**: The Amazon S3 storage class, `Standard` or | |
| 818 `ReducedRedundancy`, that you want Elastic Transcoder to assign to | |
| 819 the thumbnails that it stores in your Amazon S3 bucket. | |
| 820 | |
| 821 """ | |
| 822 uri = '/2012-09-25/pipelines/{0}'.format(id) | |
| 823 params = {} | |
| 824 if name is not None: | |
| 825 params['Name'] = name | |
| 826 if input_bucket is not None: | |
| 827 params['InputBucket'] = input_bucket | |
| 828 if role is not None: | |
| 829 params['Role'] = role | |
| 830 if notifications is not None: | |
| 831 params['Notifications'] = notifications | |
| 832 if content_config is not None: | |
| 833 params['ContentConfig'] = content_config | |
| 834 if thumbnail_config is not None: | |
| 835 params['ThumbnailConfig'] = thumbnail_config | |
| 836 return self.make_request('PUT', uri, expected_status=200, | |
| 837 data=json.dumps(params)) | |
| 838 | |
| 839 def update_pipeline_notifications(self, id=None, notifications=None): | |
| 840 """ | |
| 841 With the UpdatePipelineNotifications operation, you can update | |
| 842 Amazon Simple Notification Service (Amazon SNS) notifications | |
| 843 for a pipeline. | |
| 844 | |
| 845 When you update notifications for a pipeline, Elastic | |
| 846 Transcoder returns the values that you specified in the | |
| 847 request. | |
| 848 | |
| 849 :type id: string | |
| 850 :param id: The identifier of the pipeline for which you want to change | |
| 851 notification settings. | |
| 852 | |
| 853 :type notifications: dict | |
| 854 :param notifications: | |
| 855 The topic ARN for the Amazon Simple Notification Service (Amazon SNS) | |
| 856 topic that you want to notify to report job status. | |
| 857 To receive notifications, you must also subscribe to the new topic in | |
| 858 the Amazon SNS console. | |
| 859 | |
| 860 + **Progressing**: The topic ARN for the Amazon Simple Notification | |
| 861 Service (Amazon SNS) topic that you want to notify when Elastic | |
| 862 Transcoder has started to process jobs that are added to this | |
| 863 pipeline. This is the ARN that Amazon SNS returned when you created | |
| 864 the topic. | |
| 865 + **Completed**: The topic ARN for the Amazon SNS topic that you want | |
| 866 to notify when Elastic Transcoder has finished processing a job. | |
| 867 This is the ARN that Amazon SNS returned when you created the | |
| 868 topic. | |
| 869 + **Warning**: The topic ARN for the Amazon SNS topic that you want to | |
| 870 notify when Elastic Transcoder encounters a warning condition. This | |
| 871 is the ARN that Amazon SNS returned when you created the topic. | |
| 872 + **Error**: The topic ARN for the Amazon SNS topic that you want to | |
| 873 notify when Elastic Transcoder encounters an error condition. This | |
| 874 is the ARN that Amazon SNS returned when you created the topic. | |
| 875 | |
| 876 """ | |
| 877 uri = '/2012-09-25/pipelines/{0}/notifications'.format(id) | |
| 878 params = {} | |
| 879 if id is not None: | |
| 880 params['Id'] = id | |
| 881 if notifications is not None: | |
| 882 params['Notifications'] = notifications | |
| 883 return self.make_request('POST', uri, expected_status=200, | |
| 884 data=json.dumps(params)) | |
| 885 | |
| 886 def update_pipeline_status(self, id=None, status=None): | |
| 887 """ | |
| 888 The UpdatePipelineStatus operation pauses or reactivates a | |
| 889 pipeline, so that the pipeline stops or restarts the | |
| 890 processing of jobs. | |
| 891 | |
| 892 Changing the pipeline status is useful if you want to cancel | |
| 893 one or more jobs. You can't cancel jobs after Elastic | |
| 894 Transcoder has started processing them; if you pause the | |
| 895 pipeline to which you submitted the jobs, you have more time | |
| 896 to get the job IDs for the jobs that you want to cancel, and | |
| 897 to send a CancelJob request. | |
| 898 | |
| 899 :type id: string | |
| 900 :param id: The identifier of the pipeline to update. | |
| 901 | |
| 902 :type status: string | |
| 903 :param status: | |
| 904 The desired status of the pipeline: | |
| 905 | |
| 906 | |
| 907 + `Active`: The pipeline is processing jobs. | |
| 908 + `Paused`: The pipeline is not currently processing jobs. | |
| 909 | |
| 910 """ | |
| 911 uri = '/2012-09-25/pipelines/{0}/status'.format(id) | |
| 912 params = {} | |
| 913 if id is not None: | |
| 914 params['Id'] = id | |
| 915 if status is not None: | |
| 916 params['Status'] = status | |
| 917 return self.make_request('POST', uri, expected_status=200, | |
| 918 data=json.dumps(params)) | |
| 919 | |
| 920 def make_request(self, verb, resource, headers=None, data='', | |
| 921 expected_status=None, params=None): | |
| 922 if headers is None: | |
| 923 headers = {} | |
| 924 response = super(ElasticTranscoderConnection, self).make_request( | |
| 925 verb, resource, headers=headers, data=data, params=params) | |
| 926 body = json.loads(response.read().decode('utf-8')) | |
| 927 if response.status == expected_status: | |
| 928 return body | |
| 929 else: | |
| 930 error_type = response.getheader('x-amzn-ErrorType').split(':')[0] | |
| 931 error_class = self._faults.get(error_type, self.ResponseError) | |
| 932 raise error_class(response.status, response.reason, body) |
