
nl.tweeenveertig.openstack.command.account.ListContainersCommand Maven / Gradle / Ivy
package nl.tweeenveertig.openstack.command.account;
import nl.tweeenveertig.openstack.model.Account;
import nl.tweeenveertig.openstack.command.core.*;
import nl.tweeenveertig.openstack.command.core.httpstatus.HttpStatusChecker;
import nl.tweeenveertig.openstack.command.core.httpstatus.HttpStatusMatch;
import nl.tweeenveertig.openstack.command.core.httpstatus.HttpStatusSuccessCondition;
import nl.tweeenveertig.openstack.command.identity.access.AccessImpl;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpGet;
import java.io.IOException;
import java.util.Collection;
import static nl.tweeenveertig.openstack.command.core.CommandUtil.convertResponseToString;
public class ListContainersCommand extends AbstractSecureCommand> {
public ListContainersCommand(Account account, HttpClient httpClient, AccessImpl access) {
super(account, httpClient, access);
}
@Override
protected Collection getReturnObject(HttpResponse response) throws IOException {
return convertResponseToString(response);
}
@Override
protected HttpGet createRequest(String url) {
return new HttpGet(url);
}
@Override
protected HttpStatusChecker[] getStatusCheckers() {
return new HttpStatusChecker[] {
new HttpStatusSuccessCondition(new HttpStatusMatch(HttpStatus.SC_OK)),
new HttpStatusSuccessCondition(new HttpStatusMatch(HttpStatus.SC_NO_CONTENT))
};
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy