public JSONObject getPrimaryIdentifier()

in python/rpdk/java/templates/init/guided_aws/ResourceModel.java [47:64]


    public JSONObject getPrimaryIdentifier() {
        final JSONObject identifier = new JSONObject();
        {% for identifier in primaryIdentifier %}
        {% set components = identifier.split("/") %}
        if (this.get{{components[2]|uppercase_first_letter}}() != null
            {%- for i in range(4, components|length + 1) -%}
                {#- #} && this
                {%- for component in components[2:i] -%} .get{{component|uppercase_first_letter}}() {%- endfor -%}
                {#- #} != null
            {%- endfor -%}
        ) {
            identifier.put(IDENTIFIER_KEY_{{ components[2:]|join('_')|upper }}, this{% for component in components[2:] %}.get{{component|uppercase_first_letter}}(){% endfor %});
        }

        {% endfor %}
        // only return the identifier if it can be used, i.e. if all components are present
        return identifier.length() == {{ primaryIdentifier|length }} ? identifier : null;
    }