Skip navigation links

Package com.google.cloud.compute.v1

A client to Compute Engine API.

See: Description

Package com.google.cloud.compute.v1 Description

A client to Compute Engine API.

The interfaces provided are listed below, along with usage samples.

===================== AcceleratorTypeClient =====================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for AcceleratorTypeClient:

 
 try (AcceleratorTypeClient acceleratorTypeClient = AcceleratorTypeClient.create()) {
   ProjectZoneAcceleratorTypeName acceleratorType = ProjectZoneAcceleratorTypeName.of("[PROJECT]", "[ZONE]", "[ACCELERATOR_TYPE]");
   AcceleratorType response = acceleratorTypeClient.getAcceleratorType(acceleratorType);
 }
 
 
============= AddressClient =============

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for AddressClient:

 
 try (AddressClient addressClient = AddressClient.create()) {
   ProjectRegionAddressName address = ProjectRegionAddressName.of("[PROJECT]", "[REGION]", "[ADDRESS]");
   Operation response = addressClient.deleteAddress(address);
 }
 
 
================ AutoscalerClient ================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for AutoscalerClient:

 
 try (AutoscalerClient autoscalerClient = AutoscalerClient.create()) {
   ProjectZoneAutoscalerName autoscaler = ProjectZoneAutoscalerName.of("[PROJECT]", "[ZONE]", "[AUTOSCALER]");
   Operation response = autoscalerClient.deleteAutoscaler(autoscaler);
 }
 
 
=================== BackendBucketClient ===================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for BackendBucketClient:

 
 try (BackendBucketClient backendBucketClient = BackendBucketClient.create()) {
   ProjectGlobalBackendBucketName backendBucket = ProjectGlobalBackendBucketName.of("[PROJECT]", "[BACKEND_BUCKET]");
   SignedUrlKey signedUrlKeyResource = SignedUrlKey.newBuilder().build();
   Operation response = backendBucketClient.addSignedUrlKeyBackendBucket(backendBucket, signedUrlKeyResource);
 }
 
 
==================== BackendServiceClient ====================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for BackendServiceClient:

 
 try (BackendServiceClient backendServiceClient = BackendServiceClient.create()) {
   ProjectGlobalBackendServiceName backendService = ProjectGlobalBackendServiceName.of("[PROJECT]", "[BACKEND_SERVICE]");
   SignedUrlKey signedUrlKeyResource = SignedUrlKey.newBuilder().build();
   Operation response = backendServiceClient.addSignedUrlKeyBackendService(backendService, signedUrlKeyResource);
 }
 
 
============== DiskTypeClient ==============

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for DiskTypeClient:

 
 try (DiskTypeClient diskTypeClient = DiskTypeClient.create()) {
   ProjectZoneDiskTypeName diskType = ProjectZoneDiskTypeName.of("[PROJECT]", "[ZONE]", "[DISK_TYPE]");
   DiskType response = diskTypeClient.getDiskType(diskType);
 }
 
 
========== DiskClient ==========

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for DiskClient:

 
 try (DiskClient diskClient = DiskClient.create()) {
   ProjectZoneDiskName disk = ProjectZoneDiskName.of("[PROJECT]", "[ZONE]", "[DISK]");
   Boolean guestFlush = false;
   Snapshot snapshotResource = Snapshot.newBuilder().build();
   Operation response = diskClient.createSnapshotDisk(disk, guestFlush, snapshotResource);
 }
 
 
============== FirewallClient ==============

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for FirewallClient:

 
 try (FirewallClient firewallClient = FirewallClient.create()) {
   ProjectGlobalFirewallName firewall = ProjectGlobalFirewallName.of("[PROJECT]", "[FIREWALL]");
   Operation response = firewallClient.deleteFirewall(firewall);
 }
 
 
==================== ForwardingRuleClient ====================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for ForwardingRuleClient:

 
 try (ForwardingRuleClient forwardingRuleClient = ForwardingRuleClient.create()) {
   ProjectRegionForwardingRuleName forwardingRule = ProjectRegionForwardingRuleName.of("[PROJECT]", "[REGION]", "[FORWARDING_RULE]");
   Operation response = forwardingRuleClient.deleteForwardingRule(forwardingRule);
 }
 
 
=================== GlobalAddressClient ===================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for GlobalAddressClient:

 
 try (GlobalAddressClient globalAddressClient = GlobalAddressClient.create()) {
   ProjectGlobalAddressName address = ProjectGlobalAddressName.of("[PROJECT]", "[ADDRESS]");
   Operation response = globalAddressClient.deleteGlobalAddress(address);
 }
 
 
========================== GlobalForwardingRuleClient ==========================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for GlobalForwardingRuleClient:

 
 try (GlobalForwardingRuleClient globalForwardingRuleClient = GlobalForwardingRuleClient.create()) {
   ProjectGlobalForwardingRuleName forwardingRule = ProjectGlobalForwardingRuleName.of("[PROJECT]", "[FORWARDING_RULE]");
   Operation response = globalForwardingRuleClient.deleteGlobalForwardingRule(forwardingRule);
 }
 
 
===================== GlobalOperationClient =====================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for GlobalOperationClient:

 
 try (GlobalOperationClient globalOperationClient = GlobalOperationClient.create()) {
   ProjectGlobalOperationName operation = ProjectGlobalOperationName.of("[PROJECT]", "[OPERATION]");
   globalOperationClient.deleteGlobalOperation(operation);
 }
 
 
================= HealthCheckClient =================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for HealthCheckClient:

 
 try (HealthCheckClient healthCheckClient = HealthCheckClient.create()) {
   ProjectGlobalHealthCheckName healthCheck = ProjectGlobalHealthCheckName.of("[PROJECT]", "[HEALTH_CHECK]");
   Operation response = healthCheckClient.deleteHealthCheck(healthCheck);
 }
 
 
===================== HttpHealthCheckClient =====================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for HttpHealthCheckClient:

 
 try (HttpHealthCheckClient httpHealthCheckClient = HttpHealthCheckClient.create()) {
   ProjectGlobalHttpHealthCheckName httpHealthCheck = ProjectGlobalHttpHealthCheckName.of("[PROJECT]", "[HTTP_HEALTH_CHECK]");
   Operation response = httpHealthCheckClient.deleteHttpHealthCheck(httpHealthCheck);
 }
 
 
====================== HttpsHealthCheckClient ======================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for HttpsHealthCheckClient:

 
 try (HttpsHealthCheckClient httpsHealthCheckClient = HttpsHealthCheckClient.create()) {
   ProjectGlobalHttpsHealthCheckName httpsHealthCheck = ProjectGlobalHttpsHealthCheckName.of("[PROJECT]", "[HTTPS_HEALTH_CHECK]");
   Operation response = httpsHealthCheckClient.deleteHttpsHealthCheck(httpsHealthCheck);
 }
 
 
=========== ImageClient ===========

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for ImageClient:

 
 try (ImageClient imageClient = ImageClient.create()) {
   ProjectGlobalImageName image = ProjectGlobalImageName.of("[PROJECT]", "[IMAGE]");
   Operation response = imageClient.deleteImage(image);
 }
 
 
========================== InstanceGroupManagerClient ==========================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for InstanceGroupManagerClient:

 
 try (InstanceGroupManagerClient instanceGroupManagerClient = InstanceGroupManagerClient.create()) {
   ProjectZoneInstanceGroupManagerName instanceGroupManager = ProjectZoneInstanceGroupManagerName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP_MANAGER]");
   InstanceGroupManagersAbandonInstancesRequest instanceGroupManagersAbandonInstancesRequestResource = InstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
   Operation response = instanceGroupManagerClient.abandonInstancesInstanceGroupManager(instanceGroupManager, instanceGroupManagersAbandonInstancesRequestResource);
 }
 
 
=================== InstanceGroupClient ===================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for InstanceGroupClient:

 
 try (InstanceGroupClient instanceGroupClient = InstanceGroupClient.create()) {
   ProjectZoneInstanceGroupName instanceGroup = ProjectZoneInstanceGroupName.of("[PROJECT]", "[ZONE]", "[INSTANCE_GROUP]");
   InstanceGroupsAddInstancesRequest instanceGroupsAddInstancesRequestResource = InstanceGroupsAddInstancesRequest.newBuilder().build();
   Operation response = instanceGroupClient.addInstancesInstanceGroup(instanceGroup, instanceGroupsAddInstancesRequestResource);
 }
 
 
====================== InstanceTemplateClient ======================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for InstanceTemplateClient:

 
 try (InstanceTemplateClient instanceTemplateClient = InstanceTemplateClient.create()) {
   ProjectGlobalInstanceTemplateName instanceTemplate = ProjectGlobalInstanceTemplateName.of("[PROJECT]", "[INSTANCE_TEMPLATE]");
   Operation response = instanceTemplateClient.deleteInstanceTemplate(instanceTemplate);
 }
 
 
============== InstanceClient ==============

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for InstanceClient:

 
 try (InstanceClient instanceClient = InstanceClient.create()) {
   ProjectZoneInstanceName instance = ProjectZoneInstanceName.of("[PROJECT]", "[ZONE]", "[INSTANCE]");
   String networkInterface = "";
   AccessConfig accessConfigResource = AccessConfig.newBuilder().build();
   Operation response = instanceClient.addAccessConfigInstance(instance, networkInterface, accessConfigResource);
 }
 
 
============================ InterconnectAttachmentClient ============================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for InterconnectAttachmentClient:

 
 try (InterconnectAttachmentClient interconnectAttachmentClient = InterconnectAttachmentClient.create()) {
   ProjectRegionInterconnectAttachmentName interconnectAttachment = ProjectRegionInterconnectAttachmentName.of("[PROJECT]", "[REGION]", "[INTERCONNECT_ATTACHMENT]");
   Operation response = interconnectAttachmentClient.deleteInterconnectAttachment(interconnectAttachment);
 }
 
 
========================== InterconnectLocationClient ==========================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for InterconnectLocationClient:

 
 try (InterconnectLocationClient interconnectLocationClient = InterconnectLocationClient.create()) {
   ProjectGlobalInterconnectLocationName interconnectLocation = ProjectGlobalInterconnectLocationName.of("[PROJECT]", "[INTERCONNECT_LOCATION]");
   InterconnectLocation response = interconnectLocationClient.getInterconnectLocation(interconnectLocation);
 }
 
 
================== InterconnectClient ==================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for InterconnectClient:

 
 try (InterconnectClient interconnectClient = InterconnectClient.create()) {
   ProjectGlobalInterconnectName interconnect = ProjectGlobalInterconnectName.of("[PROJECT]", "[INTERCONNECT]");
   Operation response = interconnectClient.deleteInterconnect(interconnect);
 }
 
 
================= LicenseCodeClient =================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for LicenseCodeClient:

 
 try (LicenseCodeClient licenseCodeClient = LicenseCodeClient.create()) {
   ProjectGlobalLicenseCodeName licenseCode = ProjectGlobalLicenseCodeName.of("[PROJECT]", "[LICENSE_CODE]");
   LicenseCode response = licenseCodeClient.getLicenseCode(licenseCode);
 }
 
 
============= LicenseClient =============

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for LicenseClient:

 
 try (LicenseClient licenseClient = LicenseClient.create()) {
   ProjectGlobalLicenseName license = ProjectGlobalLicenseName.of("[PROJECT]", "[LICENSE]");
   Operation response = licenseClient.deleteLicense(license);
 }
 
 
================= MachineTypeClient =================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for MachineTypeClient:

 
 try (MachineTypeClient machineTypeClient = MachineTypeClient.create()) {
   ProjectZoneMachineTypeName machineType = ProjectZoneMachineTypeName.of("[PROJECT]", "[ZONE]", "[MACHINE_TYPE]");
   MachineType response = machineTypeClient.getMachineType(machineType);
 }
 
 
========================== NetworkEndpointGroupClient ==========================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for NetworkEndpointGroupClient:

 
 try (NetworkEndpointGroupClient networkEndpointGroupClient = NetworkEndpointGroupClient.create()) {
   ProjectZoneNetworkEndpointGroupName networkEndpointGroup = ProjectZoneNetworkEndpointGroupName.of("[PROJECT]", "[ZONE]", "[NETWORK_ENDPOINT_GROUP]");
   NetworkEndpointGroupsAttachEndpointsRequest networkEndpointGroupsAttachEndpointsRequestResource = NetworkEndpointGroupsAttachEndpointsRequest.newBuilder().build();
   Operation response = networkEndpointGroupClient.attachNetworkEndpointsNetworkEndpointGroup(networkEndpointGroup, networkEndpointGroupsAttachEndpointsRequestResource);
 }
 
 
============= NetworkClient =============

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for NetworkClient:

 
 try (NetworkClient networkClient = NetworkClient.create()) {
   ProjectGlobalNetworkName network = ProjectGlobalNetworkName.of("[PROJECT]", "[NETWORK]");
   NetworksAddPeeringRequest networksAddPeeringRequestResource = NetworksAddPeeringRequest.newBuilder().build();
   Operation response = networkClient.addPeeringNetwork(network, networksAddPeeringRequestResource);
 }
 
 
=============== NodeGroupClient ===============

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for NodeGroupClient:

 
 try (NodeGroupClient nodeGroupClient = NodeGroupClient.create()) {
   ProjectZoneNodeGroupName nodeGroup = ProjectZoneNodeGroupName.of("[PROJECT]", "[ZONE]", "[NODE_GROUP]");
   NodeGroupsAddNodesRequest nodeGroupsAddNodesRequestResource = NodeGroupsAddNodesRequest.newBuilder().build();
   Operation response = nodeGroupClient.addNodesNodeGroup(nodeGroup, nodeGroupsAddNodesRequestResource);
 }
 
 
================== NodeTemplateClient ==================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for NodeTemplateClient:

 
 try (NodeTemplateClient nodeTemplateClient = NodeTemplateClient.create()) {
   ProjectRegionNodeTemplateName nodeTemplate = ProjectRegionNodeTemplateName.of("[PROJECT]", "[REGION]", "[NODE_TEMPLATE]");
   Operation response = nodeTemplateClient.deleteNodeTemplate(nodeTemplate);
 }
 
 
============== NodeTypeClient ==============

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for NodeTypeClient:

 
 try (NodeTypeClient nodeTypeClient = NodeTypeClient.create()) {
   ProjectZoneNodeTypeName nodeType = ProjectZoneNodeTypeName.of("[PROJECT]", "[ZONE]", "[NODE_TYPE]");
   NodeType response = nodeTypeClient.getNodeType(nodeType);
 }
 
 
============= ProjectClient =============

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for ProjectClient:

 
 try (ProjectClient projectClient = ProjectClient.create()) {
   ProjectName project = ProjectName.of("[PROJECT]");
   Operation response = projectClient.disableXpnHostProject(project);
 }
 
 
====================== RegionAutoscalerClient ======================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for RegionAutoscalerClient:

 
 try (RegionAutoscalerClient regionAutoscalerClient = RegionAutoscalerClient.create()) {
   ProjectRegionAutoscalerName autoscaler = ProjectRegionAutoscalerName.of("[PROJECT]", "[REGION]", "[AUTOSCALER]");
   Operation response = regionAutoscalerClient.deleteRegionAutoscaler(autoscaler);
 }
 
 
========================== RegionBackendServiceClient ==========================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for RegionBackendServiceClient:

 
 try (RegionBackendServiceClient regionBackendServiceClient = RegionBackendServiceClient.create()) {
   ProjectRegionBackendServiceName backendService = ProjectRegionBackendServiceName.of("[PROJECT]", "[REGION]", "[BACKEND_SERVICE]");
   Operation response = regionBackendServiceClient.deleteRegionBackendService(backendService);
 }
 
 
====================== RegionCommitmentClient ======================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for RegionCommitmentClient:

 
 try (RegionCommitmentClient regionCommitmentClient = RegionCommitmentClient.create()) {
   ProjectRegionCommitmentName commitment = ProjectRegionCommitmentName.of("[PROJECT]", "[REGION]", "[COMMITMENT]");
   Commitment response = regionCommitmentClient.getRegionCommitment(commitment);
 }
 
 
==================== RegionDiskTypeClient ====================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for RegionDiskTypeClient:

 
 try (RegionDiskTypeClient regionDiskTypeClient = RegionDiskTypeClient.create()) {
   ProjectRegionDiskTypeName diskType = ProjectRegionDiskTypeName.of("[PROJECT]", "[REGION]", "[DISK_TYPE]");
   DiskType response = regionDiskTypeClient.getRegionDiskType(diskType);
 }
 
 
================ RegionDiskClient ================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for RegionDiskClient:

 
 try (RegionDiskClient regionDiskClient = RegionDiskClient.create()) {
   ProjectRegionDiskName disk = ProjectRegionDiskName.of("[PROJECT]", "[REGION]", "[DISK]");
   Snapshot snapshotResource = Snapshot.newBuilder().build();
   Operation response = regionDiskClient.createSnapshotRegionDisk(disk, snapshotResource);
 }
 
 
================================ RegionInstanceGroupManagerClient ================================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for RegionInstanceGroupManagerClient:

 
 try (RegionInstanceGroupManagerClient regionInstanceGroupManagerClient = RegionInstanceGroupManagerClient.create()) {
   ProjectRegionInstanceGroupManagerName instanceGroupManager = ProjectRegionInstanceGroupManagerName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP_MANAGER]");
   RegionInstanceGroupManagersAbandonInstancesRequest regionInstanceGroupManagersAbandonInstancesRequestResource = RegionInstanceGroupManagersAbandonInstancesRequest.newBuilder().build();
   Operation response = regionInstanceGroupManagerClient.abandonInstancesRegionInstanceGroupManager(instanceGroupManager, regionInstanceGroupManagersAbandonInstancesRequestResource);
 }
 
 
========================= RegionInstanceGroupClient =========================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for RegionInstanceGroupClient:

 
 try (RegionInstanceGroupClient regionInstanceGroupClient = RegionInstanceGroupClient.create()) {
   ProjectRegionInstanceGroupName instanceGroup = ProjectRegionInstanceGroupName.of("[PROJECT]", "[REGION]", "[INSTANCE_GROUP]");
   InstanceGroup response = regionInstanceGroupClient.getRegionInstanceGroup(instanceGroup);
 }
 
 
===================== RegionOperationClient =====================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for RegionOperationClient:

 
 try (RegionOperationClient regionOperationClient = RegionOperationClient.create()) {
   ProjectRegionOperationName operation = ProjectRegionOperationName.of("[PROJECT]", "[REGION]", "[OPERATION]");
   regionOperationClient.deleteRegionOperation(operation);
 }
 
 
============ RegionClient ============

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for RegionClient:

 
 try (RegionClient regionClient = RegionClient.create()) {
   ProjectRegionName region = ProjectRegionName.of("[PROJECT]", "[REGION]");
   Region response = regionClient.getRegion(region);
 }
 
 
============ RouterClient ============

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for RouterClient:

 
 try (RouterClient routerClient = RouterClient.create()) {
   ProjectRegionRouterName router = ProjectRegionRouterName.of("[PROJECT]", "[REGION]", "[ROUTER]");
   Operation response = routerClient.deleteRouter(router);
 }
 
 
=========== RouteClient ===========

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for RouteClient:

 
 try (RouteClient routeClient = RouteClient.create()) {
   ProjectGlobalRouteName route = ProjectGlobalRouteName.of("[PROJECT]", "[ROUTE]");
   Operation response = routeClient.deleteRoute(route);
 }
 
 
==================== SecurityPolicyClient ====================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for SecurityPolicyClient:

 
 try (SecurityPolicyClient securityPolicyClient = SecurityPolicyClient.create()) {
   ProjectGlobalSecurityPolicyName securityPolicy = ProjectGlobalSecurityPolicyName.of("[PROJECT]", "[SECURITY_POLICY]");
   SecurityPolicyRule securityPolicyRuleResource = SecurityPolicyRule.newBuilder().build();
   Operation response = securityPolicyClient.addRuleSecurityPolicy(securityPolicy, securityPolicyRuleResource);
 }
 
 
============== SnapshotClient ==============

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for SnapshotClient:

 
 try (SnapshotClient snapshotClient = SnapshotClient.create()) {
   ProjectGlobalSnapshotName snapshot = ProjectGlobalSnapshotName.of("[PROJECT]", "[SNAPSHOT]");
   Operation response = snapshotClient.deleteSnapshot(snapshot);
 }
 
 
==================== SslCertificateClient ====================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for SslCertificateClient:

 
 try (SslCertificateClient sslCertificateClient = SslCertificateClient.create()) {
   ProjectGlobalSslCertificateName sslCertificate = ProjectGlobalSslCertificateName.of("[PROJECT]", "[SSL_CERTIFICATE]");
   Operation response = sslCertificateClient.deleteSslCertificate(sslCertificate);
 }
 
 
=============== SslPolicyClient ===============

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for SslPolicyClient:

 
 try (SslPolicyClient sslPolicyClient = SslPolicyClient.create()) {
   ProjectGlobalSslPolicyName sslPolicy = ProjectGlobalSslPolicyName.of("[PROJECT]", "[SSL_POLICY]");
   Operation response = sslPolicyClient.deleteSslPolicy(sslPolicy);
 }
 
 
================ SubnetworkClient ================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for SubnetworkClient:

 
 try (SubnetworkClient subnetworkClient = SubnetworkClient.create()) {
   ProjectRegionSubnetworkName subnetwork = ProjectRegionSubnetworkName.of("[PROJECT]", "[REGION]", "[SUBNETWORK]");
   Operation response = subnetworkClient.deleteSubnetwork(subnetwork);
 }
 
 
===================== TargetHttpProxyClient =====================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for TargetHttpProxyClient:

 
 try (TargetHttpProxyClient targetHttpProxyClient = TargetHttpProxyClient.create()) {
   ProjectGlobalTargetHttpProxyName targetHttpProxy = ProjectGlobalTargetHttpProxyName.of("[PROJECT]", "[TARGET_HTTP_PROXY]");
   Operation response = targetHttpProxyClient.deleteTargetHttpProxy(targetHttpProxy);
 }
 
 
====================== TargetHttpsProxyClient ======================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for TargetHttpsProxyClient:

 
 try (TargetHttpsProxyClient targetHttpsProxyClient = TargetHttpsProxyClient.create()) {
   ProjectGlobalTargetHttpsProxyName targetHttpsProxy = ProjectGlobalTargetHttpsProxyName.of("[PROJECT]", "[TARGET_HTTPS_PROXY]");
   Operation response = targetHttpsProxyClient.deleteTargetHttpsProxy(targetHttpsProxy);
 }
 
 
==================== TargetInstanceClient ====================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for TargetInstanceClient:

 
 try (TargetInstanceClient targetInstanceClient = TargetInstanceClient.create()) {
   ProjectZoneTargetInstanceName targetInstance = ProjectZoneTargetInstanceName.of("[PROJECT]", "[ZONE]", "[TARGET_INSTANCE]");
   Operation response = targetInstanceClient.deleteTargetInstance(targetInstance);
 }
 
 
================ TargetPoolClient ================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for TargetPoolClient:

 
 try (TargetPoolClient targetPoolClient = TargetPoolClient.create()) {
   ProjectRegionTargetPoolName targetPool = ProjectRegionTargetPoolName.of("[PROJECT]", "[REGION]", "[TARGET_POOL]");
   TargetPoolsAddHealthCheckRequest targetPoolsAddHealthCheckRequestResource = TargetPoolsAddHealthCheckRequest.newBuilder().build();
   Operation response = targetPoolClient.addHealthCheckTargetPool(targetPool, targetPoolsAddHealthCheckRequestResource);
 }
 
 
==================== TargetSslProxyClient ====================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for TargetSslProxyClient:

 
 try (TargetSslProxyClient targetSslProxyClient = TargetSslProxyClient.create()) {
   ProjectGlobalTargetSslProxyName targetSslProxy = ProjectGlobalTargetSslProxyName.of("[PROJECT]", "[TARGET_SSL_PROXY]");
   Operation response = targetSslProxyClient.deleteTargetSslProxy(targetSslProxy);
 }
 
 
==================== TargetTcpProxyClient ====================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for TargetTcpProxyClient:

 
 try (TargetTcpProxyClient targetTcpProxyClient = TargetTcpProxyClient.create()) {
   ProjectGlobalTargetTcpProxyName targetTcpProxy = ProjectGlobalTargetTcpProxyName.of("[PROJECT]", "[TARGET_TCP_PROXY]");
   Operation response = targetTcpProxyClient.deleteTargetTcpProxy(targetTcpProxy);
 }
 
 
====================== TargetVpnGatewayClient ======================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for TargetVpnGatewayClient:

 
 try (TargetVpnGatewayClient targetVpnGatewayClient = TargetVpnGatewayClient.create()) {
   ProjectRegionTargetVpnGatewayName targetVpnGateway = ProjectRegionTargetVpnGatewayName.of("[PROJECT]", "[REGION]", "[TARGET_VPN_GATEWAY]");
   Operation response = targetVpnGatewayClient.deleteTargetVpnGateway(targetVpnGateway);
 }
 
 
============ UrlMapClient ============

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for UrlMapClient:

 
 try (UrlMapClient urlMapClient = UrlMapClient.create()) {
   ProjectGlobalUrlMapName urlMap = ProjectGlobalUrlMapName.of("[PROJECT]", "[URL_MAP]");
   Operation response = urlMapClient.deleteUrlMap(urlMap);
 }
 
 
=============== VpnTunnelClient ===============

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for VpnTunnelClient:

 
 try (VpnTunnelClient vpnTunnelClient = VpnTunnelClient.create()) {
   ProjectRegionVpnTunnelName vpnTunnel = ProjectRegionVpnTunnelName.of("[PROJECT]", "[REGION]", "[VPN_TUNNEL]");
   Operation response = vpnTunnelClient.deleteVpnTunnel(vpnTunnel);
 }
 
 
=================== ZoneOperationClient ===================

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for ZoneOperationClient:

 
 try (ZoneOperationClient zoneOperationClient = ZoneOperationClient.create()) {
   ProjectZoneOperationName operation = ProjectZoneOperationName.of("[PROJECT]", "[ZONE]", "[OPERATION]");
   zoneOperationClient.deleteZoneOperation(operation);
 }
 
 
========== ZoneClient ==========

Service Description: Creates and runs virtual machines on Google Cloud Platform.

Sample for ZoneClient:

 
 try (ZoneClient zoneClient = ZoneClient.create()) {
   ProjectZoneName zone = ProjectZoneName.of("[PROJECT]", "[ZONE]");
   Zone response = zoneClient.getZone(zone);
 }
 
 
Skip navigation links

Copyright © 2019 Google LLC. All rights reserved.