{"id":18936643,"url":"https://github.com/cloudevents/sdk-powershell","last_synced_at":"2026-02-27T07:42:05.624Z","repository":{"id":47200862,"uuid":"355616733","full_name":"cloudevents/sdk-powershell","owner":"cloudevents","description":"PowerShell 7.0 SDK for CloudEvents","archived":false,"fork":false,"pushed_at":"2023-10-16T13:59:08.000Z","size":77,"stargazers_count":17,"open_issues_count":1,"forks_count":7,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-07-21T04:42:07.562Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"PowerShell","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/cloudevents.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2021-04-07T16:43:23.000Z","updated_at":"2025-03-09T20:48:00.000Z","dependencies_parsed_at":"2023-10-17T00:18:45.866Z","dependency_job_id":null,"html_url":"https://github.com/cloudevents/sdk-powershell","commit_stats":null,"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/cloudevents/sdk-powershell","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudevents%2Fsdk-powershell","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudevents%2Fsdk-powershell/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudevents%2Fsdk-powershell/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudevents%2Fsdk-powershell/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cloudevents","download_url":"https://codeload.github.com/cloudevents/sdk-powershell/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cloudevents%2Fsdk-powershell/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":29887769,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-02-27T05:38:26.446Z","status":"ssl_error","status_checked_at":"2026-02-27T05:38:25.235Z","response_time":57,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-08T12:08:21.862Z","updated_at":"2026-02-27T07:42:05.608Z","avatar_url":"https://github.com/cloudevents.png","language":"PowerShell","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PowerShell 7.0 SDK for CloudEvents based on [.NET SDK for CloudEvents](https://github.com/cloudevents/sdk-csharp)\n\nOfficial CloudEvents SDK to integrate your application with CloudEvents.\n\n## Status\n\nSupported CloudEvents versions:\n- v1.0\n\nSupported Protocols:\n- HTTP\n\n## **`CloudEvents.Sdk`** Module\nThe module contains functions to\n- Create CloudEvent objects\n- Add data to a CloudEvent object\n- Read data from a CloudEvent object\n- Convert a CloudEvent object to an HTTP Message\n- Convert an HTTP Message to a CloudEvent object\n\n## Install **`CloudEvents.Sdk`** Module\n\n### Prerequisites\n- [PowerShell 7.0](https://github.com/PowerShell/PowerShell/releases/tag/v7.0.4)\n\n```powershell\nInstall-Module CloudEvents.Sdk\nImport-Module CloudEvents.Sdk\nGet-Command -Module CloudEvents.Sdk\n\nCommandType     Name                                               Version    Source\n-----------     ----                                               -------    ------\nFunction        ConvertFrom-HttpMessage                            0.3.0      CloudEvents.Sdk\nFunction        ConvertTo-HttpMessage                              0.3.0      CloudEvents.Sdk\nFunction        New-CloudEvent                                     0.3.0      CloudEvents.Sdk\nFunction        Read-CloudEventData                                0.3.0      CloudEvents.Sdk\nFunction        Read-CloudEventJsonData                            0.3.0      CloudEvents.Sdk\nFunction        Read-CloudEventXmlData                             0.3.0      CloudEvents.Sdk\nFunction        Set-CloudEventData                                 0.3.0      CloudEvents.Sdk\nFunction        Set-CloudEventJsonData                             0.3.0      CloudEvents.Sdk\nFunction        Set-CloudEventXmlData                              0.3.0      CloudEvents.Sdk\n```\n\n## Using **`CloudEvents.Sdk`** Module\n## 1. Event Producer\n### Create a CloudEvent object\n```powershell\n$cloudEvent = New-CloudEvent -Type 'com.example.object.deleted.v2' -Source 'mailto:cncf-wg-serverless@lists.cncf.io' -Id (New-Guid).Guid -Time (Get-Date)\n```\n\n### Set **JSON Data** to a CloudEvent object\n```powershell\n$cloudEvent | Set-CloudEventJsonData -Data @{\n    'Foo' = 'Hello'\n    'Bar' = 'World'\n}\n\n\nDataContentType : application/json\nData            : {\n                    \"Bar\": \"World\",\n                    \"Foo\": \"Hello\"\n                  }\nId              : ac9b12d9-ae45-4654-a4d7-42bbf0d9816d\nDataSchema      :\nSource          : mailto:cncf-wg-serverless@lists.cncf.io\nSpecVersion     : V1_0\nSubject         :\nTime            : 4/26/2021 9:00:45 AM\nType            : com.example.object.deleted.v2\n```\n\n### Set **XML Data** to a CloudEvent object\n```powershell\n$cloudEvent | Set-CloudEventXmlData -Data @{\n    'xml' = @{\n        'Foo' = 'Hello'\n        'Bar' = 'World'\n    }\n} `\n-AttributesKeysInElementAttributes $true\n\n\nDataContentType : application/xml\nData            : \u003cxml\u003e\u003cBar\u003eWorld\u003c/Bar\u003e\u003cFoo\u003eHello\u003c/Foo\u003e\u003c/xml\u003e\nId              : ac9b12d9-ae45-4654-a4d7-42bbf0d9816d\nDataSchema      :\nSource          : mailto:cncf-wg-serverless@lists.cncf.io\nSpecVersion     : V1_0\nSubject         :\nTime            : 4/26/2021 9:00:45 AM\nType            : com.example.object.deleted.v2\n```\n### Set Custom Format Data to a CloudEvent object\n```powershell\n$cloudEvent | Set-CloudEventData -DataContentType 'application/text' -Data 'Hello World!'\n\nDataContentType : application/text\nData            : Hello World!\nId              : b1b748cd-e98d-4f5f-80ea-76dea71a53a5\nDataSchema      :\nSource          : mailto:cncf-wg-serverless@lists.cncf.io\nSpecVersion     : V1_0\nSubject         :\nTime            : 4/27/2021 7:00:44 PM\nType            : com.example.object.deleted.v2\n```\n\n### Convert a CloudEvent object to an HTTP message in **Binary** or **Structured** content mode\n```powershell\n# Format structured cloud event HTTP message\n$cloudEventStructuredHttpMessage = $cloudEvent | ConvertTo-HttpMessage -ContentMode Structured\n```\n\n### Send CloudEvent object to HTTP server\n```powershell\nInvoke-WebRequest -Method POST -Uri 'http://my.cloudevents.server/' -Headers $cloudEventStructuredHttpMessage.Headers -Body $cloudEventStructuredHttpMessage.Body\n```\n\n## 2. Event Consumer\n### Convert an HTTP message to a CloudEvent object\n```powershell\n$cloudEvent = ConvertFrom-HttpMessage -Headers \u003cheaders\u003e -Body \u003cbody\u003e\n```\n\n### Read CloudEvent **JSON Data** as a **PowerShell Hashtable**\n```powershell\nRead-CloudEventJsonData -CloudEvent $cloudEvent\n\n\nName                           Value\n----                           -----\nFoo                            Hello\nBar                            World\n```\n\n### Read CloudEvent **XML Data** as a **PowerShell Hashtable**\n```powershell\nRead-CloudEventXmlData -CloudEvent $cloudEvent -ConvertMode SkipAttributes\n\nName                           Value\n----                           -----\nxml                            {Bar, Foo}\n```\n\nThe `ConvertMode` parameter specifies how the xml should be converted to a PowerShell Hashtable. `SkipAttributes` mode skips reading the xml attributes. There are three different modes of conversion. For more details check the help of the `Read-CloudEventXmlData` cmdlet.\n\n### Read CloudEvent Custom Format **Data** as a **byte[]**\n```powershell\nRead-CloudEventData -CloudEvent $cloudEvent\n\n72\n101\n108\n108\n111\n32\n87\n111\n114\n108\n100\n33\n```\n\n## Community\n\n- There are bi-weekly calls immediately following the\n  [Serverless/CloudEvents call](https://github.com/cloudevents/spec#meeting-time)\n  at 9am PT (US Pacific). Which means they will typically start at 10am PT, but\n  if the other call ends early then the SDK call will start early as well. See\n  the\n  [CloudEvents meeting minutes](https://docs.google.com/document/d/1OVF68rpuPK5shIHILK9JOqlZBbfe91RNzQ7u_P7YCDE/edit#)\n  to determine which week will have the call.\n- Slack: #cloudeventssdk channel under\n  [CNCF's Slack workspace](https://slack.cncf.io/).\n- Email: https://lists.cncf.io/g/cncf-cloudevents-sdk\n- Contact for additional information: Michael Gasch (`@Michael Gasch`\n  on slack).\n\nEach SDK may have its own unique processes, tooling and guidelines, common\ngovernance related material can be found in the\n[CloudEvents `community`](https://github.com/cloudevents/spec/tree/master/community)\ndirectory. In particular, in there you will find information concerning\nhow SDK projects are\n[managed](https://github.com/cloudevents/spec/blob/master/community/SDK-GOVERNANCE.md),\n[guidelines](https://github.com/cloudevents/spec/blob/master/community/SDK-maintainer-guidelines.md)\nfor how PR reviews and approval, and our\n[Code of Conduct](https://github.com/cloudevents/spec/blob/master/community/GOVERNANCE.md#additional-information)\ninformation.\n\nIf there is a security concern with one of the CloudEvents specifications, or\nwith one of the project's SDKs, please send an email to\n[cncf-cloudevents-security@lists.cncf.io](mailto:cncf-cloudevents-security@lists.cncf.io).\n\n## Additional SDK Resources\n\n- [List of current active maintainers](MAINTAINERS.md)\n- [How to contribute to the project](CONTRIBUTING.md)\n- [SDK's License](LICENSE)\n- [SDK's Release process](RELEASING.md)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudevents%2Fsdk-powershell","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcloudevents%2Fsdk-powershell","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcloudevents%2Fsdk-powershell/lists"}