Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
aws
GitHub Repository: aws/aws-cli
Path: blob/develop/awscli/customizations/iot.py
1566 views
1
# Copyright 2015 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
This customization makes it easier to save various pieces of data
15
returned from iot commands that would typically need to be saved to a
16
file. This customization adds the following options:
17
18
- aws iot create-certificate-from-csr
19
- ``--certificate-pem-outfile``: certificatePem
20
- aws iot create-keys-and-certificate
21
- ``--certificate-pem-outfile``: certificatePem
22
- ``--public-key-outfile``: keyPair.PublicKey
23
- ``--private-key-outfile``: keyPair.PrivateKey
24
"""
25
from awscli.customizations.arguments import QueryOutFileArgument
26
27
28
def register_create_keys_and_cert_arguments(session, argument_table, **kwargs):
29
"""Add outfile save arguments to create-keys-and-certificate
30
31
- ``--certificate-pem-outfile``
32
- ``--public-key-outfile``
33
- ``--private-key-outfile``
34
"""
35
after_event = 'after-call.iot.CreateKeysAndCertificate'
36
argument_table['certificate-pem-outfile'] = QueryOutFileArgument(
37
session=session, name='certificate-pem-outfile',
38
query='certificatePem', after_call_event=after_event, perm=0o600)
39
argument_table['public-key-outfile'] = QueryOutFileArgument(
40
session=session, name='public-key-outfile', query='keyPair.PublicKey',
41
after_call_event=after_event, perm=0o600)
42
argument_table['private-key-outfile'] = QueryOutFileArgument(
43
session=session, name='private-key-outfile',
44
query='keyPair.PrivateKey', after_call_event=after_event, perm=0o600)
45
46
47
def register_create_keys_from_csr_arguments(session, argument_table, **kwargs):
48
"""Add certificate-pem-outfile to create-certificate-from-csr"""
49
argument_table['certificate-pem-outfile'] = QueryOutFileArgument(
50
session=session, name='certificate-pem-outfile',
51
query='certificatePem',
52
after_call_event='after-call.iot.CreateCertificateFromCsr', perm=0o600)
53
54