Search in sources :

Example 1 with Configuration

use of com.cloud.configuration.Configuration in project CloudStack-archive by CloudStack-extras.

the class UpdateCfgCmd method execute.

@Override
public void execute() {
    Configuration cfg = _configService.updateConfiguration(this);
    if (cfg != null) {
        ConfigurationResponse response = _responseGenerator.createConfigurationResponse(cfg);
        response.setResponseName(getCommandName());
        this.setResponseObject(response);
    } else {
        throw new ServerApiException(BaseCmd.INTERNAL_ERROR, "Failed to update config");
    }
}
Also used : ConfigurationResponse(com.cloud.api.response.ConfigurationResponse) Configuration(com.cloud.configuration.Configuration) ServerApiException(com.cloud.api.ServerApiException)

Example 2 with Configuration

use of com.cloud.configuration.Configuration in project CloudStack-archive by CloudStack-extras.

the class ListCfgsByCmd method execute.

@Override
public void execute() {
    List<? extends Configuration> result = _mgr.searchForConfigurations(this);
    ListResponse<ConfigurationResponse> response = new ListResponse<ConfigurationResponse>();
    List<ConfigurationResponse> configResponses = new ArrayList<ConfigurationResponse>();
    for (Configuration cfg : result) {
        ConfigurationResponse cfgResponse = _responseGenerator.createConfigurationResponse(cfg);
        cfgResponse.setObjectName("configuration");
        configResponses.add(cfgResponse);
    }
    response.setResponses(configResponses);
    response.setResponseName(getCommandName());
    this.setResponseObject(response);
}
Also used : ConfigurationResponse(com.cloud.api.response.ConfigurationResponse) ListResponse(com.cloud.api.response.ListResponse) Configuration(com.cloud.configuration.Configuration) ArrayList(java.util.ArrayList)

Aggregations

ConfigurationResponse (com.cloud.api.response.ConfigurationResponse)2 Configuration (com.cloud.configuration.Configuration)2 ServerApiException (com.cloud.api.ServerApiException)1 ListResponse (com.cloud.api.response.ListResponse)1 ArrayList (java.util.ArrayList)1