
org.jclouds.digitalocean2.domain.Networks Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jclouds-shaded Show documentation
Show all versions of jclouds-shaded Show documentation
Provides a shaded jclouds with relocated guava and guice
The newest version!
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You 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 org.jclouds.digitalocean2.domain;
import static shaded.com.google.common.collect.ImmutableList.copyOf;
import java.util.List;
import org.jclouds.json.SerializedNames;
import com.google.auto.value.AutoValue;
import shaded.com.google.common.base.Predicate;
@AutoValue
public abstract class Networks {
@AutoValue
public abstract static class Address {
public abstract String ip();
public abstract String netmask();
public abstract String gateway();
public abstract String type();
@SerializedNames({ "ip_address", "netmask", "gateway", "type"})
public static Address create(String ip, String netmask, String gateway, String type) {
return new AutoValue_Networks_Address(ip, netmask, gateway, type);
}
Address() {}
}
public abstract List ipv4();
public abstract List ipv6();
@SerializedNames({ "v4", "v6" })
public static Networks create(List ipv4, List ipv6) {
return new AutoValue_Networks(copyOf(ipv4), copyOf(ipv6));
}
Networks() {}
public static class Predicates {
public static Predicate publicNetworks() {
return new Predicate() {
@Override
public boolean apply(Address network) {
return network.type().equals("public");
}
};
}
public static Predicate privateNetworks() {
return new Predicate() {
@Override
public boolean apply(Address network) {
return network.type().equals("private");
}
};
}
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy