org.openstack4j.openstack.identity.domain.KeystoneTenant Maven / Gradle / Ivy
package org.openstack4j.openstack.identity.domain;
import java.util.List;
import org.openstack4j.api.Apis;
import org.openstack4j.model.identity.Tenant;
import org.openstack4j.model.identity.builder.TenantBuilder;
import org.openstack4j.openstack.common.ListResult;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.google.common.base.Objects;
/**
* Tenant Model class use to group/isolate resources and/or identity objects
*
* @author Jeremy Unruh
*
* @see {
private static final long serialVersionUID = 1L;
@JsonProperty("tenants")
protected List list;
public List value() {
return list;
}
}
/**
* Used for backwards compatibility in fetching a Tenant By Name. Older deployments return a single object
* or null whereas newer deployments return an [] containing a single element
*/
public static class BackwardsCompatTenants extends Tenants {
private static final long serialVersionUID = 1L;
@JsonProperty("tenant")
private KeystoneTenant tenant;
public KeystoneTenant getOneOrNull()
{
if (tenant != null)
return tenant;
return (list != null && list.size() > 0) ? list.get(0) : null;
}
}
}