Class NetworkPolicy.Builder

    • Method Detail

      • create

        @Stability(Stable)
        public static NetworkPolicy.Builder create​(software.constructs.Construct scope,
                                                   String id)
        Parameters:
        scope - This parameter is required.
        id - This parameter is required.
        Returns:
        a new instance of NetworkPolicy.Builder.
      • metadata

        @Stability(Stable)
        public NetworkPolicy.Builder metadata​(org.cdk8s.ApiObjectMetadata metadata)
        Metadata that all persisted resources must have, which includes all objects users must create.

        Parameters:
        metadata - Metadata that all persisted resources must have, which includes all objects users must create. This parameter is required.
        Returns:
        this
      • egress

        @Stability(Stable)
        public NetworkPolicy.Builder egress​(NetworkPolicyTraffic egress)
        Egress traffic configuration.

        Default: - the policy doesn't change egress behavior of the pods it selects.

        Parameters:
        egress - Egress traffic configuration. This parameter is required.
        Returns:
        this
      • ingress

        @Stability(Stable)
        public NetworkPolicy.Builder ingress​(NetworkPolicyTraffic ingress)
        Ingress traffic configuration.

        Default: - the policy doesn't change ingress behavior of the pods it selects.

        Parameters:
        ingress - Ingress traffic configuration. This parameter is required.
        Returns:
        this
      • selector

        @Stability(Stable)
        public NetworkPolicy.Builder selector​(IPodSelector selector)
        Which pods does this policy object applies to.

        This can either be a single pod / workload, or a grouping of pods selected via the Pods.select function. Rules is applied to any pods selected by this property. Multiple network policies can select the same set of pods. In this case, the rules for each are combined additively.

        Note that

        Default: - will select all pods in the namespace of the policy.

        Parameters:
        selector - Which pods does this policy object applies to. This parameter is required.
        Returns:
        this
      • build

        @Stability(Stable)
        public NetworkPolicy build()
        Specified by:
        build in interface software.amazon.jsii.Builder<NetworkPolicy>