Skip to content

Commit

Permalink
Live Stream list method and terminate changes
Browse files Browse the repository at this point in the history
* Add StreamListUrls

* Documentation

* Add error when no live_stream_urls present

* Live stream termination changes
- Fail if not stopped state
- Remove StreamDeactivate as it is now a duplicate method
- Generate new token if token meta fails

* Add DeleteWriteToken

* Clear write token from HttpClient drafts

* Delete write token in StreamStopSession

* Remove edge_write_token from api response

* Handle undefined tenantContractId case
  • Loading branch information
elv-zenia authored Feb 28, 2024
1 parent 92c3f26 commit 7c9b512
Show file tree
Hide file tree
Showing 4 changed files with 182 additions and 130 deletions.
3 changes: 2 additions & 1 deletion src/FrameClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -387,6 +387,7 @@ class FrameClient {
"DeleteMetadata",
"DeleteNTPInstance",
"DeletePart",
"DeleteWriteToken",
"DeployContract",
"Download",
"DownloadEncrypted",
Expand Down Expand Up @@ -476,9 +477,9 @@ class FrameClient {
"StartABRMezzanineJobs",
"StreamConfig",
"StreamCreate",
"StreamDeactivate",
"StreamInitialize",
"StreamInsertion",
"StreamListUrls",
"StreamStatus",
"StreamStartOrStopOrReset",
"StreamStopSession",
Expand Down
6 changes: 6 additions & 0 deletions src/HttpClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ class HttpClient {
this.draftURIs[writeToken] = new URI(nodeUrlStr);
}

ClearWriteToken({writeToken}) {
if(Object.hasOwn(this.draftURIs, writeToken)) {
delete this.draftURIs[writeToken];
}
}

RequestHeaders(bodyType, headers={}) {
if(!headers.Accept) {
headers["Accept"] = "application/json";
Expand Down
29 changes: 28 additions & 1 deletion src/client/ContentManagement.js
Original file line number Diff line number Diff line change
Expand Up @@ -1524,4 +1524,31 @@ exports.SetAuthPolicy = async function({objectId, policyId}) {
metadataKey: "_AUTH_CONTEXT",
metadata: { "elv:delegation-id": policyId }
});
};
};

/**
* Delete the specified write token
*
* @methodGroup Content Objects
*
* @namedParams
* @param {string} writeToken - Write token to delete
* @param {string} libraryId - ID of the library
*/
exports.DeleteWriteToken = async function({writeToken, libraryId}) {
ValidateWriteToken(writeToken);
ValidateLibrary(libraryId);

let path = UrlJoin("qlibs", libraryId, "q", writeToken);

const authorizationHeader = await this.authClient.AuthorizationHeader({libraryId, update: true});

await this.HttpClient.Request({
headers: authorizationHeader,
method: "DELETE",
path: path,
allowFailover: false
});

await this.HttpClient.ClearWriteToken({writeToken});
};
Loading

0 comments on commit 7c9b512

Please sign in to comment.