Skip to content

docs(examples): add a team member, a bucket and an upload to the service account script - #111

Closed
ehennestad wants to merge 7 commits into
add-create-bucket-methodfrom
extend-service-account-example
Closed

ehennestad wants to merge 7 commits into
add-create-bucket-methodfrom
extend-service-account-example

Conversation

@ehennestad

@ehennestad ehennestad commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

examples/collab/checkServiceAccountCanCreateCollab.m stopped after creating a collab. This PR extends it with the next steps of setting up a collab as a service account in the integration environment:

  • CollabsClient.addTeamUser adds the user TEAM_USERNAME to the team with the role TEAM_ROLE.
  • BucketsClient.createBucket creates the bucket of the collab, which has the name of the collab. The script prints whether the bucket was created or existed already.
  • ebrains.bucket.uploadFile uploads a one-line text file to the bucket as OBJECT_NAME. The file is written to tempdir and deleted at the end.

The script prints a line after each step that completes. When a step fails it prints which one, with the identifier and message of the error, and still switches back to the environment it started in.

🤖 Generated with Claude Code

addTeamUser sends PUT /rest/v1/collabs/{collabId}/team/{role}/users/
{username}, which gives a user the role "viewer", "editor" or
"administrator" in a collab. A 204 (No Content) response is the
success case, as documented in the OpenAPI spec of the Collaboratory
API; any other status is reported through throwError.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@ehennestad
ehennestad added this pull request to stack #107 November 11, 2026 10:42
@github-actions

github-actions Bot commented Nov 11, 2026 •

Copy link
Copy Markdown
Contributor

Test Results

880 tests  +2   869 ✅ +2   50s ⏱️ -7s
 40 suites ±0    11 💤 ±0 
  1 files   ±0     0 ❌ ±0 

Results for commit 6a067a4. ± Comparison against base commit ab080ed.

♻️ This comment has been updated with latest results.

@codecov-commenter

codecov-commenter commented Nov 11, 2026 •

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.50%. Comparing base (6ad3e21) to head (6a067a4).

Additional details and impacted files
@@                    Coverage Diff                    @@
##           add-create-bucket-method     #111   +/-   ##
=========================================================
  Coverage                     90.50%   90.50%           
=========================================================
  Files                           137      137           
  Lines                          3580     3580           
=========================================================
  Hits                           3240     3240           
  Misses                          340      340           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

ehennestad and others added 2 commits November 11, 2026 11:57
The team endpoint is a PUT without a body. MATLAB warns
(MATLAB:http:BodyExpectedFor) when such a request is sent, so every
call to addTeamUser printed the warning. The warning is turned off for
the request and restored afterwards, as BucketsClient does for its
PUT requests without a body.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
createBucket sends POST /api/v1/buckets with the body
{"bucket_name": <name>}, the endpoint the Data Proxy API documents for
creating the bucket of a collab. A 200 (OK) response is the success
case; any other status is reported through throwError.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@ehennestad
ehennestad force-pushed the extend-service-account-example branch from 4db68aa to b68ff2f Compare November 11, 2026 10:57
The Data Proxy answers POST /api/v1/buckets with 201 (Created) when it
has created the bucket and with 204 (No Content) when the bucket
exists already, where its API spec documents 200 (OK). createBucket
reported the 201 of a bucket it had just created as an error. All
three statuses are now the success case, and a bucket that exists is
left as it is.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@ehennestad
ehennestad force-pushed the extend-service-account-example branch from b68ff2f to 28f2b23 Compare November 11, 2026 12:39
ehennestad and others added 3 commits November 11, 2026 13:42
createBucket returns true when the Data Proxy created the bucket and
false when it answered 204 (No Content) for a bucket that existed
already. The value is returned only when asked for, so a call without
a semicolon displays nothing.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…ice account script

After creating the collab, the script adds a user to its team with
addTeamUser, creates the bucket of the collab with createBucket and
uploads a small text file to it with ebrains.bucket.uploadFile. It
reports each step as it completes, and names the step that failed.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… bucket

The script prints that the bucket existed already when createBucket
returns false, and that it was created otherwise.

Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
@ehennestad
ehennestad force-pushed the extend-service-account-example branch from 28f2b23 to 6a067a4 Compare November 11, 2026 12:42
@ehennestad

Copy link
Copy Markdown
Owner Author

#106 no longer adds the service account script (commit 6c5409a removes it from the examples folder), so this PR has nothing left to change.

@ehennestad ehennestad closed this Nov 11, 2026
@ehennestad
ehennestad deleted the extend-service-account-example branch November 11, 2026 19:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants