|
| 1 | +# coding=utf8 |
| 2 | + |
| 3 | +# Copyright 2018 JDCLOUD.COM |
| 4 | +# |
| 5 | +# Licensed under the Apache License, Version 2.0 (the "License"); |
| 6 | +# you may not use this file except in compliance with the License. |
| 7 | +# You may obtain a copy of the License at |
| 8 | +# |
| 9 | +# http://www.apache.org/licenses/LICENSE-2.0 |
| 10 | +# |
| 11 | +# Unless required by applicable law or agreed to in writing, software |
| 12 | +# distributed under the License is distributed on an "AS IS" BASIS, |
| 13 | +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 14 | +# See the License for the specific language governing permissions and |
| 15 | +# limitations under the License. |
| 16 | +# |
| 17 | +# NOTE: This class is auto generated by the jdcloud code generator program. |
| 18 | + |
| 19 | +from argparse import RawTextHelpFormatter |
| 20 | +from cement.ext.ext_argparse import expose |
| 21 | +from jdcloud_cli.controllers.base_controller import BaseController |
| 22 | +from jdcloud_cli.client_factory import ClientFactory |
| 23 | +from jdcloud_cli.parameter_builder import collect_user_args, collect_user_headers |
| 24 | +from jdcloud_cli.printer import Printer |
| 25 | +from jdcloud_cli.skeleton import Skeleton |
| 26 | + |
| 27 | + |
| 28 | +class AmsController(BaseController): |
| 29 | + class Meta: |
| 30 | + label = 'ams' |
| 31 | + help = '京东云视频云应用管理平台接口(仅对授权用户使用)' |
| 32 | + description = ''' |
| 33 | + ams cli 子命令,京东云视频云应用管理平台接口(仅对授权用户使用)。 |
| 34 | + OpenAPI文档地址为:https://docs.jdcloud.com/cn/xxx/api/overview |
| 35 | + ''' |
| 36 | + stacked_on = 'base' |
| 37 | + stacked_type = 'nested' |
| 38 | + |
| 39 | + @expose( |
| 40 | + arguments=[ |
| 41 | + (['--stream-id'], dict(help="""(string) 流ID """, dest='streamId', required=True)), |
| 42 | + (['--start-time'], dict(help="""(string) 起始时间 """, dest='startTime', required=False)), |
| 43 | + (['--end-time'], dict(help="""(string) 结束时间 """, dest='endTime', required=False)), |
| 44 | + (['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例:--input-json \'{"field":"value"}\';\n文件格式举例:--input-json file:///xxxx.json', dest='input_json', required=False)), |
| 45 | + (['--headers'], dict(help="""(json) 用户自定义Header,举例:'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)), |
| 46 | + ], |
| 47 | + formatter_class=RawTextHelpFormatter, |
| 48 | + help=''' 获取收流基础数据查询 ''', |
| 49 | + description=''' |
| 50 | + 获取收流基础数据查询。 |
| 51 | +
|
| 52 | + 示例: jdc ams describe-streams-input --stream-id xxx |
| 53 | + ''', |
| 54 | + ) |
| 55 | + def describe_streams_input(self): |
| 56 | + client_factory = ClientFactory('ams') |
| 57 | + client = client_factory.get(self.app) |
| 58 | + if client is None: |
| 59 | + return |
| 60 | + |
| 61 | + try: |
| 62 | + from jdcloud_sdk.services.ams.apis.DescribeStreamsInputRequest import DescribeStreamsInputRequest |
| 63 | + params_dict = collect_user_args(self.app) |
| 64 | + headers = collect_user_headers(self.app) |
| 65 | + req = DescribeStreamsInputRequest(params_dict, headers) |
| 66 | + resp = client.send(req) |
| 67 | + Printer.print_result(resp) |
| 68 | + except ImportError: |
| 69 | + print('{"error":"This api is not supported, please use the newer version"}') |
| 70 | + except Exception as e: |
| 71 | + print(e.message) |
| 72 | + |
| 73 | + @expose( |
| 74 | + arguments=[ |
| 75 | + (['--p-id'], dict(help="""(string) PinId """, dest='pId', required=True)), |
| 76 | + (['--ver'], dict(help="""(int) 版本 """, dest='ver', type=int, required=False)), |
| 77 | + (['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例:--input-json \'{"field":"value"}\';\n文件格式举例:--input-json file:///xxxx.json', dest='input_json', required=False)), |
| 78 | + (['--headers'], dict(help="""(json) 用户自定义Header,举例:'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)), |
| 79 | + ], |
| 80 | + formatter_class=RawTextHelpFormatter, |
| 81 | + help=''' 客户端鉴权查询 ''', |
| 82 | + description=''' |
| 83 | + 客户端鉴权查询。 |
| 84 | +
|
| 85 | + 示例: jdc ams describe-authenticate --p-id xxx |
| 86 | + ''', |
| 87 | + ) |
| 88 | + def describe_authenticate(self): |
| 89 | + client_factory = ClientFactory('ams') |
| 90 | + client = client_factory.get(self.app) |
| 91 | + if client is None: |
| 92 | + return |
| 93 | + |
| 94 | + try: |
| 95 | + from jdcloud_sdk.services.ams.apis.DescribeAuthenticateRequest import DescribeAuthenticateRequest |
| 96 | + params_dict = collect_user_args(self.app) |
| 97 | + headers = collect_user_headers(self.app) |
| 98 | + req = DescribeAuthenticateRequest(params_dict, headers) |
| 99 | + resp = client.send(req) |
| 100 | + Printer.print_result(resp) |
| 101 | + except ImportError: |
| 102 | + print('{"error":"This api is not supported, please use the newer version"}') |
| 103 | + except Exception as e: |
| 104 | + print(e.message) |
| 105 | + |
| 106 | + @expose( |
| 107 | + arguments=[ |
| 108 | + (['--api'], dict(help="""(string) api name """, choices=['describe-streams-input','describe-authenticate',], required=True)), |
| 109 | + ], |
| 110 | + formatter_class=RawTextHelpFormatter, |
| 111 | + help=''' 生成单个API接口的json骨架空字符串 ''', |
| 112 | + description=''' |
| 113 | + 生成单个API接口的json骨架空字符串。 |
| 114 | +
|
| 115 | + 示例: jdc nc generate-skeleton --api describeContainer ''', |
| 116 | + ) |
| 117 | + def generate_skeleton(self): |
| 118 | + skeleton = Skeleton('ams', self.app.pargs.api) |
| 119 | + skeleton.show() |
0 commit comments