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

import com.pulumi.azure.containerservice.outputs.RegistryNetworkRuleSetIpRule;
import com.pulumi.azure.containerservice.outputs.RegistryNetworkRuleSetVirtualNetwork;
import com.pulumi.core.annotations.CustomType;
import java.lang.String;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import javax.annotation.Nullable;

@CustomType
public final class RegistryNetworkRuleSet {
    /**
     * @return The behaviour for requests matching no rules. Either `Allow` or `Deny`. Defaults to `Allow`
     * 
     */
    private @Nullable String defaultAction;
    /**
     * @return One or more `ip_rule` blocks as defined below.
     * 
     */
    private @Nullable List<RegistryNetworkRuleSetIpRule> ipRules;
    /**
     * @return One or more `virtual_network` blocks as defined below.
     * 
     * &gt; **NOTE:** `network_rule_set` is only supported with the `Premium` SKU at this time.
     * 
     * &gt; **NOTE:** Azure automatically configures Network Rules - to remove these you&#39;ll need to specify an `network_rule_set` block with `default_action` set to `Deny`.
     * 
     */
    private @Nullable List<RegistryNetworkRuleSetVirtualNetwork> virtualNetworks;

    private RegistryNetworkRuleSet() {}
    /**
     * @return The behaviour for requests matching no rules. Either `Allow` or `Deny`. Defaults to `Allow`
     * 
     */
    public Optional<String> defaultAction() {
        return Optional.ofNullable(this.defaultAction);
    }
    /**
     * @return One or more `ip_rule` blocks as defined below.
     * 
     */
    public List<RegistryNetworkRuleSetIpRule> ipRules() {
        return this.ipRules == null ? List.of() : this.ipRules;
    }
    /**
     * @return One or more `virtual_network` blocks as defined below.
     * 
     * &gt; **NOTE:** `network_rule_set` is only supported with the `Premium` SKU at this time.
     * 
     * &gt; **NOTE:** Azure automatically configures Network Rules - to remove these you&#39;ll need to specify an `network_rule_set` block with `default_action` set to `Deny`.
     * 
     */
    public List<RegistryNetworkRuleSetVirtualNetwork> virtualNetworks() {
        return this.virtualNetworks == null ? List.of() : this.virtualNetworks;
    }

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

    public static Builder builder(RegistryNetworkRuleSet defaults) {
        return new Builder(defaults);
    }
    @CustomType.Builder
    public static final class Builder {
        private @Nullable String defaultAction;
        private @Nullable List<RegistryNetworkRuleSetIpRule> ipRules;
        private @Nullable List<RegistryNetworkRuleSetVirtualNetwork> virtualNetworks;
        public Builder() {}
        public Builder(RegistryNetworkRuleSet defaults) {
    	      Objects.requireNonNull(defaults);
    	      this.defaultAction = defaults.defaultAction;
    	      this.ipRules = defaults.ipRules;
    	      this.virtualNetworks = defaults.virtualNetworks;
        }

        @CustomType.Setter
        public Builder defaultAction(@Nullable String defaultAction) {
            this.defaultAction = defaultAction;
            return this;
        }
        @CustomType.Setter
        public Builder ipRules(@Nullable List<RegistryNetworkRuleSetIpRule> ipRules) {
            this.ipRules = ipRules;
            return this;
        }
        public Builder ipRules(RegistryNetworkRuleSetIpRule... ipRules) {
            return ipRules(List.of(ipRules));
        }
        @CustomType.Setter
        public Builder virtualNetworks(@Nullable List<RegistryNetworkRuleSetVirtualNetwork> virtualNetworks) {
            this.virtualNetworks = virtualNetworks;
            return this;
        }
        public Builder virtualNetworks(RegistryNetworkRuleSetVirtualNetwork... virtualNetworks) {
            return virtualNetworks(List.of(virtualNetworks));
        }
        public RegistryNetworkRuleSet build() {
            final var o = new RegistryNetworkRuleSet();
            o.defaultAction = defaultAction;
            o.ipRules = ipRules;
            o.virtualNetworks = virtualNetworks;
            return o;
        }
    }
}
