ReadModifyWrite
in package
The read-modify-write form CONTRACT.md §27.4 rule 5 recommends for `replace` updates: a read result turned back into the replacement body, every member carried over, so that changing one field and sending the body back preserves the rest instead of resetting every omitted member to its default.
$sp = $client->saml()->getServiceProvider($id);
$body = ReadModifyWrite::samlServiceProvider($sp, ['display_name' => 'Payroll (EU)']);
$client->saml()->updateServiceProvider($id, $body);
No secret is ever carried over, because no read carries one: the directory's
bindSecret, a SCIM target's credential and an SSF stream's authorizationHeader come
back absent, which on each of those updates means "keep the stored one" — except where
the update moves the connection, which then requires the secret again (§30.3 rule 2,
§31.3 rule 2, §32.3 rule 5). Pass it explicitly in that case, as a change.
Each helper takes the changes to make as $changes, keyed by the WIRE member name (the
same names toArray() renders), applied over the read before the body is rebuilt — the
generated bodies are immutable, so this is where a field gets changed. A secret given in
$changes (bind_secret, credential, authorization_header) may be given as a string
or as a Sensitive; the body holds it wrapped either way.
Table of Contents
Methods
- directoryConfig() : SetDirectoryConfig
- `directory.set`'s body from a `get()` result. `bindSecret` is left absent: absent keeps the stored secret, unless the write moves the connection (§30.3 rule 2).
- samlServiceProvider() : SamlServiceProviderInput
- `saml.update_service_provider`'s body from a `getServiceProvider()` result.
- scimTarget() : ScimTargetInput
- `scim_targets.update`'s body from a `get()` result. `credential` is left absent: absent keeps the stored one, unless the write moves its URL (§31.3 rule 2).
- ssfStream() : SsfStreamInput
- `ssf.update_stream`'s body from a `getStream()` result and **the changes to make to it** — the change-taking form of CONTRACT.md §32.2 (contract 1.62). `authorizationHeader` and `clearAuthorizationHeader` are left absent: absent keeps the stored header.
Methods
directoryConfig()
`directory.set`'s body from a `get()` result. `bindSecret` is left absent: absent keeps the stored secret, unless the write moves the connection (§30.3 rule 2).
public
static directoryConfig(DirectoryConfig $config[, array<string, mixed> $changes = [] ]) : SetDirectoryConfig
Parameters
- $config : DirectoryConfig
- $changes : array<string, mixed> = []
-
Wire members to change, applied over the read.
Return values
SetDirectoryConfigsamlServiceProvider()
`saml.update_service_provider`'s body from a `getServiceProvider()` result.
public
static samlServiceProvider(SamlServiceProvider $sp[, array<string, mixed> $changes = [] ]) : SamlServiceProviderInput
Parameters
- $sp : SamlServiceProvider
- $changes : array<string, mixed> = []
-
Wire members to change, applied over the read.
Return values
SamlServiceProviderInputscimTarget()
`scim_targets.update`'s body from a `get()` result. `credential` is left absent: absent keeps the stored one, unless the write moves its URL (§31.3 rule 2).
public
static scimTarget(ScimTargetResponse $target[, array<string, mixed> $changes = [] ]) : ScimTargetInput
expected_updated_at is the read's updated_at, so the replacement lands only on the
version that was read and an edit made since answers 409 instead of being overwritten
(§31.3 rule 4, contract 1.60); reload and retry. Pass expected_updated_at in $changes
to send another value.
Parameters
- $target : ScimTargetResponse
- $changes : array<string, mixed> = []
-
Wire members to change, applied over the read.
Return values
ScimTargetInputssfStream()
`ssf.update_stream`'s body from a `getStream()` result and **the changes to make to it** — the change-taking form of CONTRACT.md §32.2 (contract 1.62). `authorizationHeader` and `clearAuthorizationHeader` are left absent: absent keeps the stored header.
public
static ssfStream(SsfStream $stream[, array<string, mixed> $changes = [] ]) : SsfStreamInput
$stream = $client->ssf()->getStream($id);
$client->ssf()->updateStream($id, ReadModifyWrite::ssfStream($stream, [
'events_allowed' => [SsfEventTypes::SESSION_REVOKED], // lower the ceiling
]));
What the body carries, and why each point is a rule rather than a convenience:
events_requested, as read. An update that omits it resets the stream to every event ofevents_allowed, widening what the receiver narrowed, and AXIAM then sends the receiver more events about the tenant's users than it asked for. The read list goes back as it was; an[](the receiver's "none") goes back as[]and is never omitted.- Cut to the new ceiling. When
$changeslowersevents_allowedand does not nameevents_requested, the requested list becomes the entries of the read list that are in the new ceiling, in their order (a request outside the ceiling is400). Anevents_requestednamed in$changesis sent as given: the server judges it. expected_updated_at, as read. Theupdated_atstring of the stream you read, byte for byte — not parsed and rendered again, because the comparison is of the instant and a timestamp rounded to fewer fraction digits than the server stored does not match. The update then lands only on the version you read, and a write made since (the receiver's own included) answers409(a ConflictError, never retried): read again and decide again.expected_updated_at => nullin$changesis "none": the key is left out of the body andnullis never sent, which replaces whatever is stored.
This is the form to use. ssfStream($stream) with no changes is the plain converter,
and it sends the stream back as read. It cannot know that the caller is about to lower
the ceiling, so cutting events_requested to the new events_allowed is the caller's
duty wherever a body is built another way (SsfStreamInput::fromArray() over a
hand-edited array, a constructor call): a requested list left outside the new ceiling is
400, and one left out altogether resets the stream (the three meanings of
events_requested, §32.2; an update conditional on the version read is 409 once the
stream changes under it).
Parameters
- $stream : SsfStream
- $changes : array<string, mixed> = []
-
Wire members to change, applied over the read.