2 * ============LICENSE_START====================================================
4 * ===========================================================================
5 * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
6 * Modifications Copyright (C) 2018 IBM.
7 * ===========================================================================
8 * Licensed under the Apache License, Version 2.0 (the "License");
9 * you may not use this file except in compliance with the License.
10 * You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing, software
15 * distributed under the License is distributed on an "AS IS" BASIS,
16 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
17 * See the License for the specific language governing permissions and
18 * limitations under the License.
19 * ============LICENSE_END====================================================
23 package org.onap.aaf.auth.cmd.role;
25 import org.onap.aaf.auth.cmd.Cmd;
26 import org.onap.aaf.auth.cmd.Param;
27 import org.onap.aaf.auth.rserv.HttpMethods;
28 import org.onap.aaf.cadi.CadiException;
29 import org.onap.aaf.cadi.LocatorException;
30 import org.onap.aaf.cadi.client.Future;
31 import org.onap.aaf.cadi.client.Rcli;
32 import org.onap.aaf.misc.env.APIException;
34 import aaf.v2_0.Roles;
42 public class ListByPerm extends Cmd {
43 private static final String HEADER = "List Roles by Perm ";
45 public ListByPerm(List parent) {
47 new Param("type",true),
48 new Param("instance", true),
49 new Param("action", true));
53 public int _exec(int idx0, final String ... args) throws CadiException, APIException, LocatorException {
55 final String type=args[idx];
56 final String instance=args[++idx];
57 final String action=args[++idx];
59 return same(((List)parent).new ListRoles() {
61 public Integer code(Rcli<?> client) throws CadiException, APIException {
63 Future<Roles> fp = client.read(
64 "/authz/roles/perm/"+type+'/'+instance+'/'+action,
67 return list(fp,client, HEADER+type+'|'+instance+'|'+action);
73 public void detailedHelp(int indent, StringBuilder sb) {
74 detailLine(sb,indent,HEADER);
75 api(sb,indent,HttpMethods.GET,"authz/roles/user/<user>",Roles.class,true);