Skip to content

Commit cd39132

Browse files
committed
Start work on projects documentation
1 parent 9726e86 commit cd39132

11 files changed

Lines changed: 252 additions & 48 deletions

File tree

Dockerfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
FROM squidfunk/mkdocs-material
2+
3+
RUN pip install --no-cache-dir mkdocs-monorepo-plugin

iam/docs/getting-started.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Something about IAM

iam/mkdocs.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
site_name: IAM
2+
theme:
3+
name: material
4+
5+
nav:
6+
- Guides:
7+
- Getting started: "getting-started.md"
8+
# - Reference:
9+
# - Permissions/roles: "reference/permissions.md"
10+
# - Golang: "golang.md"
11+
# - PHP: "php.md"
12+
# - Protobuf: "reference/protobuf.md"

mkdocs.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
site_name: Default
2+
theme:
3+
name: material
4+
features:
5+
- tabs
6+
#- instant
7+
nav:
8+
- Home: index.md
9+
- Services:
10+
- Identity and Access Management: '!include ./iam/mkdocs.yml'
11+
- Projects: '!include ./projects/mkdocs.yml'
12+
- Virtual Private Networks: '!include ./vpn/mkdocs.yml'
13+
14+
markdown_extensions:
15+
- admonition
16+
- codehilite
17+
- pymdownx.tabbed
18+
- pymdownx.superfences
19+
20+
plugins:
21+
- monorepo

projects/docs/getting-started.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
A resources on the CBWS platform are part of a project, they help bundle related resources for a specific goal.
2+
3+
Some use cases would be specific projects per environment for example production and staging, managing access based on teams or setups that don't use the Cloudbear DevOps service and don't have an SLA.
4+
5+
Projects can be freely made within your organization account and can be removed anytime as long as there are no more resources inside.
6+
7+
The name of a project is unique across the CBWS platform, if a project named `production-website` exists you won't also be able to use that project name.

projects/docs/managing-projects.md

Lines changed: 154 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,154 @@
1+
A resources on the CBWS platform are part of a project, they help bundle related resources for a specific goal.
2+
3+
This guide describes how to create and use them to organize your resources.
4+
5+
## Creating a project
6+
7+
Creating projects requires the `Project creator` role on an organization, after creation you will get the
8+
`Project owner` role allowing to fully manage resources in the newly created project.
9+
10+
!!! hint
11+
Since project names are unique across the entire CBWS platform it might be useful to for example prepend them
12+
with a abbreviation of your organization or product name.
13+
14+
=== "Panel"
15+
1. Click on the project selection button
16+
2. Click on create project
17+
18+
=== "CLI"
19+
```bash
20+
cbws projects create test-project
21+
```
22+
23+
=== "Golang"
24+
```go
25+
package main
26+
27+
import (
28+
"context"
29+
"log"
30+
31+
projects "github.com/cbws/go-cbws/cbws/projects/v1alpha1"
32+
33+
)
34+
func main() {
35+
p, err := projects.NewClient(context.Background())
36+
if err != nil {
37+
log.Fatalf("Error: %+v", err)
38+
}
39+
40+
project, err := p.CreateProject(context.Background(), "//organizations.cloudbear.nl/organizations/908e6132-1eb9-11ea-939b-9c81b2f6bed2", "test-project")
41+
if err != nil {
42+
log.Fatalf("Error: %+v", err)
43+
}
44+
45+
log.Printf("Project: %+v", project)
46+
}
47+
```
48+
49+
=== "PHP"
50+
```php
51+
<?php
52+
$projects = new \Cbws\API\Projects\V1alpha1\Client();
53+
$project = $projects->createProject('//organizations.cloudbear.nl/organizations/908e6132-1eb9-11ea-939b-9c81b2f6bed2', 'test-project');
54+
```
55+
56+
## Listing projects
57+
58+
You generally have quite a few projects, listing all of them can be doing as follows:
59+
60+
=== "Panel"
61+
62+
=== "CLI"
63+
List all the projects you have access to, this will also include projects from organizations you've been given
64+
access to.
65+
66+
```bash
67+
cbws projects list
68+
```
69+
70+
=== "Golang"
71+
This example uses the `PaginateProjects` helper method and the `Iterate` function of the CBWS pagination library
72+
to iterate through all the projects and handles pagination on the background.
73+
74+
```go
75+
package main
76+
77+
import (
78+
"context"
79+
"log"
80+
81+
projects "github.com/cbws/go-cbws/cbws/projects/v1alpha1"
82+
83+
)
84+
func main() {
85+
p, err := projects.NewClient(context.Background())
86+
if err != nil {
87+
log.Fatalf("Error: %+v", err)
88+
}
89+
90+
paginator := p.PaginateProjects()
91+
edges, err := pagination.Iterate(context.Background(), paginator)
92+
if err != nil {
93+
log.Fatalf("Error: %+v", err)
94+
}
95+
96+
for _, edge := range edges {
97+
log.Printf("Project: %+v", edge.Node)
98+
}
99+
}
100+
```
101+
102+
=== "PHP"
103+
```php
104+
<?php
105+
$projects = new \Cbws\API\Projects\V1alpha1\Client();
106+
$data = $projects->listProjects();
107+
foreach ($data->getProjects() as $project) {
108+
var_dump($project);
109+
}
110+
echo 'Next page token: ' . $data->getNextPageToken() . PHP_EOL;
111+
```
112+
113+
## Using a project
114+
115+
Most things you do on the CBWS platform will be done in the context of a project. Most tools will work in a specific
116+
project so you can focus on the things at hand. It is however very easy to switch back and forth between different
117+
projects.
118+
119+
=== "Panel"
120+
121+
When you open the CBWS panel you can select a project by using the project selection button in the menu on the left.
122+
123+
=== "CLI"
124+
The CBWS command line tool generally operates on a specific project. This way you only see and manage the resources
125+
related to that specific project. Switching between projects can be done using the following command:
126+
127+
```bash
128+
cbws projects use test-project
129+
```
130+
131+
You can also use a flag to run a specfic command on a different project:
132+
133+
```bash
134+
cbws -p test-project iam service-accounts list
135+
```
136+
137+
## Project IAM policies
138+
139+
When creating a new project, you will be the only one with the `Project owner` role. This will give you full access to
140+
all resources within the project, and full access to the project itself. To give others or service accounts access to
141+
your project or create a more specific access policy you can use the project IAM policies.
142+
143+
For more details IAM policies you can read the IAM getting started documentation.
144+
145+
!!! info
146+
To ensure we can help you we by default also give `Cloudbear tech support` the `Tech support` role on your project.
147+
You can remove this at any point, this does mean our support department won't be able to immediately help you.
148+
149+
### Getting current policy
150+
151+
### Changing policy
152+
153+
!!! warning
154+
Giving a principal the `setIAMPOlicy` permission will also this principal to give themselves more access.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
The projects service defines the following permissions and roles.
2+
3+
## Permissions
4+
5+
### Project
6+
7+
| Action | Description |
8+
| ----------------- | ------------------------------------------------------------------------------------ |
9+
| get | Getting information about a project. |
10+
| getIAMPolicy | Getting IAM policy of a project. |
11+
| setIAMPolicy | Setting IAM policy of a project. This will also allow the principal to give themselves more rights on the project, so be careful in giving this permission. | |
12+
13+
## Roles
14+
15+
All roles that have been defined by the projects service.
16+
17+
### Organization
18+
19+
| Role | Description |
20+
| --------------- | ------------------------------------ |
21+
| Project creator | Gives ability to create new projects |
22+
23+
### Project
24+
25+
| Role | Description |
26+
| --------------- | ------------------------------------------------------------------------------------ |
27+
| Project owner | Gives full access to all resources within a project and the project itself, this is automatically assigned during project creation. |
28+
| Project viewer | Gives read-only access to most resources within a project. |
Lines changed: 0 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,3 @@
1-
# Protocol Documentation
2-
<a name="top"></a>
3-
4-
## Table of Contents
5-
6-
- [cbws/projects/v1alpha1/project.proto](#cbws/projects/v1alpha1/project.proto)
7-
- [Project](#cbws.projects.v1alpha1.Project)
8-
9-
- [cbws/projects/v1alpha1/projects.proto](#cbws/projects/v1alpha1/projects.proto)
10-
- [CreateProjectRequest](#cbws.projects.v1alpha1.CreateProjectRequest)
11-
- [GetProjectRequest](#cbws.projects.v1alpha1.GetProjectRequest)
12-
- [ListProjectsRequest](#cbws.projects.v1alpha1.ListProjectsRequest)
13-
- [ListProjectsResponse](#cbws.projects.v1alpha1.ListProjectsResponse)
14-
15-
- [ProjectsService](#cbws.projects.v1alpha1.ProjectsService)
16-
17-
- [Scalar Value Types](#scalar-value-types)
18-
19-
20-
21-
<a name="cbws/projects/v1alpha1/project.proto"></a>
22-
<p align="right"><a href="#top">Top</a></p>
23-
241
## cbws/projects/v1alpha1/project.proto
252

263

@@ -142,28 +119,3 @@ The service account list request.
142119
| GetPolicy | [.cbws.iam.policy.v1alpha1.GetPolicyRequest](#cbws.iam.policy.v1alpha1.GetPolicyRequest) | [.cbws.iam.policy.v1alpha1.Policy](#cbws.iam.policy.v1alpha1.Policy) | Returns the IAM access control policy for a Project. |
143120
| SetPolicy | [.cbws.iam.policy.v1alpha1.SetPolicyRequest](#cbws.iam.policy.v1alpha1.SetPolicyRequest) | [.cbws.iam.policy.v1alpha1.Policy](#cbws.iam.policy.v1alpha1.Policy) | Sets the IAM access control policy for a Project. |
144121
| TestPermissions | [.cbws.iam.policy.v1alpha1.TestPermissionsRequest](#cbws.iam.policy.v1alpha1.TestPermissionsRequest) | [.cbws.iam.policy.v1alpha1.TestPermissionsResponse](#cbws.iam.policy.v1alpha1.TestPermissionsResponse) | Tests the specified permissions against the IAM access control policy for a Project. |
145-
146-
147-
148-
149-
150-
## Scalar Value Types
151-
152-
| .proto Type | Notes | C++ | Java | Python | Go | C# | PHP | Ruby |
153-
| ----------- | ----- | --- | ---- | ------ | -- | -- | --- | ---- |
154-
| <a name="double" /> double | | double | double | float | float64 | double | float | Float |
155-
| <a name="float" /> float | | float | float | float | float32 | float | float | Float |
156-
| <a name="int32" /> int32 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint32 instead. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
157-
| <a name="int64" /> int64 | Uses variable-length encoding. Inefficient for encoding negative numbers – if your field is likely to have negative values, use sint64 instead. | int64 | long | int/long | int64 | long | integer/string | Bignum |
158-
| <a name="uint32" /> uint32 | Uses variable-length encoding. | uint32 | int | int/long | uint32 | uint | integer | Bignum or Fixnum (as required) |
159-
| <a name="uint64" /> uint64 | Uses variable-length encoding. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum or Fixnum (as required) |
160-
| <a name="sint32" /> sint32 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int32s. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
161-
| <a name="sint64" /> sint64 | Uses variable-length encoding. Signed int value. These more efficiently encode negative numbers than regular int64s. | int64 | long | int/long | int64 | long | integer/string | Bignum |
162-
| <a name="fixed32" /> fixed32 | Always four bytes. More efficient than uint32 if values are often greater than 2^28. | uint32 | int | int | uint32 | uint | integer | Bignum or Fixnum (as required) |
163-
| <a name="fixed64" /> fixed64 | Always eight bytes. More efficient than uint64 if values are often greater than 2^56. | uint64 | long | int/long | uint64 | ulong | integer/string | Bignum |
164-
| <a name="sfixed32" /> sfixed32 | Always four bytes. | int32 | int | int | int32 | int | integer | Bignum or Fixnum (as required) |
165-
| <a name="sfixed64" /> sfixed64 | Always eight bytes. | int64 | long | int/long | int64 | long | integer/string | Bignum |
166-
| <a name="bool" /> bool | | bool | boolean | boolean | bool | bool | boolean | TrueClass/FalseClass |
167-
| <a name="string" /> string | A string must always contain UTF-8 encoded or 7-bit ASCII text. | string | String | str/unicode | string | string | string | String (UTF-8) |
168-
| <a name="bytes" /> bytes | May contain any arbitrary sequence of bytes. | string | ByteString | str | []byte | ByteString | string | String (ASCII-8BIT) |
169-

projects/mkdocs.yml

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
site_name: Projects
2+
theme:
3+
name: material
4+
5+
nav:
6+
- Guides:
7+
- Getting started: "getting-started.md"
8+
- Managing projects: "managing-projects.md"
9+
- Reference:
10+
- Permissions/roles: "reference/permissions.md"
11+
- Golang: "golang.md"
12+
- PHP: "php.md"
13+
- Protobuf: "reference/protobuf.md"

vpn/docs/getting-started.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Something about VPNs

0 commit comments

Comments
 (0)