UNPKG

armpit

Version:

Another resource manager programming interface toolkit.

37 lines 1.1 kB
import { validate as uuidValidate } from 'uuid'; export function isSubscriptionId(value) { return uuidValidate(value); } export function isSubscriptionIdOrName(value) { return typeof value === "string" && value.length > 0; } export function isTenantId(value) { return uuidValidate(value); } export function isNamedLocationDescriptor(resource) { return resource != null && typeof resource.name === "string" && typeof resource.location === "string"; } // type VirtualMachineCreateResult = { // fqdns: string, // id: string, // location: string, // macAddress: string, // powerState: string, // privateIpAddress: string, // publicIpAddress: string, // resourceGroup: string, // zones: string // }; export function extractSubscriptionId(resourceId) { if (!resourceId) { return null; } const match = resourceId.match(/\/subscriptions\/([^/]+)\//i); return (match && match[1]) ?? null; } export function isScope(value) { return typeof value === "string" && /^[0-9a-zA-Z-_.:/]+$/.test(value); } //# sourceMappingURL=azUtils.js.map