Codota Logo
IdReference.extractName
Code IndexAdd Codota to your IDE (free)

How to use
extractName
method
in
org.jclouds.azurecompute.arm.domain.IdReference

Best Java code snippets using org.jclouds.azurecompute.arm.domain.IdReference.extractName (Showing top 20 results out of 315)

  • Add the Codota plugin to your IDE and get smart completions
private void myMethod () {
List l =
  • Codota Iconnew LinkedList()
  • Codota IconCollections.emptyList()
  • Codota Iconnew ArrayList()
  • Smart code suggestions by Codota
}
origin: org.apache.jclouds.labs/azurecompute-arm

@Nullable
public String name() {
 return extractName(id());
}
origin: apache/jclouds

@Nullable
public String name() {
 return extractName(id());
}
origin: apache/jclouds

  @Test
  public void testExtractName() {
   assertEquals(extractName(null), null);
   assertEquals(extractName(""), "");
   assertEquals(extractName("foo"), "foo");
   assertEquals(extractName("/foo/bar"), "bar");
   assertEquals(extractName("/foo/bar/"), "bar");
   assertEquals(extractName("/foo/bar////"), "bar");
   assertEquals(extractName("/foo///bar////"), "bar");
   assertEquals(extractName("////bar"), "bar");
  }
}
origin: org.apache.jclouds.labs/azurecompute-arm

private NetworkInterfaceCard getNetworkInterfaceCard(NetworkInterface nic) {
 return api.getNetworkInterfaceCardApi(extractResourceGroup(nic.id())).get(extractName(nic.id()));
}
origin: apache/jclouds

private NetworkInterfaceCard getNetworkInterfaceCard(NetworkInterface nic) {
 return api.getNetworkInterfaceCardApi(extractResourceGroup(nic.id())).get(extractName(nic.id()));
}
origin: org.apache.jclouds.labs/azurecompute-arm

String subnetName = extractName(ipConfig.subnet());
     extractName(ipConfig.publicIpId()));
  checkState(publicIp != null, "Configured public ip %s does not exist", ipConfig.publicIpId());               
origin: apache/jclouds

String subnetName = extractName(ipConfig.subnet());
Subnet subnet = api.getSubnetApi(resourceGroup, networkName).get(subnetName);
checkState(subnet != null, "Configured subnet %s does not exist", ipConfig.subnet());
     extractName(ipConfig.publicIpId()));
  checkState(publicIp != null, "Configured public ip %s does not exist", ipConfig.publicIpId());               
origin: org.apache.jclouds.labs/azurecompute-arm

private void configurePublicIP(IpOptions ipConfig, IpConfigurationProperties.Builder ipProperties,
   String resourceGroup, String location, String nodeName) {
 if (ipConfig.publicIpId() != null) {
   logger.debug(">> configuring public ip: %s",  extractName(ipConfig.publicIpId()));
   PublicIPAddress publicIp = api.getPublicIPAddressApi(extractResourceGroup(ipConfig.publicIpId())).get(
      extractName(ipConfig.publicIpId()));
   ipProperties.publicIPAddress(IdReference.create(publicIp.id()));
 } else if (ipConfig.allocateNewPublicIp()) {
   PublicIPAddress publicIp = createPublicIp(resourceGroup, location, nodeName);
   ipProperties.publicIPAddress(IdReference.create(publicIp.id()));
 }
}
origin: apache/jclouds

private void configurePublicIP(IpOptions ipConfig, IpConfigurationProperties.Builder ipProperties,
   String resourceGroup, String location, String nodeName) {
 if (ipConfig.publicIpId() != null) {
   logger.debug(">> configuring public ip: %s",  extractName(ipConfig.publicIpId()));
   PublicIPAddress publicIp = api.getPublicIPAddressApi(extractResourceGroup(ipConfig.publicIpId())).get(
      extractName(ipConfig.publicIpId()));
   ipProperties.publicIPAddress(IdReference.create(publicIp.id()));
 } else if (ipConfig.allocateNewPublicIp()) {
   PublicIPAddress publicIp = createPublicIp(resourceGroup, location, nodeName);
   ipProperties.publicIPAddress(IdReference.create(publicIp.id()));
 }
}
origin: org.apache.jclouds.labs/azurecompute-arm

@Override
public Set<SecurityGroup> listSecurityGroupsForNode(String nodeId) {
 logger.debug(">> getting security groups for node %s...", nodeId);
 final ResourceGroupAndName resourceGroupAndName = ResourceGroupAndName.fromSlashEncoded(nodeId);
 VirtualMachine vm = api.getVirtualMachineApi(resourceGroupAndName.resourceGroup()).get(
    resourceGroupAndName.name());
 if (vm == null) {
   throw new IllegalArgumentException("Node " + nodeId + " was not found");
 }
 List<NetworkInterface> networkInterfaces = vm.properties().networkProfile().networkInterfaces();
 List<NetworkSecurityGroup> networkGroups = new ArrayList<NetworkSecurityGroup>();
 for (NetworkInterface networkInterfaceCardIdReference : networkInterfaces) {
   String nicName = extractName(networkInterfaceCardIdReference.id());
   String nicResourceGroup = extractResourceGroup(networkInterfaceCardIdReference.id());
   NetworkInterfaceCard card = api.getNetworkInterfaceCardApi(nicResourceGroup).get(nicName);
   if (card != null && card.properties().networkSecurityGroup() != null) {
    String secGroupName = card.properties().networkSecurityGroup().name();
    String sgResourceGroup = card.properties().networkSecurityGroup().resourceGroup();
    NetworkSecurityGroup group = api.getNetworkSecurityGroupApi(sgResourceGroup).get(secGroupName);
    networkGroups.add(group);
   }
 }
 return ImmutableSet.copyOf(transform(filter(networkGroups, notNull()), securityGroupConverter));
}
origin: apache/jclouds

@Override
public Set<SecurityGroup> listSecurityGroupsForNode(String nodeId) {
 logger.debug(">> getting security groups for node %s...", nodeId);
 final ResourceGroupAndName resourceGroupAndName = ResourceGroupAndName.fromSlashEncoded(nodeId);
 VirtualMachine vm = api.getVirtualMachineApi(resourceGroupAndName.resourceGroup()).get(
    resourceGroupAndName.name());
 if (vm == null) {
   throw new IllegalArgumentException("Node " + nodeId + " was not found");
 }
 List<NetworkInterface> networkInterfaces = vm.properties().networkProfile().networkInterfaces();
 List<NetworkSecurityGroup> networkGroups = new ArrayList<NetworkSecurityGroup>();
 for (NetworkInterface networkInterfaceCardIdReference : networkInterfaces) {
   String nicName = extractName(networkInterfaceCardIdReference.id());
   String nicResourceGroup = extractResourceGroup(networkInterfaceCardIdReference.id());
   NetworkInterfaceCard card = api.getNetworkInterfaceCardApi(nicResourceGroup).get(nicName);
   if (card != null && card.properties().networkSecurityGroup() != null) {
    String secGroupName = card.properties().networkSecurityGroup().name();
    String sgResourceGroup = card.properties().networkSecurityGroup().resourceGroup();
    NetworkSecurityGroup group = api.getNetworkSecurityGroupApi(sgResourceGroup).get(secGroupName);
    networkGroups.add(group);
   }
 }
 return ImmutableSet.copyOf(transform(filter(networkGroups, notNull()), securityGroupConverter));
}
origin: apache/jclouds

  public String encodeFieldsToUniqueIdCustom(String location) {
   return VMImage.customImage().resourceGroup(extractResourceGroup(customImageId())).location(location)
      .name(extractName(customImageId())).build().encodeFieldsToUniqueIdCustom();
  }
}
origin: org.apache.jclouds.labs/azurecompute-arm

  public String encodeFieldsToUniqueIdCustom(String location) {
   return VMImage.customImage().resourceGroup(extractResourceGroup(customImageId())).location(location)
      .name(extractName(customImageId())).build().encodeFieldsToUniqueIdCustom();
  }
}
origin: apache/jclouds

@Override
@BeforeClass
public void setupContext() {
 super.setupContext();
 dateFormat = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
 startTime = dateFormat.format(new Date());
 NodeMetadata node = null;
 try {
   node = getOnlyElement(view.getComputeService().createNodesInGroup(group, 1, resourceGroup(group)));
 } catch (RunNodesException e) {
   fail();
 }
 String resourceId = String.format("/resourceGroups/%s/providers/Microsoft.Compute/virtualMachines/%s",
    IdReference.extractResourceGroup(node.getProviderId()), IdReference.extractName(node.getProviderId()));
 location = view.getComputeService().templateBuilder().build().getLocation().getId();
 view.unwrapApi(AzureComputeApi.class).getResourceGroupApi().create(group, location, null);
 metricsApi = api.getMetricsApi(resourceId);
}
origin: org.apache.jclouds.labs/azurecompute-arm

public boolean cleanupVirtualMachineNICs(VirtualMachine virtualMachine) {
 boolean deleted = true;
 for (NetworkInterface nicRef : virtualMachine.properties().networkProfile().networkInterfaces()) {
   String nicResourceGroup = extractResourceGroup(nicRef.id());
   String nicName = extractName(nicRef.id());
   NetworkInterfaceCard nic = api.getNetworkInterfaceCardApi(nicResourceGroup).get(nicName);
   Iterable<IdReference> publicIps = getPublicIps(nic);
   logger.debug(">> destroying nic %s...", nicName);
   URI nicDeletionURI = api.getNetworkInterfaceCardApi(nicResourceGroup).delete(nicName);
   deleted &= nicDeletionURI == null || resourceDeleted.apply(nicDeletionURI);
   for (IdReference publicIp : publicIps) {
    String publicIpResourceGroup = publicIp.resourceGroup();
    String publicIpName = publicIp.name();
    PublicIPAddress ip = api.getPublicIPAddressApi(publicIpResourceGroup).get(publicIpName);
    if (ip.tags() != null && Boolean.parseBoolean(ip.tags().get(AUTOGENERATED_IP_KEY))) {
      logger.debug(">> deleting public ip %s...", publicIpName);
      deleted &= api.getPublicIPAddressApi(publicIpResourceGroup).delete(publicIpName);
    }
   }
 }
 return deleted;
}
origin: apache/jclouds

public boolean cleanupVirtualMachineNICs(VirtualMachine virtualMachine) {
 boolean deleted = true;
 for (NetworkInterface nicRef : virtualMachine.properties().networkProfile().networkInterfaces()) {
   String nicResourceGroup = extractResourceGroup(nicRef.id());
   String nicName = extractName(nicRef.id());
   NetworkInterfaceCard nic = api.getNetworkInterfaceCardApi(nicResourceGroup).get(nicName);
   Iterable<IdReference> publicIps = getPublicIps(nic);
   logger.debug(">> destroying nic %s...", nicName);
   URI nicDeletionURI = api.getNetworkInterfaceCardApi(nicResourceGroup).delete(nicName);
   deleted &= nicDeletionURI == null || resourceDeleted.apply(nicDeletionURI);
   for (IdReference publicIp : publicIps) {
    String publicIpResourceGroup = publicIp.resourceGroup();
    String publicIpName = publicIp.name();
    PublicIPAddress ip = api.getPublicIPAddressApi(publicIpResourceGroup).get(publicIpName);
    if (ip.tags() != null && Boolean.parseBoolean(ip.tags().get(AUTOGENERATED_IP_KEY))) {
      logger.debug(">> deleting public ip %s...", publicIpName);
      deleted &= api.getPublicIPAddressApi(publicIpResourceGroup).delete(publicIpName);
    }
   }
 }
 return deleted;
}
origin: org.apache.jclouds.labs/azurecompute-arm

private NetworkInterfaceCard createNetworkInterfaceCard(IpOptions ipConfig, String nodeName, String location,
   String securityGroup) {
 String resourceGroup = extractResourceGroup(ipConfig.subnet());
 String subnetName = extractName(ipConfig.subnet());
origin: apache/jclouds

private NetworkInterfaceCard createNetworkInterfaceCard(IpOptions ipConfig, String nodeName, String location,
   String securityGroup) {
 String resourceGroup = extractResourceGroup(ipConfig.subnet());
 String subnetName = extractName(ipConfig.subnet());
origin: apache/jclouds

@Override
@BeforeClass
public void setupContext() {
 super.setupContext();
 NodeMetadata node = null;
 try {
   node = getOnlyElement(view.getComputeService().createNodesInGroup(group, 1, resourceGroup(group)));
 } catch (RunNodesException e) {
   fail();
 }
 String resourceId = String.format("/resourceGroups/%s/providers/Microsoft.Compute/virtualMachines/%s",
    IdReference.extractResourceGroup(node.getProviderId()), IdReference.extractName(node.getProviderId()));
 location = view.getComputeService().templateBuilder().build().getLocation().getId();
 view.unwrapApi(AzureComputeApi.class).getResourceGroupApi().create(group, location, null);
 metricDefinitionsApi = api.getMetricsDefinitionsApi(resourceId);
}
origin: apache/jclouds

private List<String> createVirtualMachinesInGroupAndGetNicRefs(final String group, final int count)
   throws RunNodesException {
 // To add multiple nodes in a LB they must belong to the same availability
 // set
 AvailabilitySetProperties props = AvailabilitySetProperties.builder().platformUpdateDomainCount(count)
    .platformFaultDomainCount(count).build();
 AvailabilitySet as = AvailabilitySet.managed().name(group).properties(props).build();
 Set<? extends NodeMetadata> nodes = view.getComputeService().createNodesInGroup(group, count,
    availabilitySet(as).resourceGroup(this.group));
 List<String> nicNames = new ArrayList<String>();
 for (NodeMetadata node : nodes) {
   ResourceGroupAndName resourceGroupAndName = ResourceGroupAndName.fromSlashEncoded(node.getId());
   VirtualMachine vm = api.getVirtualMachineApi(resourceGroupAndName.resourceGroup()).get(
      resourceGroupAndName.name());
   String nicName = extractName(vm.properties().networkProfile().networkInterfaces().get(0).id());
   nicNames.add(nicName);
 }
 return nicNames;
}
org.jclouds.azurecompute.arm.domainIdReferenceextractName

Javadoc

Extracts the name from the given URI.

Popular methods of IdReference

  • create
  • extractResourceGroup
    Extracts the resource group name from the given URI.
  • id
  • name
  • resourceGroup

Popular in Java

  • Start an intent from android
  • getResourceAsStream (ClassLoader)
  • runOnUiThread (Activity)
  • onCreateOptionsMenu (Activity)
  • UnknownHostException (java.net)
    Thrown when a hostname can not be resolved.
  • SimpleDateFormat (java.text)
    Formats and parses dates in a locale-sensitive manner. Formatting turns a Date into a String, and pa
  • Collection (java.util)
    Collection is the root of the collection hierarchy. It defines operations on data collections and t
  • Executor (java.util.concurrent)
    An object that executes submitted Runnable tasks. This interface provides a way of decoupling task s
  • Handler (java.util.logging)
    A Handler object accepts a logging request and exports the desired messages to a target, for example
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement.A servlet is a small Java program that runs within
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now