ResourceUtils Class
- java.
lang. Object - com.
microsoft. azure. management. resources. fluentcore. arm. ResourceUtils
- com.
public class ResourceUtils
Utility methods for Azure resource IDs.
Method Summary
Modifier and Type | Method and Description |
---|---|
String |
constructResourceId(final String subscriptionId, final String resourceGroupName, final String resourceProviderNamespace, final String resourceType, final String resourceName, final String parentResourcePath)
Creates a resource ID from information of a generic resource. |
String |
defaultApiVersion(String id, Provider provider)
Find out the default api version to make a REST request with from the resource provider. |
String |
extractFromResourceId(String id, String identifier)
Extract information from a resource ID string with the resource type as the identifier. |
String |
groupFromResourceId(String id)
Extract resource group from a resource ID string. |
String |
nameFromResourceId(String id)
Extract name of the resource from a resource ID. |
String |
parentRelativePathFromResourceId(String id)
Extract parent resource path from a resource ID string. E.g. subscriptions/s/resourcegroups/r/foos/foo/bars/bar will return foos/foo. |
String |
parentResourceIdFromResourceId(String id)
Extract parent resource ID from a resource ID string. E.g. subscriptions/s/resourcegroups/r/foos/foo/bars/bar will return subscriptions/s/resourcegroups/r/foos/foo. |
String |
relativePathFromResourceId(String id)
Extract the relative path to the current resource provider. E.g. subscriptions/sub1/resourceGroups/rg1/providers/Microsoft.Foo/foos/foo1 will return foos/foo1. |
String |
resourceProviderFromResourceId(String id)
Extract resource provider from a resource ID string. |
String |
resourceTypeFromResourceId(String id)
Extract resource type from a resource ID string. |
String |
subscriptionFromResourceId(String id)
Extract the subscription ID from a resource ID string. |
Method Details
constructResourceId
public static String constructResourceId(final String subscriptionId, final String resourceGroupName, final String resourceProviderNamespace, final String resourceType, final String resourceName, final String parentResourcePath)
Creates a resource ID from information of a generic resource.
Parameters:
Returns:
defaultApiVersion
public static String defaultApiVersion(String id, Provider provider)
Find out the default api version to make a REST request with from the resource provider.
Parameters:
Returns:
extractFromResourceId
public static String extractFromResourceId(String id, String identifier)
Extract information from a resource ID string with the resource type as the identifier.
Parameters:
Returns:
groupFromResourceId
public static String groupFromResourceId(String id)
Extract resource group from a resource ID string.
Parameters:
Returns:
nameFromResourceId
public static String nameFromResourceId(String id)
Extract name of the resource from a resource ID.
Parameters:
Returns:
parentRelativePathFromResourceId
public static String parentRelativePathFromResourceId(String id)
Extract parent resource path from a resource ID string. E.g. subscriptions/s/resourcegroups/r/foos/foo/bars/bar will return foos/foo.
Parameters:
Returns:
parentResourceIdFromResourceId
public static String parentResourceIdFromResourceId(String id)
Extract parent resource ID from a resource ID string. E.g. subscriptions/s/resourcegroups/r/foos/foo/bars/bar will return subscriptions/s/resourcegroups/r/foos/foo.
Parameters:
Returns:
relativePathFromResourceId
public static String relativePathFromResourceId(String id)
Extract the relative path to the current resource provider. E.g. subscriptions/sub1/resourceGroups/rg1/providers/Microsoft.Foo/foos/foo1 will return foos/foo1.
Parameters:
Returns:
resourceProviderFromResourceId
public static String resourceProviderFromResourceId(String id)
Extract resource provider from a resource ID string.
Parameters:
Returns:
resourceTypeFromResourceId
public static String resourceTypeFromResourceId(String id)
Extract resource type from a resource ID string.
Parameters:
Returns:
subscriptionFromResourceId
public static String subscriptionFromResourceId(String id)
Extract the subscription ID from a resource ID string.
Parameters:
Returns: