Skip to content

Commit 01afd25

Browse files
hcsa73Henrique Santos
andauthored
Replace membership example with authentication (#320)
* Fix typo * Replace example --------- Co-authored-by: Henrique Santos <[email protected]>
1 parent be01338 commit 01afd25

File tree

5 files changed

+13
-13
lines changed

5 files changed

+13
-13
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
>
55
> **This module will receive no further updates.** Use `github.com/stackitcloud/stackit-sdk-go/services/authorization` instead.
66
7-
## Highlights
7+
### Highlights
88

99
- `authorization`: [v0.1.0](services/authorization/CHANGELOG.md#v010-2024-02-07)
1010
- First release. This module offers the same functionalities as `membership` (release v0.4.0).

examples/membership/membership.go renamed to examples/authorization/authorization.go

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import (
66
"os"
77

88
"github.com/stackitcloud/stackit-sdk-go/core/utils"
9-
"github.com/stackitcloud/stackit-sdk-go/services/membership"
9+
"github.com/stackitcloud/stackit-sdk-go/services/authorization"
1010
)
1111

1212
func main() {
@@ -16,7 +16,7 @@ func main() {
1616
emailToBeAdded := "[email protected]"
1717

1818
// Create a new API client, that uses default authentication and configuration
19-
client, err := membership.NewAPIClient()
19+
client, err := authorization.NewAPIClient()
2020
if err != nil {
2121
fmt.Fprintf(os.Stderr, "Creating API client: %v\n", err)
2222
os.Exit(1)
@@ -36,7 +36,7 @@ func main() {
3636
// Get the memberships of your user
3737
getMembershipsResp, err := client.ListUserMemberships(context.Background(), yourEmail).Execute()
3838
if err != nil {
39-
fmt.Fprintf(os.Stderr, "Error when calling `GetMemberships`: %v\n", err)
39+
fmt.Fprintf(os.Stderr, "Error when calling `ListUserMemberships`: %v\n", err)
4040
} else {
4141
userMemberships := *getMembershipsResp.Items
4242
fmt.Printf("Number of memberships: %v\n", len(userMemberships))
@@ -60,8 +60,8 @@ func main() {
6060
}
6161

6262
// Add a member to your project or add an additional role to an existing member
63-
updateMemberPayload := membership.AddMembersPayload{
64-
Members: &[]membership.Member{
63+
updateMemberPayload := authorization.AddMembersPayload{
64+
Members: &[]authorization.Member{
6565
{
6666
Role: utils.Ptr("project.member"),
6767
Subject: utils.Ptr(emailToBeAdded),
@@ -77,8 +77,8 @@ func main() {
7777
}
7878

7979
// Remove a role from a member of your project
80-
deleteMemberPayload := membership.RemoveMembersPayload{
81-
Members: &[]membership.Member{
80+
deleteMemberPayload := authorization.RemoveMembersPayload{
81+
Members: &[]authorization.Member{
8282
{
8383
Role: utils.Ptr("project.member"),
8484
Subject: utils.Ptr(emailToBeAdded),

examples/membership/go.mod renamed to examples/authorization/go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
module github.com/stackitcloud/stackit-sdk-go/examples/membership
1+
module github.com/stackitcloud/stackit-sdk-go/examples/authorization
22

33
go 1.18
44

55
require (
66
github.com/stackitcloud/stackit-sdk-go/core v0.7.7
7-
github.com/stackitcloud/stackit-sdk-go/services/membership v0.3.5
7+
github.com/stackitcloud/stackit-sdk-go/services/authorization v0.1.0
88
)
99

1010
require (

examples/membership/go.sum renamed to examples/authorization/go.sum

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0=
1414
github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
1515
github.com/stackitcloud/stackit-sdk-go/core v0.7.7 h1:w1T8I2ERT5xPHXS+UV9maSseK8tyUJQjzS21hhRSWjU=
1616
github.com/stackitcloud/stackit-sdk-go/core v0.7.7/go.mod h1:nfC2Tbjd73Ivn8wEp3lvG/dmiXHgl6QX+HY2Ih3aGgw=
17-
github.com/stackitcloud/stackit-sdk-go/services/membership v0.3.5 h1:10uLQ28A/GpnLRVHJRA3eAFFpSFVYX59kpcAL5SQFSM=
18-
github.com/stackitcloud/stackit-sdk-go/services/membership v0.3.5/go.mod h1:2bLrUstAsD/t0OtuVm88O2vaNvJM/vJq/o3ZCv0j1kQ=
17+
github.com/stackitcloud/stackit-sdk-go/services/authorization v0.1.0 h1:FkOaz7ZutvteismzVHsabddg5GLWvRCA9jEzWH1/V9Y=
18+
github.com/stackitcloud/stackit-sdk-go/services/authorization v0.1.0/go.mod h1:n2iI0NZdawwkGt3nqm09l8kSJ3MGgLCCOWdVzanEPzA=
1919
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
2020
golang.org/x/net v0.0.0-20190603091049-60506f45cf65/go.mod h1:HSz+uSET+XFnRR8LxR5pz3Of3rY3CfYBVs4xY44aLks=
2121
golang.org/x/net v0.20.0 h1:aCL9BSgETF1k+blQaYUBx9hJ9LOGP3gAVemcZlf1Kpo=

go.work

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,14 @@ use (
44
./core
55
./examples/argus
66
./examples/authentication
7+
./examples/authorization
78
./examples/configuration
89
./examples/dns
910
./examples/errorhandling
1011
./examples/httpresponse
1112
./examples/loadbalancer
1213
./examples/logme
1314
./examples/mariadb
14-
./examples/membership
1515
./examples/mongodbflex
1616
./examples/objectstorage
1717
./examples/opensearch

0 commit comments

Comments
 (0)