com.huawei.openstack4j.openstack.identity.v2.domain.KeystoneTenant Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of openstack4j Show documentation
Show all versions of openstack4j Show documentation
Huawei Cloud Open API SDK for Java
/*******************************************************************************
* Copyright 2016 ContainX and OpenStack4j
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not
* use this file except in compliance with the License. You may obtain a copy of
* the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
* WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
* License for the specific language governing permissions and limitations under
* the License.
*******************************************************************************/
package com.huawei.openstack4j.openstack.identity.v2.domain;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.huawei.openstack4j.api.Apis;
import com.huawei.openstack4j.model.identity.v2.Tenant;
import com.huawei.openstack4j.model.identity.v2.builder.TenantBuilder;
import com.huawei.openstack4j.openstack.common.ListResult;
import com.google.common.base.MoreObjects;
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;
}
}
}