Skip to content

Commit aabcb14

Browse files
authored
Merge branch 'main' into data
2 parents 9a84ab3 + 8973419 commit aabcb14

File tree

11 files changed

+1474
-26
lines changed

11 files changed

+1474
-26
lines changed

components/swagger.tsx

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
import dynamic from 'next/dynamic'
2+
import type { SwaggerUIProps } from 'swagger-ui-react'
3+
4+
const SwaggerUI = dynamic(() => import('swagger-ui-react') as Promise<{ default: React.ComponentType<SwaggerUIProps> }>, { ssr: false })
5+
6+
import 'swagger-ui-react/swagger-ui.css'
7+
8+
export function Swagger(props: {}) {
9+
return (<SwaggerUI
10+
url="https://raw.githubusercontent.com/authzed/api/refs/heads/main/docs/apidocs.swagger.json"
11+
deepLinking={true}
12+
supportedSubmitMethods={[]}
13+
tryItOutEnabled={false}
14+
defaultModelsExpandDepth={-1}
15+
defaultModelRendering={'model'}
16+
/>)
17+
}

globals.css

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,3 +23,11 @@ body {
2323
top: 0;
2424
left: 0;
2525
}
26+
27+
.swagger-ui .information-container {
28+
display: none;
29+
}
30+
31+
.swagger-ui .scheme-container {
32+
display: none;
33+
}

package.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@
3737
"react-dom": "^18.3.1",
3838
"react-youtube": "^10.1.0",
3939
"sharp": "^0.34.0",
40+
"swagger-ui-react": "^5.22.0",
4041
"tailwind-merge": "^2.4.0"
4142
},
4243
"devDependencies": {
@@ -54,5 +55,6 @@
5455
"tailwindcss": "^3.4.4",
5556
"typescript": "^4.9.5",
5657
"yaml-loader": "^0.8.1"
57-
}
58+
},
59+
"packageManager": "pnpm@10.10.0+sha512.d615db246fe70f25dcfea6d8d73dee782ce23e2245e3c4f6f888249fb568149318637dca73c2c5c8ef2a4ca0d5657fb9567188bfab47f566d1ee6ce987815c39"
5860
}

pages/authzed/api/_meta.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
"newWindow": true
66
},
77
"http-api": {
8-
"title": "HTTP API Reference",
9-
"href": "https://www.postman.com/authzed/workspace/spicedb/overview",
10-
"newWindow": true
8+
"title": "HTTP API Reference"
119
},
1210
"cloud-api": {
1311
"title": "Cloud API Reference",

pages/authzed/api/http-api.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import {Swagger} from "../../../components/swagger";
2+
3+
# HTTP API Documentation
4+
5+
<Swagger />

pages/authzed/concepts/restricted-api-access.mdx

Lines changed: 55 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,16 @@ Those familiar with configuring IAM on the major cloud providers should feel com
1515
- Roles
1616
- Policies
1717

18-
## Service Accounts
18+
## Components
19+
20+
### Service Accounts
1921

2022
Service Accounts represent your unique workloads.
2123
We recommend creating a Service Account for each application that will access the SpiceDB API.
2224

2325
By default Service Accounts have no access to the SpiceDB API; you must apply a Role to gain access.
2426

25-
## Tokens
27+
### Tokens
2628

2729
Tokens are long-lived credentials for Service Accounts.
2830
SpiceDB clients must provide a Token in the Authorization header of an API request to perform actions granted to the Service Account.
@@ -31,7 +33,7 @@ Service Accounts can have an arbitrary number of Tokens.
3133

3234
<Callout type="info">We recommend deploying new Tokens before deprovisioning any old Tokens to avoid downtime.</Callout>
3335

34-
### Token Format
36+
#### Token Format
3537

3638
<Callout type="warning">The entire contents of a Token is considered secret.</Callout>
3739

@@ -62,7 +64,7 @@ The command should output the hash, which can be referenced in your static confi
6264

6365
[static configuration]: #static-configuration
6466

65-
## Roles
67+
### Roles
6668

6769
Roles define rules for accessing the SpiceDB API.
6870
Roles are bound to Service Accounts to apply those rules to all API Tokens representing the Service Account.
@@ -89,9 +91,51 @@ The following variables are provided the CEL expression varying based on the req
8991
[cel]: https://github.com/google/cel-spec
9092
[cel-lang-spec]: https://github.com/google/cel-spec/blob/81e07d7cf76e7fc89b177bd0fdee8ba6d6604bf5/doc/langdef.md
9193

92-
### Example Rule Expressions
94+
### Policies
95+
96+
Policies are what bind Roles to a Service Account.
97+
98+
Each policy is composed of a unique identifer for the policy itself, the principal (the target of the role assignment), and any roles being assigned.
99+
100+
## Task-Specific Configuration
101+
102+
### `zed backup`/`zed restore`
103+
104+
To configure a service account for use with `zed backup` and `zed restore`, you'll need the following APIs:
105+
106+
On a Service Account on the **source** PS:
107+
108+
```yaml
109+
## For backup
110+
# Exporting relationships
111+
authzed.api/ExportBulkRelationships
112+
authzed.api/BulkExportRelationships
113+
114+
# Dumping existing schema
115+
authzed.api/ReadSchema
116+
```
117+
118+
On a Service Account on the **destination** PS:
119+
120+
```yaml
121+
## For restore
122+
## Put these on the DESTINATION PS
123+
# Importing relationships
124+
authzed.api/ImportBulkRelationships
125+
authzed.api/BulkImportRelationships
126+
127+
# Retrying failed relationships
128+
authzed.api/WriteRelationships
129+
130+
# Writing new schema
131+
authzed.api/WriteSchema
132+
```
133+
134+
## Example Rule CEL Expressions
93135

94-
#### Resource-type Write Limit
136+
These are some examples of CEL expressions that you might attach to Permissions on a Role.
137+
138+
### Resource-type Write Limit
95139

96140
This CEL expression disables the ability for writes to occur on anything but the provided resource type.
97141

@@ -101,15 +145,15 @@ This is useful for limiting an application to only be able to perform writes to
101145
WriteRelationshipsRequest.updates.all(x, x.relationship.resource.object_type == "resource")
102146
```
103147

104-
#### Subject-type Write Limit
148+
### Subject-type Write Limit
105149

106150
This CEL expression disables the ability for writes to occur on anything but the provided subject type.
107151

108152
```cel
109153
WriteRelationshipsRequest.updates.all(x, x.relationship.subject.object.object_type == "user")
110154
```
111155

112-
#### Create-only Write Limit
156+
### Create-only Write Limit
113157

114158
This CEL expression disables the ability for writes to perform updates; they can only create new relationships.
115159

@@ -120,15 +164,15 @@ WriteRelationshipsRequest.updates.all(
120164
)
121165
```
122166

123-
#### Resource-type Read Limit
167+
### Resource-type Read Limit
124168

125169
This CEL expression limits the ReadRelationships API from being able to list anything but the a specific resource type.
126170

127171
```cel
128172
ReadRelationshipsRequest.relationship_filter.resource_type == "resource"
129173
```
130174

131-
#### Blocking Schema Writes
175+
### Blocking Schema Writes
132176

133177
This CEL expression prevents any schema writes that contain the substring "blockchain".
134178
This example could be extended to prevent PII or undesirable patterns from reaching a production schema.
@@ -137,20 +181,14 @@ This example could be extended to prevent PII or undesirable patterns from reach
137181
!WriteSchemaRequest.schema.contains("blockchain")
138182
```
139183

140-
#### Limit Checks to one Permission
184+
### Limit Checks to one Permission
141185

142186
This CEL expression limits CheckPermissions requests to only be able to check a particular permission.
143187

144188
```cel
145189
CheckPermissionRequest.permission == "admin"
146190
```
147191

148-
## Policies
149-
150-
Policies are what bind Roles to a Service Account.
151-
152-
Each policy is composed of a unique identifer for the policy itself, the principal (the target of the role assignment), and any roles being assigned.
153-
154192
## Static Configuration
155193

156194
Enterprise builds of SpiceDB can have their API access configured statically with a YAML configuration file.

pages/spicedb/api/_meta.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@
55
"newWindow": true
66
},
77
"http-api": {
8-
"title": "HTTP API Reference",
8+
"title": "HTTP API Reference"
9+
},
10+
"postman": {
11+
"title": "Postman Collection",
912
"href": "https://www.postman.com/authzed/workspace/spicedb/overview",
1013
"newWindow": true
1114
}

pages/spicedb/api/http-api.mdx

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import {Swagger} from "../../../components/swagger";
2+
3+
# HTTP API Documentation
4+
5+
<Swagger />

pages/spicedb/concepts/datastores.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@ import { Callout } from 'nextra/components'
44

55
In order to reduce operational complexity, SpiceDB leverages existing, popular systems for persisting data.
66

7-
AuthzZed has standardized our managed services on CockroachDB, but we give self-hosted users the option to pick the datastore that best suits their operational requirements.
7+
AuthZed has standardized our managed services on CockroachDB, but we give self-hosted customers the option to pick the datastore that best suits their operational requirements.
88

9-
- [CockroachDB](#cockroachdb) - Recommended for self-hosted deployments with high throughput and/or multi-region requirements
9+
- [CockroachDB](#cockroachdb) - Recomended for self hosted deployments with high throughput and/or multi-region requirements
1010
- [Cloud Spanner](#cloud-spanner) - Recommended for self-hosted Google Cloud deployments
1111
- [PostgreSQL](#postgresql) - Recommended for self-hosted single-region deployments
1212
- [MySQL](#mysql) - Not recommended; only use if you cannot use PostgreSQL

pages/spicedb/getting-started/client-libraries.mdx

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,7 @@ Additionally, there are `example` directories in the client libraries that provi
1919
## HTTP Clients
2020

2121
SpiceDB exposes an HTTP API when run with the `--http-enabled` flag.
22-
While Authzed doesn't officially maintain HTTP client libraries, there are [OpenAPI] docs available
23-
both in [the authzed-go git repo](https://github.com/authzed/authzed-go/blob/main/proto/apidocs.swagger.json)
22+
While Authzed doesn't officially maintain HTTP client libraries, there are [OpenAPI] docs available [here](../api/http-api).
2423
and served by a SpiceDB instance running the HTTP server.
2524
For example:
2625

0 commit comments

Comments
 (0)