/** * <p> * Use this structure if the ECS task uses the <code>awsvpc</code> network mode. This structure specifies the * VPC subnets and security groups associated with the task, and whether a public IP address is to be used. This * structure is required if <code>LaunchType</code> is <code>FARGATE</code> because the <code>awsvpc</code> mode * is required for Fargate tasks. * </p> * <p> * If you specify <code>NetworkConfiguration</code> when the target ECS task does not use the * <code>awsvpc</code> network mode, the task fails. * </p> * This is a convenience that creates an instance of the {@link NetworkConfiguration.Builder} avoiding the need * to create one manually via {@link NetworkConfiguration#builder()}. * * When the {@link Consumer} completes, {@link NetworkConfiguration.Builder#build()} is called immediately and * its result is passed to {@link #networkConfiguration(NetworkConfiguration)}. * * @param networkConfiguration * a consumer that will call methods on {@link NetworkConfiguration.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #networkConfiguration(NetworkConfiguration) */ default Builder networkConfiguration(Consumer<NetworkConfiguration.Builder> networkConfiguration) { return networkConfiguration(NetworkConfiguration.builder().applyMutation(networkConfiguration).build()); }
/** * <p> * Use this structure if the ECS task uses the <code>awsvpc</code> network mode. This structure specifies the * VPC subnets and security groups associated with the task, and whether a public IP address is to be used. This * structure is required if <code>LaunchType</code> is <code>FARGATE</code> because the <code>awsvpc</code> mode * is required for Fargate tasks. * </p> * <p> * If you specify <code>NetworkConfiguration</code> when the target ECS task does not use the * <code>awsvpc</code> network mode, the task fails. * </p> * This is a convenience that creates an instance of the {@link NetworkConfiguration.Builder} avoiding the need * to create one manually via {@link NetworkConfiguration#builder()}. * * When the {@link Consumer} completes, {@link NetworkConfiguration.Builder#build()} is called immediately and * its result is passed to {@link #networkConfiguration(NetworkConfiguration)}. * * @param networkConfiguration * a consumer that will call methods on {@link NetworkConfiguration.Builder} * @return Returns a reference to this object so that method calls can be chained together. * @see #networkConfiguration(NetworkConfiguration) */ default Builder networkConfiguration(Consumer<NetworkConfiguration.Builder> networkConfiguration) { return networkConfiguration(NetworkConfiguration.builder().applyMutation(networkConfiguration).build()); }