org.cdk8s.plus.ServiceSpecDefinition Maven / Gradle / Ivy
Show all versions of cdk8s-plus Show documentation
package org.cdk8s.plus;
/**
* A description of a service.
*
* EXPERIMENTAL
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.7.0 (build 179a3a5)", date = "2020-06-29T13:29:38.539Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = org.cdk8s.plus.$Module.class, fqn = "cdk8s-plus.ServiceSpecDefinition")
public class ServiceSpecDefinition extends software.amazon.jsii.JsiiObject {
protected ServiceSpecDefinition(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected ServiceSpecDefinition(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* EXPERIMENTAL
*
* @param props
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public ServiceSpecDefinition(final @org.jetbrains.annotations.Nullable org.cdk8s.plus.ServiceSpec props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { props });
}
/**
* EXPERIMENTAL
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public ServiceSpecDefinition() {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this);
}
/**
* Services defined using this spec will select pods according the provided label.
*
* EXPERIMENTAL
*
* @param label The label key. This parameter is required.
* @param value The label value. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void addSelector(final @org.jetbrains.annotations.NotNull java.lang.String label, final @org.jetbrains.annotations.NotNull java.lang.String value) {
this.jsiiCall("addSelector", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(label, "label is required"), java.util.Objects.requireNonNull(value, "value is required") });
}
/**
* Configure a port the service will bind to.
*
* This method can be called multiple times.
*
* EXPERIMENTAL
*
* @param port The port definition. This parameter is required.
* @param options
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void serve(final @org.jetbrains.annotations.NotNull java.lang.Number port, final @org.jetbrains.annotations.Nullable org.cdk8s.plus.ServicePortOptions options) {
this.jsiiCall("serve", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(port, "port is required"), options });
}
/**
* Configure a port the service will bind to.
*
* This method can be called multiple times.
*
* EXPERIMENTAL
*
* @param port The port definition. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public void serve(final @org.jetbrains.annotations.NotNull java.lang.Number port) {
this.jsiiCall("serve", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(port, "port is required") });
}
/**
* Returns the labels which are used to select pods for this service.
*
* EXPERIMENTAL
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull java.util.Map getSelector() {
return java.util.Collections.unmodifiableMap(this.jsiiGet("selector", software.amazon.jsii.NativeType.mapOf(software.amazon.jsii.NativeType.forClass(java.lang.String.class))));
}
/**
* Determines how the Service is exposed.
*
* EXPERIMENTAL
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull org.cdk8s.plus.ServiceType getType() {
return this.jsiiGet("type", org.cdk8s.plus.ServiceType.class);
}
/**
* The IP address of the service and is usually assigned randomly by the master.
*
* EXPERIMENTAL
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.Nullable java.lang.String getClusterIp() {
return this.jsiiGet("clusterIP", java.lang.String.class);
}
/**
* A fluent builder for {@link org.cdk8s.plus.ServiceSpecDefinition}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* EXPERIMENTAL
*
* @return a new instance of {@link Builder}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create() {
return new Builder();
}
private org.cdk8s.plus.ServiceSpec.Builder props;
private Builder() {
}
/**
* The IP address of the service and is usually assigned randomly by the master.
*
* If an address is specified manually and is not in use by others, it
* will be allocated to the service; otherwise, creation of the service will
* fail. This field can not be changed through updates. Valid values are
* "None", empty string (""), or a valid IP address. "None" can be specified
* for headless services when proxying is not required. Only applies to types
* ClusterIP, NodePort, and LoadBalancer. Ignored if type is ExternalName.
*
* Default: - Automatically assigned.
*
* EXPERIMENTAL
*
* @return {@code this}
* @see https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
* @param clusterIp The IP address of the service and is usually assigned randomly by the master. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder clusterIp(final java.lang.String clusterIp) {
this.props().clusterIp(clusterIp);
return this;
}
/**
* A list of IP addresses for which nodes in the cluster will also accept traffic for this service.
*
* These IPs are not managed by Kubernetes. The user
* is responsible for ensuring that traffic arrives at a node with this IP. A
* common example is external load-balancers that are not part of the
* Kubernetes system.
*
* Default: - No external IPs.
*
* EXPERIMENTAL
*
* @return {@code this}
* @param externalIPs A list of IP addresses for which nodes in the cluster will also accept traffic for this service. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder externalIPs(final java.util.List externalIPs) {
this.props().externalIPs(externalIPs);
return this;
}
/**
* The port exposed by this service.
*
* More info: https://kubernetes.io/docs/concepts/services-networking/service/#virtual-ips-and-service-proxies
*
* EXPERIMENTAL
*
* @return {@code this}
* @param ports The port exposed by this service. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder ports(final java.util.List ports) {
this.props().ports(ports);
return this;
}
/**
* Determines how the Service is exposed.
*
* More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types
*
* Default: ServiceType.ClusterIP
*
* EXPERIMENTAL
*
* @return {@code this}
* @param type Determines how the Service is exposed. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder type(final org.cdk8s.plus.ServiceType type) {
this.props().type(type);
return this;
}
/**
* @returns a newly built instance of {@link org.cdk8s.plus.ServiceSpecDefinition}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public org.cdk8s.plus.ServiceSpecDefinition build() {
return new org.cdk8s.plus.ServiceSpecDefinition(
this.props != null ? this.props.build() : null
);
}
private org.cdk8s.plus.ServiceSpec.Builder props() {
if (this.props == null) {
this.props = new org.cdk8s.plus.ServiceSpec.Builder();
}
return this.props;
}
}
}