shwstppr commented on code in PR #11016:
URL: https://github.com/apache/cloudstack/pull/11016#discussion_r2227836253


##########
api/src/main/java/org/apache/cloudstack/api/command/user/consoleproxy/ListConsoleSessionsCmd.java:
##########
@@ -0,0 +1,182 @@
+// 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.import org.apache.cloudstack.context.CallContext;
+package org.apache.cloudstack.api.command.user.consoleproxy;
+
+import org.apache.cloudstack.consoleproxy.ConsoleSession;
+
+import com.cloud.user.Account;
+import com.cloud.user.AccountService;
+import com.cloud.user.UserAccount;
+import org.apache.cloudstack.acl.RoleType;
+import org.apache.cloudstack.api.ACL;
+import org.apache.cloudstack.api.APICommand;
+import org.apache.cloudstack.api.ApiConstants;
+import org.apache.cloudstack.api.BaseListCmd;
+import org.apache.cloudstack.api.Parameter;
+import org.apache.cloudstack.api.response.AccountResponse;
+import org.apache.cloudstack.api.response.ConsoleSessionResponse;
+import org.apache.cloudstack.api.response.DomainResponse;
+import org.apache.cloudstack.api.response.HostResponse;
+import org.apache.cloudstack.api.response.ListResponse;
+import org.apache.cloudstack.api.response.UserResponse;
+import org.apache.cloudstack.api.response.UserVmResponse;
+import org.apache.cloudstack.consoleproxy.ConsoleAccessManager;
+
+import javax.inject.Inject;
+import java.util.Date;
+
+@APICommand(name = "listConsoleSessions", description = "Lists console 
sessions.", responseObject = ConsoleSessionResponse.class,
+        entityType = {ConsoleSession.class}, since = "4.21.0",
+        requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
+        authorized = {RoleType.Admin, RoleType.DomainAdmin, 
RoleType.ResourceAdmin, RoleType.User})
+public class ListConsoleSessionsCmd extends BaseListCmd {
+    @Inject
+    private AccountService accountService;
+
+    @Inject
+    private ConsoleAccessManager consoleAccessManager;
+
+    @ACL
+    @Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = 
ConsoleSessionResponse.class, description = "The ID of the console session.")
+    private Long id;
+
+    @Parameter(name = ApiConstants.DOMAIN_ID, type = CommandType.UUID, 
entityType = DomainResponse.class, description = "The domain ID of the account 
that created the console endpoint.")
+    private Long domainId;
+
+    @ACL
+    @Parameter(name = ApiConstants.ACCOUNT_ID, type = CommandType.UUID, 
entityType = AccountResponse.class, description = "The ID of the account that 
created the console endpoint.")
+    private Long accountId;
+
+    @ACL
+    @Parameter(name = ApiConstants.USER_ID, type = CommandType.UUID, 
entityType = UserResponse.class, description = "The ID of the user that created 
the console endpoint.")
+    private Long userId;
+
+    @Parameter(name = ApiConstants.HOST_ID, type = CommandType.UUID, 
entityType = HostResponse.class, authorized = {RoleType.Admin}, description = 
"Lists console sessions from the specified host.")
+    private Long hostId;
+
+    @Parameter(name = ApiConstants.START_DATE, type = CommandType.DATE, 
description = "Lists console sessions generated from this date onwards. " +
+            ApiConstants.PARAMETER_DESCRIPTION_START_DATE_POSSIBLE_FORMATS)
+    private Date startDate;
+
+    @Parameter(name = ApiConstants.END_DATE, type = CommandType.DATE, 
description = "Lists console sessions generated up until this date. " +
+            ApiConstants.PARAMETER_DESCRIPTION_END_DATE_POSSIBLE_FORMATS)
+    private Date endDate;
+
+    @Parameter(name = ApiConstants.INSTANCE_ID, type = CommandType.UUID, 
entityType = UserVmResponse.class, description = "The ID of the instance.")

Review Comment:
   @bernardodemarco curious, why not name the parameter virtualmachineid as 
some of the other APIs already use that?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscr...@cloudstack.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to