// *** WARNING: this file was generated by pulumi-java-gen. ***
// *** Do not edit by hand unless you're certain you know what you are doing! ***

package com.pulumi.kubernetes.core.v1.outputs;

import com.pulumi.core.annotations.CustomType;
import com.pulumi.kubernetes.core.v1.outputs.NodeAffinityPatch;
import com.pulumi.kubernetes.core.v1.outputs.PodAffinityPatch;
import com.pulumi.kubernetes.core.v1.outputs.PodAntiAffinityPatch;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;

@CustomType
public final class AffinityPatch {
    /**
     * @return Describes node affinity scheduling rules for the pod.
     * 
     */
    private @Nullable NodeAffinityPatch nodeAffinity;
    /**
     * @return Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)).
     * 
     */
    private @Nullable PodAffinityPatch podAffinity;
    /**
     * @return Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s)).
     * 
     */
    private @Nullable PodAntiAffinityPatch podAntiAffinity;

    private AffinityPatch() {}
    /**
     * @return Describes node affinity scheduling rules for the pod.
     * 
     */
    public Optional<NodeAffinityPatch> nodeAffinity() {
        return Optional.ofNullable(this.nodeAffinity);
    }
    /**
     * @return Describes pod affinity scheduling rules (e.g. co-locate this pod in the same node, zone, etc. as some other pod(s)).
     * 
     */
    public Optional<PodAffinityPatch> podAffinity() {
        return Optional.ofNullable(this.podAffinity);
    }
    /**
     * @return Describes pod anti-affinity scheduling rules (e.g. avoid putting this pod in the same node, zone, etc. as some other pod(s)).
     * 
     */
    public Optional<PodAntiAffinityPatch> podAntiAffinity() {
        return Optional.ofNullable(this.podAntiAffinity);
    }

    public static Builder builder() {
        return new Builder();
    }

    public static Builder builder(AffinityPatch defaults) {
        return new Builder(defaults);
    }
    @CustomType.Builder
    public static final class Builder {
        private @Nullable NodeAffinityPatch nodeAffinity;
        private @Nullable PodAffinityPatch podAffinity;
        private @Nullable PodAntiAffinityPatch podAntiAffinity;
        public Builder() {}
        public Builder(AffinityPatch defaults) {
    	      Objects.requireNonNull(defaults);
    	      this.nodeAffinity = defaults.nodeAffinity;
    	      this.podAffinity = defaults.podAffinity;
    	      this.podAntiAffinity = defaults.podAntiAffinity;
        }

        @CustomType.Setter
        public Builder nodeAffinity(@Nullable NodeAffinityPatch nodeAffinity) {
            this.nodeAffinity = nodeAffinity;
            return this;
        }
        @CustomType.Setter
        public Builder podAffinity(@Nullable PodAffinityPatch podAffinity) {
            this.podAffinity = podAffinity;
            return this;
        }
        @CustomType.Setter
        public Builder podAntiAffinity(@Nullable PodAntiAffinityPatch podAntiAffinity) {
            this.podAntiAffinity = podAntiAffinity;
            return this;
        }
        public AffinityPatch build() {
            final var o = new AffinityPatch();
            o.nodeAffinity = nodeAffinity;
            o.podAffinity = podAffinity;
            o.podAntiAffinity = podAntiAffinity;
            return o;
        }
    }
}
