com.huawei.openstack4j.openstack.networking.domain.NeutronNetQuota 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.networking.domain;
import static com.google.common.base.MoreObjects.toStringHelper;
import java.util.List;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonRootName;
import com.huawei.openstack4j.model.network.NetQuota;
import com.huawei.openstack4j.model.network.builder.NetQuotaBuilder;
import com.huawei.openstack4j.openstack.common.ListResult;
/**
* Network quotas that are bound to a Tenant
*
* @author Jeremy Unruh
*/
@JsonRootName("quota")
public class NeutronNetQuota implements NetQuota {
private static final long serialVersionUID = 1L;
@JsonProperty
private int subnet;
@JsonProperty
private int router;
@JsonProperty
private int port;
@JsonProperty
private int network;
@JsonProperty("floatingip")
private int floatingIp;
@JsonProperty("security_group")
private int securityGroup;
@JsonProperty("security_group_rule")
private int securityGroupRule;
public static NetQuotaBuilder builder() {
return new NetQuotaConcreteBuilder();
}
@Override
public NetQuotaBuilder toBuilder() {
return new NetQuotaConcreteBuilder(this);
}
@Override
public int getSubnet() {
return subnet;
}
@Override
public int getRouter() {
return router;
}
@Override
public int getPort() {
return port;
}
@Override
public int getNetwork() {
return network;
}
@JsonIgnore
@Override
public int getFloatingIP() {
return floatingIp;
}
@Override
public int getSecurityGroup() {
return securityGroup;
}
@Override
public int getSecurityGroupRule() {
return securityGroupRule;
}
@Override
public String toString() {
return toStringHelper(this)
.add("subnet", subnet).add("router", router).add("port", port)
.add("network", network).add("floatingIp", floatingIp)
.toString();
}
public static class NetQuotaConcreteBuilder implements NetQuotaBuilder {
private NeutronNetQuota model;
public NetQuotaConcreteBuilder() {
model = new NeutronNetQuota();
}
public NetQuotaConcreteBuilder(NeutronNetQuota model) {
this.model = model;
}
@Override
public NetQuota build() {
return model;
}
@Override
public NetQuotaBuilder from(NetQuota in) {
model = (NeutronNetQuota) in;
return this;
}
@Override
public NetQuotaBuilder subnet(int subnet) {
model.subnet = subnet;
return this;
}
@Override
public NetQuotaBuilder router(int router) {
model.router = router;
return this;
}
@Override
public NetQuotaBuilder port(int port) {
model.port = port;
return this;
}
@Override
public NetQuotaBuilder network(int network) {
model.network = network;
return this;
}
@Override
public NetQuotaBuilder floatingIP(int floatingIP) {
model.floatingIp = floatingIP;
return this;
}
@Override
public NetQuotaBuilder securityGroup(int securityGroup) {
model.securityGroup = securityGroup;
return this;
}
@Override
public NetQuotaBuilder securityGroupRule(int securityGroupRule) {
model.securityGroupRule = securityGroupRule;
return this;
}
}
public static class NeutronNetQuotas extends ListResult {
private static final long serialVersionUID = 1L;
@JsonProperty("quotas")
private List quotas;
@Override
protected List value() {
return quotas;
}
}
}