o .&aE@s`dZddlZddlZddlZeeZdgZddZddZ dd Z d d Z Gd d d e Z dS)a:This module enables the preview-mode customization. If a service is marked as being in preview mode, then any attempts to call operations on that service will print a message pointing the user to alternate solutions. A user can still access this service by enabling the service in their config file via: [preview] servicename=true or by running: aws configure set preview.servicename true Also any service that is marked as being in preview will *not* be listed in the help docs, unless the service has been enabled in the config file as shown above. NsdbcCs|dtdS)Nzbuilding-command-table.main)registermark_as_preview)eventsr?/usr/lib/python3/dist-packages/awscli/customizations/preview.pyregister_preview_commands-rcKs|t|}tD]5}d}||vrtd|d}||}tdt|jfi}||j||jj |d||<| d d|t qdS)NFz/Preview service enabled through config file: %sTPreviewCommand)cli_namesession service_name is_enabled event_emitterzdoc-description.%s) _get_allowed_servicesPREVIEW_SERVICESloggerdebugtypePreviewModeCommandMixin __class__name service_modelr get_component register_lastupdate_description_with_preview) command_tabler kwargsallowed_servicespreview_serviceroriginal_command preview_clsrrrr1s0  rcKsV|jj}||tj|jd|j dd}| d|| dS)Nz(You can enable this service by running: .rz!aws configure set preview.%s true) docstyle start_noteboldr HELP_SNIPPETstripwrite event_classsplitcodeend_note) help_commandrr$r rrrrNs  rcCs:g}|jdi}|D] \}}|dkr||q |S)Npreviewtrue) full_configgetitemsappend)r allowedpreview_servicesr/valuerrrres rcsFeZdZedZdZfddZfddZddZ d d Z Z S) ra However, if you'd like to use the "aws {service}" commands with the AWS CLI, you can enable this service by adding the following to your CLI config file: [preview] {service}=true or by running: aws configure set preview.{service} true zGAWS CLI support for this service is only available in a preview stage. cs&|d|_tt|j|i|dS)Nr)pop _is_enabledsuperr__init__)selfargsrrrrr;s z PreviewModeCommandMixin.__init__cs*|js||rtt|||S|S)N)r9_is_help_commandr:r__call___display_opt_in_message)r<r=parsed_globalsr>rrr@s  z PreviewModeCommandMixin.__call__cCs|o|ddkS)Nhelpr)r<r=rrrr?r z(PreviewModeCommandMixin._is_help_commandcCs6tj|jtjdtj|jj|jddS)N )service)sysstderrr)r' ENABLE_DOCSformat _service_name)r<rrrrAs z/PreviewModeCommandMixin._display_opt_in_message) __name__ __module__ __qualname__textwrapdedentrJr'r;r@r?rA __classcell__rrr>rrqs   r)__doc__loggingrHrP getLoggerrMrrrrrrobjectrrrrrs