
    <!-- S3 bucket partial -->
    <script id="services.s3.buckets.partial" type="text/x-handlebars-template">
        <div id="resource-name" class="list-group-item active">
          <h4 class="list-group-item-heading">{{name}}</h4>
        </div>
        <div class="list-group-item">
          <h4 class="list-group-item-heading">Information</h4>
          <div class="list-group-item-text item-margin">ARN: <samp>{{arn}}</samp></div>
          <div class="list-group-item-text item-margin">Region: {{region}}</div>
          <div class="list-group-item-text item-margin">Creation date: {{CreationDate}}</div>
          <div class="list-group-item-text item-margin">Logging: <span id="s3.buckets.{{@key}}.logging">{{has_logging? logging}}</span></div>
          <div class="list-group-item-text item-margin">Default encryption: <span id="s3.buckets.{{@key}}.default_encryption_enabled">{{ convert_bool_to_enabled default_encryption_enabled}}</span></div>
          <div class="list-group-item-text item-margin">Versioning: <span id="s3.buckets.{{@key}}.versioning">{{convert_bool_to_enabled versioning_status_enabled}}</span></div>
          <div class="list-group-item-text item-margin">MFA Delete: <span id="s3.buckets.{{@key}}.mfa_delete">{{convert_bool_to_enabled version_mfa_delete_enabled}}</span></div>
          <div class="list-group-item-text item-margin">Secure transport: <span id="s3.buckets.{{@key}}.secure_transport_enabled">{{convert_bool_to_enabled secure_transport_enabled}}</span></div>
          <div class="list-group-item-text item-margin">Static website hosting: <span id="s3.buckets.{{@key}}.web_hosting_enabled">{{convert_bool_to_enabled web_hosting_enabled}}</span></div>
        </div>
        {{> services.s3.public_access_block_configuration resource_type = 'bucket' resource_path = (concat 's3.buckets' @key)}}
        <div class="list-group-item">
            {{#if policy}}
                {{> accordion_policy name = 'Bucket Policy' document = policy policy_path = (concat 's3.buckets' @key 'policy')}}
            {{else}}
                <h4 class="list-group-item-heading accordion-heading text-secondary">Bucket Policy</h4>
            {{/if}}
        </div>
        {{> services.s3.acls resource_type = 'bucket' resource_path = (concat 's3.buckets' @key)}}
        {{> services.s3.bucket_iam_policies resource_type = 'groups' resource_count = groups_count}}
        {{> services.s3.bucket_iam_policies resource_type = 'roles' resource_count = roles_count}}
        {{> services.s3.bucket_iam_policies resource_type = 'users' resource_count = users_count}}
        {{#if keys}}
          <div class="list-group-item">
            <div class="accordion">
              <h4 class="list-group-item-heading accordion-heading">Keys
                {{> count_badge count=keys_count target=(concat '#services.s3.buckets' @key 'keys')}}
              </h4>
              <div id="services.s3.buckets.{{@key}}.keys" class="accordion-body item-margin">
                <div class="accordion-inner">
                  <table class="table-striped" width="100%" >
                    <tr>
                      <td width="80%">Name</td>
                      <td width="10%" class="text-center">Encrypted</td>
                      <td width="10%" class="text-center">Perms</td>
                    </tr>
                    {{#each keys}}
                    <tr>
                      <td width="80%"><a href="javascript:showS3Object('{{@../key}}', '{{@key}}')">{{name}}</a></td>
                      <td width="10%" class="text-center">
                        <span id="s3.buckets.{{@../key}}.keys.{{@key}}.unencrypted">
                          {{{good_bad_icon 's3-object-unencrypted' @../key @key 'ServerSideEncryption'}}}
                        </span>
                      </td>
                      <td width="10%" class="text-center">
                        <span id="s3.buckets.{{@../key}}.keys.{{@key}}.grantees">
                          {{{good_bad_icon 's3-object-acls-mismatch-bucket' @../key @key 'grantees'}}}
                        </span>
                      </td>
                    </tr>
                    {{/each}}
                  </table>
                </div>
              </div>
            </div>
          </div>
        {{/if}}
    </script>
    <script>
      Handlebars.registerPartial("services.s3.buckets", $("#services\\.s3\\.buckets\\.partial").html());
    </script>

    <!-- Single S3 bucket template -->
    <script id="single_s3_bucket-template" type="text/x-handlebars-template">
        {{> modal-template template='services.s3.buckets' }}
    </script>
    <script>
        var single_s3_bucket_template = Handlebars.compile($("#single_s3_bucket-template").html());
    </script>

