All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.openstack4j.openstack.identity.domain.KeystoneTenant Maven / Gradle / Ivy

There is a newer version: 3.2.0
Show newest version
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;
	    }
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy