public ResourceModel buildModel()

in aws-cloudformation-stackset/src/main/java/software/amazon/cloudformation/stackset/util/ResourceModelBuilder.java [44:85]


    public ResourceModel buildModel(final String callAs) {

        final String stackSetId = stackSet.stackSetId();

        // NOTE: TemplateURL from StackSet service client is currently not retrievable
        final ResourceModel model = ResourceModel.builder()
                .stackSetName(stackSet.stackSetName())
                .autoDeployment(translateFromSdkAutoDeployment(stackSet.autoDeployment()))
                .stackSetId(stackSetId)
                .description(stackSet.description())
                .permissionModel(stackSet.permissionModelAsString() == null
                        ? PermissionModels.SELF_MANAGED.toString() : stackSet.permissionModelAsString())
                .capabilities(stackSet.hasCapabilities() ? new HashSet<>(stackSet.capabilitiesAsStrings()) : null)
                .tags(translateFromSdkTags(stackSet.tags()))
                .parameters(translateFromSdkParameters(stackSet.parameters()))
                .templateBody(stackSet.templateBody())
                .callAs(callAs)
                .managedExecution(translateFromSdkManagedExecution(stackSet.managedExecution()))
                .build();

        isSelfManaged = Comparator.isSelfManaged(model);

        if (isSelfManaged) {
            model.setAdministrationRoleARN(stackSet.administrationRoleARN());
            model.setExecutionRoleName(stackSet.executionRoleName());
        }

        String token = null;
        final Set<StackInstance> stackInstanceSet = new HashSet<>();
        // Retrieves all Stack Instances associated with the StackSet,
        // Attaches regions and deploymentTargets to the constructing model
        do {
            token = attachStackInstances(stackSetId, isSelfManaged, stackInstanceSet, callAs, token);
        } while (token != null);

        if (!stackInstanceSet.isEmpty()) {
            final Set<StackInstances> stackInstancesGroup = aggregateStackInstances(stackInstanceSet, isSelfManaged);
            model.setStackInstancesGroup(stackInstancesGroup);
        }

        return model;
    }