/** * Extract name of the resource from a resource ID. * @param id the resource ID * @return the name of the resource */ public static String nameFromResourceId(String id) { return (id != null) ? ResourceId.fromString(id).name() : null; }
/** * Extract resource provider from a resource ID string. * @param id the resource ID string * @return the resource group name */ public static String resourceProviderFromResourceId(String id) { return (id != null) ? ResourceId.fromString(id).providerNamespace() : null; }
/** * Finds or creates an availability zone identifier based on the specified identifier in string format. * @param id the zone identifier in string format * @return an instance of AvailabilityZone */ public static AvailabilityZoneId fromString(String id) { return fromString(id, AvailabilityZoneId.class); }
/** * Creates WindowsVolumeEncryptionMonitorImpl. * * @param virtualMachineId resource id of Windows virtual machine to retrieve encryption status from * @param computeManager compute manager */ WindowsVolumeEncryptionMonitorImpl(String virtualMachineId, ComputeManager computeManager) { this.rgName = ResourceUtils.groupFromResourceId(virtualMachineId); this.vmName = ResourceUtils.nameFromResourceId(virtualMachineId); this.computeManager = computeManager; }
/** * Extract resource group from a resource ID string. * @param id the resource ID string * @return the resource group name */ public static String groupFromResourceId(String id) { return (id != null) ? ResourceId.fromString(id).resourceGroupName() : null; }
/** * Extract the subscription ID from a resource ID string. * @param id the resource ID string * @return the subscription ID */ public static String subscriptionFromResourceId(String id) { return (id != null) ? ResourceId.fromString(id).subscriptionId() : null; }
/** * Extract resource type from a resource ID string. * @param id the resource ID string * @return the resource type */ public static String resourceTypeFromResourceId(String id) { return (id != null) ? ResourceId.fromString(id).resourceType() : null; }
/** * @return parent resource id of the resource if any, otherwise null. */ public ResourceId parent() { if (this.id == null || this.parentId == null) { return null; } else { return fromString(this.parentId); } }
/** * @return full type of the resource. */ public String fullResourceType() { if (this.parentId == null) { return this.providerNamespace + "/" + this.resourceType; } else { return this.parent().fullResourceType() + "/" + this.resourceType; } }
/** * Creates or finds a CountryIsoCode based on the specified code. * @param code a country ISO code * @return a CountryIsoCode */ public static CountryIsoCode fromString(String code) { return fromString(code, CountryIsoCode.class); } }
/** * Returns parsed ResourceId object for a given resource id. * @param id of the resource * @return ResourceId object */ public static ResourceId fromString(String id) { return new ResourceId(id); }
@Override public String call(Provider provider) { return ResourceUtils.defaultApiVersion(id, provider); } });
/** * Creates or finds a country phone code from its string representation. * @param code a country phone code * @return the corresponding CountryPhoneCode */ public static CountryPhoneCode fromString(String code) { return fromString(code, CountryPhoneCode.class); }
/** * @return known country ISO codes */ public static Collection<CountryIsoCode> values() { return values(CountryIsoCode.class); }
/** * @return known availability zone identifiers */ public static Collection<AvailabilityZoneId> values() { return values(AvailabilityZoneId.class); } }
/** * @return known country phone codes */ public static Collection<CountryPhoneCode> values() { return values(CountryPhoneCode.class); } }
/** * Extract name of the resource from a resource ID. * @param id the resource ID * @return the name of the resource */ public static String nameFromResourceId(String id) { return (id != null) ? ResourceId.fromString(id).name() : null; }
/** * Finds or creates an availability zone identifier based on the specified identifier in string format. * @param id the zone identifier in string format * @return an instance of AvailabilityZone */ public static AvailabilityZoneId fromString(String id) { return fromString(id, AvailabilityZoneId.class); }
@Override public String call(Provider provider) { return ResourceUtils.defaultApiVersion(id, provider); } });
/** * Creates or finds a country phone code from its string representation. * @param code a country phone code * @return the corresponding CountryPhoneCode */ public static CountryPhoneCode fromString(String code) { return fromString(code, CountryPhoneCode.class); }