Search in sources :

Example 1 with StorageProviderResponse

use of org.apache.cloudstack.api.response.StorageProviderResponse in project cloudstack by apache.

the class ListStorageProvidersCmd method execute.

@Override
public void execute() throws ResourceUnavailableException, InsufficientCapacityException, ServerApiException, ConcurrentOperationException, ResourceAllocationException, NetworkRuleConflictException {
    if (getType() == null) {
        throw new ServerApiException(ApiErrorCode.MALFORMED_PARAMETER_ERROR, "need to specify type: either primary or image");
    }
    List<StorageProviderResponse> providers = this.dataStoreProviderApiService.getDataStoreProviders(getType());
    ListResponse<StorageProviderResponse> responses = new ListResponse<StorageProviderResponse>();
    for (StorageProviderResponse provider : providers) {
        provider.setObjectName("dataStoreProvider");
    }
    responses.setResponses(providers);
    responses.setResponseName(this.getCommandName());
    this.setResponseObject(responses);
}
Also used : ServerApiException(org.apache.cloudstack.api.ServerApiException) ListResponse(org.apache.cloudstack.api.response.ListResponse) StorageProviderResponse(org.apache.cloudstack.api.response.StorageProviderResponse)

Example 2 with StorageProviderResponse

use of org.apache.cloudstack.api.response.StorageProviderResponse in project cloudstack by apache.

the class DataStoreProviderManagerImpl method getPrimaryDataStoreProviders.

public List<StorageProviderResponse> getPrimaryDataStoreProviders() {
    List<StorageProviderResponse> providers = new ArrayList<StorageProviderResponse>();
    for (DataStoreProvider provider : providerMap.values()) {
        if (provider.getTypes().contains(DataStoreProviderType.PRIMARY)) {
            StorageProviderResponse response = new StorageProviderResponse();
            response.setName(provider.getName());
            response.setType(DataStoreProvider.DataStoreProviderType.PRIMARY.toString());
            providers.add(response);
        }
    }
    return providers;
}
Also used : StorageProviderResponse(org.apache.cloudstack.api.response.StorageProviderResponse) DataStoreProvider(org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList)

Example 3 with StorageProviderResponse

use of org.apache.cloudstack.api.response.StorageProviderResponse in project cloudstack by apache.

the class DataStoreProviderManagerImpl method getImageDataStoreProviders.

public List<StorageProviderResponse> getImageDataStoreProviders() {
    List<StorageProviderResponse> providers = new ArrayList<StorageProviderResponse>();
    for (DataStoreProvider provider : providerMap.values()) {
        if (provider.getTypes().contains(DataStoreProviderType.IMAGE)) {
            StorageProviderResponse response = new StorageProviderResponse();
            response.setName(provider.getName());
            response.setType(DataStoreProvider.DataStoreProviderType.IMAGE.toString());
            providers.add(response);
        }
    }
    return providers;
}
Also used : StorageProviderResponse(org.apache.cloudstack.api.response.StorageProviderResponse) DataStoreProvider(org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList)

Example 4 with StorageProviderResponse

use of org.apache.cloudstack.api.response.StorageProviderResponse in project cloudstack by apache.

the class DataStoreProviderManagerImpl method getCacheDataStoreProviders.

public List<StorageProviderResponse> getCacheDataStoreProviders() {
    List<StorageProviderResponse> providers = new ArrayList<StorageProviderResponse>();
    for (DataStoreProvider provider : providerMap.values()) {
        if (provider.getTypes().contains(DataStoreProviderType.ImageCache)) {
            StorageProviderResponse response = new StorageProviderResponse();
            response.setName(provider.getName());
            response.setType(DataStoreProviderType.ImageCache.toString());
            providers.add(response);
        }
    }
    return providers;
}
Also used : StorageProviderResponse(org.apache.cloudstack.api.response.StorageProviderResponse) DataStoreProvider(org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider) ArrayList(java.util.ArrayList) CopyOnWriteArrayList(java.util.concurrent.CopyOnWriteArrayList)

Aggregations

StorageProviderResponse (org.apache.cloudstack.api.response.StorageProviderResponse)4 ArrayList (java.util.ArrayList)3 CopyOnWriteArrayList (java.util.concurrent.CopyOnWriteArrayList)3 DataStoreProvider (org.apache.cloudstack.engine.subsystem.api.storage.DataStoreProvider)3 ServerApiException (org.apache.cloudstack.api.ServerApiException)1 ListResponse (org.apache.cloudstack.api.response.ListResponse)1