Class NetworkEndpoint


  • public class NetworkEndpoint
    extends com.pulumi.resources.CustomResource
    A 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. To get more information about NetworkEndpoint, 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 Endpoint ```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.NetworkEndpoint; import com.pulumi.gcp.compute.NetworkEndpointArgs; 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("debian-11") .project("debian-cloud") .build()); var defaultNetwork = new Network("defaultNetwork", NetworkArgs.builder() .autoCreateSubnetworks(false) .build()); var defaultSubnetwork = new Subnetwork("defaultSubnetwork", SubnetworkArgs.builder() .ipCidrRange("10.0.0.1/16") .region("us-central1") .network(defaultNetwork.id()) .build()); var endpoint_instance = new Instance("endpoint-instance", InstanceArgs.builder() .machineType("e2-medium") .bootDisk(InstanceBootDiskArgs.builder() .initializeParams(InstanceBootDiskInitializeParamsArgs.builder() .image(myImage.applyValue(getImageResult -> getImageResult.selfLink())) .build()) .build()) .networkInterfaces(InstanceNetworkInterfaceArgs.builder() .subnetwork(defaultSubnetwork.id()) .accessConfigs() .build()) .build()); var default_endpoint = new NetworkEndpoint("default-endpoint", NetworkEndpointArgs.builder() .networkEndpointGroup(google_compute_network_endpoint_group.neg().name()) .instance(endpoint_instance.name()) .port(google_compute_network_endpoint_group.neg().default_port()) .ipAddress(endpoint_instance.networkInterfaces().applyValue(networkInterfaces -> networkInterfaces[0].networkIp())) .build()); var group = new NetworkEndpointGroup("group", NetworkEndpointGroupArgs.builder() .network(defaultNetwork.id()) .subnetwork(defaultSubnetwork.id()) .defaultPort("90") .zone("us-central1-a") .build()); } } ``` ## Import NetworkEndpoint can be imported using any of these accepted formats ```sh $ pulumi import gcp:compute/networkEndpoint:NetworkEndpoint default projects/{{project}}/zones/{{zone}}/networkEndpointGroups/{{network_endpoint_group}}/{{instance}}/{{ip_address}}/{{port}} ``` ```sh $ pulumi import gcp:compute/networkEndpoint:NetworkEndpoint default {{project}}/{{zone}}/{{network_endpoint_group}}/{{instance}}/{{ip_address}}/{{port}} ``` ```sh $ pulumi import gcp:compute/networkEndpoint:NetworkEndpoint default {{zone}}/{{network_endpoint_group}}/{{instance}}/{{ip_address}}/{{port}} ``` ```sh $ pulumi import gcp:compute/networkEndpoint:NetworkEndpoint default {{network_endpoint_group}}/{{instance}}/{{ip_address}}/{{port}} ```
    • Nested Class Summary

      • Nested classes/interfaces inherited from class com.pulumi.resources.CustomResource

        com.pulumi.resources.CustomResource.CustomResourceInternal
      • Nested classes/interfaces inherited from class com.pulumi.resources.Resource

        com.pulumi.resources.Resource.LazyField<T extends java.lang.Object>, com.pulumi.resources.Resource.LazyFields, com.pulumi.resources.Resource.ResourceInternal
    • Field Summary

      • Fields inherited from class com.pulumi.resources.Resource

        childResources, remote
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      static NetworkEndpoint get​(java.lang.String name, com.pulumi.core.Output<java.lang.String> id, NetworkEndpointState state, com.pulumi.resources.CustomResourceOptions options)
      Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
      com.pulumi.core.Output<java.util.Optional<java.lang.String>> instance()  
      com.pulumi.core.Output<java.lang.String> ipAddress()  
      com.pulumi.core.Output<java.lang.String> networkEndpointGroup()  
      com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> port()  
      com.pulumi.core.Output<java.lang.String> project()  
      com.pulumi.core.Output<java.lang.String> zone()  
      • Methods inherited from class com.pulumi.resources.CustomResource

        getId, idFuture
      • Methods inherited from class com.pulumi.resources.Resource

        getChildResources, getResourceName, getResourceType, getUrn
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • NetworkEndpoint

        public NetworkEndpoint​(java.lang.String name)
        Parameters:
        name - The _unique_ name of the resulting resource.
      • NetworkEndpoint

        public NetworkEndpoint​(java.lang.String name,
                               NetworkEndpointArgs args)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
      • NetworkEndpoint

        public NetworkEndpoint​(java.lang.String name,
                               NetworkEndpointArgs args,
                               @Nullable
                               com.pulumi.resources.CustomResourceOptions options)
        Parameters:
        name - The _unique_ name of the resulting resource.
        args - The arguments to use to populate this resource's properties.
        options - A bag of options that control this resource's behavior.
    • Method Detail

      • instance

        public com.pulumi.core.Output<java.util.Optional<java.lang.String>> instance()
        Returns:
        The name for a specific VM instance that the IP address belongs to. This is required for network endpoints of type GCE_VM_IP_PORT. The instance must be in the same zone of network endpoint group.
      • ipAddress

        public com.pulumi.core.Output<java.lang.String> ipAddress()
        Returns:
        IPv4 address of network endpoint. The IP address must belong to a VM in GCE (either the primary IP or as part of an aliased IP range).
      • networkEndpointGroup

        public com.pulumi.core.Output<java.lang.String> networkEndpointGroup()
        Returns:
        The network endpoint group this endpoint is part of. ***
      • port

        public com.pulumi.core.Output<java.util.Optional<java.lang.Integer>> port()
        Returns:
        Port number of network endpoint. **Note** `port` is required unless the Network Endpoint Group is created with the type of `GCE_VM_IP`
      • project

        public com.pulumi.core.Output<java.lang.String> project()
        Returns:
        The ID of the project in which the resource belongs. If it is not provided, the provider project is used.
      • zone

        public com.pulumi.core.Output<java.lang.String> zone()
        Returns:
        Zone where the containing network endpoint group is located.
      • get

        public static NetworkEndpoint get​(java.lang.String name,
                                          com.pulumi.core.Output<java.lang.String> id,
                                          @Nullable
                                          NetworkEndpointState state,
                                          @Nullable
                                          com.pulumi.resources.CustomResourceOptions options)
        Get an existing Host resource's state with the given name, ID, and optional extra properties used to qualify the lookup.
        Parameters:
        name - The _unique_ name of the resulting resource.
        id - The _unique_ provider ID of the resource to lookup.
        state -
        options - Optional settings to control the behavior of the CustomResource.