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

import com.pulumi.core.annotations.CustomType;
import com.pulumi.gcp.osconfig.outputs.OsPolicyAssignmentOsPolicyResourceGroup;
import java.lang.Boolean;
import java.lang.String;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;

@CustomType
public final class OsPolicyAssignmentOsPolicy {
    /**
     * @return This flag determines the OS
     * policy compliance status when none of the resource groups within the policy
     * are applicable for a VM. Set this value to `true` if the policy needs to be
     * reported as compliant even if the policy has nothing to validate or enforce.
     * 
     */
    private @Nullable Boolean allowNoResourceGroupMatch;
    /**
     * @return Policy description. Length of the description is
     * limited to 1024 characters.
     * 
     */
    private @Nullable String description;
    /**
     * @return The id of the OS policy with the following restrictions:
     * 
     * *   Must contain only lowercase letters, numbers, and hyphens.
     * *   Must start with a letter.
     * *   Must be between 1-63 characters.
     * *   Must end with a number or a letter.
     * *   Must be unique within the assignment.
     * 
     */
    private String id;
    /**
     * @return Policy mode Possible values are: `MODE_UNSPECIFIED`,
     * `VALIDATION`, `ENFORCEMENT`.
     * 
     */
    private String mode;
    /**
     * @return List of resource groups for the policy. For a
     * particular VM, resource groups are evaluated in the order specified and the
     * first resource group that is applicable is selected and the rest are
     * ignored. If none of the resource groups are applicable for a VM, the VM is
     * considered to be non-compliant w.r.t this policy. This behavior can be
     * toggled by the flag `allow_no_resource_group_match` Structure is
     * documented below.
     * 
     */
    private List<OsPolicyAssignmentOsPolicyResourceGroup> resourceGroups;

    private OsPolicyAssignmentOsPolicy() {}
    /**
     * @return This flag determines the OS
     * policy compliance status when none of the resource groups within the policy
     * are applicable for a VM. Set this value to `true` if the policy needs to be
     * reported as compliant even if the policy has nothing to validate or enforce.
     * 
     */
    public Optional<Boolean> allowNoResourceGroupMatch() {
        return Optional.ofNullable(this.allowNoResourceGroupMatch);
    }
    /**
     * @return Policy description. Length of the description is
     * limited to 1024 characters.
     * 
     */
    public Optional<String> description() {
        return Optional.ofNullable(this.description);
    }
    /**
     * @return The id of the OS policy with the following restrictions:
     * 
     * *   Must contain only lowercase letters, numbers, and hyphens.
     * *   Must start with a letter.
     * *   Must be between 1-63 characters.
     * *   Must end with a number or a letter.
     * *   Must be unique within the assignment.
     * 
     */
    public String id() {
        return this.id;
    }
    /**
     * @return Policy mode Possible values are: `MODE_UNSPECIFIED`,
     * `VALIDATION`, `ENFORCEMENT`.
     * 
     */
    public String mode() {
        return this.mode;
    }
    /**
     * @return List of resource groups for the policy. For a
     * particular VM, resource groups are evaluated in the order specified and the
     * first resource group that is applicable is selected and the rest are
     * ignored. If none of the resource groups are applicable for a VM, the VM is
     * considered to be non-compliant w.r.t this policy. This behavior can be
     * toggled by the flag `allow_no_resource_group_match` Structure is
     * documented below.
     * 
     */
    public List<OsPolicyAssignmentOsPolicyResourceGroup> resourceGroups() {
        return this.resourceGroups;
    }

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

    public static Builder builder(OsPolicyAssignmentOsPolicy defaults) {
        return new Builder(defaults);
    }
    @CustomType.Builder
    public static final class Builder {
        private @Nullable Boolean allowNoResourceGroupMatch;
        private @Nullable String description;
        private String id;
        private String mode;
        private List<OsPolicyAssignmentOsPolicyResourceGroup> resourceGroups;
        public Builder() {}
        public Builder(OsPolicyAssignmentOsPolicy defaults) {
    	      Objects.requireNonNull(defaults);
    	      this.allowNoResourceGroupMatch = defaults.allowNoResourceGroupMatch;
    	      this.description = defaults.description;
    	      this.id = defaults.id;
    	      this.mode = defaults.mode;
    	      this.resourceGroups = defaults.resourceGroups;
        }

        @CustomType.Setter
        public Builder allowNoResourceGroupMatch(@Nullable Boolean allowNoResourceGroupMatch) {
            this.allowNoResourceGroupMatch = allowNoResourceGroupMatch;
            return this;
        }
        @CustomType.Setter
        public Builder description(@Nullable String description) {
            this.description = description;
            return this;
        }
        @CustomType.Setter
        public Builder id(String id) {
            this.id = Objects.requireNonNull(id);
            return this;
        }
        @CustomType.Setter
        public Builder mode(String mode) {
            this.mode = Objects.requireNonNull(mode);
            return this;
        }
        @CustomType.Setter
        public Builder resourceGroups(List<OsPolicyAssignmentOsPolicyResourceGroup> resourceGroups) {
            this.resourceGroups = Objects.requireNonNull(resourceGroups);
            return this;
        }
        public Builder resourceGroups(OsPolicyAssignmentOsPolicyResourceGroup... resourceGroups) {
            return resourceGroups(List.of(resourceGroups));
        }
        public OsPolicyAssignmentOsPolicy build() {
            final var o = new OsPolicyAssignmentOsPolicy();
            o.allowNoResourceGroupMatch = allowNoResourceGroupMatch;
            o.description = description;
            o.id = id;
            o.mode = mode;
            o.resourceGroups = resourceGroups;
            return o;
        }
    }
}
