Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/awscli/customizations/rekognition.py
1566 views
1
# Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved.
2
#
3
# Licensed under the Apache License, Version 2.0 (the "License"). You
4
# may not use this file except in compliance with the License. A copy of
5
# the License is located at
6
#
7
# http://aws.amazon.com/apache2.0/
8
#
9
# or in the "license" file accompanying this file. This file is
10
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF
11
# ANY KIND, either express or implied. See the License for the specific
12
# language governing permissions and limitations under the License.
13
14
from awscli.customizations.arguments import NestedBlobArgumentHoister
15
16
IMAGE_FILE_DOCSTRING = ('<p>The content of the image to be uploaded. '
17
'To specify the content of a local file use the '
18
'fileb:// prefix. '
19
'Example: fileb://image.png</p>')
20
IMAGE_DOCSTRING_ADDENDUM = ('<p>To specify a local file use <code>--%s</code> '
21
'instead.</p>')
22
23
24
FILE_PARAMETER_UPDATES = {
25
'compare-faces.source-image': 'source-image-bytes',
26
'compare-faces.target-image': 'target-image-bytes',
27
'*.image': 'image-bytes',
28
}
29
30
31
def register_rekognition_detect_labels(cli):
32
for target, new_param in FILE_PARAMETER_UPDATES.items():
33
operation, old_param = target.rsplit('.', 1)
34
doc_string_addendum = IMAGE_DOCSTRING_ADDENDUM % new_param
35
cli.register('building-argument-table.rekognition.%s' % operation,
36
NestedBlobArgumentHoister(
37
source_arg=old_param,
38
source_arg_blob_member='Bytes',
39
new_arg=new_param,
40
new_arg_doc_string=IMAGE_FILE_DOCSTRING,
41
doc_string_addendum=doc_string_addendum))
42
43