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;
}
相关文章
|
监控 iOS开发 MacOS
解决启动 Parallels Desktop 之后 macOS 没声音的问题
解决启动 Parallels Desktop 之后 macOS 没声音的问题
1193 0
解决启动 Parallels Desktop 之后 macOS 没声音的问题
|
10月前
|
机器学习/深度学习 数据采集 人工智能
AI赋能教育:深度学习在个性化学习系统中的应用
【10月更文挑战第26天】随着人工智能的发展,深度学习技术正逐步应用于教育领域,特别是个性化学习系统中。通过分析学生的学习数据,深度学习模型能够精准预测学生的学习表现,并为其推荐合适的学习资源和规划学习路径,从而提供更加高效、有趣和个性化的学习体验。
560 9
|
8月前
|
存储 分布式计算 MaxCompute
使用PAI-FeatureStore管理风控应用中的特征
PAI-FeatureStore 是阿里云提供的特征管理平台,适用于风控应用中的离线和实时特征管理。通过MaxCompute定义和设计特征表,利用PAI-FeatureStore SDK进行数据摄取与预处理,并通过定时任务批量计算离线特征,同步至在线存储系统如FeatureDB或Hologres。对于实时特征,借助Flink等流处理引擎即时分析并写入在线存储,确保特征时效性。模型推理方面,支持EasyRec Processor和PAI-EAS推理服务,实现高效且灵活的风险控制特征管理,促进系统迭代优化。
161 6
|
9月前
|
数据处理 项目管理
进度一目了然,Excel和看板的神仙联动
在项目管理中,Excel擅长结构化信息记录,但直观展示项目进度稍显不足。结合板.栗.看.板.工具,可将Excel数据同步为任务卡片,清晰显示任务状态、完成时间、负责人和优先级,实现数据与看板的双向联动,提升团队协作效率。
进度一目了然,Excel和看板的神仙联动
|
10月前
|
前端开发 开发者
本文将深入探讨 BEM 的概念、原理以及其在前端开发中的应用
BEM(Block-Element-Modifier)是一种前端开发中的命名规范和架构方法,旨在提高代码的可维护性和复用性。通过将界面拆分为独立的模块,BEM 提供了一套清晰的命名规则,增强了代码的结构化和模块化设计,促进了团队协作。本文深入探讨了 BEM 的概念、原理及其在前端开发中的应用,分析了其优势与局限性,为开发者提供了宝贵的参考。
309 8
|
11月前
|
编解码 Linux API
从FFplay到自定义播放器:构建高性能多媒体应用程序的进阶之路
【10月更文挑战第15天】多媒体应用程序的开发是一个复杂的过程,尤其是在追求高性能和定制化体验时。本文将引导你从使用FFplay作为起点,逐步过渡到构建一个完全自定义的播放器。我们将探讨FFmpeg库的高级用法、多媒体同步原理、跨平台开发注意事项,以及如何实现用户界面与音视频解码的无缝集成。
319 1
|
11月前
|
数据采集 机器学习/深度学习
港大发布智能交通大模型全家桶OpenCity!打破时空零样本预测壁垒,训练速度最多提升50倍
【10月更文挑战第15天】香港大学近日发布了智能交通大模型OpenCity,旨在通过创新技术手段解决城市交通预测和管理难题。OpenCity结合了Transformer和图神经网络(GNN)的优势,能够有效捕捉复杂时空依赖关系,实现零样本预测。该模型采用大规模异构交通数据集预训练,显著提升了泛化能力和训练速度,实验结果显示其在未见过的城市或区域的交通预测中表现出色。然而,模型的计算资源需求和数据质量仍需进一步优化。
175 1
|
存储 安全 算法
静态路由与动态路由的区别及应用场景
【8月更文挑战第25天】
557 0
|
机器学习/深度学习 人工智能 算法
【AI赋能】——我国战略新兴业务快速发展 —产业结构调整持续优化
【AI赋能】——我国战略新兴业务快速发展 —产业结构调整持续优化
419 2
|
监控 安全 数据安全/隐私保护
如何通过手机设置苹果账户的双重认证
如何通过手机设置苹果账户的双重认证
263 1