import { IResource , IResourceRef , TemplateRoot } from '../parser' ; import { Reference , Resource } from './resource' ; import { ServiceControlPolicyResource } from './service-control-policy-resource' ; export interface IOrganizationRootProperties { ServiceControlPolicies : IResourceRef | IResourceRef [ ] ; DefaultOrganizationAccessRoleName ? : string ; DefaultBuildAccessRoleName ? : string ; MirrorInPartition ? : boolean ; } export class OrganizationRootResource extends Resource { public serviceControlPolicies : Reference < ServiceControlPolicyResource > [ ] = [ ] ; private props : IOrganizationRootProperties ; public defaultOrganizationAccessRoleName ? : string ; public defaultBuildAccessRoleName ? : string ; public mirrorInPartition ? : boolean ; constructor ( root , id , resource ) { super ( root , id , resource ) ; this . props = this . resource . Properties as IOrganizationRootProperties ; super . throwForUnknownAttributes ( resource , id , 'Type' , 'Properties' ) ; super . throwForUnknownAttributes ( this . props , id , 'ServiceControlPolicies' , 'DefaultOrganizationAccessRoleName' , 'DefaultBuildAccessRoleName' , 'MirrorInPartition' ) ; if ( this . props ) { this . defaultOrganizationAccessRoleName = this . props . DefaultOrganizationAccessRoleName ; this . defaultBuildAccessRoleName = this . props . DefaultBuildAccessRoleName ; this . mirrorInPartition = this . props . MirrorInPartition ; } } public resolveRefs ( ) { if ( this . props ) { this . serviceControlPolicies = super . resolve ( this . props . ServiceControlPolicies , this . root . organizationSection . serviceControlPolicies ) ; } else { this . serviceControlPolicies = [ ] ; } } }