Skip to content

Commit 4cb1fe6

Browse files
committed
General fixes and project IAM docs
1 parent 26597f0 commit 4cb1fe6

5 files changed

Lines changed: 86 additions & 8 deletions

File tree

iam/mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
site_name: IAM
1+
site_name: iam
22
theme:
33
name: material
44

mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ theme:
77
nav:
88
- Home: index.md
99
- Services:
10-
- Identity and Access Management: '!include ./iam/mkdocs.yml'
10+
- Identity & Access Management: '!include ./iam/mkdocs.yml'
1111
- Projects: '!include ./projects/mkdocs.yml'
1212
- Virtual Private Networks: '!include ./vpn/mkdocs.yml'
1313

projects/docs/getting-started.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
A resources on the CBWS platform are part of a project, they help bundle related resources for a specific goal.
1+
All resources on the CBWS platform are part of a project, they help bundle related resources for a specific goal.
22

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.
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 a SLA.
44

55
Projects can be freely made within your organization account and can be removed anytime as long as there are no more resources inside.
66

projects/docs/managing-projects.md

Lines changed: 81 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
A resources on the CBWS platform are part of a project, they help bundle related resources for a specific goal.
1+
All resources on the CBWS platform are part of a project, they help bundle related resources for a specific goal.
22

33
This guide describes how to create and use them to organize your resources.
44

@@ -9,7 +9,7 @@ Creating projects requires the `Project creator` role on an organization, after
99

1010
!!! hint
1111
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.
12+
with an abbreviation of your organization or product name.
1313

1414
=== "Panel"
1515
1. Click on the project selection button
@@ -144,11 +144,89 @@ For more details IAM policies you can read the IAM getting started documentation
144144

145145
!!! info
146146
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.
147+
You can remove this at any point, this however means our support department won't be able to immediately help you.
148148

149149
### Getting current policy
150150

151+
In this example we're going to view the current IAM policy of the `test-project` project.
152+
153+
=== "Golang"
154+
155+
```go
156+
package main
157+
158+
import (
159+
"context"
160+
"log"
161+
162+
projects "github.com/cbws/go-cbws/cbws/projects/v1alpha1"
163+
164+
)
165+
func main() {
166+
p, err := projects.NewClient(context.Background())
167+
if err != nil {
168+
log.Fatalf("Error: %+v", err)
169+
}
170+
171+
policy, err := v.GetIAMPolicy(context.Background(), "projects/test-project")
172+
if err != nil {
173+
log.Fatalf("Error: %+v", err)
174+
}
175+
176+
log.Printf("Policy: %+v", policy)
177+
}
178+
```
179+
151180
### Changing policy
152181

182+
In this example we're going to give user `employee2@example.com` the ability to administer virtual machines in the
183+
`test-project` project. For this we will be creating a binding in the policy that uses the
184+
`services/vm.cbws.xyz/roles/vm-admin` role.
185+
153186
!!! warning
154187
Giving a principal the `setIAMPOlicy` permission will also this principal to give themselves more access.
188+
189+
=== "Golang"
190+
191+
!!! tip
192+
Setting a new policy overrides the previous policy entirely, make sure you include all bindings that should
193+
exist after applying.
194+
195+
```go
196+
package main
197+
198+
import (
199+
"context"
200+
"log"
201+
202+
"github.com/cbws/go-cbws-grpc/cbws/iam/policy/v1alpha1"
203+
projects "github.com/cbws/go-cbws/cbws/projects/v1alpha1"
204+
205+
)
206+
func main() {
207+
p, err := projects.NewClient(context.Background())
208+
if err != nil {
209+
log.Fatalf("Error: %+v", err)
210+
}
211+
212+
_, err = v.SetIAMPolicy(context.Background(), "projects/test-project", v1alpha1.Policy{
213+
Bindings: []*v1alpha1.Binding{
214+
{
215+
Role: "roles/owner",
216+
Description: "Owner access for project creator",
217+
Members: []string{"user:employee1@example.com"},
218+
},
219+
{
220+
Role: "services/vm.cbws.xyz/roles/vm-admin",
221+
Description: "Virtual machine admin for colleague",
222+
Members: []string{"user:employee2@example.com"},
223+
},
224+
{
225+
Role: "roles/tech-support",
226+
Description: "Tech support access for Cloudbear tech departments",
227+
Members: []string{"group:tech@cloudbear.nl"},
228+
},
229+
},
230+
})
231+
}
232+
```

projects/mkdocs.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
site_name: Projects
1+
site_name: projects
22
theme:
33
name: material
44

0 commit comments

Comments
 (0)