import { Documented , PrimitiveType } from './base-types' ; import { isTagProperty , isTagPropertyName , Property , TagProperty } from './property' ; export interface ResourceType extends Documented { /**
     * The attributes exposed by the resource type, if any.
     */ Attributes ? : { [ name ] : Attribute ; } ; /**
     * The properties accepted by the resource type, if any.
     */ Properties ? : { [ name ] : Property ; } ; /**
     * The ``Transform`` required by the resource type, if any.
     */ RequiredTransform ? : string ; /**
     * What kind of value the 'Ref' operator refers to, if any.
     */ RefKind ? : string ; default ScrutinyType ? : ResourceScrutinyType ; } export interface TaggableResource extends ResourceType { Properties : { FileSystemTags : TagProperty ; HostedZoneTags : TagProperty ; Tags : TagProperty ; UserPoolTags : TagProperty ; [ name ] : Property ; } ; } export type Attribute = PrimitiveAttribute | ListAttribute | MapAttribute ; export interface PrimitiveAttribute { PrimitiveType : PrimitiveType ; } export type ListAttribute = PrimitiveListAttribute | ComplexListAttribute ; export interface PrimitiveListAttribute { Type : 'List' ; PrimitiveItemType : PrimitiveType ; } export interface ComplexListAttribute { Type : 'List' ; ItemType : string ; } export type MapAttribute = PrimitiveMapAttribute ; export interface PrimitiveMapAttribute { Type : 'Map' ; PrimitiveItemType : PrimitiveType ; } /**
 * Determine if the resource supports tags
 *
 * This function combined with isTagProperty determines if the `cdk.TagManager`
 * and `cdk.TaggableResource` can process these tags. If not, standard code
 * generation of properties will be used.
 */ export function isTaggableResource ( spec ) { if ( spec . Properties === undefined ) { return false ; } for ( const key of Object . keys ( spec . Properties ) ) { if ( isTagPropertyName ( key ) && isTagProperty ( spec . Properties [ key ] ) ) { return true ; } } return false ; } export function isPrimitiveAttribute ( spec ) { return ! ! ( spec as PrimitiveAttribute ) . PrimitiveType ; } export function isListAttribute ( spec ) { return ( spec as ListAttribute ) . Type === 'List' ; } export function isMapAttribute ( spec ) { return ( spec as MapAttribute ) . Type === 'Map' ; } export function isPrimitiveListAttribute ( spec ) { return isListAttribute ( spec ) && ! ! ( spec as PrimitiveListAttribute ) . PrimitiveItemType ; } export function isComplexListAttribute ( spec ) { return isListAttribute ( spec ) && ! ! ( spec as ComplexListAttribute ) . ItemType ; } export function isPrimitiveMapAttribute ( spec ) { return isMapAttribute ( spec ) && ! ! ( spec as PrimitiveMapAttribute ) . PrimitiveItemType ; } /**
 * Type declaration for special values of the "Ref" attribute represents.
 *
 * The attribute can take on more values than these, but these are treated specially.
 */ export enum SpecialRefKind { /**
     * No '.ref' member is generated for this type, because it doesn't have a meaningful value.
     */ None = 'None' , /**
     * The generated class will inherit from the built-in 'Arn' type.
     */ Arn = 'Arn' } export enum ResourceScrutinyType { /**
     * No additional scrutiny
     */ None = 'None' , /**
     * An externally attached policy document to a resource
     *
     * (Common for SQS, SNS, S3, ...)
     */ ResourcePolicyResource = 'ResourcePolicyResource' , /**
     * This is an IAM policy on an identity resource
     *
     * (Basically saying: this is AWS::IAM::Policy)
     */ IdentityPolicyResource = 'IdentityPolicyResource' , /**
     * This is a Lambda Permission policy
     */ LambdaPermission = 'LambdaPermission' , /**
     * An ingress rule object
     */ IngressRuleResource = 'IngressRuleResource' , /**
     * A set of egress rules
     */ EgressRuleResource = 'EgressRuleResource' } export function isResourceScrutinyType ( str ) { return ( ResourceScrutinyType as any ) [ str ] !== undefined ; }