Skip to content

Commit

Permalink
Merge pull request #225 from Yashsharma1911/yash/updatePermissionSpre…
Browse files Browse the repository at this point in the history
…adSheet

Add workflow and keys spreadsheet
  • Loading branch information
Yashsharma1911 authored Mar 7, 2024
2 parents 452e18a + f73025f commit 0589de6
Show file tree
Hide file tree
Showing 8 changed files with 209 additions and 93 deletions.
40 changes: 40 additions & 0 deletions .github/workflows/generate-keys.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Import Keys
on:
workflow_dispatch:
inputs:
spreadsheet_uri:
description: Link of the spreadsheet containing keys.
type: string
default: https://docs.google.com/spreadsheets/d/e/2PACX-1vQwzrUSKfuSRcpkp7sJTw1cSB63s4HCjYLJeGPWECsvqn222hjaaONQlN4X8auKvlaB0es3BqV5rQyz/pub?gid=64355745&single=true&output=csv
jobs:
fetch-keys:
name: Fetch Keys
if: github.repository == 'layer5io/docs'
runs-on: ubuntu-22.04
steps:
- name: Check out code
uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
fetch-depth: 1
- name: Set spreadsheet_uri as environment variable
run: echo "spreadsheet_uri=" >> $GITHUB_ENV
if: inputs.spreadshet_uri != ''
echo "spreadsheet_uri=${{ inputs.spreadsheet_uri }}" >> $GITHUB_ENV

- name: Dump keys from the spreadsheet
run: |
curl -L "${{ inputs.spreadsheet_uri }}" -o "./keys.csv";
- name: Create permissions folder
run: |
[ ! -d "./static/data/csv" ] && mkdir -p "./static/data/csv";
mv keys.csv static/data/csv/keys.csv;
- name: Commit changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: Added permissions keys.
branch: master
commit_options: '--signoff'
commit_user_name: l5io
commit_user_email: [email protected]
commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>author of the commit that triggered the run
28 changes: 1 addition & 27 deletions content/en/cloud/reference/_index.md
Original file line number Diff line number Diff line change
@@ -1,33 +1,7 @@
---
title: Reference
description: Low-level ReST API reference for extending Layer5 Cloud.
description: References for using Layer5 Cloud’s various features and components.
weight: 20
categories: [Reference]
tags: [extensibility]
---
To create integrations, retrieve data, and automate your cloud native infrastructure, build with the Layer5 Cloud REST API.

## Authenticating with the API

In order to authenticate to Layer5 Cloud's REST API, you need to generate and use a [security token](../security/tokens). Visit your [user account's security tokens](https://meshery.layer5.io/security/tokens) and generate a long-lived security token. Security tokens are without expiration date. You can generate as many tokens as you like. You can also revoke them at any time.

To authenticate with the API, pass the token as a bearer token in the `Authorization` header. For example, in cURL:

```bash
curl <protocol>://<Layer5-cloud-hostname>/<API> \
-H "Authorization: Bearer <token>"
```

- Replace `<protocol>` with `http` or `https` depending on your Layer5 Cloud instance.
- Replace `<Layer5-cloud-hostname>` with the hostname or IP address of your hosted Layer5 Cloud instance. For example, [`https://cloud.layer5.io`](https://cloud.layer5.io).
- Replace `<API>` with the API endpoint you want to access. For example, `/api/identity/users/profile`.
- Replace `<token>` with the security token you generated.

## All API Endpoints

{{< alert type="info" >}}
<a href="https://meshery.layer5.io/system/api/docs">Open API Endpoints in new window <i class="fa fa-external-link" aria-hidden="true"></i></a>
{{< /alert >}}



32 changes: 32 additions & 0 deletions content/en/cloud/reference/api-reference.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
---
title: API Endpoints
description: >
Low-level ReST API reference for extending Layer5 Cloud.
weight: 1
categories: [Reference]
tags: [extensibility]
---

To create integrations, retrieve data, and automate your cloud native infrastructure, build with the Layer5 Cloud REST API.

## Authenticating with the API

In order to authenticate to Layer5 Cloud's REST API, you need to generate and use a [security token](../security/tokens). Visit your [user account's security tokens](https://meshery.layer5.io/security/tokens) and generate a long-lived security token. Security tokens are without expiration date. You can generate as many tokens as you like. You can also revoke them at any time.

To authenticate with the API, pass the token as a bearer token in the `Authorization` header. For example, in cURL:

```bash
curl <protocol>://<Layer5-cloud-hostname>/<API> \
-H "Authorization: Bearer <token>"
```

- Replace `<protocol>` with `http` or `https` depending on your Layer5 Cloud instance.
- Replace `<Layer5-cloud-hostname>` with the hostname or IP address of your hosted Layer5 Cloud instance. For example, [`https://cloud.layer5.io`](https://cloud.layer5.io).
- Replace `<API>` with the API endpoint you want to access. For example, `/api/identity/users/profile`.
- Replace `<token>` with the security token you generated.

## All API Endpoints

{{< alert type="info" >}}
<a href="https://meshery.layer5.io/system/api/docs">Open API Endpoints in new window <i class="fa fa-external-link" aria-hidden="true"></i></a>
{{< /alert >}}
13 changes: 13 additions & 0 deletions content/en/cloud/reference/default-permissions.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
---
title: Default Permissions
description: >
List of default permissions granted to the Organizations, Teams and Users roles.
weight: 2
categories: [Identity]
tags: [perms]
---


{{< alert title="Customizable Permissions" type="info" >}}Default permissions can be easily customized by simply creating your own [keychains](/cloud/security/keychains/#keychains-management) and [roles](/cloud/security/roles).{{< /alert >}}

{{< csvtable >}}
40 changes: 0 additions & 40 deletions content/en/cloud/reference/organization-permissions.md

This file was deleted.

26 changes: 0 additions & 26 deletions content/en/cloud/reference/team-permissions.md

This file was deleted.

73 changes: 73 additions & 0 deletions layouts/shortcodes/csvtable.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
{{ $data := "" }}

{{ $p := "static/data/csv/keys.csv" }}
{{ $excludedColumns := slice 0 9 10 11 12 13 14 15 16 }}

{{ if os.FileExists $p }}
{{ $opts := dict "delimiter" "," }}
{{ $data = (os.ReadFile $p | transform.Unmarshal $opts) }}
{{ else }}
{{ errorf "Unable to get resource %q" $p }}
{{ end }}


{{ if $data }}
{{ $uniqueCategories := slice }}

{{ range $i, $row := $data }}
{{ if gt $i 0 }}
{{ $category := trim (index $row 0) " " }}
{{ if not (in $uniqueCategories $category) }}
{{ $uniqueCategories = $uniqueCategories | append $category }}
{{ end }}
{{ end }}
{{ end }}

{{ range $index, $category := $uniqueCategories }}
<h2>{{ $category }} Permissions</h2>
<table class="csvtable">
<thead>
<tr>
{{ range $i, $col := index $data 0 }}
{{ if and (not (in $excludedColumns $i)) (or (eq $i 0) (ne $i 1) (ne $i 2)) }}
{{ if and (eq $i 1) }}
<th>Permission</th>
{{ else }}
{{ if and (eq $i 2) }}
<th>Description</th>
{{ else }}
<th>{{ $col }}</th>
{{ end }}{{ end }}
{{ end }}
{{ end }}
</tr>
</thead>
<tbody>
{{ range $i, $row := $data }}
{{ if and (gt $i 0) (eq (trim (index $row 0) " ") $category) }}
<tr>
{{ range $j, $cell := $row }}
{{ if and (not (in $excludedColumns $j)) (or (gt $j 2) (lt $j 8)) }}
<td>
{{ if and (gt $j 2) (lt $j 8) }}
{{ if eq $cell "X" }}
{{ else }}
{{ end }}
{{ else }}
{{ $cell }}
{{ end }}
</td>
{{ end }}
{{ end }}
</tr>
{{ end }}
{{ end }}
</tbody>
</table>
{{ end }}

{{ else }}
<p>No data available.</p>
{{ end }}
Loading

0 comments on commit 0589de6

Please sign in to comment.