text: # coding=utf8
  
  # Copyright 2018 JDCLOUD.COM
  #
  # Licensed under the Apache License, Version 2.0 (the "License");
  # you may not use this file except in compliance with the License.
  # You may obtain a copy of the License at
  #
  #     http://www.apache.org/licenses/LICENSE-2.0
  #
  # Unless required by applicable law or agreed to in writing, software
  # distributed under the License is distributed on an "AS IS" BASIS,
  # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  # See the License for the specific language governing permissions and
  # limitations under the License.
  #
  # NOTE: This class is auto generated by the jdcloud code generator program.
  
  from argparse import RawTextHelpFormatter
  from jdcloud_cli.cement.ext.ext_argparse import expose
  from jdcloud_cli.controllers.base_controller import BaseController
  from jdcloud_cli.client_factory import ClientFactory
  from jdcloud_cli.parameter_builder import collect_user_args, collect_user_headers
  from jdcloud_cli.printer import Printer
  from jdcloud_cli.skeleton import Skeleton
  
  
  class FunctionController(BaseController):
      class Meta:
          label = 'function'
          help = '京东云function接口'
          description = '''
          function cli 子命令，function相关接口。
          OpenAPI文档地址为：https://docs.jdcloud.com/cn/function-service/api/overview
          '''
          stacked_on = 'base'
          stacked_type = 'nested'
  
      @expose(
          arguments=[
              (['--region-id'], dict(help="""(string) Region ID """, dest='regionId',  required=False)),
              (['--function-name'], dict(help="""(string) 别名所属函数名称 """, dest='functionName',  required=True)),
              (['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例：--input-json \'{"field":"value"}\';\n文件格式举例：--input-json file:///xxxx.json', dest='input_json', required=False)),
              (['--headers'], dict(help="""(json) 用户自定义Header，举例：'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
          ],
          formatter_class=RawTextHelpFormatter,
          help=''' 查询别名列表 ''',
          description='''
              查询别名列表。
  
              示例: jdc function list-alias  --function-name xxx
          ''',
      )
      def list_alias(self):
          client_factory = ClientFactory('function')
          client = client_factory.get(self.app)
          if client is None:
              return
  
          try:
              from jdcloud_sdk.services.function.apis.ListAliasRequest import ListAliasRequest
              params_dict = collect_user_args(self.app)
              headers = collect_user_headers(self.app)
              req = ListAliasRequest(params_dict, headers)
              resp = client.send(req)
              Printer.print_result(resp)
          except ImportError:
              print('{"error":"This api is not supported, please use the newer version"}')
          except Exception as e:
              print(e)
  
      @expose(
          arguments=[
              (['--region-id'], dict(help="""(string) Region ID """, dest='regionId',  required=False)),
              (['--function-name'], dict(help="""(string) 别名所属函数名称 """, dest='functionName',  required=True)),
              (['--alias-name'], dict(help="""(string) 别名名称 """, dest='aliasName',  required=True)),
              (['--description'], dict(help="""(string) 别名描述信息 """, dest='description',  required=False)),
              (['--version'], dict(help="""(string) 别名对应的版本名称 """, dest='version',  required=False)),
              (['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例：--input-json \'{"field":"value"}\';\n文件格式举例：--input-json file:///xxxx.json', dest='input_json', required=False)),
              (['--headers'], dict(help="""(json) 用户自定义Header，举例：'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
          ],
          formatter_class=RawTextHelpFormatter,
          help=''' 创建别名 ''',
          description='''
              创建别名。
  
              示例: jdc function create-alias  --function-name xxx --alias-name xxx
          ''',
      )
      def create_alias(self):
          client_factory = ClientFactory('function')
          client = client_factory.get(self.app)
          if client is None:
              return
  
          try:
              from jdcloud_sdk.services.function.apis.CreateAliasRequest import CreateAliasRequest
              params_dict = collect_user_args(self.app)
              headers = collect_user_headers(self.app)
              req = CreateAliasRequest(params_dict, headers)
              resp = client.send(req)
              Printer.print_result(resp)
          except ImportError:
              print('{"error":"This api is not supported, please use the newer version"}')
          except Exception as e:
              print(e)
  
      @expose(
          arguments=[
              (['--region-id'], dict(help="""(string) Region ID """, dest='regionId',  required=False)),
              (['--function-name'], dict(help="""(string) 别名所属函数名称 """, dest='functionName',  required=True)),
              (['--alias-name'], dict(help="""(string) 别名名称 """, dest='aliasName',  required=True)),
              (['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例：--input-json \'{"field":"value"}\';\n文件格式举例：--input-json file:///xxxx.json', dest='input_json', required=False)),
              (['--headers'], dict(help="""(json) 用户自定义Header，举例：'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
          ],
          formatter_class=RawTextHelpFormatter,
          help=''' 查询别名详情 ''',
          description='''
              查询别名详情。
  
              示例: jdc function get-alias  --function-name xxx --alias-name xxx
          ''',
      )
      def get_alias(self):
          client_factory = ClientFactory('function')
          client = client_factory.get(self.app)
          if client is None:
              return
  
          try:
              from jdcloud_sdk.services.function.apis.GetAliasRequest import GetAliasRequest
              params_dict = collect_user_args(self.app)
              headers = collect_user_headers(self.app)
              req = GetAliasRequest(params_dict, headers)
              resp = client.send(req)
              Printer.print_result(resp)
          except ImportError:
              print('{"error":"This api is not supported, please use the newer version"}')
          except Exception as e:
              print(e)
  
      @expose(
          arguments=[
              (['--region-id'], dict(help="""(string) Region ID """, dest='regionId',  required=False)),
              (['--function-name'], dict(help="""(string) 别名所属函数名称 """, dest='functionName',  required=True)),
              (['--alias-name'], dict(help="""(string) 别名名称 """, dest='aliasName',  required=True)),
              (['--description'], dict(help="""(string) 别名描述信息 """, dest='description',  required=True)),
              (['--version'], dict(help="""(string) 别名对应版本 """, dest='version',  required=True)),
              (['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例：--input-json \'{"field":"value"}\';\n文件格式举例：--input-json file:///xxxx.json', dest='input_json', required=False)),
              (['--headers'], dict(help="""(json) 用户自定义Header，举例：'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
          ],
          formatter_class=RawTextHelpFormatter,
          help=''' 更新别名 ''',
          description='''
              更新别名。
  
              示例: jdc function update-alias  --function-name xxx --alias-name xxx --description xxx --version xxx
          ''',
      )
      def update_alias(self):
          client_factory = ClientFactory('function')
          client = client_factory.get(self.app)
          if client is None:
              return
  
          try:
              from jdcloud_sdk.services.function.apis.UpdateAliasRequest import UpdateAliasRequest
              params_dict = collect_user_args(self.app)
              headers = collect_user_headers(self.app)
              req = UpdateAliasRequest(params_dict, headers)
              resp = client.send(req)
              Printer.print_result(resp)
          except ImportError:
              print('{"error":"This api is not supported, please use the newer version"}')
          except Exception as e:
              print(e)
  
      @expose(
          arguments=[
              (['--region-id'], dict(help="""(string) Region ID """, dest='regionId',  required=False)),
              (['--function-name'], dict(help="""(string) 别名所属函数名称 """, dest='functionName',  required=True)),
              (['--alias-name'], dict(help="""(string) 别名名称 """, dest='aliasName',  required=True)),
              (['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例：--input-json \'{"field":"value"}\';\n文件格式举例：--input-json file:///xxxx.json', dest='input_json', required=False)),
              (['--headers'], dict(help="""(json) 用户自定义Header，举例：'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
          ],
          formatter_class=RawTextHelpFormatter,
          help=''' 删除别名 ''',
          description='''
              删除别名。
  
              示例: jdc function delete-alias  --function-name xxx --alias-name xxx
          ''',
      )
      def delete_alias(self):
          client_factory = ClientFactory('function')
          client = client_factory.get(self.app)
          if client is None:
              return
  
          try:
              from jdcloud_sdk.services.function.apis.DeleteAliasRequest import DeleteAliasRequest
              params_dict = collect_user_args(self.app)
              headers = collect_user_headers(self.app)
              req = DeleteAliasRequest(params_dict, headers)
              resp = client.send(req)
              Printer.print_result(resp)
          except ImportError:
              print('{"error":"This api is not supported, please use the newer version"}')
          except Exception as e:
              print(e)
  
      @expose(
          arguments=[
              (['--region-id'], dict(help="""(string) Region ID """, dest='regionId',  required=False)),
              (['--list-all'], dict(help="""(bool) 是否返回所有函数 """, dest='listAll',  required=True)),
              (['--page-number'], dict(help="""(int) 页码 """, dest='pageNumber', type=int, required=False)),
              (['--page-size'], dict(help="""(int) 分页大小 """, dest='pageSize', type=int, required=False)),
              (['--filters'], dict(help="""(array: filter) functionId -函数ID，精确匹配，支持多个; functionName  - 函数名称，模糊匹配，支持单个;  """, dest='filters',  required=False)),
              (['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例：--input-json \'{"field":"value"}\';\n文件格式举例：--input-json file:///xxxx.json', dest='input_json', required=False)),
              (['--headers'], dict(help="""(json) 用户自定义Header，举例：'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
          ],
          formatter_class=RawTextHelpFormatter,
          help=''' 查询函数列表 ''',
          description='''
              查询函数列表。
  
              示例: jdc function list-function  --list-all true
          ''',
      )
      def list_function(self):
          client_factory = ClientFactory('function')
          client = client_factory.get(self.app)
          if client is None:
              return
  
          try:
              from jdcloud_sdk.services.function.apis.ListFunctionRequest import ListFunctionRequest
              params_dict = collect_user_args(self.app)
              headers = collect_user_headers(self.app)
              req = ListFunctionRequest(params_dict, headers)
              resp = client.send(req)
              Printer.print_result(resp)
          except ImportError:
              print('{"error":"This api is not supported, please use the newer version"}')
          except Exception as e:
              print(e)
  
      @expose(
          arguments=[
              (['--region-id'], dict(help="""(string) Region ID """, dest='regionId',  required=False)),
              (['--name'], dict(help="""(string) 函数名称 """, dest='name',  required=False)),
              (['--description'], dict(help="""(string) 函数描述信息 """, dest='description',  required=False)),
              (['--entrance'], dict(help="""(string) 函数入口，格式为入口文件.入口函数名 """, dest='entrance',  required=False)),
              (['--memory'], dict(help="""(int) 函数运行最大内存 """, dest='memory', type=int, required=False)),
              (['--run-time'], dict(help="""(string) 函数运行环境 """, dest='runTime',  required=False)),
              (['--over-time'], dict(help="""(int) 函数运行超时时间 """, dest='overTime', type=int, required=False)),
              (['--version'], dict(help="""(string) 函数版本，默认为LATEST """, dest='version',  required=False)),
              (['--code'], dict(help="""(code) 函数代码包 """, dest='code',  required=False)),
              (['--environment'], dict(help="""(env) 函数运行时环境变量 """, dest='environment',  required=False)),
              (['--log-set-id'], dict(help="""(string) 函数指定的日志集Id """, dest='logSetId',  required=False)),
              (['--log-topic-id'], dict(help="""(string) 函数指定的日志主题Id """, dest='logTopicId',  required=False)),
              (['--vpc-id'], dict(help="""(string) 函数配置的VPCId """, dest='vpcId',  required=False)),
              (['--subnet-id'], dict(help="""(string) 函数配置的子网Id """, dest='subnetId',  required=False)),
              (['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例：--input-json \'{"field":"value"}\';\n文件格式举例：--input-json file:///xxxx.json', dest='input_json', required=False)),
              (['--headers'], dict(help="""(json) 用户自定义Header，举例：'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
          ],
          formatter_class=RawTextHelpFormatter,
          help=''' 创建函数 ''',
          description='''
              创建函数。
  
              示例: jdc function create-function 
          ''',
      )
      def create_function(self):
          client_factory = ClientFactory('function')
          client = client_factory.get(self.app)
          if client is None:
              return
  
          try:
              from jdcloud_sdk.services.function.apis.CreateFunctionRequest import CreateFunctionRequest
              params_dict = collect_user_args(self.app)
              headers = collect_user_headers(self.app)
              req = CreateFunctionRequest(params_dict, headers)
              resp = client.send(req)
              Printer.print_result(resp)
          except ImportError:
              print('{"error":"This api is not supported, please use the newer version"}')
          except Exception as e:
              print(e)
  
      @expose(
          arguments=[
              (['--region-id'], dict(help="""(string) Region ID """, dest='regionId',  required=False)),
              (['--function-name'], dict(help="""(string) 函数名称 """, dest='functionName',  required=True)),
              (['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例：--input-json \'{"field":"value"}\';\n文件格式举例：--input-json file:///xxxx.json', dest='input_json', required=False)),
              (['--headers'], dict(help="""(json) 用户自定义Header，举例：'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
          ],
          formatter_class=RawTextHelpFormatter,
          help=''' 查询函数详情 ''',
          description='''
              查询函数详情。
  
              示例: jdc function get-function  --function-name xxx
          ''',
      )
      def get_function(self):
          client_factory = ClientFactory('function')
          client = client_factory.get(self.app)
          if client is None:
              return
  
          try:
              from jdcloud_sdk.services.function.apis.GetFunctionRequest import GetFunctionRequest
              params_dict = collect_user_args(self.app)
              headers = collect_user_headers(self.app)
              req = GetFunctionRequest(params_dict, headers)
              resp = client.send(req)
              Printer.print_result(resp)
          except ImportError:
              print('{"error":"This api is not supported, please use the newer version"}')
          except Exception as e:
              print(e)
  
      @expose(
          arguments=[
              (['--region-id'], dict(help="""(string) Region ID """, dest='regionId',  required=False)),
              (['--function-name'], dict(help="""(string) 函数名称 """, dest='functionName',  required=True)),
              (['--description'], dict(help="""(string) 函数描述信息 """, dest='description',  required=False)),
              (['--entrance'], dict(help="""(string) 函数入口，格式为入口文件.入口函数名 """, dest='entrance',  required=False)),
              (['--memory'], dict(help="""(int) 函数运行最大内存 """, dest='memory', type=int, required=False)),
              (['--run-time'], dict(help="""(string) 函数运行环境 """, dest='runTime',  required=False)),
              (['--over-time'], dict(help="""(int) 函数运行超时时间 """, dest='overTime', type=int, required=False)),
              (['--version'], dict(help="""(string) 函数版本 """, dest='version',  required=False)),
              (['--code'], dict(help="""(code) 函数代码包 """, dest='code',  required=False)),
              (['--environment'], dict(help="""(env) 函数运行时环境变量 """, dest='environment',  required=False)),
              (['--log-set-id'], dict(help="""(string) 函数指定的日志集Id """, dest='logSetId',  required=False)),
              (['--log-topic-id'], dict(help="""(string) 函数指定的日志主题Id """, dest='logTopicId',  required=False)),
              (['--vpc-id'], dict(help="""(string) 函数配置的VPCId """, dest='vpcId',  required=False)),
              (['--subnet-id'], dict(help="""(string) 函数配置的子网Id """, dest='subnetId',  required=False)),
              (['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例：--input-json \'{"field":"value"}\';\n文件格式举例：--input-json file:///xxxx.json', dest='input_json', required=False)),
              (['--headers'], dict(help="""(json) 用户自定义Header，举例：'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
          ],
          formatter_class=RawTextHelpFormatter,
          help=''' 更新函数 ''',
          description='''
              更新函数。
  
              示例: jdc function update-function  --function-name xxx
          ''',
      )
      def update_function(self):
          client_factory = ClientFactory('function')
          client = client_factory.get(self.app)
          if client is None:
              return
  
          try:
              from jdcloud_sdk.services.function.apis.UpdateFunctionRequest import UpdateFunctionRequest
              params_dict = collect_user_args(self.app)
              headers = collect_user_headers(self.app)
              req = UpdateFunctionRequest(params_dict, headers)
              resp = client.send(req)
              Printer.print_result(resp)
          except ImportError:
              print('{"error":"This api is not supported, please use the newer version"}')
          except Exception as e:
              print(e)
  
      @expose(
          arguments=[
              (['--region-id'], dict(help="""(string) Region ID """, dest='regionId',  required=False)),
              (['--function-name'], dict(help="""(string) 函数名称 """, dest='functionName',  required=True)),
              (['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例：--input-json \'{"field":"value"}\';\n文件格式举例：--input-json file:///xxxx.json', dest='input_json', required=False)),
              (['--headers'], dict(help="""(json) 用户自定义Header，举例：'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
          ],
          formatter_class=RawTextHelpFormatter,
          help=''' 删除函数 ''',
          description='''
              删除函数。
  
              示例: jdc function delete-function  --function-name xxx
          ''',
      )
      def delete_function(self):
          client_factory = ClientFactory('function')
          client = client_factory.get(self.app)
          if client is None:
              return
  
          try:
              from jdcloud_sdk.services.function.apis.DeleteFunctionRequest import DeleteFunctionRequest
              params_dict = collect_user_args(self.app)
              headers = collect_user_headers(self.app)
              req = DeleteFunctionRequest(params_dict, headers)
              resp = client.send(req)
              Printer.print_result(resp)
          except ImportError:
              print('{"error":"This api is not supported, please use the newer version"}')
          except Exception as e:
              print(e)
  
      @expose(
          arguments=[
              (['--region-id'], dict(help="""(string) Region ID """, dest='regionId',  required=False)),
              (['--function-name'], dict(help="""(string) 函数名称 """, dest='functionName',  required=True)),
              (['--version-name'], dict(help="""(string) 版本名称 """, dest='versionName',  required=True)),
              (['--event'], dict(help="""(string) 执行函数的输入事件 """, dest='event',  required=True)),
              (['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例：--input-json \'{"field":"value"}\';\n文件格式举例：--input-json file:///xxxx.json', dest='input_json', required=False)),
              (['--headers'], dict(help="""(json) 用户自定义Header，举例：'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
          ],
          formatter_class=RawTextHelpFormatter,
          help=''' 控制台测试执行函数 ''',
          description='''
              控制台测试执行函数。
  
              示例: jdc function invoke  --function-name xxx --version-name xxx --event xxx
          ''',
      )
      def invoke(self):
          client_factory = ClientFactory('function')
          client = client_factory.get(self.app)
          if client is None:
              return
  
          try:
              from jdcloud_sdk.services.function.apis.InvokeRequest import InvokeRequest
              params_dict = collect_user_args(self.app)
              headers = collect_user_headers(self.app)
              req = InvokeRequest(params_dict, headers)
              resp = client.send(req)
              Printer.print_result(resp)
          except ImportError:
              print('{"error":"This api is not supported, please use the newer version"}')
          except Exception as e:
              print(e)
  
      @expose(
          arguments=[
              (['--region-id'], dict(help="""(string) Region ID """, dest='regionId',  required=False)),
              (['--function-name'], dict(help="""(string) 函数名称 """, dest='functionName',  required=True)),
              (['--version-name'], dict(help="""(string) 版本名称 """, dest='versionName',  required=True)),
              (['--event'], dict(help="""(string) 异步执行函数的输入事件 """, dest='event',  required=True)),
              (['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例：--input-json \'{"field":"value"}\';\n文件格式举例：--input-json file:///xxxx.json', dest='input_json', required=False)),
              (['--headers'], dict(help="""(json) 用户自定义Header，举例：'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
          ],
          formatter_class=RawTextHelpFormatter,
          help=''' 异步测试执行函数 ''',
          description='''
              异步测试执行函数。
  
              示例: jdc function async-invoke  --function-name xxx --version-name xxx --event xxx
          ''',
      )
      def async_invoke(self):
          client_factory = ClientFactory('function')
          client = client_factory.get(self.app)
          if client is None:
              return
  
          try:
              from jdcloud_sdk.services.function.apis.AsyncInvokeRequest import AsyncInvokeRequest
              params_dict = collect_user_args(self.app)
              headers = collect_user_headers(self.app)
              req = AsyncInvokeRequest(params_dict, headers)
              resp = client.send(req)
              Printer.print_result(resp)
          except ImportError:
              print('{"error":"This api is not supported, please use the newer version"}')
          except Exception as e:
              print(e)
  
      @expose(
          arguments=[
              (['--region-id'], dict(help="""(string) Region ID """, dest='regionId',  required=False)),
              (['--function-name'], dict(help="""(string) 函数名称 """, dest='functionName',  required=True)),
              (['--version-name'], dict(help="""(string) 版本名称 """, dest='versionName',  required=True)),
              (['--trigger-id'], dict(help="""(string) 触发器Id """, dest='triggerId',  required=True)),
              (['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例：--input-json \'{"field":"value"}\';\n文件格式举例：--input-json file:///xxxx.json', dest='input_json', required=False)),
              (['--headers'], dict(help="""(json) 用户自定义Header，举例：'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
          ],
          formatter_class=RawTextHelpFormatter,
          help=''' 获取触发器详情 ''',
          description='''
              获取触发器详情。
  
              示例: jdc function get-trigger  --function-name xxx --version-name xxx --trigger-id xxx
          ''',
      )
      def get_trigger(self):
          client_factory = ClientFactory('function')
          client = client_factory.get(self.app)
          if client is None:
              return
  
          try:
              from jdcloud_sdk.services.function.apis.GetTriggerRequest import GetTriggerRequest
              params_dict = collect_user_args(self.app)
              headers = collect_user_headers(self.app)
              req = GetTriggerRequest(params_dict, headers)
              resp = client.send(req)
              Printer.print_result(resp)
          except ImportError:
              print('{"error":"This api is not supported, please use the newer version"}')
          except Exception as e:
              print(e)
  
      @expose(
          arguments=[
              (['--region-id'], dict(help="""(string) Region ID """, dest='regionId',  required=False)),
              (['--function-name'], dict(help="""(string) 函数名称 """, dest='functionName',  required=True)),
              (['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例：--input-json \'{"field":"value"}\';\n文件格式举例：--input-json file:///xxxx.json', dest='input_json', required=False)),
              (['--headers'], dict(help="""(json) 用户自定义Header，举例：'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
          ],
          formatter_class=RawTextHelpFormatter,
          help=''' 查询版本列表 ''',
          description='''
              查询版本列表。
  
              示例: jdc function list-version  --function-name xxx
          ''',
      )
      def list_version(self):
          client_factory = ClientFactory('function')
          client = client_factory.get(self.app)
          if client is None:
              return
  
          try:
              from jdcloud_sdk.services.function.apis.ListVersionRequest import ListVersionRequest
              params_dict = collect_user_args(self.app)
              headers = collect_user_headers(self.app)
              req = ListVersionRequest(params_dict, headers)
              resp = client.send(req)
              Printer.print_result(resp)
          except ImportError:
              print('{"error":"This api is not supported, please use the newer version"}')
          except Exception as e:
              print(e)
  
      @expose(
          arguments=[
              (['--region-id'], dict(help="""(string) Region ID """, dest='regionId',  required=False)),
              (['--function-name'], dict(help="""(string) 函数名称 """, dest='functionName',  required=True)),
              (['--description'], dict(help="""(string) 版本描述 """, dest='description',  required=False)),
              (['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例：--input-json \'{"field":"value"}\';\n文件格式举例：--input-json file:///xxxx.json', dest='input_json', required=False)),
              (['--headers'], dict(help="""(json) 用户自定义Header，举例：'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
          ],
          formatter_class=RawTextHelpFormatter,
          help=''' 创建版本 ''',
          description='''
              创建版本。
  
              示例: jdc function create-version  --function-name xxx
          ''',
      )
      def create_version(self):
          client_factory = ClientFactory('function')
          client = client_factory.get(self.app)
          if client is None:
              return
  
          try:
              from jdcloud_sdk.services.function.apis.CreateVersionRequest import CreateVersionRequest
              params_dict = collect_user_args(self.app)
              headers = collect_user_headers(self.app)
              req = CreateVersionRequest(params_dict, headers)
              resp = client.send(req)
              Printer.print_result(resp)
          except ImportError:
              print('{"error":"This api is not supported, please use the newer version"}')
          except Exception as e:
              print(e)
  
      @expose(
          arguments=[
              (['--region-id'], dict(help="""(string) Region ID """, dest='regionId',  required=False)),
              (['--function-name'], dict(help="""(string) 函数名称 """, dest='functionName',  required=True)),
              (['--version-name'], dict(help="""(string) 版本名称 """, dest='versionName',  required=True)),
              (['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例：--input-json \'{"field":"value"}\';\n文件格式举例：--input-json file:///xxxx.json', dest='input_json', required=False)),
              (['--headers'], dict(help="""(json) 用户自定义Header，举例：'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
          ],
          formatter_class=RawTextHelpFormatter,
          help=''' 获取版本详情 ''',
          description='''
              获取版本详情。
  
              示例: jdc function get-version  --function-name xxx --version-name xxx
          ''',
      )
      def get_version(self):
          client_factory = ClientFactory('function')
          client = client_factory.get(self.app)
          if client is None:
              return
  
          try:
              from jdcloud_sdk.services.function.apis.GetVersionRequest import GetVersionRequest
              params_dict = collect_user_args(self.app)
              headers = collect_user_headers(self.app)
              req = GetVersionRequest(params_dict, headers)
              resp = client.send(req)
              Printer.print_result(resp)
          except ImportError:
              print('{"error":"This api is not supported, please use the newer version"}')
          except Exception as e:
              print(e)
  
      @expose(
          arguments=[
              (['--region-id'], dict(help="""(string) Region ID """, dest='regionId',  required=False)),
              (['--function-name'], dict(help="""(string) 函数名称 """, dest='functionName',  required=True)),
              (['--version-name'], dict(help="""(string) 版本名称 """, dest='versionName',  required=True)),
              (['--input-json'], dict(help='(json) 以json字符串或文件绝对路径形式作为输入参数。\n字符串方式举例：--input-json \'{"field":"value"}\';\n文件格式举例：--input-json file:///xxxx.json', dest='input_json', required=False)),
              (['--headers'], dict(help="""(json) 用户自定义Header，举例：'{"x-jdcloud-security-token":"abc","test":"123"}'""", dest='headers', required=False)),
          ],
          formatter_class=RawTextHelpFormatter,
          help=''' 删除版本 ''',
          description='''
              删除版本。
  
              示例: jdc function delete-version  --function-name xxx --version-name xxx
          ''',
      )
      def delete_version(self):
          client_factory = ClientFactory('function')
          client = client_factory.get(self.app)
          if client is None:
              return
  
          try:
              from jdcloud_sdk.services.function.apis.DeleteVersionRequest import DeleteVersionRequest
              params_dict = collect_user_args(self.app)
              headers = collect_user_headers(self.app)
              req = DeleteVersionRequest(params_dict, headers)
              resp = client.send(req)
              Printer.print_result(resp)
          except ImportError:
              print('{"error":"This api is not supported, please use the newer version"}')
          except Exception as e:
              print(e)
  
      @expose(
          arguments=[
              (['--api'], dict(help="""(string) api name """, choices=['list-alias','create-alias','get-alias','update-alias','delete-alias','list-function','create-function','get-function','update-function','delete-function','invoke','async-invoke','get-trigger','list-version','create-version','get-version','delete-version',], required=True)),
          ],
          formatter_class=RawTextHelpFormatter,
          help=''' 生成单个API接口的json骨架空字符串 ''',
          description='''
              生成单个API接口的json骨架空字符串。
  
              示例: jdc nc generate-skeleton --api describeContainer ''',
      )
      def generate_skeleton(self):
          skeleton = Skeleton('function', self.app.pargs.api)
          skeleton.show()
  