-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add API command remove management server #10325
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
1145c3a
de5b6f5
380d621
16c4aba
b656688
4d7472c
fb3e7de
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
// 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.management; | ||
|
||
import com.cloud.event.EventTypes; | ||
import org.apache.cloudstack.acl.RoleType; | ||
import org.apache.cloudstack.api.APICommand; | ||
import org.apache.cloudstack.api.Parameter; | ||
import org.apache.cloudstack.api.ServerApiException; | ||
import org.apache.cloudstack.api.ApiConstants; | ||
import org.apache.cloudstack.api.ApiErrorCode; | ||
import org.apache.cloudstack.api.BaseCmd; | ||
import org.apache.cloudstack.api.response.ManagementServerResponse; | ||
import org.apache.cloudstack.api.response.SuccessResponse; | ||
import org.apache.cloudstack.context.CallContext; | ||
|
||
@APICommand(name = "removeManagementServer", description = "Removes a Management Server.", responseObject = SuccessResponse.class, | ||
requestHasSensitiveInfo = false, responseHasSensitiveInfo = false, authorized = RoleType.Admin) | ||
public class RemoveManagementServerCmd extends BaseCmd { | ||
|
||
@Parameter(name = ApiConstants.ID, type = CommandType.UUID, entityType = ManagementServerResponse.class, required = true, description = "the ID of the Management Server") | ||
private Long id; | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
Check warning on line 40 in api/src/main/java/org/apache/cloudstack/api/command/admin/management/RemoveManagementServerCmd.java
|
||
|
||
@Override | ||
public void execute() { | ||
boolean result = _mgr.removeManagementServer(this); | ||
Check warning on line 44 in api/src/main/java/org/apache/cloudstack/api/command/admin/management/RemoveManagementServerCmd.java
|
||
if (result) { | ||
SuccessResponse response = new SuccessResponse(getCommandName()); | ||
this.setResponseObject(response); | ||
} else { | ||
throw new ServerApiException(ApiErrorCode.INTERNAL_ERROR, "Failed to remove Management Server."); | ||
Check warning on line 49 in api/src/main/java/org/apache/cloudstack/api/command/admin/management/RemoveManagementServerCmd.java
|
||
} | ||
} | ||
Check warning on line 51 in api/src/main/java/org/apache/cloudstack/api/command/admin/management/RemoveManagementServerCmd.java
|
||
|
||
@Override | ||
public long getEntityOwnerId() { | ||
return CallContext.current().getCallingAccountId(); | ||
winterhazel marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} | ||
Check warning on line 56 in api/src/main/java/org/apache/cloudstack/api/command/admin/management/RemoveManagementServerCmd.java
|
||
|
||
public String getEventType() { | ||
return EventTypes.EVENT_MANAGEMENT_SERVER_REMOVE; | ||
} | ||
Check warning on line 60 in api/src/main/java/org/apache/cloudstack/api/command/admin/management/RemoveManagementServerCmd.java
|
||
} |
Uh oh!
There was an error while loading. Please reload this page.