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

import com.pulumi.core.Output;
import com.pulumi.core.annotations.Export;
import com.pulumi.core.annotations.ResourceType;
import com.pulumi.core.internal.Codegen;
import com.pulumi.gcp.Utilities;
import com.pulumi.gcp.compute.NetworkEndpointListArgs;
import com.pulumi.gcp.compute.inputs.NetworkEndpointListState;
import com.pulumi.gcp.compute.outputs.NetworkEndpointListNetworkEndpoint;
import java.lang.String;
import java.util.List;
import java.util.Optional;
import javax.annotation.Nullable;

/**
 * A set of network endpoints belonging to a network endpoint group (NEG). A
 * single network endpoint represents a IP address and port combination that is
 * part of a specific network endpoint group  (NEG). NEGs are zonal collections
 * of these endpoints for GCP resources within a single subnet. **NOTE**:
 * Network endpoints cannot be created outside of a network endpoint group.
 * 
 * This resource is authoritative for a single NEG. Any endpoints not specified
 * by this resource will be deleted when the resource configuration is applied.
 * 
 * To get more information about NetworkEndpoints, see:
 * 
 * * [API documentation](https://cloud.google.com/compute/docs/reference/rest/beta/networkEndpointGroups)
 * * How-to Guides
 *     * [Official Documentation](https://cloud.google.com/load-balancing/docs/negs/)
 * 
 * ## Example Usage
 * ### Network Endpoints
 * ```java
 * package generated_program;
 * 
 * import com.pulumi.Context;
 * import com.pulumi.Pulumi;
 * import com.pulumi.core.Output;
 * import com.pulumi.gcp.compute.ComputeFunctions;
 * import com.pulumi.gcp.compute.inputs.GetImageArgs;
 * import com.pulumi.gcp.compute.Network;
 * import com.pulumi.gcp.compute.NetworkArgs;
 * import com.pulumi.gcp.compute.Subnetwork;
 * import com.pulumi.gcp.compute.SubnetworkArgs;
 * import com.pulumi.gcp.compute.Instance;
 * import com.pulumi.gcp.compute.InstanceArgs;
 * import com.pulumi.gcp.compute.inputs.InstanceBootDiskArgs;
 * import com.pulumi.gcp.compute.inputs.InstanceBootDiskInitializeParamsArgs;
 * import com.pulumi.gcp.compute.inputs.InstanceNetworkInterfaceArgs;
 * import com.pulumi.gcp.compute.NetworkEndpointList;
 * import com.pulumi.gcp.compute.NetworkEndpointListArgs;
 * import com.pulumi.gcp.compute.inputs.NetworkEndpointListNetworkEndpointArgs;
 * import com.pulumi.gcp.compute.NetworkEndpointGroup;
 * import com.pulumi.gcp.compute.NetworkEndpointGroupArgs;
 * import java.util.List;
 * import java.util.ArrayList;
 * import java.util.Map;
 * import java.io.File;
 * import java.nio.file.Files;
 * import java.nio.file.Paths;
 * 
 * public class App {
 *     public static void main(String[] args) {
 *         Pulumi.run(App::stack);
 *     }
 * 
 *     public static void stack(Context ctx) {
 *         final var myImage = ComputeFunctions.getImage(GetImageArgs.builder()
 *             .family(&#34;debian-11&#34;)
 *             .project(&#34;debian-cloud&#34;)
 *             .build());
 * 
 *         var defaultNetwork = new Network(&#34;defaultNetwork&#34;, NetworkArgs.builder()        
 *             .autoCreateSubnetworks(false)
 *             .build());
 * 
 *         var defaultSubnetwork = new Subnetwork(&#34;defaultSubnetwork&#34;, SubnetworkArgs.builder()        
 *             .ipCidrRange(&#34;10.0.0.1/16&#34;)
 *             .region(&#34;us-central1&#34;)
 *             .network(defaultNetwork.id())
 *             .build());
 * 
 *         var endpoint_instance1 = new Instance(&#34;endpoint-instance1&#34;, InstanceArgs.builder()        
 *             .machineType(&#34;e2-medium&#34;)
 *             .bootDisk(InstanceBootDiskArgs.builder()
 *                 .initializeParams(InstanceBootDiskInitializeParamsArgs.builder()
 *                     .image(myImage.applyValue(getImageResult -&gt; getImageResult.selfLink()))
 *                     .build())
 *                 .build())
 *             .networkInterfaces(InstanceNetworkInterfaceArgs.builder()
 *                 .subnetwork(defaultSubnetwork.id())
 *                 .accessConfigs()
 *                 .build())
 *             .build());
 * 
 *         var endpoint_instance2 = new Instance(&#34;endpoint-instance2&#34;, InstanceArgs.builder()        
 *             .machineType(&#34;e2-medium&#34;)
 *             .bootDisk(InstanceBootDiskArgs.builder()
 *                 .initializeParams(InstanceBootDiskInitializeParamsArgs.builder()
 *                     .image(myImage.applyValue(getImageResult -&gt; getImageResult.selfLink()))
 *                     .build())
 *                 .build())
 *             .networkInterfaces(InstanceNetworkInterfaceArgs.builder()
 *                 .subnetwork(defaultSubnetwork.id())
 *                 .accessConfigs()
 *                 .build())
 *             .build());
 * 
 *         var default_endpoints = new NetworkEndpointList(&#34;default-endpoints&#34;, NetworkEndpointListArgs.builder()        
 *             .networkEndpointGroup(google_compute_network_endpoint_group.neg().name())
 *             .networkEndpoints(            
 *                 NetworkEndpointListNetworkEndpointArgs.builder()
 *                     .instance(endpoint_instance1.name())
 *                     .port(google_compute_network_endpoint_group.neg().default_port())
 *                     .ipAddress(endpoint_instance1.networkInterfaces().applyValue(networkInterfaces -&gt; networkInterfaces[0].networkIp()))
 *                     .build(),
 *                 NetworkEndpointListNetworkEndpointArgs.builder()
 *                     .instance(endpoint_instance2.name())
 *                     .port(google_compute_network_endpoint_group.neg().default_port())
 *                     .ipAddress(endpoint_instance2.networkInterfaces().applyValue(networkInterfaces -&gt; networkInterfaces[0].networkIp()))
 *                     .build())
 *             .build());
 * 
 *         var group = new NetworkEndpointGroup(&#34;group&#34;, NetworkEndpointGroupArgs.builder()        
 *             .network(defaultNetwork.id())
 *             .subnetwork(defaultSubnetwork.id())
 *             .defaultPort(&#34;90&#34;)
 *             .zone(&#34;us-central1-a&#34;)
 *             .build());
 * 
 *     }
 * }
 * ```
 * 
 * ## Import
 * 
 * NetworkEndpoints can be imported using any of these accepted formats
 * 
 * ```sh
 *  $ pulumi import gcp:compute/networkEndpointList:NetworkEndpointList default projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{network_endpoint_group}}
 * ```
 * 
 * ```sh
 *  $ pulumi import gcp:compute/networkEndpointList:NetworkEndpointList default {{project}}/{{zone}}/{{network_endpoint_group}}
 * ```
 * 
 * ```sh
 *  $ pulumi import gcp:compute/networkEndpointList:NetworkEndpointList default {{zone}}/{{network_endpoint_group}}
 * ```
 * 
 * ```sh
 *  $ pulumi import gcp:compute/networkEndpointList:NetworkEndpointList default {{network_endpoint_group}}
 * ```
 * 
 */
@ResourceType(type="gcp:compute/networkEndpointList:NetworkEndpointList")
public class NetworkEndpointList extends com.pulumi.resources.CustomResource {
    /**
     * The network endpoint group these endpoints are part of.
     * 
     * ***
     * 
     */
    @Export(name="networkEndpointGroup", type=String.class, parameters={})
    private Output<String> networkEndpointGroup;

    /**
     * @return The network endpoint group these endpoints are part of.
     * 
     * ***
     * 
     */
    public Output<String> networkEndpointGroup() {
        return this.networkEndpointGroup;
    }
    /**
     * The network endpoints to be added to the enclosing network endpoint group
     * (NEG). Each endpoint specifies an IP address and port, along with
     * additional information depending on the NEG type.
     * Structure is documented below.
     * 
     */
    @Export(name="networkEndpoints", type=List.class, parameters={NetworkEndpointListNetworkEndpoint.class})
    private Output</* @Nullable */ List<NetworkEndpointListNetworkEndpoint>> networkEndpoints;

    /**
     * @return The network endpoints to be added to the enclosing network endpoint group
     * (NEG). Each endpoint specifies an IP address and port, along with
     * additional information depending on the NEG type.
     * Structure is documented below.
     * 
     */
    public Output<Optional<List<NetworkEndpointListNetworkEndpoint>>> networkEndpoints() {
        return Codegen.optional(this.networkEndpoints);
    }
    /**
     * The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     * 
     */
    @Export(name="project", type=String.class, parameters={})
    private Output<String> project;

    /**
     * @return The ID of the project in which the resource belongs.
     * If it is not provided, the provider project is used.
     * 
     */
    public Output<String> project() {
        return this.project;
    }
    /**
     * Zone where the containing network endpoint group is located.
     * 
     */
    @Export(name="zone", type=String.class, parameters={})
    private Output<String> zone;

    /**
     * @return Zone where the containing network endpoint group is located.
     * 
     */
    public Output<String> zone() {
        return this.zone;
    }

    /**
     *
     * @param name The _unique_ name of the resulting resource.
     */
    public NetworkEndpointList(String name) {
        this(name, NetworkEndpointListArgs.Empty);
    }
    /**
     *
     * @param name The _unique_ name of the resulting resource.
     * @param args The arguments to use to populate this resource's properties.
     */
    public NetworkEndpointList(String name, NetworkEndpointListArgs args) {
        this(name, args, null);
    }
    /**
     *
     * @param name The _unique_ name of the resulting resource.
     * @param args The arguments to use to populate this resource's properties.
     * @param options A bag of options that control this resource's behavior.
     */
    public NetworkEndpointList(String name, NetworkEndpointListArgs args, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("gcp:compute/networkEndpointList:NetworkEndpointList", name, args == null ? NetworkEndpointListArgs.Empty : args, makeResourceOptions(options, Codegen.empty()));
    }

    private NetworkEndpointList(String name, Output<String> id, @Nullable NetworkEndpointListState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        super("gcp:compute/networkEndpointList:NetworkEndpointList", name, state, makeResourceOptions(options, id));
    }

    private static com.pulumi.resources.CustomResourceOptions makeResourceOptions(@Nullable com.pulumi.resources.CustomResourceOptions options, @Nullable Output<String> id) {
        var defaultOptions = com.pulumi.resources.CustomResourceOptions.builder()
            .version(Utilities.getVersion())
            .build();
        return com.pulumi.resources.CustomResourceOptions.merge(defaultOptions, options, id);
    }

    /**
     * Get an existing Host resource's state with the given name, ID, and optional extra
     * properties used to qualify the lookup.
     *
     * @param name The _unique_ name of the resulting resource.
     * @param id The _unique_ provider ID of the resource to lookup.
     * @param state
     * @param options Optional settings to control the behavior of the CustomResource.
     */
    public static NetworkEndpointList get(String name, Output<String> id, @Nullable NetworkEndpointListState state, @Nullable com.pulumi.resources.CustomResourceOptions options) {
        return new NetworkEndpointList(name, id, state, options);
    }
}
