io.github.cdklabs.cdkecsserviceextensions.AppMeshExtension Maven / Gradle / Ivy
Show all versions of cdk-ecs-service-extensions Show documentation
package io.github.cdklabs.cdkecsserviceextensions;
/**
* (experimental) This extension adds an Envoy sidecar to the task definition and creates the App Mesh resources required to route network traffic to the container in a service mesh.
*
* The service will then be available to other App Mesh services at the
* address <service name>.<environment name>
. For example, a service called
* orders
deploying in an environment called production
would be accessible
* to other App Mesh enabled services at the address http://orders.production
.
*/
@javax.annotation.Generated(value = "jsii-pacmak/1.103.1 (build bef2dea)", date = "2024-09-19T00:29:44.705Z")
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@software.amazon.jsii.Jsii(module = io.github.cdklabs.cdkecsserviceextensions.$Module.class, fqn = "@aws-cdk-containers/ecs-service-extensions.AppMeshExtension")
public class AppMeshExtension extends io.github.cdklabs.cdkecsserviceextensions.ServiceExtension {
protected AppMeshExtension(final software.amazon.jsii.JsiiObjectRef objRef) {
super(objRef);
}
protected AppMeshExtension(final software.amazon.jsii.JsiiObject.InitializationMode initializationMode) {
super(initializationMode);
}
/**
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public AppMeshExtension(final @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.MeshProps props) {
super(software.amazon.jsii.JsiiObject.InitializationMode.JSII);
software.amazon.jsii.JsiiEngine.getInstance().createNewObject(this, new Object[] { java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* (experimental) This hook allows the extension to establish a connection to extensions from another service.
*
* Usually used for things like
* allowing one service to talk to the load balancer or service mesh
* proxy for another service.
*
* @param otherService This parameter is required.
* @param _connectToProps
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public void connectToService(final @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.Service otherService, final @org.jetbrains.annotations.Nullable io.github.cdklabs.cdkecsserviceextensions.ConnectToProps _connectToProps) {
software.amazon.jsii.Kernel.call(this, "connectToService", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(otherService, "otherService is required"), _connectToProps });
}
/**
* (experimental) This hook allows the extension to establish a connection to extensions from another service.
*
* Usually used for things like
* allowing one service to talk to the load balancer or service mesh
* proxy for another service.
*
* @param otherService This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public void connectToService(final @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.Service otherService) {
software.amazon.jsii.Kernel.call(this, "connectToService", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(otherService, "otherService is required") });
}
/**
* (experimental) Prior to launching the task definition as a service, this hook is called on each extension to give it a chance to mutate the properties of the service to be created.
*
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.ServiceBuild modifyServiceProps(final @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.ServiceBuild props) {
return software.amazon.jsii.Kernel.call(this, "modifyServiceProps", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdkecsserviceextensions.ServiceBuild.class), new Object[] { java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* (experimental) This is a hook which allows extensions to modify the settings of the task definition prior to it being created.
*
* For example, the App Mesh
* extension needs to configure an Envoy proxy in the task definition,
* or the Application extension wants to set the overall resource for
* the task.
*
* @param props This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.TaskDefinitionProps modifyTaskDefinitionProps(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.TaskDefinitionProps props) {
return software.amazon.jsii.Kernel.call(this, "modifyTaskDefinitionProps", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.ecs.TaskDefinitionProps.class), new Object[] { java.util.Objects.requireNonNull(props, "props is required") });
}
/**
* (experimental) A hook that is called for each extension ahead of time to allow for any initial setup, such as creating resources in advance.
*
* @param service This parameter is required.
* @param scope This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public void prehook(final @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.Service service, final @org.jetbrains.annotations.NotNull software.constructs.Construct scope) {
software.amazon.jsii.Kernel.call(this, "prehook", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(service, "service is required"), java.util.Objects.requireNonNull(scope, "scope is required") });
}
/**
* (experimental) When this hook is implemented by extension, it allows the extension to use the service which has been created.
*
* It is generally used to
* create any final resources which might depend on the service itself.
*
* @param service This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public void useService(final @org.jetbrains.annotations.NotNull java.lang.Object service) {
if (software.amazon.jsii.Configuration.getRuntimeTypeChecking()) {
if (
!(service instanceof software.amazon.awscdk.services.ecs.Ec2Service)
&& !(service instanceof software.amazon.awscdk.services.ecs.FargateService)
) {
throw new IllegalArgumentException(
new java.lang.StringBuilder("Expected ")
.append("service")
.append(" to be one of: software.amazon.awscdk.services.ecs.Ec2Service, software.amazon.awscdk.services.ecs.FargateService; received ")
.append(service.getClass()).toString());
}
}
software.amazon.jsii.Kernel.call(this, "useService", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(service, "service is required") });
}
/**
* (experimental) Once the task definition is created, this hook is called for each extension to give it a chance to add containers to the task definition, change the task definition's role to add permissions, etc.
*
* @param taskDefinition This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public void useTaskDefinition(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.ecs.TaskDefinition taskDefinition) {
software.amazon.jsii.Kernel.call(this, "useTaskDefinition", software.amazon.jsii.NativeType.VOID, new Object[] { java.util.Objects.requireNonNull(taskDefinition, "taskDefinition is required") });
}
/**
* (experimental) The protocol used for AppMesh routing.
*
* default - Protocol.HTTP
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public @org.jetbrains.annotations.NotNull io.github.cdklabs.cdkecsserviceextensions.Protocol getProtocol() {
return software.amazon.jsii.Kernel.get(this, "protocol", software.amazon.jsii.NativeType.forClass(io.github.cdklabs.cdkecsserviceextensions.Protocol.class));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
protected @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.appmesh.Route getRoute() {
return software.amazon.jsii.Kernel.get(this, "route", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.appmesh.Route.class));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
protected void setRoute(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.appmesh.Route value) {
software.amazon.jsii.Kernel.set(this, "route", java.util.Objects.requireNonNull(value, "route is required"));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
protected @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.appmesh.VirtualNode getVirtualNode() {
return software.amazon.jsii.Kernel.get(this, "virtualNode", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.appmesh.VirtualNode.class));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
protected void setVirtualNode(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.appmesh.VirtualNode value) {
software.amazon.jsii.Kernel.set(this, "virtualNode", java.util.Objects.requireNonNull(value, "virtualNode is required"));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
protected @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.appmesh.VirtualRouter getVirtualRouter() {
return software.amazon.jsii.Kernel.get(this, "virtualRouter", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.appmesh.VirtualRouter.class));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
protected void setVirtualRouter(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.appmesh.VirtualRouter value) {
software.amazon.jsii.Kernel.set(this, "virtualRouter", java.util.Objects.requireNonNull(value, "virtualRouter is required"));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
protected @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.appmesh.VirtualService getVirtualService() {
return software.amazon.jsii.Kernel.get(this, "virtualService", software.amazon.jsii.NativeType.forClass(software.amazon.awscdk.services.appmesh.VirtualService.class));
}
/**
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
protected void setVirtualService(final @org.jetbrains.annotations.NotNull software.amazon.awscdk.services.appmesh.VirtualService value) {
software.amazon.jsii.Kernel.set(this, "virtualService", java.util.Objects.requireNonNull(value, "virtualService is required"));
}
/**
* (experimental) A fluent builder for {@link io.github.cdklabs.cdkecsserviceextensions.AppMeshExtension}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public static final class Builder implements software.amazon.jsii.Builder {
/**
* @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 final io.github.cdklabs.cdkecsserviceextensions.MeshProps.Builder props;
private Builder() {
this.props = new io.github.cdklabs.cdkecsserviceextensions.MeshProps.Builder();
}
/**
* (experimental) The service mesh into which to register the service.
*
* @return {@code this}
* @param mesh The service mesh into which to register the service. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder mesh(final software.amazon.awscdk.services.appmesh.Mesh mesh) {
this.props.mesh(mesh);
return this;
}
/**
* (experimental) The protocol of the service.
*
* Valid values are Protocol.HTTP, Protocol.HTTP2, Protocol.TCP, Protocol.GRPC
*
* Default: - Protocol.HTTP
*
* @return {@code this}
* @param protocol The protocol of the service. This parameter is required.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
public Builder protocol(final io.github.cdklabs.cdkecsserviceextensions.Protocol protocol) {
this.props.protocol(protocol);
return this;
}
/**
* @return a newly built instance of {@link io.github.cdklabs.cdkecsserviceextensions.AppMeshExtension}.
*/
@software.amazon.jsii.Stability(software.amazon.jsii.Stability.Level.Experimental)
@Override
public io.github.cdklabs.cdkecsserviceextensions.AppMeshExtension build() {
return new io.github.cdklabs.cdkecsserviceextensions.AppMeshExtension(
this.props.build()
);
}
}
}