Package org.cdk8s.plus24
Class ServiceProps.Builder
- java.lang.Object
-
- org.cdk8s.plus24.ServiceProps.Builder
-
- All Implemented Interfaces:
software.amazon.jsii.Builder<ServiceProps>
- Enclosing interface:
- ServiceProps
@Stability(Stable) public static final class ServiceProps.Builder extends Object implements software.amazon.jsii.Builder<ServiceProps>
A builder forServiceProps
-
-
Constructor Summary
Constructors Constructor Description Builder()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ServiceProps
build()
Builds the configured instance.ServiceProps.Builder
clusterIp(String clusterIp)
Sets the value ofServiceProps#getClusterIp
ServiceProps.Builder
externalIPs(List<String> externalIPs)
Sets the value ofServiceProps.getExternalIPs()
ServiceProps.Builder
externalName(String externalName)
Sets the value ofServiceProps.getExternalName()
ServiceProps.Builder
loadBalancerSourceRanges(List<String> loadBalancerSourceRanges)
Sets the value ofServiceProps.getLoadBalancerSourceRanges()
ServiceProps.Builder
metadata(org.cdk8s.ApiObjectMetadata metadata)
Sets the value ofResourceProps.getMetadata()
ServiceProps.Builder
ports(List<? extends ServicePort> ports)
Sets the value ofServiceProps.getPorts()
ServiceProps.Builder
selector(IPodSelector selector)
Sets the value ofServiceProps.getSelector()
ServiceProps.Builder
type(ServiceType type)
Sets the value ofServiceProps.getType()
-
-
-
Method Detail
-
clusterIp
@Stability(Stable) public ServiceProps.Builder clusterIp(String clusterIp)
Sets the value ofServiceProps#getClusterIp
- Parameters:
clusterIp
- 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.- Returns:
this
-
externalIPs
@Stability(Stable) public ServiceProps.Builder externalIPs(List<String> externalIPs)
Sets the value ofServiceProps.getExternalIPs()
- Parameters:
externalIPs
- 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.- Returns:
this
-
externalName
@Stability(Stable) public ServiceProps.Builder externalName(String externalName)
Sets the value ofServiceProps.getExternalName()
- Parameters:
externalName
- The externalName to be used when ServiceType.EXTERNAL_NAME is set.- Returns:
this
-
loadBalancerSourceRanges
@Stability(Stable) public ServiceProps.Builder loadBalancerSourceRanges(List<String> loadBalancerSourceRanges)
Sets the value ofServiceProps.getLoadBalancerSourceRanges()
- Parameters:
loadBalancerSourceRanges
- A list of CIDR IP addresses, if specified and supported by the platform, will restrict traffic through the cloud-provider load-balancer to the specified client IPs. More info: https://kubernetes.io/docs/tasks/access-application-cluster/configure-cloud-provider-firewall/- Returns:
this
-
ports
@Stability(Stable) public ServiceProps.Builder ports(List<? extends ServicePort> ports)
Sets the value ofServiceProps.getPorts()
- Parameters:
ports
- The ports this service binds to. If the selector of the service is a managed pod / workload, its ports will are automatically extracted and used as the default value. Otherwise, no ports are bound.- Returns:
this
-
selector
@Stability(Stable) public ServiceProps.Builder selector(IPodSelector selector)
Sets the value ofServiceProps.getSelector()
- Parameters:
selector
- Which pods should the service select and route to. You can pass one of the following:- An instance of
Pod
or any workload resource (e.gDeployment
,StatefulSet
, ...) - Pods selected by the
Pods.select
function. Note that in this case only labels can be specified.
- An instance of
- Returns:
this
-
type
@Stability(Stable) public ServiceProps.Builder type(ServiceType type)
Sets the value ofServiceProps.getType()
- Parameters:
type
- Determines how the Service is exposed. More info: https://kubernetes.io/docs/concepts/services-networking/service/#publishing-services-service-types- Returns:
this
-
metadata
@Stability(Stable) public ServiceProps.Builder metadata(org.cdk8s.ApiObjectMetadata metadata)
Sets the value ofResourceProps.getMetadata()
- Parameters:
metadata
- Metadata that all persisted resources must have, which includes all objects users must create.- Returns:
this
-
build
@Stability(Stable) public ServiceProps build()
Builds the configured instance.- Specified by:
build
in interfacesoftware.amazon.jsii.Builder<ServiceProps>
- Returns:
- a new instance of
ServiceProps
- Throws:
NullPointerException
- if any required attribute was not provided
-
-