![JAR search and dependency download from the Maven repository](/logo.png)
org.cdk8s.plus.Service Maven / Gradle / Ivy
Show all versions of cdk8s-plus Show documentation
package org.cdk8s.plus;
/**
* An abstract way to expose an application running on a set of Pods as a network service.
*
* With Kubernetes you don't need to modify your application to use an unfamiliar service discovery mechanism.
* Kubernetes gives Pods their own IP addresses and a single DNS name for a set of Pods, and can load-balance across them.
*
* For example, consider a stateless image-processing backend which is running with 3 replicas. Those replicas are fungible—frontends do not care which backend they use.
* While the actual Pods that compose the backend set may change, the frontend clients should not need to be aware of that,
* nor should they need to keep track of the set of backends themselves.
* The Service abstraction enables this decoupling.
*
* If you're able to use Kubernetes APIs for service discovery in your application, you can query the API server for Endpoints,
* that get updated whenever the set of Pods in a Service changes. For non-native applications, Kubernetes offers ways to place a network port
* or load balancer in between your application and the backend Pods.
*
* EXPERIMENTAL
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.7.0 (build 179a3a5)", date = "2020-06-29T13:29:38.532Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = org.cdk8s.plus.$Module.class, fqn = "cdk8s-plus.Service")
public class Service extends org.cdk8s.plus.Resource {
protected Service(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected Service(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* EXPERIMENTAL
*
* @param scope This parameter is required.
* @param id This parameter is required.
* @param props
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Service(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id, final @org.jetbrains.annotations.Nullable org.cdk8s.plus.ServiceProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required"), props });
}
/**
* EXPERIMENTAL
*
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Service(final @org.jetbrains.annotations.NotNull software.constructs.Construct scope, final @org.jetbrains.annotations.NotNull java.lang.String id) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(scope, "scope is required"), java.util.Objects.requireNonNull(id, "id is required") });
}
/**
* The underlying cdk8s API object.
*
* EXPERIMENTAL
*/
@Override
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
protected @org.jetbrains.annotations.NotNull org.cdk8s.ApiObject getApiObject() {
return this.jsiiGet("apiObject", org.cdk8s.ApiObject.class);
}
/**
* Provides access to the underlying spec.
*
* You can use this field to apply post instantiation mutations
* to the spec.
*
* EXPERIMENTAL
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull org.cdk8s.plus.ServiceSpecDefinition getSpec() {
return this.jsiiGet("spec", org.cdk8s.plus.ServiceSpecDefinition.class);
}
/**
* A fluent builder for {@link org.cdk8s.plus.Service}.
*/
@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}.
* @param scope This parameter is required.
* @param id This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static Builder create(final software.constructs.Construct scope, final java.lang.String id) {
return new Builder(scope, id);
}
private final software.constructs.Construct scope;
private final java.lang.String id;
private org.cdk8s.plus.ServiceProps.Builder props;
private Builder(final software.constructs.Construct scope, final java.lang.String id) {
this.scope = scope;
this.id = id;
}
/**
* Metadata that all persisted resources must have, which includes all objects users must create.
*
* EXPERIMENTAL
*
* @return {@code this}
* @param metadata Metadata that all persisted resources must have, which includes all objects users must create. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder metadata(final org.cdk8s.ApiObjectMetadata metadata) {
this.props().metadata(metadata);
return this;
}
/**
* The spec of the service.
*
* Use service.spec
to apply post instantiation mutations.
*
* Default: - An empty spec will be created.
*
* EXPERIMENTAL
*
* @return {@code this}
* @param spec The spec of the service. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder spec(final org.cdk8s.plus.ServiceSpec spec) {
this.props().spec(spec);
return this;
}
/**
* @returns a newly built instance of {@link org.cdk8s.plus.Service}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public org.cdk8s.plus.Service build() {
return new org.cdk8s.plus.Service(
this.scope,
this.id,
this.props != null ? this.props.build() : null
);
}
private org.cdk8s.plus.ServiceProps.Builder props() {
if (this.props == null) {
this.props = new org.cdk8s.plus.ServiceProps.Builder();
}
return this.props;
}
}
}