export function isValidTagSpecification()

in packages/aws-rfdk/lib/lambdas/nodejs/configure-spot-event-plugin/conversion.ts [76:87]


export function isValidTagSpecification(tagSpecification: SpotFleetTagSpecification): boolean {
  if (!tagSpecification || typeof(tagSpecification) !== 'object' || Array.isArray(tagSpecification)) { return false; }
  // We also verify resourceType with validateString later
  if (!tagSpecification.ResourceType || typeof(tagSpecification.ResourceType) !== 'string') { return false; }
  if (!tagSpecification.Tags || !Array.isArray(tagSpecification.Tags)) { return false; }
  for (let element of tagSpecification.Tags) {
    if (!element || typeof(element) !== 'object') { return false; };
    if (!element.Key || typeof(element.Key) !== 'string') { return false; }
    if (!element.Value || typeof(element.Value) !== 'string') { return false; }
  }
  return true;
}