@Test public void setTags () { GcpComputeInstanceContainer container = GcpComputeInstanceContainer.builder() .withZone("my-datacenter") .withInstanceName("my-instance") .withUniqueIdentifier("1234567890") .build(); List<String> tags = List.of("new-tag"); String oldFingerprint = "old-fingerprint"; Tags oldTags = Tags.newBuilder().setFingerprint(oldFingerprint).build(); ProjectZoneInstanceName instanceName = ProjectZoneInstanceName.of("1234567890", MY_AWESOME_PROJECT, "my-datacenter"); Instance instance = Instance.newBuilder().setTags(oldTags).build(); doReturn(instance).when(instanceClient).getInstance(instanceName); doReturn("my-operation").when(gcpComputePlatform).setTagsSafe(container, tags, oldFingerprint); assertEquals("my-operation", gcpComputePlatform.setTags(container, tags)); }
public String setTags (GcpComputeInstanceContainer container, List<String> tags) { log.info("Setting tags of instance {} to {}", v(DATADOG_CONTAINER_KEY, container), tags); ProjectZoneInstanceName instance = getProjectZoneInstanceNameOfContainer(container, getProjectName()); String oldFingerprint = getInstanceClient().getInstance(instance).getTags().getFingerprint(); return setTagsSafe(container, tags, oldFingerprint); }
GcpComputePlatform extends Platform implements SshBasedExperiment<GcpComputeInstanceContainer> { public String setTags (GcpComputeInstanceContainer container, List<String> tags) { log.info("Setting tags of instance {} to {}", v(DATADOG_CONTAINER_KEY, container), tags); ProjectZoneInstanceName instance = getProjectZoneInstanceNameOfContainer(container, getProjectName()); String oldFingerprint = getInstanceClient().getInstance(instance).getTags().getFingerprint(); return setTagsSafe(container, tags, oldFingerprint); } }
GcpComputePlatform extends Platform implements SshBasedExperiment<GcpComputeInstanceContainer> { public String setTags (GcpComputeInstanceContainer container, List<String> tags) { log.info("Setting tags of instance {} to {}", v(DATADOG_CONTAINER_KEY, container), tags); ProjectZoneInstanceName instance = getProjectZoneInstanceNameOfContainer(container, getProjectName()); String oldFingerprint = getInstanceClient().getInstance(instance).getTags().getFingerprint(); return setTagsSafe(container, tags, oldFingerprint); }  }
GcpComputePlatform extends Platform implements SshBasedExperiment<GcpComputeInstanceContainer> { public String setTags (GcpComputeInstanceContainer container, List<String> tags) { log.info("Setting tags of instance {} to {}", v(DATADOG_CONTAINER_KEY, container), tags); ProjectZoneInstanceName instance = getProjectZoneInstanceNameOfContainer(container, getProjectName()); String oldFingerprint = getInstanceClient().getInstance(instance).getTags().getFingerprint(); return setTagsSafe(container, tags, oldFingerprint); }  void setRoutableCIDRBlocks(Collection<String> routableCIDRBlocks); @Override ApiStatus getApiStatus(); @Override PlatformLevel getPlatformLevel(); @Override PlatformHealth getPlatformHealth(); Collection<Items> getIncludeFilter(); void setIncludeFilter(Map<String, String> includeFilter); Collection<Items> getExcludeFilter(); void setExcludeFilter(Map<String, String> excludeFilter); @Override boolean isContainerRecycled(Container container); String stopInstance(GcpComputeInstanceContainer container); ContainerHealth isContainerRunning(GcpComputeInstanceContainer gcpComputeInstanceContainer); String simulateMaintenance(GcpComputeInstanceContainer container); String setTags(GcpComputeInstanceContainer container, List<String> tags); String setTagsSafe(GcpComputeInstanceContainer container, List<String> newTags, String oldFingerprint); boolean isContainerGroupAtCapacity(GcpComputeInstanceContainer container); boolean checkTags(GcpComputeInstanceContainer container, List<String> expectedTags); void startInstance(GcpComputeInstanceContainer container); String restartContainer(GcpComputeInstanceContainer container); String getBestEndpoint(String privateIPAddress, String publicIPAddress); boolean isAddressRoutable(String privateIPAddress); String getLatestInstanceId(String instanceName, String zone); Fingerprint<List<String>> getFirewallTags(GcpComputeInstanceContainer container); void setProjectId(String projectId); @Override String getEndpoint(GcpComputeInstanceContainer container); @Override SSHCredentials getSshCredentials(GcpComputeInstanceContainer container); @Override String getRunningDirectory(); @Override void recycleContainer(GcpComputeInstanceContainer container); String recreateInstanceInInstanceGroup(GcpComputeInstanceContainer container); boolean isOperationComplete(String operationId); }
GcpComputePlatform extends Platform implements SshBasedExperiment<GcpComputeInstanceContainer> { public String setTags (GcpComputeInstanceContainer container, List<String> tags) { log.info("Setting tags of instance {} to {}", v(DATADOG_CONTAINER_KEY, container), tags); ProjectZoneInstanceName instance = getProjectZoneInstanceNameOfContainer(container, getProjectName()); String oldFingerprint = getInstanceClient().getInstance(instance).getTags().getFingerprint(); return setTagsSafe(container, tags, oldFingerprint); }  void setRoutableCIDRBlocks(Collection<String> routableCIDRBlocks); @Override ApiStatus getApiStatus(); @Override PlatformLevel getPlatformLevel(); @Override PlatformHealth getPlatformHealth(); Collection<Items> getIncludeFilter(); void setIncludeFilter(Map<String, String> includeFilter); Collection<Items> getExcludeFilter(); void setExcludeFilter(Map<String, String> excludeFilter); @Override boolean isContainerRecycled(Container container); String stopInstance(GcpComputeInstanceContainer container); ContainerHealth isContainerRunning(GcpComputeInstanceContainer gcpComputeInstanceContainer); String simulateMaintenance(GcpComputeInstanceContainer container); String setTags(GcpComputeInstanceContainer container, List<String> tags); String setTagsSafe(GcpComputeInstanceContainer container, List<String> newTags, String oldFingerprint); boolean isContainerGroupAtCapacity(GcpComputeInstanceContainer container); boolean checkTags(GcpComputeInstanceContainer container, List<String> expectedTags); void startInstance(GcpComputeInstanceContainer container); String restartContainer(GcpComputeInstanceContainer container); String getBestEndpoint(String privateIPAddress, String publicIPAddress); boolean isAddressRoutable(String privateIPAddress); String getLatestInstanceId(String instanceName, String zone); Fingerprint<List<String>> getFirewallTags(GcpComputeInstanceContainer container); void setProjectId(String projectId); @Override String getEndpoint(GcpComputeInstanceContainer container); @Override SSHCredentials getSshCredentials(GcpComputeInstanceContainer container); @Override String getRunningDirectory(); @Override void recycleContainer(GcpComputeInstanceContainer container); String recreateInstanceInInstanceGroup(GcpComputeInstanceContainer container); boolean isOperationComplete(String operationId);  }