CloudStack中@APICommand、@Parameter注解字段解释

简介: CloudStack中@APICommand、@Parameter注解字段解释

一、@APICommand

// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you 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.
package org.apache.cloudstack.api;
 
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
 
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.ResponseObject.ResponseView;
 
import static java.lang.annotation.ElementType.TYPE;
 
@Retention(RetentionPolicy.RUNTIME)
@Target({TYPE})
public @interface APICommand {
    //命令的响应类(class<? Extends BaseResponse)
    Class<? extends BaseResponse> responseObject();
 
    //名称(字符串并且全局唯一)
    String name() default "";
 
    //描述(字符串,默认空)
    String description() default "";
 
    //使用方法(字符串,默认空)
    String usage() default "";
 
    //    声明是否包含在 API 文档中(boolean,默认 true)
    boolean includeInApiDoc() default true;
 
    //  命令在哪个版本加入的(字符串,默认空)
    String since() default "";
 
    ResponseView responseView() default ResponseView.Full;
 
    boolean requestHasSensitiveInfo() default true;
 
    boolean responseHasSensitiveInfo() default true;
 
    RoleType[] authorized() default {};
 
    Class<?>[] entityType() default {};
}

二、@Parameter

// Licensed to the Apache Software Foundation (ASF) under one
// or more contributor license agreements.  See the NOTICE file
// distributed with this work for additional information
// regarding copyright ownership.  The ASF licenses this file
// to you 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.
package org.apache.cloudstack.api;
 
import static java.lang.annotation.ElementType.FIELD;
 
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
 
import org.apache.cloudstack.acl.RoleType;
import org.apache.cloudstack.api.BaseCmd.CommandType;
 
@Retention(RetentionPolicy.RUNTIME)
@Target({FIELD})
public @interface Parameter {
    //    参数名称(字符串,默认空)
    String name() default "";
 
    //描述(字符串,默认空)
    String description() default "";
 
    //必填(boolean,默认 false)
    boolean required() default false;
 
    //参数类型(CommandType 枚举)
    CommandType type() default CommandType.OBJECT;
 
    //如果参数类型为 list,需要指定集合泛型(CommandType 枚举
    CommandType collectionType() default CommandType.OBJECT;
 
    //映射数据库实体类型
    Class<?>[] entityType() default Object.class;
 
    //如果设置 false,将忽略传递的参数(boolean,默认 true)
    boolean expose() default true;
 
    //声明是否包含在 API 文档中(boolean,默认 true)
    boolean includeInApiDoc() default true;
 
    //参数的最大长度(整形,默认 255)
    int length() default 255;
 
    //参数的最大长度(整形,默认 255)
    String since() default "";
 
    RoleType[] authorized() default {};
 
    ApiArgValidator[] validations() default {};
 
    boolean acceptedOnAdminPort() default true;
}
相关文章
|
Web App开发
vscode设置默认浏览器
vscode设置默认浏览器
1475 1
|
算法 异构计算 Python
|
存储 NoSQL Ubuntu
在Ubuntu上安装Redis并学习使用get、set和keys命令
在Ubuntu上安装Redis并学习使用get、set和keys命令
|
关系型数据库 Linux Apache
|
3月前
|
人工智能 弹性计算
Qoder CN的QoderWake是什么?数字员工能7×24小时工作吗?
QoderWake CN是阿里云Qoder CN系列的数字员工子产品,支持云端或本地部署,7×24小时“常醒常思”,可主动发现问题、推进任务、协同作业,并沉淀组织资产,助力企业实现“永远在线”的智能运营。(238字)
|
5月前
|
人工智能 安全 前端开发
A÷ 你还我账号!Claude 封号事件完整复盘
Anthropic 你还我账号!Claude Max 零元购漏洞与大规模封号事件全程复盘
1346 0
|
9月前
|
编解码 运维 测试技术
基于DSP F28335的AD2S1210旋变数字转换器串行通信程序
AD2S1210是一款高精度的旋变数字转换器(RDC),用于将旋转变压器输出的模拟信号转换为数字角度和速度值。本程序基于TI DSP F28335实现与AD2S1210的串行通信(SPI接口),完成角度和速度的读取与解析。
|
10月前
|
数据采集 存储 JavaScript
Python实现网页内容转纯文本与EPUB电子书全攻略
本文介绍用Python自动化保存网页为TXT或EPUB电子书的完整方案:基于requests+BeautifulSoup抓取解析,ebooklib生成标准EPUB,支持正文智能提取、多章合并、图片保留与异常处理,兼顾实用性与合规性。(239字)
1184 0
|
11月前
|
人工智能 安全 搜索推荐
2026 AI 元年:智能时代的正式启幕
当 2026 年的时钟敲响,人工智能领域迎来历史性转折点 —— 从技术迭代的 “积累期” 正式迈入产业落地的 “爆发期”,2026 年也因此被定义为真正意义上的 “AI 元年”,标志着智能时代的正式启幕。这一年,大模型技术完成从 “能力突破” 到 “价值兑现” 的关键跨越,智能体成为企业数字化转型的核心载体,AI 普惠化浪潮席卷各行各业,技术、产业、政策的三重协同让 AI 真正从实验室走向产业一线、从概念走向实用。本文立足 2026 年这一关键时间节点,深度剖析 AI 元年到来的核心驱动因素,全景解读智能时代启幕下的制造业、金融业、服务业等全产业变革图景,预判 2026 年后 AI 协同化、
2074 1
|
11月前
|
人工智能 供应链 搜索推荐
AI智能体是刚需还是噱头?2026年五大争议辨真相
2026年,AI智能体赛道呈现“冰火两重天”:巨头重金布局,微软、谷歌争相构建生态;明星初创却接连倒闭。技术能力、ROI、场景真伪、生态格局与安全伦理五大争议,揭示其在降本增效与成本黑洞间的艰难平衡,展现真实价值与泡沫并存的复杂图景。