import { Attribute, Property, Resource, ResourceProperties, SpecDatabase, TagInformation, TypeDefinition } from '@aws-cdk/service-spec-types'; import { jsonschema } from './types'; /** * Options for the resourceBuilder API */ export interface ResourceBuilderOptions { description?: string; region?: string; primaryIdentifier?: string[]; } /** * Adds resources and types to a spec database */ export declare class SpecBuilder { readonly db: SpecDatabase; constructor(db: SpecDatabase); resourceBuilder(typeName: string, options?: ResourceBuilderOptions): ResourceBuilder; private allocateService; private allocateRegion; } interface ObjectWithProperties { properties: ResourceProperties; } export declare class PropertyBagBuilder { private readonly _propertyBag; protected candidateProperties: ResourceProperties; constructor(_propertyBag: ObjectWithProperties); setProperty(name: string, prop: Property): void; /** * Delete a property from the builder * * This avoids committing it to the underlying property bag -- if the underlying * bag already has the property, it will not be removed. */ unsetProperty(name: string): void; /** * Commit the property and attribute changes to the underlying property bag. */ commit(): ObjectWithProperties; private commitProperty; protected mergeProperty(prop: Property, updates: Property): void; /** * Remove settings that are equal to their defaults */ protected simplifyProperty(prop: Property): void; } export declare class ResourceBuilder extends PropertyBagBuilder { readonly db: SpecDatabase; private readonly resource; private typeDefinitions; private typesCreatedHere; /** * Keep a copy of all properties configured here * * We'll need some of them later to turn them into attributes. */ private allProperties; private candidateAttributes; constructor(db: SpecDatabase, resource: Resource); get cloudFormationType(): string; setProperty(name: string, prop: Property): void; setAttribute(name: string, attr: Attribute): void; unsetAttribute(name: string): void; /** * Mark the given properties as attributes instead * * These can be simple property names (`Foo`, `Bar`), but they can also be * compound property names (`Foo/Bar`), and the compound property names can * contain array wildcards (`Foo/*­/Bar`). * * In the CloudFormation resource spec, compound property names are separated * by periods (`Foo.Bar`). * * In upconverted CloudFormation resource specs -> registry specs, the compound * property name references may contain a period, while the actual property name * in the properties bag has the periods stripped: attributeName is `Foo.Bar`, * but the actual property name is `FooBar`. * * The same deep property name may occur multiple times (`Foo`, `Foo/Bar`, `Foo/Baz`). */ markAsAttributes(props: string[]): void; /** * Mark the given properties as immutable * * This be a top-level property reference, or a deep property reference, like `Foo` or * `Foo/Bar`. */ markAsImmutable(props: string[]): void; markDeprecatedProperties(...props: string[]): void; setTagInformation(tagInfo: TagInformation): void; propertyDeep(...fieldPath: string[]): Property | undefined; typeDefinitionBuilder(typeName: string, options?: { description?: string; schema?: jsonschema.RecordLikeObject; }): { typeDefinitionBuilder: TypeDefinitionBuilder; freshInDb: boolean; freshInSession: boolean; }; /** * Commit the property and attribute changes to the resource. */ commit(): Resource; private commitAttribute; /** * Index the existing type definitions currently in the DB */ private indexExistingTypeDefinitions; } export type TypeDefinitionFields = Pick; export declare class TypeDefinitionBuilder extends PropertyBagBuilder { readonly db: SpecDatabase; private readonly typeDef; private readonly fields; constructor(db: SpecDatabase, typeDef: TypeDefinition); setFields(fields: TypeDefinitionFields): void; commit(): TypeDefinition; } export {};