// *** 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.gcp.orgpolicy.outputs;

import com.pulumi.core.annotations.CustomType;
import com.pulumi.gcp.orgpolicy.outputs.PolicySpecRuleCondition;
import com.pulumi.gcp.orgpolicy.outputs.PolicySpecRuleValues;
import java.lang.String;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;

@CustomType
public final class PolicySpecRule {
    /**
     * @return Setting this to true means that all values are allowed. This field can be set only in Policies for list constraints.
     * 
     */
    private @Nullable String allowAll;
    /**
     * @return A condition which determines whether this rule is used in the evaluation of the policy. When set, the `expression` field in the `Expr&#39; must include from 1 to 10 subexpressions, joined by the &#34;||&#34; or &#34;&amp;&amp;&#34; operators. Each subexpression must be of the form &#34;resource.matchTag(&#39;/tag_key_short_name, &#39;tag_value_short_name&#39;)&#34;. or &#34;resource.matchTagId(&#39;tagKeys/key_id&#39;, &#39;tagValues/value_id&#39;)&#34;. where key_name and value_name are the resource names for Label Keys and Values. These names are available from the Tag Manager Service. An example expression is: &#34;resource.matchTag(&#39;123456789/environment, &#39;prod&#39;)&#34;. or &#34;resource.matchTagId(&#39;tagKeys/123&#39;, &#39;tagValues/456&#39;)&#34;.
     * 
     */
    private @Nullable PolicySpecRuleCondition condition;
    /**
     * @return Setting this to true means that all values are denied. This field can be set only in Policies for list constraints.
     * 
     */
    private @Nullable String denyAll;
    /**
     * @return If `true`, then the `Policy` is enforced. If `false`, then any configuration is acceptable. This field can be set only in Policies for boolean constraints.
     * 
     */
    private @Nullable String enforce;
    /**
     * @return List of values to be used for this PolicyRule. This field can be set only in Policies for list constraints.
     * 
     */
    private @Nullable PolicySpecRuleValues values;

    private PolicySpecRule() {}
    /**
     * @return Setting this to true means that all values are allowed. This field can be set only in Policies for list constraints.
     * 
     */
    public Optional<String> allowAll() {
        return Optional.ofNullable(this.allowAll);
    }
    /**
     * @return A condition which determines whether this rule is used in the evaluation of the policy. When set, the `expression` field in the `Expr&#39; must include from 1 to 10 subexpressions, joined by the &#34;||&#34; or &#34;&amp;&amp;&#34; operators. Each subexpression must be of the form &#34;resource.matchTag(&#39;/tag_key_short_name, &#39;tag_value_short_name&#39;)&#34;. or &#34;resource.matchTagId(&#39;tagKeys/key_id&#39;, &#39;tagValues/value_id&#39;)&#34;. where key_name and value_name are the resource names for Label Keys and Values. These names are available from the Tag Manager Service. An example expression is: &#34;resource.matchTag(&#39;123456789/environment, &#39;prod&#39;)&#34;. or &#34;resource.matchTagId(&#39;tagKeys/123&#39;, &#39;tagValues/456&#39;)&#34;.
     * 
     */
    public Optional<PolicySpecRuleCondition> condition() {
        return Optional.ofNullable(this.condition);
    }
    /**
     * @return Setting this to true means that all values are denied. This field can be set only in Policies for list constraints.
     * 
     */
    public Optional<String> denyAll() {
        return Optional.ofNullable(this.denyAll);
    }
    /**
     * @return If `true`, then the `Policy` is enforced. If `false`, then any configuration is acceptable. This field can be set only in Policies for boolean constraints.
     * 
     */
    public Optional<String> enforce() {
        return Optional.ofNullable(this.enforce);
    }
    /**
     * @return List of values to be used for this PolicyRule. This field can be set only in Policies for list constraints.
     * 
     */
    public Optional<PolicySpecRuleValues> values() {
        return Optional.ofNullable(this.values);
    }

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

    public static Builder builder(PolicySpecRule defaults) {
        return new Builder(defaults);
    }
    @CustomType.Builder
    public static final class Builder {
        private @Nullable String allowAll;
        private @Nullable PolicySpecRuleCondition condition;
        private @Nullable String denyAll;
        private @Nullable String enforce;
        private @Nullable PolicySpecRuleValues values;
        public Builder() {}
        public Builder(PolicySpecRule defaults) {
    	      Objects.requireNonNull(defaults);
    	      this.allowAll = defaults.allowAll;
    	      this.condition = defaults.condition;
    	      this.denyAll = defaults.denyAll;
    	      this.enforce = defaults.enforce;
    	      this.values = defaults.values;
        }

        @CustomType.Setter
        public Builder allowAll(@Nullable String allowAll) {
            this.allowAll = allowAll;
            return this;
        }
        @CustomType.Setter
        public Builder condition(@Nullable PolicySpecRuleCondition condition) {
            this.condition = condition;
            return this;
        }
        @CustomType.Setter
        public Builder denyAll(@Nullable String denyAll) {
            this.denyAll = denyAll;
            return this;
        }
        @CustomType.Setter
        public Builder enforce(@Nullable String enforce) {
            this.enforce = enforce;
            return this;
        }
        @CustomType.Setter
        public Builder values(@Nullable PolicySpecRuleValues values) {
            this.values = values;
            return this;
        }
        public PolicySpecRule build() {
            final var o = new PolicySpecRule();
            o.allowAll = allowAll;
            o.condition = condition;
            o.denyAll = denyAll;
            o.enforce = enforce;
            o.values = values;
            return o;
        }
    }
}
