mirror of https://github.com/apache/cloudstack.git
VNF: add API listVnfAppliances (#8994)
This commit is contained in:
parent
2315a73a20
commit
81269ad62a
|
|
@ -0,0 +1,36 @@
|
|||
// 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.command.admin.vm;
|
||||
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.command.admin.AdminCmd;
|
||||
|
||||
import org.apache.cloudstack.api.command.user.vm.ListVnfAppliancesCmd;
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
|
||||
@APICommand(name = "listVnfAppliances", description = "List VNF appliance owned by the account.",
|
||||
responseObject = UserVmResponse.class,
|
||||
responseView = ResponseView.Full,
|
||||
entityType = {VirtualMachine.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
|
||||
authorized = {RoleType.Admin},
|
||||
since = "4.19.1")
|
||||
public class ListVnfAppliancesCmdByAdmin extends ListVnfAppliancesCmd implements AdminCmd {
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
// 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.command.user.vm;
|
||||
|
||||
import com.cloud.vm.VirtualMachine;
|
||||
import org.apache.cloudstack.acl.RoleType;
|
||||
import org.apache.cloudstack.api.APICommand;
|
||||
import org.apache.cloudstack.api.ResponseObject.ResponseView;
|
||||
import org.apache.cloudstack.api.command.user.UserCmd;
|
||||
|
||||
import org.apache.cloudstack.api.response.UserVmResponse;
|
||||
|
||||
@APICommand(name = "listVnfAppliances", description = "List VNF appliance owned by the account.",
|
||||
responseObject = UserVmResponse.class,
|
||||
responseView = ResponseView.Restricted, entityType = {VirtualMachine.class},
|
||||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false,
|
||||
authorized = {RoleType.Admin, RoleType.ResourceAdmin, RoleType.DomainAdmin, RoleType.User},
|
||||
since = "4.19.1")
|
||||
public class ListVnfAppliancesCmd extends ListVMsCmd implements UserCmd {
|
||||
|
||||
@Override
|
||||
public Boolean getVnf() {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -71,11 +71,13 @@ import org.apache.cloudstack.api.command.admin.template.ListVnfTemplatesCmdByAdm
|
|||
import org.apache.cloudstack.api.command.admin.template.RegisterVnfTemplateCmdByAdmin;
|
||||
import org.apache.cloudstack.api.command.admin.template.UpdateVnfTemplateCmdByAdmin;
|
||||
import org.apache.cloudstack.api.command.admin.vm.DeployVnfApplianceCmdByAdmin;
|
||||
import org.apache.cloudstack.api.command.admin.vm.ListVnfAppliancesCmdByAdmin;
|
||||
import org.apache.cloudstack.api.command.user.template.DeleteVnfTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.ListVnfTemplatesCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.RegisterVnfTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.template.UpdateVnfTemplateCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.DeployVnfApplianceCmd;
|
||||
import org.apache.cloudstack.api.command.user.vm.ListVnfAppliancesCmd;
|
||||
import org.apache.cloudstack.framework.config.ConfigKey;
|
||||
import org.apache.cloudstack.framework.config.Configurable;
|
||||
import org.apache.commons.collections.CollectionUtils;
|
||||
|
|
@ -133,6 +135,8 @@ public class VnfTemplateManagerImpl extends ManagerBase implements VnfTemplateMa
|
|||
cmdList.add(DeleteVnfTemplateCmd.class);
|
||||
cmdList.add(DeployVnfApplianceCmd.class);
|
||||
cmdList.add(DeployVnfApplianceCmdByAdmin.class);
|
||||
cmdList.add(ListVnfAppliancesCmd.class);
|
||||
cmdList.add(ListVnfAppliancesCmdByAdmin.class);
|
||||
return cmdList;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -90,7 +90,7 @@ export default {
|
|||
}, {
|
||||
name: 'vnf.settings',
|
||||
component: shallowRef(defineAsyncComponent(() => import('@/views/image/TemplateVnfSettings.vue'))),
|
||||
show: (record) => { return record.templatetype === 'VNF' }
|
||||
show: (record) => { return record.templatetype === 'VNF' && 'updateVnfTemplate' in store.getters.apis }
|
||||
},
|
||||
{
|
||||
name: 'events',
|
||||
|
|
|
|||
|
|
@ -82,7 +82,7 @@ export default {
|
|||
}, {
|
||||
name: 'vnf.appliances',
|
||||
component: shallowRef(defineAsyncComponent(() => import('@/views/network/VnfAppliancesTab.vue'))),
|
||||
show: () => { return 'deployVnfAppliance' in store.getters.apis }
|
||||
show: () => { return 'listVnfAppliances' in store.getters.apis }
|
||||
}, {
|
||||
name: 'guest.ip.range',
|
||||
component: shallowRef(defineAsyncComponent(() => import('@/views/network/GuestIpRanges.vue'))),
|
||||
|
|
@ -337,7 +337,7 @@ export default {
|
|||
name: 'vnfapp',
|
||||
title: 'label.vnf.appliances',
|
||||
icon: 'gateway-outlined',
|
||||
permission: ['listVnfTemplates'],
|
||||
permission: ['listVnfAppliances'],
|
||||
resourceType: 'UserVm',
|
||||
params: () => {
|
||||
return { details: 'servoff,tmpl,nics', isvnf: true }
|
||||
|
|
|
|||
|
|
@ -130,7 +130,7 @@ export default {
|
|||
params.networkid = this.resource.id
|
||||
}
|
||||
this.fetchLoading = true
|
||||
api('listVirtualMachines', params).then(json => {
|
||||
api('listVnfAppliances', params).then(json => {
|
||||
this.virtualmachines = json.listvirtualmachinesresponse.virtualmachine || []
|
||||
for (const vm of this.virtualmachines) {
|
||||
for (const vmnic of vm.nic) {
|
||||
|
|
|
|||
Loading…
Reference in New Issue