forked from apache/cloudstack
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
64 changed files
with
2,555 additions
and
120 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
package com.cloud.storage; | ||
|
||
import org.apache.cloudstack.acl.ControlledEntity; | ||
import org.apache.cloudstack.api.Identity; | ||
import org.apache.cloudstack.api.InternalIdentity; | ||
|
||
/** | ||
* Created with IntelliJ IDEA. | ||
* User: nitinmehta | ||
* Date: 24/04/13 | ||
* Time: 5:55 PM | ||
* To change this template use File | Settings | File Templates. | ||
*/ | ||
public interface VolumeDetail extends ControlledEntity, InternalIdentity, Identity { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
116 changes: 116 additions & 0 deletions
116
api/src/org/apache/cloudstack/api/command/user/network/AddNicDetailCmd.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,116 @@ | ||
// 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.network; | ||
|
||
import org.apache.cloudstack.api.APICommand; | ||
import org.apache.cloudstack.api.ApiConstants; | ||
import org.apache.cloudstack.api.ApiErrorCode; | ||
import org.apache.cloudstack.api.BaseAsyncCmd; | ||
import org.apache.cloudstack.api.Parameter; | ||
import org.apache.cloudstack.api.ServerApiException; | ||
import org.apache.cloudstack.api.response.NicResponse; | ||
import org.apache.cloudstack.api.response.SuccessResponse; | ||
import org.apache.cloudstack.api.response.UserVmResponse; | ||
import org.apache.cloudstack.api.response.VolumeResponse; | ||
import org.apache.log4j.Logger; | ||
|
||
import com.cloud.async.AsyncJob; | ||
import com.cloud.event.EventTypes; | ||
import com.cloud.storage.Volume; | ||
import com.cloud.user.Account; | ||
import com.cloud.user.UserContext; | ||
|
||
@APICommand(name = "addNicDetail", description="Adds detail for the volume.", since="4.2", responseObject=SuccessResponse.class) | ||
public class AddNicDetailCmd extends BaseAsyncCmd { | ||
public static final Logger s_logger = Logger.getLogger(AddNicDetailCmd.class.getName()); | ||
private static final String s_name = "addNicDetailresponse"; | ||
|
||
///////////////////////////////////////////////////// | ||
//////////////// API parameters ///////////////////// | ||
///////////////////////////////////////////////////// | ||
|
||
@Parameter(name=ApiConstants.ID, type=CommandType.UUID, entityType=NicResponse.class, | ||
required=true, description="the ID of the nic") | ||
private Long id; | ||
|
||
@Parameter(name=ApiConstants.NAME, type=CommandType.STRING, | ||
required=true, description="the name of the field") | ||
private String name; | ||
|
||
@Parameter(name=ApiConstants.VALUE, type=CommandType.STRING, | ||
required=true, description="the value of the field") | ||
private String value; | ||
|
||
///////////////////////////////////////////////////// | ||
/////////////////// Accessors /////////////////////// | ||
///////////////////////////////////////////////////// | ||
|
||
|
||
public String getName() { | ||
return name; | ||
} | ||
|
||
public String getValue() { | ||
return value; | ||
} | ||
|
||
public Long getId() { | ||
return id; | ||
} | ||
|
||
///////////////////////////////////////////////////// | ||
/////////////// API Implementation/////////////////// | ||
///////////////////////////////////////////////////// | ||
|
||
@Override | ||
public String getCommandName() { | ||
return s_name; | ||
} | ||
|
||
public AsyncJob.Type getInstanceType() { | ||
return AsyncJob.Type.Volume; | ||
} | ||
|
||
public Long getInstanceId() { | ||
return getId(); | ||
} | ||
|
||
@Override | ||
public long getEntityOwnerId() { | ||
Volume volume = _responseGenerator.findVolumeById(getId()); | ||
if (volume == null) { | ||
return Account.ACCOUNT_ID_SYSTEM; // bad id given, parent this command to SYSTEM so ERROR events are tracked | ||
} | ||
return volume.getAccountId(); | ||
} | ||
|
||
@Override | ||
public String getEventType() { | ||
return EventTypes.EVENT_VOLUME_ATTACH; | ||
} | ||
|
||
@Override | ||
public String getEventDescription() { | ||
return "adding detail to the nic: " + getId(); | ||
} | ||
|
||
@Override | ||
public void execute(){ | ||
_networkService.addNicDetail(this); | ||
this.setResponseObject(new SuccessResponse(getCommandName())); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.